algorand / algorand/go-algorand

`goal clerk inspect` does not fail when encoded transaction is malformed.

Aperta
#4,765 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Team Lamprey
Lingua principale
Go
Stelle
1.4k
Fork
537
Merge medio
1g 6h
PR unite (30g)
17

Descrizione

### Subject of the issue

`goal clerk inspect` does not fail when encoded transaction is malformed.
### Your environment

* Software version: `algod -v`
```
12885557248
3.10.0.stable [rel/stable] (commit #9869cd96)
go-algorand is licensed with AGPLv3.0
source code available at https://github.com/algorand/go-algorand
```
* Operating System details.
```
mscOS Monterey 12.6
```

### Steps to reproduce

1. Create a simple transaction using `goal clerk` and write it to a file.
2. Decode the transaction using `msgpacktool -d -b32` and write it to a file.
e.g.
```json
{
"txn": {
"fee": 1000,
"fv": 18317067,
"gen": "testnet-v1.0",
"gh:b32": "JBR3KGFEWPEE5SAQ6IWU6EEBZMHXD4CZU6WCBXWGF57XBZIJHIRA====",
"lv": 18318067,
"note:b32": "DFK4JSUQTAZMW===",
"rcv:b32": "GDJRC6E65LY43F6DSFCLZDN4RJKQXPBHPPYFS37BBSVCYEMKIOWQ====",
"snd:b32": "GDJRC6E65LY43F6DSFCLZDN4RJKQXPBHPPYFS37BBSVCYEMKIOWQ====",
"type": "pay"
}
}
```
3. Edit the decoded transaction using a text editor or use `sed s/rcv:b32/rcv/` to remove the `:b32` suffix from the `rcv` field.
e.g.
```json
{
"txn": {
"fee": 1000,
"fv": 18317067,
"gen": "testnet-v1.0",
"gh:b32": "JBR3KGFEWPEE5SAQ6IWU6EEBZMHXD4CZU6WCBXWGF57XBZIJHIRA====",
"lv": 18318067,
"note:b32": "DFK4JSUQTAZMW===",
"rcv": "GDJRC6E65LY43F6DSFCLZDN4RJKQXPBHPPYFS37BBSVCYEMKIOWQ====",
"snd:b32": "GDJRC6E65LY43F6DSFCLZDN4RJKQXPBHPPYFS37BBSVCYEMKIOWQ====",
"type": "pay"
}
}
```
4. Encode the decoded transaction using `msgpacktool -e -b32` and write it to a file.
5. Inspect the file from the previous step using `goal clerk inspect`.
e.g.
```json
/tmp/tx.d.e[0]
{
"txn": {
"fee": 1000,
"fv": 18317067,
"gen": "testnet-v1.0",
"gh": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
"lv": 18318067,
"note": "GVXEypCYMss=",
"rcv": "I5CEUUSDGZCTMNKMLE2DGRRWIRJUMQ2MLJCE4NCSJJFVCWCQIJEKXL5FQU",
"snd": "GDJRC6E65LY43F6DSFCLZDN4RJKQXPBHPPYFS37BBSVCYEMKIOW7KEK7CQ",
"type": "pay"
}
}
```

### Expected behaviour

`goal clerk inspect` should fail since the `rcv` field is not valid.

### Actual behaviour

`goal clerk inspect` does not fail and displays a wrong value for the `rcv` field.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.