Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Unhelpful Error Messages + Need help with configuration #2

Open
JBongars opened this issue May 10, 2022 · 0 comments
Open

Comments

@JBongars
Copy link

JBongars commented May 10, 2022

Hi!

First of all, thanks so much for releasing this extension as it is really helping with development in TEAL.

Having some issues configuring local storage on the tests and particularly when I run the app_opted_in, app_local_get and app_local_put opcode on TEAL which makes me suspect there is a problem with the account configuration.

I'm getting this error message:-

27 - Expected to pop byte[] from stack, instead found bigint. Stack: [ { "type": "bigint", "value": "0", "from": "0" } ]

and the following when I try to comment line 27:-

39 - Expected to pop byte[] from stack, instead found bigint. Stack: [ { "type": "bigint", "value": "0", "from": "0" } ]

Here is my .teal-debugger configuration:-

{
    "appGlobals": {},
    "assetParams": {},
    "appParams": {},
    "accounts": {
        "jack": {
            "balance": 100000,
            "minBalance": 1000,
            "appLocals": {
                "5": {
                    "anotherlocalvariable": "abc",
                    "localarg": "some_value"
                }
            },
            "appsOptedIn": ["5"],
            "assetHoldings": {}
        }
    },
    "args": {},
    "txn": {
        "ApplicationID": 5,
        "OnCompletion": 0,
        "ApplicationArgs": {
            "0": "check_local_storage",
            "1": "some_value"
        },
        "Accounts": {
            "0": "addr:jack"
        }
    },
    "gtxn": {},
    "txnSideEffects": {},
    "gaid": {},
    "globals": {
        "anotherglobalvariable": "abc"
    },
    "logState": []
}

and my TEAL contract (simplified for this example):-

#pragma version 6

txn ApplicationID
int 0
==
bnz create_app
b not_create_app

create_app:

not_create_app:
    txn OnCompletion
    int NoOp
    ==
    bnz handle_noop

    err

handle_noop:

    // #################################
    // ## Check from Local Storage    ##
    // #################################

    int 0
    txn ApplicationID
    app_opted_in // check if account is opted in

    txna ApplicationArgs 0 // command
    byte "check_local_storage"
    ==
    bnz handle_check_local_storage

    b fail

handle_check_local_storage:
    int 0
    byte "localarg"
    app_local_get

    txna ApplicationArgs 1 // value to compare with local storage
    ==
    bnz pass

    b fail

pass:
int 1
return

fail:
int 0
return

Any help would be greatly appreciated, thanks!

Julien

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant