algorand / algorand/js-algorand-sdk

keyreg transactions with `voteFirst: 0` fail to send

Aperta
#925 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub
new-bug
Lingua principale
TypeScript
Stelle
297
Fork
214
Merge medio
1h 3m
PR unite (30g)
3

Descrizione

### Subject of the issue

An online key registration transaction with `voteFirst: 0` fails to send to the network.

### Your environment

* JS SDK version: 3.1.0
* Software version: 4.0.1.stable

### Steps to reproduce

1. Create a key registration transaction with `voteFirst: 0`. The transaction is created without any issues.
```typescript
const suggestedParams = await algod.getTransactionParams().do()
const sender = localnet.context.testAccount
const txn = new algosdk.Transaction({
type: algosdk.TransactionType.keyreg,
sender: sender.addr,
keyregParams: {
voteKey: algosdk.base64ToBytes('5/D4TQaBHfnzHI2HixFV9GcdUaGFwgCQhmf0SVhwaKE='),
selectionKey: algosdk.base64ToBytes('oImqaSLjuZj63/bNSAjd+eAh5JROOJ6j1cY4eGaJGX4='),
stateProofKey: algosdk.base64ToBytes('mgh7ddGf7dF1Z5/9RDzN/JZZF9yA7XYCKJXvqhwPdvI7pLKh7hizaM5rTC2kizVOpVRIU9PXSLeapvBJ/OxQYA=='),
voteFirst: 0,
voteLast: 61,
voteKeyDilution: 1234,
},
suggestedParams,
})
const signedTxn = algosdk.signTransaction(txn, sender.sk)
```

2. Send the transaction
```typescript
const res = await algod.sendRawTransaction(signedTxn.blob).do()
```

### Expected behaviour
The transaction is successfully sent.

### Actual behaviour
An exception with message "Online key registration missing at least one of the following fields: voteKey, selectionKey, voteFirst, voteLast, voteKeyDilution" is thrown when sending

Additionally, the same error is thrown when fetching a block containing a keyreg transaction sent (via another mechanism) with `voteFirst: 0`.
For example:

```typescript
// round 66 contains a keyreg sent with `voteFirst: 0`
const res = await algod.block(66).do()
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.