Skip to content

Commit

Permalink
Add VSCMatured packets instead of acks (cosmos#188)
Browse files Browse the repository at this point in the history
* iterate over all consumer chains

* add pending VSCs

* replace UnbondingTime with PacketMaturityTime; add method to compute consumer unbonding time

* store unbonding time on consumer chain

* Update x/ccv/consumer/keeper/keeper.go

* fix EndBlockCallback on provider; add test for pendingVSCs

* fix GetConsumerClient for nonexisting chainID

* fix client unbonding times in tests

* wip

* TestUndelegationDuringInit done

* fix TestUnbondingNoConsumer

* test multiple pending VSC packets

* add VSCMaturedPacketData and remove packets from UnbondingSequence

* add found return to GetPendingVSCs

* apply changes from review

* fix TestUndelegationDuringInit

* fix TestUndelegationEdgeCase

* fix TestTimelyUndelegation1 and rename to TestUndelegationConsumerFirst

* fix TestTimelyUndelegation2 and rename to TestUndelegationProviderFirst

* cleanup unbonding tests

* fix KeeperTestSuite/TestOnRecvPacket

* fix KeeperTestSuite/TestUnbondMaturePackets

* fix TestPacketRoundtrip

* fixing ibc ack handling - wip

* handle ibc acks correctly

* remove TODO

* fix typo

* Update x/ccv/consumer/keeper/relay.go

Co-authored-by: Aditya <[email protected]>

* add logging error on ErrorAcknowledgement

* add logging error on ErrorAcknowledgement

Co-authored-by: Aditya <[email protected]>
  • Loading branch information
mpoke and AdityaSripal authored Jul 7, 2022
1 parent 744d4a7 commit bfd886d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
9 changes: 4 additions & 5 deletions proto/interchain_security/ccv/consumer/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ message GenesisState {
ibc.lightclients.tendermint.v1.ClientState provider_client_state = 5;
// ProviderConsensusState filled in on new chain, nil on restart.
ibc.lightclients.tendermint.v1.ConsensusState provider_consensus_state = 6;
repeated UnbondingSequence unbonding_sequences = 7 [(gogoproto.nullable) = false];
repeated MaturingVSCPacket maturing_packets = 7 [(gogoproto.nullable) = false];
repeated .tendermint.abci.ValidatorUpdate initial_val_set = 8 [(gogoproto.nullable) = false];
}

// UnbondingSequence defines the genesis information for each unbonding packet sequence.
message UnbondingSequence {
uint64 sequence = 1;
uint64 unbonding_time = 2;
ibc.core.channel.v1.Packet unbonding_packet = 3 [(gogoproto.nullable) = false];
message MaturingVSCPacket {
uint64 vscId = 1;
uint64 maturity_time = 2;
}
15 changes: 11 additions & 4 deletions proto/interchain_security/ccv/v1/ccv.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "tendermint/abci/types.proto";

// This packet is sent from provider chain to consumer chain if the validator set for consumer chain
// changes (due to new bonding/unbonding messages or slashing events)
// The acknowledgement from consumer chain will be sent asynchronously once unbonding period is over,
// A VSCMatured packet from consumer chain will be sent asynchronously once unbonding period is over,
// and this will function as `UnbondingOver` message for this packet.
message ValidatorSetChangePacketData {
repeated .tendermint.abci.ValidatorUpdate validator_updates = 1
Expand All @@ -28,9 +28,16 @@ message UnbondingOp {
repeated string unbonding_consumer_chains = 2;
}

// This packet is sent from the consumer chain to the provider chain.
// The acknowledgement will be sent asynchrounously when the jailing
// will be started on the provider chain.
// This packet is sent from the consumer chain to the provider chain
// to notify that a VSC packet reached maturity on the consumer chain.
message VSCMaturedPacketData {
// the id of the VSC packet that reached maturity
uint64 valset_update_id = 1;
}

// This packet is sent from the consumer chain to the provider chain
// to request the slashing of a validator as a result of an infraction
// committed on the consumer chain.
message SlashPacketData {
tendermint.abci.Validator validator = 1
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validator\""];
Expand Down

0 comments on commit bfd886d

Please sign in to comment.