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

New Feature: Lookup Boxes by app-id + Name and Search Boxes by app-id #1117

Merged
merged 241 commits into from
Sep 14, 2022

Conversation

tzaffi
Copy link
Contributor

@tzaffi tzaffi commented Jul 14, 2022

Related PR's

Summary

Exposing box information for querying indexer. In particular:

  • 2 new endpoints:
    • v2/applications/:application-id/box
    • v2/applications/:application-id/boxes
  • returning new fields for /v2/accounts/:account-id (account info):
    • total-box-bytes
    • total-boxes

TODO / Questions

  • Is paging for .../boxes working as expected? ANSWER: yes
  • Modify the block data on AWS with box info for make integration ? (this is happening automatically from go-algorand e2e subs)
  • Test that ensures we can handle goal/abi encoded box names and values
  • Add a /v2/accounts/:account-id fixtures_test to show that we're exposing the new box fields even for non-app related accounts
  • Question: Should a test be added to handlers_test.go ?This will probably involve implementing ApplicationBoxes() in mocks/IndexerDb.go. Tentative answer: NO: The fixtures test's lifecycle is a superset of the lifecycle being tested in the handlers test.
  • Question: Should we handle MaxBoxResultsPerAppError a la MaxAPIResourcesPerAccountError ? NO - this is unecessary because the built-in limit facilities in indexer should already guard against unexpected response size when querying for boxes. An adjacent question might be: should we take boxes into account as part of the MaxAPIResourcesPerAccount controls during the querying of account information? The question here is "no" as well because detailed box information isn't currently included in the GetAccounts() query and therefore doesn't impact the limit.
  • Question: Should a Block Generator test be added for boxes? I believe NO because the end-to-end test covers block processing for blocks containing box transactions. However, I'm open to further discussion.
  • The proposed usage of boxes/ search parameter next requires a b64: rather than providing what was received for next-token in the previous response. This violates indexer usage patterns. TODO: adhere to the typical non-modification pattern for next-token in indexer. This is now done, but controvertially, b64: is being removed altogether. We can adhere to the opaquness property of next while still allowing arbitrary encoding if we simply return the next token with a b64: prefix. This is under active discussion. CONCLUSION: we're returning the b64 prefix in next token, and accepting arbitrary encoding in the same way that box names are handled in the /box?name=... endpoint
  • Have gained consensus that ORDER BY (i.e. the order param) is not exposed in the boxes/ endpoint, or a consensus in a going forward policy (e.g. issue creation, or change request) CONCLUSION: hard coded ASC ordering for boxes in /boxes/ endpoint
  • Should fixtures_test.go exist? Or is there sufficient end-to-end testing coverage in handlers_e2e_test.go to obviate this new test? Answer: YES, it should exist because it has utility as we can see: per this commit I'm conforming to the same response code and error as with other indexer treatments. However, I made a commitment to:
    • Explain how to bootstrap a new fixtures test in a README
  • Reach a consensus on treatment of box name in the box/ and boxes/ endpoints. Should this continue to exist as a required query parameter, or should instead become a path parameter? UPDATE: a consensus has been reached, and that is to keep the treatment of the endpoints as they currently are in the PR.

Test Plan

CI

shiqizng and others added 30 commits June 8, 2022 09:59
* integrate block processor
* add simple local ledger migration
* add fast catchup
* return empty lists from fetchApplications and fetchAppLocalStates (#1010)

* Update model to converge with algod (#1005)

* New Feature: Adds Data Directory Support (#1012)

- Updates the go-algorand submodule hash to point to rel/beta
- Moves the cpu profiling file, pid file and indexer configuration file
  to be options of only the daemon sub-command
- Changes os.Exit() to be a panic with a special handler.  This is so
  that defer's are handled instead of being ignored.
- Detects auto-loading configuration files in the data directory and
  issues errors if equivalent command line arguments are supplied.
- Updates the README with instructions on how to use the auto-loading
  configuration files and the data directory.

* Update mockery version

Co-authored-by: erer1243 <[email protected]>
Co-authored-by: AlgoStephenAkiki <[email protected]>
* handle ledger recovery scenario
* refactor create genesis block
* Adds Local Ledger Readme

Resolves #4109

Starts Readme docs

* Update docs/LocalLedger.md

Co-authored-by: Will Winder <[email protected]>

* Update docs/LocalLedger.md

Co-authored-by: Will Winder <[email protected]>

* Update docs/LocalLedger.md

Co-authored-by: Will Winder <[email protected]>

* Removed troubleshooting section

Co-authored-by: Will Winder <[email protected]>
Part 1

    cleanup genesis file access.
    put node catchup into a function that can be swapped out with the catchup service.
    pass the indexer logger into the block processor.
    move open ledger into a util function, and move the initial state util function into a new ledger util file.
    add initial catchupservice implementation.
    move ledger init from daemon.go to constructor.
    Merge multiple read genesis functions.

Part 2

    Merge local_ledger migration package into blockprocessor.
    Rename Migration to Initialize
    Use logger in catchup service catchup

Part 3

    Update submodule and use NewWrappedLogger.
    Make util.CreateInitState private
api/README.md Outdated Show resolved Hide resolved
api/README.md Outdated Show resolved Hide resolved
api/README.md Outdated Show resolved Hide resolved
api/README.md Outdated Show resolved Hide resolved
@@ -1613,16 +1711,38 @@
}
}
},
"ParticipationUpdates": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ParticipationUpdates has been moved further below to starting line 1834 and following the OnCompletion section

api/README.md Outdated Show resolved Hide resolved
api/README.md Show resolved Hide resolved
api/handlers.go Outdated Show resolved Hide resolved
api/handlers.go Outdated Show resolved Hide resolved
@tzaffi tzaffi merged commit 64a6462 into integration/boxes Sep 14, 2022
@tzaffi tzaffi deleted the tzaffi/box-search branch September 14, 2022 17:11
Comment on lines +2327 to +2330
orderKind := "ASC"
if queryOpts.Ascending != nil && !*queryOpts.Ascending {
orderKind = "DESC"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this feature user visible? On some tables the indexes are optimized for one vs the other, so there could be performance implications here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. It's not visible. Can we continue the conversation on #1168 ?

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.

7 participants