Skip to content

[Investigate] REST API /v2/blocks/{rnd} returns invalid json #1699

@algorandskiy

Description

@algorandskiy

Subject of the issue

If block contains app state change, it is incorrectly serialized to json - EvalDelta.LocalDeltas has non-quoted integer keys.
Seems like protocol.EncodeJSONStrict needs to be used.

Your environment

  • Software version: algod -v
algod -v
8590155987
2.2.90323.master [master] (commit #e8a24ee9+)
go-algorand is licensed with AGPLv3.0

Steps to reproduce

Use newest pingpong with updated apps test (see #1700) to create blocks with local deltas. Then iterate over blocks and observe json decoding error.

goal network create -t test/testdata/nettemplates/TwoNodes50EachFuture.json -r ~/networks/two-fut -n two-fut

goal network start -r ~/networks/two-fut/
sleep 2
pingpong run -d ~/networks/two-fut/Primary --numapp 100 --appprogops 300 --numappoptin 10 --appproggk 10 --appproglk 10 --tps 1000 --rest 0  --refresh 1 --numaccounts 500 --duration 60 --minaccount 34000000
sleep 30
ROUND=$(curl -k http://$(cat ~/networks/two-fut/Primary/algod.net)/v2/status -H "X-Algo-API-Token: $(cat ~/networks/two-fut/Primary/algod.token)" | jq '.["last-round"]')
for i in $(seq 1 $ROUND); do curl -k http://$(cat ~/networks/two-fut/Primary/algod.net)/v2/blocks/$i -H "X-Algo-API-Token: $(cat ~/networks/two-fut/Primary/algod.token)" | python3 -m json.tool || break; done
goal network stop -r ~/networks/two-fut/
# goal network delete -r ~/networks/two-fut

Expected behaviour

No parsing error

Actual behaviour

Expecting property name enclosed in double quotes: line 11963 column 13 (char 397656)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions