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

Sandbox contract calls responding with 400 errors #978

Open
whoabuddy opened this issue Jan 30, 2023 · 3 comments
Open

Sandbox contract calls responding with 400 errors #978

whoabuddy opened this issue Jan 30, 2023 · 3 comments
Labels

Comments

@whoabuddy
Copy link

Describe the bug

Certain contract calls from the sandbox are failing with HTTP 400 errors starting after the instability this weekend.


If I call get-pox-info from ST000000000000000000002AMW42H.pox on testnet, the payload info is:

URL:
https://stacks-node-api.testnet.stacks.co/v2/contracts/call-read/ST000000000000000000002AMW42H/pox/get-pox-info

Payload:
{"sender":"ST113N3MMPZRMJJRZH6JTHA5CB7TBZH1EH4C22GFV","arguments":[]}

and the response is:

(ok (tuple (current-rejection-votes u0) (first-burnchain-block-height u2000000) (min-amount-ustx u5175407755455) (prepare-cycle-length u50) (rejection-fraction u12) (reward-cycle-id u398) (reward-cycle-length u1050) (total-liquid-supply-ustx u41403262043641960)))

If I call is-pox-active from ST000000000000000000002AMW42H.pox on testnet and pass a reward cycle, I receive the HTTP 400 error. The payload info is:

URL:
https://stacks-node-api.testnet.stacks.co/v2/contracts/call-read/ST000000000000000000002AMW42H/pox/is-pox-active

Payload:
{"sender":"ST113N3MMPZRMJJRZH6JTHA5CB7TBZH1EH4C22GFV","arguments":["0x1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55"]}

and the response is:

Failed to load resource: the server responded with a status of 400 ()

If I call get-stacker-info from ST000000000000000000002AMW42H.pox on testnet and pass a principal, I receive the HTTP 400 error. The payload info is:

URL:
https://stacks-node-api.testnet.stacks.co/v2/contracts/call-read/ST000000000000000000002AMW42H/pox/get-stacker-info

Payload:
{"sender":"ST113N3MMPZRMJJRZH6JTHA5CB7TBZH1EH4C22GFV","arguments":["0x5,26,66,58,142,148,183,241,73,75,31,137,165,168,168,172,89,244,191,196,46,137"]}

To Reproduce

This was noticed initially with the CityCoins contracts, but seems to affect anything that passes the values above as payloads. Iirc these should be hex-encoded Clarity values but above looks like a raw Buffer or Uint8Array with the Clarity type as the first value.

Expected behavior

Contract calls from the sandbox return a response.

Screenshots

image

@whoabuddy
Copy link
Author

Tagging these two issues as well since they are related to creating/passing sandbox function arguments:

@whoabuddy
Copy link
Author

FYI - this was fixed after @He1DAr rolled back some changes, here are the differences in the contract call payload from the working version.

Calling is-pox-active from ST000000000000000000002AMW42H.pox with a uint:

{"sender":"ST113N3MMPZRMJJRZH6JTHA5CB7TBZH1EH4C22GFV","arguments":["0x010000000000000000000000000000018e"]}

Calling executed-at in ST355N8734E5PVX9538H2QGMFP38RE211D9E2B4X5.base-dao with a principal:

{"sender":"ST113N3MMPZRMJJRZH6JTHA5CB7TBZH1EH4C22GFV","arguments":["0x061aca5aa0e3238b6df5251a222bc28fb0d18708216a14636369703031322d626f6f7473747261702d7632"]}

@andresgalante
Copy link
Member

@BLuEScioN let's keep this in mind for when we bring back postconditions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Backlog
Development

No branches or pull requests

2 participants