Skip to content

Commit

Permalink
handle provider and consumer client expiration (cosmos#448)
Browse files Browse the repository at this point in the history
* handle expired client when sending packets

* add e2e test

* add upgradeExpiredClient to e2e tests

* improve incrementTime... functions

* fix golangci-lint error

* add client expired check

* replace incrementTimeBy w/ incrementTime

* replace AppendPendingVSC w/ AppendPendingVSCs

* simplify logic of sendValidatorUpdates

* separate PrepareIBCPacketSend from SendIBCPacket

* error handling on SendPacket

* export pending VSC packets

* improve comments

* use k.GetCCVTimeoutPeriod

* remove GetUpgradeKeeper

* AppendPendingVSCs: use variadic function

* remove unnecessary if

* refactor pending VSC CRUD methods

* refactor sending valset updates to chains

* add tests for VSC queueing

* refactor after reviews

* refactor after reviews

* Merge marius/435-client-expired-consumer into marius/435-client-expired

Squashed commit of the following:

commit 3d82d19304a49938bfef573c99d2a77182167645
Author: mpoke <[email protected]>
Date:   Fri Nov 11 10:37:06 2022 +0100

    fix typo

commit 1efa9909162acb22a0e6d70e8da540ba437a3a59
Author: mpoke <[email protected]>
Date:   Wed Nov 9 19:07:30 2022 +0100

    avoid trying to send on expired client

commit a0cb6452776cdf68bf1f35ec5c069bdd76086991
Author: mpoke <[email protected]>
Date:   Wed Nov 9 15:56:59 2022 +0100

    error handling on SendPacket

commit 7c9c7629966a7d0b894fde3be9ad83f36afac97f
Author: mpoke <[email protected]>
Date:   Wed Nov 9 13:55:05 2022 +0100

    use PrepareIBCPacketSend pattern on consumer

commit e7ff9d96fd325f851c1c1eb7dc1ed87c65274878
Author: mpoke <[email protected]>
Date:   Wed Nov 9 10:17:18 2022 +0100

    update QA plan

commit d7fafe8e9987f3b449e3cff07733f8316c484027
Author: mpoke <[email protected]>
Date:   Wed Nov 9 10:09:41 2022 +0100

    add e2e test TestConsumerPacketSendExpiredClient

commit 1722f1319edb44e3dd867329c6c6875436d9457e
Author: mpoke <[email protected]>
Date:   Tue Nov 8 20:20:13 2022 +0100

    remove SlashRequest from proto

commit 241e13b2d9d47b641a9054973f4d109c78e68ec6
Author: mpoke <[email protected]>
Date:   Tue Nov 8 20:17:52 2022 +0100

    remove pending slash requests from genesis

commit 073f10160dd9a1d4cd857043e4dcff494230e489
Author: mpoke <[email protected]>
Date:   Tue Nov 8 19:44:46 2022 +0100

    replace pending SlashRequests w/ peding DataPackets

commit a2d1069459f99de0c3d2ce8d4794e51cff5cd8ed
Author: mpoke <[email protected]>
Date:   Tue Nov 8 19:08:33 2022 +0100

    code for pending data packets

commit acc3454279052237054abab26bf20c7f5a42c386
Author: mpoke <[email protected]>
Date:   Mon Nov 7 21:03:03 2022 +0100

    add e2e test

commit 6170fa879745bb8f1e12f82b47deee13462f3c0e
Author: mpoke <[email protected]>
Date:   Mon Nov 7 11:37:57 2022 +0100

    handle expired client when sending packets

* and packet queueing to consumer keeper

* refactor e2e tests

* refactor after review session

* additional refactor after reviews

Co-authored-by: Matija Salopek <[email protected]>
Co-authored-by: Jehan <[email protected]>
  • Loading branch information
3 people authored Nov 18, 2022
1 parent 34c28bc commit 3362a1c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
27 changes: 19 additions & 8 deletions proto/interchain_security/ccv/consumer/v1/consumer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import "interchain_security/ccv/v1/ccv.proto";
option go_package = "github.com/cosmos/interchain-security/x/ccv/consumer/types";

import "google/protobuf/any.proto";
import "cosmos/staking/v1beta1/staking.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "google/protobuf/duration.proto";
Expand Down Expand Up @@ -69,14 +68,26 @@ message CrossChainValidator {
];
}

// SlashRequest defines a slashing request for CCV consumer module
message SlashRequest {
interchain_security.ccv.v1.SlashPacketData packet = 1;
cosmos.staking.v1beta1.InfractionType infraction = 2;
// ConsumerPacketType indicates interchain security specific packet types.
enum ConsumerPacketType {
option (gogoproto.goproto_enum_prefix) = false;

// UNSPECIFIED packet type
CONSUMER_PACKET_TYPE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "UnspecifiedPacket"];
// Slash packet
CONSUMER_PACKET_TYPE_SLASH = 1 [(gogoproto.enumvalue_customname) = "SlashPacket"];
// VSCMatured packet
CONSUMER_PACKET_TYPE_VSCM = 2 [(gogoproto.enumvalue_customname) = "VscMaturedPacket"];
}

// ConsumerPacket contains raw packet bytes and packet type.
message ConsumerPacket {
ConsumerPacketType type = 1;
bytes data = 2;
}

// SlashRequests is a list of slash requests for CCV consumer module
message SlashRequests {
repeated SlashRequest requests = 1
// ConsumerPackets is a list of data packets.
message ConsumerPackets {
repeated ConsumerPacket list = 1
[ (gogoproto.nullable) = false ];
}
3 changes: 0 additions & 3 deletions proto/interchain_security/ccv/consumer/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ message GenesisState {
// OutstandingDowntimes nil on new chain, filled on restart.
repeated OutstandingDowntime outstanding_downtime_slashing = 10
[ (gogoproto.nullable) = false ];
// PendingSlashRequests filled in on new chain, nil on restart.
interchain_security.ccv.consumer.v1.SlashRequests pending_slash_requests = 11
[ (gogoproto.nullable) = false ];
}

// MaturingVSCPacket defines the genesis information for the
Expand Down

0 comments on commit 3362a1c

Please sign in to comment.