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

Accept a string or int in the gateway HTTP server #3334

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

teor2345
Copy link
Contributor

This PR makes the gateway accept a block number as a string or int from the HTTP server.

This is the first part of ticket #3323.

Once this PR merges, the HTTP server can start providing integers. When that is deployed, we can remove the string code and close #3323.

Code contributor checklist:

@teor2345 teor2345 added the improvement it is already working, but can be better label Dec 24, 2024
@teor2345 teor2345 self-assigned this Dec 24, 2024
Copy link
Member

@nazar-pc nazar-pc left a comment

Choose a reason for hiding this comment

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

This would work, but why can't we just make a breaking change here? Is anyone except us using gateway? Can't they change the way they send data when upgrading gateway backend at once?

let v: serde_json::Value = Deserialize::deserialize(deserializer)?;

match v {
Value::String(s) => s.parse::<u32>().map_err(serde::de::Error::custom),
Copy link
Member

Choose a reason for hiding this comment

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

I'd also print a warning here that it'll stop working in the next release.

@teor2345
Copy link
Contributor Author

This would work, but why can't we just make a breaking change here? Is anyone except us using gateway? Can't they change the way they send data when upgrading gateway backend at once?

@clostao are you happy to just make a breaking change here? It would be simpler for us.

If we did it that way, next time you upgraded the gateway, you'd also need to upgrade to a version of the indexer which sent block numbers as integers (rather than block number strings).

@clostao
Copy link

clostao commented Dec 24, 2024

No problem with that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement it is already working, but can be better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Take BlockNumber as a JSON number in subspace gateway HTTP
3 participants