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

REST: add the round number to algod box endpoint repsonse #5340

Merged
merged 9 commits into from
Apr 28, 2023

Conversation

bbroder-algo
Copy link
Contributor

Summary

Include the round that the value of the box's contents is pulled from to the response from v2/box endpoint

Test Plan

Modified e2e to check rounds.

jannotti
jannotti previously approved these changes Apr 27, 2023
Copy link
Contributor

@jannotti jannotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good idea and correct implementation to me.

@jannotti jannotti changed the title Enhancement: add the round number to algod box endpoint repsonse REST: add the round number to algod box endpoint repsonse Apr 27, 2023
@bbroder-algo
Copy link
Contributor Author

I made up the round numbers in the e2e test, they need to be replaced with the right answer.

@jannotti
Copy link
Contributor

I made up the round numbers in the e2e test, they need to be replaced with the right answer.

Will that even be possible? Are these e2e tests run deterministically? (the e2e_subs are not)

@bbroder-algo
Copy link
Contributor Author

Ran in sandbox, caught up to testnet, found an app with a box, ran box endpoint:

bob@algobob sandbox #curl -i -H "X-Algo-API-Token:${AUTH_TOKEN}" "localhost:31200/v2/applications/200641557/box?name=b64:ABrYmUED76S3MLW1Lkb0mvlRD0YJD2rX2y5QIu%2FqXz09"
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Vary: Origin
Date: Thu, 27 Apr 2023 22:36:28 GMT
Content-Length: 120

{"name":"ABrYmUED76S3MLW1Lkb0mvlRD0YJD2rX2y5QIu/qXz09","round":29457190,"value":"AAAAAAAhQ6AAAAAAZD+e9AAAAAAABfXhAA=="}
bob@algobob sandbox #

Copy link
Contributor

@ahangsu ahangsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems right

Comment on lines +1378 to +1381
"round": {
"description": "The round for which this information is relevant",
"type": "integer"
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasonpaulos would it be better to add the round in BoxResponse instead? BoxResponse uses a schema reference though, and I seem to remember something about not being able to add to a schema reference.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this makes sense here. The schema ref that BoxResponse uses means it's really just an alias to Box. See our generated type here:

Comment on lines +1378 to +1381
"round": {
"description": "The round for which this information is relevant",
"type": "integer"
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this makes sense here. The schema ref that BoxResponse uses means it's really just an alias to Box. See our generated type here:

Comment on lines +1539 to +1541
// To reduce flakiness, only check the round from boxes is within a range.
a.GreaterOrEqual(boxResponse.Round, currentRoundBeforeBoxes)
a.LessOrEqual(boxResponse.Round, currentRoundAfterBoxes)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done

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

Successfully merging this pull request may close these issues.

None yet

4 participants