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
Add reward and treasury settings to settings REST #1291
Conversation
#[derive(Deserialize, Serialize)] | ||
#[serde(transparent, remote = "value::Value")] | ||
pub struct ValueDef(u64); |
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.
Not going to be always true that a Value
is a u64
. Use the Value
type above and pay the cost of writing .into()
.
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.
This is guaranteed by Serde's remote
attribute, see https://serde.rs/remote-derive.html
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 still don't see the point in duplicating that Value
. I see how it makes it easy. for you but I'd rather like to see all of this going toward a harmonised interface.
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.
All fields in SettingsDto
are "normal" types from chain-impl-mockchain
, but with custom serialization (mostly with
and remote
types). This make its usage easier, especially in tests. Adding remote
type for Value
lets us keep this property of SettingsDto
.
I also think that its a cleaner solution than conversion from and to the jormungandr-lib::Value
and it's generally a good idea to start using it in all Serde DTOs.
f5bd8a3
to
6ee194f
Compare
6ee194f
to
cd77f3a
Compare
Fixes #1248