-
Notifications
You must be signed in to change notification settings - Fork 618
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
hack: restore JSON API compatibility #6844
Conversation
@frol could you make a judgement call from the perspective of the clients whether this is a sufficient and necessary fix? From the server perspective, this looks good to me (as in, cheap to support in the future) |
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.
From a client perspective, I think this is better.
#[serde(default, rename = "contract_compile_base")] | ||
pub _unused1: Gas, |
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.
How about we do this instead?
#[serde(default, rename = "contract_compile_base")] | |
pub _unused1: Gas, | |
#[serde(default)] | |
pub contract_compile_base: Option<Gas>, |
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.
I rather like that _unused1
very clearly signals that you shouldn't use that. The Option
would also get serialized as null
, which I think might break somebody?
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.
Why don’t we set the values to be the same as contract_loading_base and contract_loading_bytes respectively? To me it seems like a proper way to rename a field is to keep the old one for a couple releases to give people time to migrate.
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.
We can do that, but that requires writing custom code which might contain bugs. The current solution is significantly simpler than that.
My understanding that for this code we want to prioritize simplicity over compatibility. I think the problem here is just that the Rust code fails with deserialization error, rather than that someone actually looks at the old field.
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.
Looks good to me
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.
I’m not thrilled that we’re start returning zeros to people to be honest.
Tagged: https://github.com/near/nearcore/releases/tag/crates-0.14.0 Notable changes: - #6844 - #6853 - #6902 - #6917 - #6916 Check here for a full changelog: crates-0.13.0...crates-0.14.0 Tested `cargo package` on each public crate locally, they all compile independently of the workspace. We should be good to go.
See
contract_compile
gas parameter #6587 (comment)jsonrpc
from rest of codebase, to preventrpc
s to breaking due to refactoring. #5516