-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat(cat-voices): cip36 registrations consolidated endpoint #1494
Conversation
Stake addresses need to be individually checked to make sure they are still actively associated with the voting key, and have not been registered to another voting key.
Stake addresses need to be individually checked to make sure they are still actively associated with the voting key, and have not been registered to another voting key.
✅ Test Report | |
✅ Test Report | |
✅ Test Report | |
✅ Test Report | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The general issue in this PR is the response types for error cases.
It used only an UnprocessableContent
response type for every error case which is not correct.
UnprocessableContent
should not be returned by us explicitly in most of the cases, it will return during the request arguments parsing/processing.- For any database database failure we should call
handle_error
where in most cases it will just return a503
response or in some special cases returnservice_unavailable
- If something fails because of the incorrect request argument, but it is related to the business logic of the endpoint (e.g. you are getting a stake address which is structurally correct, but during endpoint execution something fails because of it) then it should be
BadRequest
response, and such response must be specified inside the responseenum
for such endpoint.
catalyst-gateway/bin/src/db/index/queries/registrations/get_all_stakes_and_vote_keys.rs
Outdated
Show resolved
Hide resolved
catalyst-gateway/bin/src/service/common/types/cardano/query/stake_or_voter.rs
Show resolved
Hide resolved
catalyst-gateway/bin/src/service/common/types/generic/ed25519_public_key.rs
Show resolved
Hide resolved
✅ Test Report | |
✅ Test Report | |
✅ Test Report | |
✅ Test Report | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
✅ Test Report | |
Consolidated endpoint for cip36 registrations.
Example usage:
Single registration with lookup param as vote key:
Single registration bound by time of Unix timestamp:
http://localhost:3030/api/draft/cardano/registration/cip36?lookup=0xa31e0e52dfc72b6bc142c60dd119d46dafe660db7cc3240968c9878497ce9e8e&asat=TIME:1736164751
Single registration bound by time of slot#:
http://localhost:3030/api/draft/cardano/registration/cip36?lookup=0xa31e0e52dfc72b6bc142c60dd119d46dafe660db7cc3240968c9878497ce9e8e&asat=SLOT:11718738
When not bound by time, return latest registration for given vote key.
http://localhost:3030/api/draft/cardano/registration/cip36?lookup=0xa31e0e52dfc72b6bc142c60dd119d46dafe660db7cc3240968c9878497ce9e8e
The same mechanics apply for stake address lookup
http://localhost:3030/api/draft/cardano/registration/cip36?lookup=stake1u9ugz54klca9xqe7nhmdpp23dsp95gkw8snk94gl2rwpdpqcvyze0
.......
ALL registrations: Snapshot
Endpoint requires
X-API-Key
header with secret token defined in ENV VAR. Contact SRE.http://localhost:3030/api/draft/cardano/registration/cip36?lookup=ALL
ALL registrations bound by time of slot#:
http://localhost:3030/api/draft/cardano/registration/cip36?lookup=ALL&asat=SLOT:12313103
ALL registrations bound by time of Unix timestamp
http://localhost:3030/api/draft/cardano/registration/cip36?lookup=ALL&asat=TIME:1736164751