algorand / go-algorand

Algorand's official implementation in Go.
https://developer.algorand.org/
Other
1.35k stars 473 forks source link

Confusing error message when approval/clear programs are empty #2585

Closed fabrice102 closed 1 year ago

fabrice102 commented 3 years ago

Subject of the issue

When the approval/clear programs are empty files, goal app create ... returns the following error:

Couldn't broadcast tx with algod: HTTP 400 Bad Request: TransactionPool.Remember: transaction XL5EMGOG5CZK6NN2KRFAUCA4KKBV5QCZIPCTV6C77GBPEKTWST7Q: check failed on ApprovalProgram: program version 18446744073709551615 greater than max supported version 4

See https://forum.algorand.org/t/crowdfunding-smartcontract-error/3797/3?u=fabrice for a user having the issue.

Your environment

sandbox

$ ./sandbox goal version -v
Version: [v1 v2]
GenesisID: sandnet-v1
Build: 2.7.1.stable [rel/stable] (commit #5e00bcd6)

Steps to reproduce

Using sandbox:

./sandbox up release

export ADDR_CREATOR="YOURACCOUNTIDENTIFIERGOESHERE"

export TEAL_APPROVAL_PROG="approval_program.teal"
export TEAL_CLEAR_PROG="clear_state_program.teal"

export GLOBAL_BYTESLICES=0
export GLOBAL_INTS=1
export LOCAL_BYTESLICES=0
export LOCAL_INTS=0

touch approval_program.teal
touch clear_state_program.teal

./sandbox copyTo "$TEAL_APPROVAL_PROG"
./sandbox copyTo "$TEAL_CLEAR_PROG"

./sandbox goal app create --creator $ADDR_CREATOR \
                --approval-prog "$TEAL_APPROVAL_PROG" \
                --clear-prog "$TEAL_CLEAR_PROG" \
                --global-byteslices $GLOBAL_BYTESLICES \
                --global-ints $GLOBAL_INTS \
                --local-byteslices $LOCAL_BYTESLICES \
                --local-ints $LOCAL_INTS

Expected behaviour

Display an error message saying that the approval program is empty.

Actual behaviour

Error message:

Couldn't broadcast tx with algod: HTTP 400 Bad Request: TransactionPool.Remember: transaction XL5EMGOG5CZK6NN2KRFAUCA4KKBV5QCZIPCTV6C77GBPEKTWST7Q: check failed on ApprovalProgram: program version 18446744073709551615 greater than max supported version 4
yaovi-a commented 3 years ago

Hey team! Please add your planning poker estimate with ZenHub @algobolson @algonautshant @AlgoStephenAkiki @nicholasguoalgorand @tolikzinovyev @tsachizehub @winder