-
Notifications
You must be signed in to change notification settings - Fork 354
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
Rename TimestampNanos to Timestamp and improve IbcTimeout docs #902
Conversation
9ac8ce2
to
ad3e86f
Compare
I changed the name from This is the only nanosecond time we have in cosmwasm (the block time is broken into unix seconds, plus the nanoseconds fraction). We need to make this clear. If you don't like this name, I have two other proposals.
(Note we accept one field with timeout in |
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.
Please don't just rename. I proposed two other approaches.
I feel renaming to timestamp: Nanos
with a different u64
new-type will keep a clean JSON interface that you like and keep contract developers from making simple mistakes that are hard to debug (and only show up in real relayers)
I see, makes sense. I was also thinging about
I'd avoid 1. as there is already enough complexity in the type and it is nice that we can use u64 nanos in IBC, which serves us well for 600 years as long as no float parser is reading that JSON. 2^53 nanoseconds is less than 15 weeks. Version 2. seems solid to me. There the unit goes where it belongs: from the variable to the value. I'll think about it a little more. |
Sure, We do have a helper to take care of most usage, so I think just the serde rename may be plenty. impl From<Timestamp> for IbcTimeout {
fn from(time: Timestamp) -> IbcTimeout {
IbcTimeout::TimestampNanos(time.seconds * 1_000_000_000 + time.nanos)
}
} |
Oh, I just realize this makes the timestamp pub enum ExecuteMsg {
/// Changes the admin
UpdateAdmin {
admin: String,
},
SendMsgs {
channel_id: String,
// Note: we don't handle custom messages on remote chains
msgs: Vec<CosmosMsg<Empty>>, // <---- IbcTimeout used here
}, |
I was going to say it was just internal, but yeah, |
We can solve both by having |
Simply the case name by avoiding type information in the variable name