-
Notifications
You must be signed in to change notification settings - Fork 9
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
Implement IBC Validator Sync sub-protocol #63
Conversation
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.
LGTM.
} | ||
|
||
#[cfg_attr(not(feature = "library"), entry_point)] | ||
/// never should be called as we do not send packets | ||
/// The most we can do here is retry the packet, hoping it will eventually arrive. |
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.
👍🏼 Perhaps we can introduce number of retries 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.
Some more comments on IBC packets design / fields.
packages/apis/src/ibc/packet.rs
Outdated
|
||
/// This is a generic ICS acknowledgement format. | ||
/// Proto defined here: https://github.com/cosmos/cosmos-sdk/blob/v0.42.0/proto/ibc/core/channel/v1/channel.proto#L141-L147 | ||
/// This is compatible with the JSON serialization. | ||
/// Wasmd uses this same wrapper for unhandled errors. | ||
#[cw_serde] | ||
pub enum AckWrapper { | ||
Result(Binary), | ||
Error(String), | ||
} |
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.
👍🏼 Makes sense.
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.
Struct copied from cw20-ics20 (and methods updated).
This is tested to work with wasmd handling
@@ -132,13 +132,13 @@ pub fn ibc_packet_receive( | |||
}; | |||
VAL_CRDT.add_validator(deps.storage, &valoper, update)?; |
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.
Do we capture / map the error(s) here, and return ack_fail
instead?
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 done in wasmd.
If contract panics, it aborts the whole tx (no ack written)
If contract returns error, it wraps the error message in this "standard" struct, which is what I use now as AckWrapper.
Ok(IbcBasicResponse::new()) | ||
let ack: AckWrapper = from_slice(&msg.acknowledgement.data)?; | ||
let mut res = IbcBasicResponse::new(); | ||
match ack { |
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.
👍🏼 Taking shape.
Send the validator sync packets from Consumer (
converter
) to Provider (external-staking
) and process them into the CRDT type there.Add tests on the CRDT and some queries, so we can (in a future PR) check validators before staking, or associate tendermint double-signs with valoper addresses (next milestone)