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

feat(sequencer): query full denomination from asset ID #1067

Merged
merged 11 commits into from
May 24, 2024
Merged

Conversation

noot
Copy link
Collaborator

@noot noot commented May 13, 2024

Summary

implement ABCI query to get full denomination from an asset ID, if it exists in the latest sequencer state.

Background

useful for block explorers/UIs as txs only have asset IDs, not the full denom.

Changes

  • implement ABCI query to get full denomination from an asset ID, if it exists in the latest sequencer state

Testing

unit tests

Related Issues

closes #1053

@noot noot requested review from a team as code owners May 13, 2024 23:28
@noot noot requested a review from SuperFluffy May 13, 2024 23:28
@github-actions github-actions bot added proto pertaining to the Astria Protobuf spec sequencer pertaining to the astria-sequencer crate labels May 13, 2024
Copy link
Contributor

@Fraser999 Fraser999 left a comment

Choose a reason for hiding this comment

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

Nothing critical, but a few suggestions.

I don't think a server should be returning a full stack trace as part of an error response message, hence I suggested changing the formatting of the anyhow errors from debug to alternate {:#} to only include the display-formatted source chain. This might not be what we do elsewhere, so feel free to ignore.

Also, it might be nice to have some sad-path tests for the new endpoint, but that's not a blocker IMO.

crates/astria-sequencer/src/asset/query.rs Outdated Show resolved Hide resolved
crates/astria-sequencer/src/asset/query.rs Outdated Show resolved Hide resolved
crates/astria-sequencer/src/asset/query.rs Outdated Show resolved Hide resolved
crates/astria-sequencer/src/asset/query.rs Outdated Show resolved Hide resolved
crates/astria-sequencer/src/asset/query.rs Show resolved Hide resolved
crates/astria-sequencer/src/asset/query.rs Outdated Show resolved Hide resolved
crates/astria-sequencer/src/asset/query.rs Outdated Show resolved Hide resolved
crates/astria-sequencer/src/asset/query.rs Outdated Show resolved Hide resolved
crates/astria-sequencer/src/asset/query.rs Outdated Show resolved Hide resolved
@noot
Copy link
Collaborator Author

noot commented May 14, 2024

@Fraser999 addressed comments - I changed the error returned to be display-formatted, but in the account query module, we return the debug formatted errors. do you think we should change it there as well?

@Fraser999
Copy link
Contributor

@noot - yes, I would vote for changing them all to return the alternate display form. There's still one debug one lingering in query.rs on line 95 btw :)

Copy link
Member

@joroshiba joroshiba left a comment

Choose a reason for hiding this comment

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

api approval

Copy link
Member

@SuperFluffy SuperFluffy left a comment

Choose a reason for hiding this comment

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

looks fine, but the DenomResponse starting at number 1 is throwing me off?


// A response containing the denomination given an asset ID.
message DenomResponse {
uint64 height = 2;
Copy link
Member

Choose a reason for hiding this comment

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

should this start at 1?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i did it to match the existing responses:

// A response containing the balance of an account.
message BalanceResponse {
  uint64 height = 2;
  repeated AssetBalance balances = 3;
}

// A response containing the current nonce for an account.
message NonceResponse {
  uint64 height = 2;
  uint32 nonce = 3;
}

should we change all of those?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, they should all start at 1. Too late now because that would be a breaking change. 🤷

@noot noot added this pull request to the merge queue May 24, 2024
Merged via the queue into main with commit 1860dec May 24, 2024
36 checks passed
@noot noot deleted the noot/denom-query branch May 24, 2024 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proto pertaining to the Astria Protobuf spec sequencer pertaining to the astria-sequencer crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sequencer: query node for full denom from asset ID
4 participants