From 469c88af03eec2eabb5979b565828302a7ae9789 Mon Sep 17 00:00:00 2001 From: Simon Noetzlin Date: Tue, 21 Nov 2023 16:37:31 +0100 Subject: [PATCH] feat!: add cryptographic equivocation (#1340) * docs: cleanup changelog for v2.0.0 on release/v2.0.x (#987) * Update CHANGELOG.md * Update CHANGELOG.md * comment * chore: Hardcode golangci-lint version (backport #990) (#1013) chore: Hardcode golangci-lint version (#990) * Hardcode golangci-lint version * Hardcode version in CI config (cherry picked from commit 9920121274605ee5bf79984a687d7b4586fdec71) Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * fix: proper consumer key prefix ordering (backport #991) (#1011) fix: proper consumer key prefix ordering (#991) * Update keys.go * tests * fix another bug * fix comments (cherry picked from commit a1e18d0cfe4cfc105e6bbb0730471075ee1edc28) Co-authored-by: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> * feat: Remove consumer genesis migration on provider (backport #997) (#1012) feat: Remove consumer genesis migration on provider (#997) * Update keys.go * tests * fix another bug * remove consumer genesis deletion, link to test * remove unused bond denom method * Revert "remove unused bond denom method" This reverts commit f930eca428bade49a05368fe5dae2d96842659cc. * remove test too * update changelog (cherry picked from commit e2ac9743e9a309b29e6e92ab64be2e4e79503f75) Co-authored-by: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> * fix: limit vsc matured packets handled per endblocker (backport #1004) (#1015) fix: limit vsc matured packets handled per endblocker (#1004) * initial implementation, still need tests * UTs * integration test * linter * Update CHANGELOG.md * make vsc matured handled this block a var * comment (cherry picked from commit 8c2fc562dedecee7799ac69bd72734c37a356638) Co-authored-by: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> * feat: integrate cometmock (backport #989) (#1030) feat: integrate cometmock (#989) * Add gorelayer and CometMock to Dockerfile * Add option to start with cometmock in start-chain script * Start adding support for rly * Adjust relayer start action * Add entrypoint for short happy path steps * Add . nosec G204 and waiting for blocks * Adjust rly config: Gas is free * Remove optout steps from short happy path * Use separate redelegate step for short happy path * Wait for blocks after unbonding * Make naming more descriptive and add comments * Add comment to chain name sorting and improve comments * Update start-chain.sh Address comments form joint review session with @MSalopek * Fix typo (cherry picked from commit 07be71aa678a0ad204c62a6eb6033a526c0bef27) Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * feat!: Add DistributionTransmissionChannel to ConsumerAdditionProposal (manual backport #965) (#1031) feat!: Add DistributionTransmissionChannel to ConsumerAdditionProposal (#965) * update proto * remove transfer_channel_id from consumer genesis * ConsumerAdditionProposal: transfer_channel_id -> distribution_transmission_channel * send updated ConsumerAdditionProposal * validate consumer genesis param * remove StandaloneTransferChannelID from store * fix TestOnChanOpenAck * remove state breaking change * finalize merge and fix issues * chore: update docs and changelog * chore: regenerate protos * re-add integrationt tests around changeover * mv entry in changelog * test: add sovereign to consumer changeover e2e (#1025) * tests: add sovereign to consumer e2e test * rm unused bash scripts * partially address review comments * apply remaining review comments * chore: apply formatting rules --------- Co-authored-by: Marius Poke Co-authored-by: MSalopek * refactor: log when constructing IBC err ack (backport #1090) (#1094) refactor: log when constructing IBC err ack (#1090) * log with err ack * linter (cherry picked from commit 07302ffb6692fe849f5f5d393de5db6395e74a53) Co-authored-by: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> * fix: `AttributeDistributionTotal` in event emit (backport #1097) (#1114) * fix: `AttributeDistributionTotal` in event emit (#1097) * fix: emitted distribution events * docs: update changelog * fix: lint --------- Co-authored-by: MSalopek (cherry picked from commit d16c7669b4f23380a50c8dedfaf6d25f50ca0edd) * resolve conflicts * docs: remove v3 changelog from v2 release line --------- Co-authored-by: yaruwangway <69694322+yaruwangway@users.noreply.github.com> Co-authored-by: Yaru Wang * docs: update broken md links (backport #1130) (#1142) * docs: update broken md links (#1130) (cherry picked from commit fd76f45b726f4ef65f817e8032c4f87f986f2d71) * Update joining-testnet.md --------- Co-authored-by: MSalopek Co-authored-by: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> * feat!: add ICS misbehaviour handling (#826) * define msg to submit misbehaviour to provider implement msg handling logic e2e test msg handling logic * wip: get byzantine validators in misbehavioiur handling * add tx handler * format HandleConsumerMisbehaviour * add tx handler * add debugging stuff * Add misbehaviour handler * create message for consumer double voting evidence * add DRAFT double vote handler * Add cli cmd for submit consumer double voting * Add double-vote handler * add last update * fix jailing * pass first jailing integration test * format tests * doc * save * update e2e tests' * fix typo and improve docs * remove unwanted tm evidence protofile * fix typos * update submit-consumer-misbehaviour cli description * check that header1 and header2 have the same TrustedValidators * feat: add e2e tests for ICS misbehaviour (#1118) * remove unwanted changes * fix hermes config with assigned key * revert unwanted changes * revert local setup * remove log file * typo * update doc * update ICS misbehaviour test * update ICS misbehaviour test * revert mixed commits * add doc * lint * update to handle only equivocations * improve doc * update doc * update E2E tests comment * optimize signatures check * doc * update e2e tests * linter * remove todo * Feat: avoid race condition in ICS misbehaviour handling (#1148) * remove unwanted changes * fix hermes config with assigned key * revert unwanted changes * revert local setup * remove log file * typo * update doc * update ICS misbehaviour test * update ICS misbehaviour test * revert mixed commits * update ICS misbehaviour test * update ICS misbehaviour test * Add test for MsgSubmitConsumerMisbehaviour parsing * fix linter * save progress * add CheckMisbehaviourAndUpdateState * update integration tests * typo * remove e2e tests from another PRs * cleaning' * Update x/ccv/provider/keeper/misbehaviour.go Co-authored-by: Anca Zamfir * Update x/ccv/provider/keeper/misbehaviour.go Co-authored-by: Anca Zamfir * update integration tests * save * save * nits * remove todo * lint * Update x/ccv/provider/keeper/misbehaviour.go --------- Co-authored-by: Anca Zamfir Co-authored-by: Marius Poke * Update x/ccv/provider/client/cli/tx.go Co-authored-by: Anca Zamfir * Update x/ccv/provider/client/cli/tx.go Co-authored-by: Anca Zamfir * add attributes to EventTypeSubmitConsumerMisbehaviour * Update x/ccv/provider/keeper/misbehaviour.go Co-authored-by: Anca Zamfir * Update x/ccv/provider/keeper/misbehaviour.go Co-authored-by: Anca Zamfir * apply review suggestions * fix docstring * Update x/ccv/provider/keeper/misbehaviour.go Co-authored-by: Anca Zamfir * fix link * apply review suggestions * update docstring --------- Co-authored-by: Anca Zamfir Co-authored-by: Marius Poke * deps!: support cosmos-sdk-v45-ics-lsm integration (#1120) * tests: check cosmos-sdk-v45-ics-lsm integration * bump cosmos-sdk to inqlusion latest * support new method signatuers * fix: bump v0.45.16-ics-lsm to latest [fixes difftests] * fix: update democracy tests representative registration * chore: bump iqlusion:cosmos-sdk to latest * chore: bump iqlusion:cosmos-sdk to latest * chore: bump iqlusion:cosmos-sdk to latest * fix!: avoid panicking on CancelUnbondingDelegation (#977) * handle CancelUnbondingDelegation message * tests: add cancel-unbond e2e test * fix: appease linter * chore: Hardcode golangci-lint version (#990) * Hardcode golangci-lint version * Hardcode version in CI config --------- Co-authored-by: MSalopek Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * tests: fix broken cancelUnbond e2e after cherry pick * chore: regenerate mocks * chore: run make proto-gen * fix: complete concel-unbond handling in hooks * chore: bump iqlusion:cosmos-sdk to latest * chore: fix brokene gov prop submit * chore: fix brokene gov prop submit * use SDK 0.45.16-ics-lsm-rc0 * add changelog entry --------- Co-authored-by: Marius Poke Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * docs: add v2.0.0-lsm changelog section (#1210) add changelog section * deps: bump SDK to v0.45.16-ics-lsm (#1212) bump SDK to v0.45.16-ics-lsm * feat: improve ICS misbehaviour E2E testing coverage (#1225) * update e2e tests * update the chain halt assertion * refactor: address comments of ICS Misbehaviour PRs #826 and #1148 (#1223) * remove interface * improve comment * update godoc * address last comments * feat: add handler for consumer double voting (#1232) * create new endpoint for consumer double voting * add first draft handling logic * first iteration of double voting * draft first mem test * error handling * refactor * add unit test of double voting verification * remove evidence age checks * document * doc * protogen * reformat double voting handling * logger nit * nits * check evidence age duration * move verify double voting evidence to ut * fix nit * nits * fix e2e tests * improve double vote testing coverage * remove TODO * lint * add UT for JailAndTombstoneValidator * nits * nits * remove tombstoning and evidence age check * lint * typo * improve godoc * fix: tiny bug in `NewSubmitConsumerDoubleVotingCmd` (#1247) * fix double voting cli * fix bug double signing handler * godoc * nits * revert wrong push of lasts commits * fix: make `HandleConsumerDoubleVoting` works with provider pubkeys (#1254) * fix double voting cli * fix bug double signing handler * godoc * nits * lint * nit * fix: verify equivocation using validator pubkey in `SubmitConsumerDoubleVoting` msg (#1264) * verify dv evidence using malicious validator pubkey in infraction block header * nits * nits * refactor: update the E2E tests to work with Hermes relayer v1.6.0 (#1278) * save changes * fix hermes config * fist successful run * nit * nits * nits * doc and nits * lint * test: add E2E tests for double voting evidence handling (#1256) * fix double voting cli * add double-signing e2e test * refortmat e2e double voting test * godoc, revert unwanted changes * nit * verify dv evidence using malicious validator pubkey in infraction block header * save changes * fix hermes config * fist successful run * nit * nits * nits * doc and nits * lint * refactor * typo * change hermes docker image * nits * Update tests/e2e/steps.go Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * address PR comments * nits --------- Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * feat!: provider proposal for changing reward denoms (backport #1280) (#1291) * feat!: provider proposal for changing reward denoms (#1280) * new provider prop type * add methods and tests for new prop, update docs * remove old tx, fix tests * e2e handling * fix command type * boilerplate * fix e2e tests * Update CHANGELOG.md * lint * validate denoms * Update proposal.go * rm msg string * fix tests * rm chain in change denom action * lint * test for invalid denom * events for both add and remove * Update proposal_test.go (cherry picked from commit 48a21869e9a56cafff53b5c51077a96d1e3c4926) * fix conflicts * fix rest handler * Update CHANGELOG.md * rm uneeded tx proto --------- Co-authored-by: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> * save * fix nits * update changelog and fix nits * feat: implement slashing functionality on the provider chain (ADR-013) (#1275) Implementing the slashing functionality, as described in ADDR, on the provider chain. * fix e2e happy-path-short test * make consumer misbehaviour and double signing tests pass * currently debugging democracy-reward * fix e2e democ test * refactor: remove equivocation proposal (#1294) * remove equivocation proposal * bring back evidencekeeper * go.sum added * rebase and fix lint issues * fix mocks * clean up protos & delete unecessary file * fix E2E test * fix Dockerfile * more fixes * increase wait attempt * increase wait attempt * wait 1 block in gov proposal * fix numbers --------- Co-authored-by: Karolos Antoniadis * add equivo removal failing tests * fix democ e2e tests * make mem tests pass * lint * fix Dockerfile * update changelog * fix nits * update rapid test * fix democ tests * update changelog * fix CHANGELOG.md * nits * Update docs/docs/features/slashing.md Co-authored-by: insumity * Update proto/interchain_security/ccv/provider/v1/tx.proto Co-authored-by: insumity * Update x/ccv/provider/client/cli/tx.go Co-authored-by: insumity * Update x/ccv/provider/client/cli/tx.go Co-authored-by: insumity * Update x/ccv/provider/keeper/misbehaviour.go Co-authored-by: insumity * Update x/ccv/provider/keeper/punish_validator.go Co-authored-by: insumity * Update x/ccv/provider/keeper/punish_validator.go Co-authored-by: insumity * Update x/ccv/provider/keeper/punish_validator.go Co-authored-by: insumity * check verifying pubkey against validator address * add tests * update checkMisbehaviour tests * save * update all misbehaviour memory tests * fix misb verify valset sigs test * revert misb check fix for ibc 7 * nit fix * fix nit * fix: add equivocation proposal message back in protos (#1394) * add depreacted equiv prop msg def * add codec and content for equivo proposal msg * doc * proto * fix!: verify the signatures of byzantine validators in misbehaviour handling (#1422) * update byzantine validators extraction * nits * Update x/ccv/provider/keeper/misbehaviour.go Co-authored-by: insumity * last changes * udpdate changelog --------- Co-authored-by: insumity * feat: update misbehaviour handling using IBC-Go 7 (#1401) * nit fix * improve doc * super picky nit * fix!: drop nil votes in misbehaviour handling (#1404) * update CHANGELOG for final release * save * update test to extract byzantine validators * improve testing * nits * nits * Update tests/integration/misbehaviour.go Co-authored-by: insumity * Update testutil/crypto/evidence.go Co-authored-by: insumity * update util func * doc * check misb client ID * Update x/ccv/provider/keeper/misbehaviour.go Co-authored-by: insumity * nits --------- Co-authored-by: insumity * fix comments * update changelog * Update x/ccv/provider/keeper/misbehaviour.go Co-authored-by: insumity * improve tests * lint * udpate traces * silly bug --------- Co-authored-by: insumity * nit * Update x/ccv/provider/keeper/double_vote.go Co-authored-by: insumity * Update x/ccv/provider/keeper/double_vote.go Co-authored-by: insumity * Update x/ccv/provider/keeper/misbehaviour.go Co-authored-by: insumity * Update x/ccv/provider/keeper/misbehaviour.go Co-authored-by: insumity * Update tests/integration/double_vote.go Co-authored-by: insumity * Update x/ccv/provider/client/cli/tx.go Co-authored-by: insumity * Update x/ccv/provider/client/cli/tx.go Co-authored-by: insumity * address comments * address comments * Update x/ccv/provider/types/proposal.go Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * Update tests/integration/double_vote.go Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * Port: (feat!) [#1435](https://github.com/cosmos/interchain-security/pull/1435) Add height-base filter for consumer equivocation evidence. * fix: update consumer double vote cmd (#1439) add cmd fix * update CHANGELOG * update changelog * update changelog entries * nits --------- Co-authored-by: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> Co-authored-by: Marius Poke Co-authored-by: MSalopek Co-authored-by: yaruwangway <69694322+yaruwangway@users.noreply.github.com> Co-authored-by: Yaru Wang Co-authored-by: Anca Zamfir Co-authored-by: insumity Co-authored-by: Karolos Antoniadis --- ...ic-verification-of-equivocation-feature.md | 2 + ...1340-cryptographic-equivocation-feature.md | 4 + ...1340-cryptographic-equivocation-feature.md | 4 + CHANGELOG.md | 1 + Dockerfile | 2 +- app/provider/app.go | 20 +- docs/docs/features/proposals.md | 58 -- docs/docs/features/slashing.md | 17 +- docs/docs/introduction/overview.md | 4 - docs/docs/validators/overview.md | 2 +- .../ccv/provider/v1/provider.proto | 5 +- .../ccv/provider/v1/tx.proto | 40 +- tests/e2e/action_rapid_test.go | 49 +- tests/e2e/actions.go | 128 +-- tests/e2e/actions_consumer_misbehaviour.go | 98 ++ tests/e2e/config.go | 86 ++ tests/e2e/json_utils.go | 30 +- tests/e2e/main.go | 37 +- tests/e2e/state.go | 115 ++- tests/e2e/state_rapid_test.go | 13 - tests/e2e/steps.go | 32 +- tests/e2e/steps_consumer_misbehaviour.go | 287 ++++++ tests/e2e/steps_double_sign.go | 83 +- tests/e2e/steps_light_client_attack.go | 1 - .../e2e/steps_submit_equivocation_proposal.go | 150 --- tests/e2e/testnet-scripts/fork-consumer.sh | 114 +++ tests/e2e/testnet-scripts/hermes-config.toml | 18 +- tests/e2e/testnet-scripts/start-chain.sh | 8 +- tests/e2e/trace_handlers_test.go | 23 +- .../e2e/tracehandler_testdata/changeover.json | 19 +- .../consumer-double-sign.json | 452 +++++++++ .../consumer-misbehaviour.json | 424 +++++++++ .../e2e/tracehandler_testdata/democracy.json | 38 +- .../democracyRewardsSteps.json | 30 +- .../e2e/tracehandler_testdata/happyPath.json | 448 ++------- .../multipleConsumers.json | 99 +- .../e2e/tracehandler_testdata/shorthappy.json | 431 +-------- .../tracehandler_testdata/slashThrottle.json | 26 +- tests/integration/double_vote.go | 395 ++++++++ tests/integration/misbehaviour.go | 551 +++++++++++ testutil/crypto/evidence.go | 135 +++ testutil/integration/debug_test.go | 27 + testutil/keeper/expectations.go | 63 ++ testutil/keeper/mocks.go | 217 +++-- testutil/keeper/unit_test_helpers.go | 3 - x/ccv/provider/client/cli/tx.go | 127 +++ x/ccv/provider/client/proposal_handler.go | 126 --- x/ccv/provider/handler.go | 6 + .../provider/keeper/consumer_equivocation.go | 480 ++++++++++ .../keeper/consumer_equivocation_test.go | 790 ++++++++++++++++ x/ccv/provider/keeper/hooks.go | 4 + x/ccv/provider/keeper/keeper.go | 17 +- x/ccv/provider/keeper/msg_server.go | 73 +- x/ccv/provider/keeper/proposal.go | 12 - x/ccv/provider/keeper/proposal_test.go | 61 -- x/ccv/provider/proposal_handler.go | 4 +- x/ccv/provider/proposal_handler_test.go | 26 +- x/ccv/provider/types/codec.go | 9 +- x/ccv/provider/types/keys.go | 10 + x/ccv/provider/types/keys_test.go | 2 + x/ccv/provider/types/msg.go | 118 ++- x/ccv/provider/types/proposal.go | 6 +- x/ccv/provider/types/proposal_test.go | 57 -- x/ccv/provider/types/provider.pb.go | 212 +++-- x/ccv/provider/types/tx.pb.go | 890 +++++++++++++++++- x/ccv/types/errors.go | 26 +- x/ccv/types/events.go | 48 +- x/ccv/types/expected_keepers.go | 15 +- 68 files changed, 6131 insertions(+), 1777 deletions(-) create mode 100644 .changelog/unreleased/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md create mode 100644 .changelog/unreleased/features/provider/1340-cryptographic-equivocation-feature.md create mode 100644 .changelog/unreleased/state-breaking/provider/1340-cryptographic-equivocation-feature.md create mode 100644 tests/e2e/actions_consumer_misbehaviour.go create mode 100644 tests/e2e/steps_consumer_misbehaviour.go delete mode 100644 tests/e2e/steps_submit_equivocation_proposal.go create mode 100644 tests/e2e/testnet-scripts/fork-consumer.sh create mode 100644 tests/e2e/tracehandler_testdata/consumer-double-sign.json create mode 100644 tests/e2e/tracehandler_testdata/consumer-misbehaviour.json create mode 100644 tests/integration/double_vote.go create mode 100644 tests/integration/misbehaviour.go create mode 100644 testutil/crypto/evidence.go create mode 100644 x/ccv/provider/keeper/consumer_equivocation.go create mode 100644 x/ccv/provider/keeper/consumer_equivocation_test.go diff --git a/.changelog/unreleased/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md b/.changelog/unreleased/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md new file mode 100644 index 0000000000..c50662be72 --- /dev/null +++ b/.changelog/unreleased/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md @@ -0,0 +1,2 @@ +- Deprecate equivocation proposals. +([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) \ No newline at end of file diff --git a/.changelog/unreleased/features/provider/1340-cryptographic-equivocation-feature.md b/.changelog/unreleased/features/provider/1340-cryptographic-equivocation-feature.md new file mode 100644 index 0000000000..4a90b46488 --- /dev/null +++ b/.changelog/unreleased/features/provider/1340-cryptographic-equivocation-feature.md @@ -0,0 +1,4 @@ +- Introduce the cryptographic verification of equivocation feature to the provider + (cf. [ADR-005](/docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md) + & [ADR-013](/docs/docs/adrs/adr-013-equivocation-slashing.md)). + ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) \ No newline at end of file diff --git a/.changelog/unreleased/state-breaking/provider/1340-cryptographic-equivocation-feature.md b/.changelog/unreleased/state-breaking/provider/1340-cryptographic-equivocation-feature.md new file mode 100644 index 0000000000..4a90b46488 --- /dev/null +++ b/.changelog/unreleased/state-breaking/provider/1340-cryptographic-equivocation-feature.md @@ -0,0 +1,4 @@ +- Introduce the cryptographic verification of equivocation feature to the provider + (cf. [ADR-005](/docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md) + & [ADR-013](/docs/docs/adrs/adr-013-equivocation-slashing.md)). + ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 35c926aab1..046a01c16e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -186,3 +186,4 @@ In addition, RS has the following features: - **Key Assignment**: Enables validator operators to use different consensus keys for each consumer chain validator node that they operate. - **Jail Throttling**: Enables the provider to slow down a "worst case scenario" attack where a malicious consumer binary attempts to jail a significant amount (> 2/3) of the voting power, effectively taking control of the provider. + diff --git a/Dockerfile b/Dockerfile index 7c45187034..2e4ea3c334 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ RUN go mod tidy RUN make install # Get Hermes build -FROM ghcr.io/informalsystems/hermes:1.4.1 AS hermes-builder +FROM otacrew/hermes-ics:evidence-cmd AS hermes-builder # Get CometMock FROM ghcr.io/informalsystems/cometmock:v0.37.x as cometmock-builder diff --git a/app/provider/app.go b/app/provider/app.go index 4550ec77d2..497158449a 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -140,7 +140,6 @@ var ( ibcclientclient.UpgradeProposalHandler, ibcproviderclient.ConsumerAdditionProposalHandler, ibcproviderclient.ConsumerRemovalProposalHandler, - ibcproviderclient.EquivocationProposalHandler, ibcproviderclient.ChangeRewardDenomsProposalHandler, }, ), @@ -404,14 +403,6 @@ func New( scopedIBCKeeper, ) - // create evidence keeper with router - app.EvidenceKeeper = *evidencekeeper.NewKeeper( - appCodec, - keys[evidencetypes.StoreKey], - app.StakingKeeper, - app.SlashingKeeper, - ) - app.ProviderKeeper = ibcproviderkeeper.NewKeeper( appCodec, keys[providertypes.StoreKey], @@ -424,7 +415,6 @@ func New( app.StakingKeeper, app.SlashingKeeper, app.AccountKeeper, - app.EvidenceKeeper, app.DistrKeeper, app.BankKeeper, authtypes.FeeCollectorName, @@ -477,6 +467,16 @@ func New( ibcRouter.AddRoute(providertypes.ModuleName, providerModule) app.IBCKeeper.SetRouter(ibcRouter) + // create evidence keeper with router + evidenceKeeper := evidencekeeper.NewKeeper( + appCodec, + keys[evidencetypes.StoreKey], + app.StakingKeeper, + app.SlashingKeeper, + ) + + app.EvidenceKeeper = *evidenceKeeper + skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) // NOTE: Any module instantiated in the module manager that is later modified diff --git a/docs/docs/features/proposals.md b/docs/docs/features/proposals.md index de4f2dc421..70077944ea 100644 --- a/docs/docs/features/proposals.md +++ b/docs/docs/features/proposals.md @@ -74,37 +74,6 @@ Minimal example: } ``` -## `EquivocationProposal` -:::tip -`EquivocationProposal` will only be accepted on the provider chain if at least one of the consumer chains submits equivocation evidence to the provider. -Sending equivocation evidence to the provider is handled automatically by the interchain security protocol when an equivocation infraction is detected on the consumer chain. -::: - -Proposal type used to suggest slashing a validator for double signing on consumer chain. -When proposals of this type are passed, the validator in question will be slashed for equivocation on the provider chain. - -:::warning -Take note that an equivocation slash causes a validator to be tombstoned (can never re-enter the active set). -Tombstoning a validator on the provider chain will remove the validator from the validator set of all consumer chains. -::: - -Minimal example: -```js -{ - "title": "Validator-1 double signed on consumerchain-1", - "description": "Here is more information about the infraction so you can verify it yourself", - // the list of equivocations that will be processed - "equivocations": [ - { - "height": 14444680, - "time": "2023-02-28T20:40:00.000000Z", - "power": 5500000, - "consensus_address": "" - } - ] -} -``` - ## ChangeRewardDenomProposal :::tip `ChangeRewardDenomProposal` will only be accepted on the provider chain if at least one of the denomsToAdd or denomsToRemove fields is populated with at least one denom. Also, a denom cannot be repeated in both sets. @@ -121,30 +90,3 @@ Minimal example: "denomsToRemove": [] } ``` - -### Notes -When submitting equivocation evidence through an `EquivocationProposal` please take note that you need to use the consensus address (`valcons`) of the offending validator on the **provider chain**. -Besides that, the `height` and the `time` fields should be mapped to the **provider chain** to avoid your evidence being rejected. - -Before submitting the proposal please check that the evidence is not outdated by comparing the infraction height with the `max_age_duration` and `max_age_num_blocks` consensus parameters of the **provider chain**. - -### Gaia example: -``` -➜ ~ cat genesis.json | jq ".consensus_params" -{ - "block": { - ... - }, - "evidence": { - "max_age_duration": "172800000000000", - "max_age_num_blocks": "1000000", - "max_bytes": "50000" - }, - "validator": { - ... - }, - "version": {} -} -``` - -Any `EquivocationProposal` transactions that submit evidence with `height` older than `max_age_num_blocks` and `time` older than `max_age_duration` will be considered invalid. diff --git a/docs/docs/features/slashing.md b/docs/docs/features/slashing.md index 4c74153b15..cdf166da8c 100644 --- a/docs/docs/features/slashing.md +++ b/docs/docs/features/slashing.md @@ -20,17 +20,10 @@ Instead of slashing, the provider will only jail offending validator for the dur Slash throttling (sometimes called jail throttling) mechanism ensures that only a fraction of the validator set can be jailed at any one time to prevent malicious consumer chains from harming the provider. ::: -## Double-signing (equivocation) -infractions are not acted upon immediately. +# Cryptographic verification of equivocation and slashing +The Cryptographic verification of equivocation allows external agents to submit evidences of light client and double signing attacks observed on a consumer chain. When valid evidence is received, the malicious validators will be slashed, jailed, and tombstoned on the provider. -Upon receiving double signing evidence, the provider chain will take note of the evidence and allow for `EquivocationProposal` to be submitted to slash the offending validator. -Any `EquivocationProposal`s to slash a validator that has not double signed on any of the consumer chains will be automatically rejected by the provider chain. +The feature is outlined in [ADR-005](../adrs/adr-005-cryptographic-equivocation-verification.md) and [ADR-013](../adrs/adr-013-equivocation-slashing.md). -:::info -The offending validator will only be slashed (and tombstoned) if an `EquivocationProposal` is accepted and passed through governance. - -The offending validator will effectively get slashed and tombstoned on all consumer chains. -::: - - -You can find instructions on creating `EquivocationProposal`s [here](./proposals#equivocationproposal). +By sending a `MsgSubmitConsumerMisbehaviour` or a `MsgSubmitConsumerDoubleVoting` transaction, the provider will + verify the reported equivocation and, if successful, slash, jail, and tombstone the malicious validator. \ No newline at end of file diff --git a/docs/docs/introduction/overview.md b/docs/docs/introduction/overview.md index f61fe4d209..aba31751e1 100644 --- a/docs/docs/introduction/overview.md +++ b/docs/docs/introduction/overview.md @@ -30,10 +30,6 @@ To ensure the security of the consumer chain, provider delegators cannot unbond If downtime is initiated by a validator on a consumer chain, a downtime packet will be relayed to the provider to jail that validator for a set amount of time. The validator who committed downtime will then miss out on staking rewards for the configured jailing period. -### Equivocation (Double Sign) Slashing - -Evidence of equivocation must be submitted to provider governance and be voted on. This behavior is an extra safeguard before a validator is slashed, and may be replaced by a more automated system in the future. - ### Tokenomics and Rewards Consumer chains are free to create their own native token which can be used for fees, and can be created on the consumer chain in the form of inflationary rewards. These rewards can be used to incentivize user behavior, for example, LPing or staking. A portion of these fees and rewards will be sent to provider chain stakers, but that proportion is completely customizable by the developers, and subject to governance. diff --git a/docs/docs/validators/overview.md b/docs/docs/validators/overview.md index 35ce56cdb3..4d764703be 100644 --- a/docs/docs/validators/overview.md +++ b/docs/docs/validators/overview.md @@ -91,7 +91,7 @@ More information is available in [Downtime Slashing documentation](../features/s ::: ## Double-signing Infractions -To learn more about equivocation handling in replicated security check out the [Slashing](../features/slashing.md#double-signing-equivocation) and [EquivocationProposal](../features/proposals.md#equivocationproposal) documentation sections +To learn more about equivocation handling in replicated security check out the [Slashing](../features/slashing.md) documentation section. ## Key assignment Validators can use different consensus keys on the provider and each of the consumer chains. The consumer chain consensus key must be registered on the provider before use. diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index eb502b0d97..3c284ff9b5 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -106,10 +106,13 @@ message ConsumerRemovalProposal { // punish a validator for equivocation on a consumer chain. // // This type is only used internally to the consumer CCV module. +// WARNING: This message is deprecated now that equivocations can be submitted +// and verified automatically on the provider. (see SubmitConsumerDoubleVoting in proto/interchain-security/ccv/provider/v1/tx.proto). message EquivocationProposal { + option deprecated = true; // the title of the proposal string title = 1; - // the description of the proposal +// the description of the proposal string description = 2; // the list of equivocations that will be processed repeated cosmos.evidence.v1beta1.Equivocation equivocations = 3; diff --git a/proto/interchain_security/ccv/provider/v1/tx.proto b/proto/interchain_security/ccv/provider/v1/tx.proto index 1fb97e4132..ada2bffde8 100644 --- a/proto/interchain_security/ccv/provider/v1/tx.proto +++ b/proto/interchain_security/ccv/provider/v1/tx.proto @@ -4,11 +4,17 @@ package interchain_security.ccv.provider.v1; option go_package = "github.com/cosmos/interchain-security/v3/x/ccv/provider/types"; import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "google/protobuf/any.proto"; +import "ibc/lightclients/tendermint/v1/tendermint.proto"; +import "tendermint/types/evidence.proto"; + // Msg defines the Msg service. service Msg { - rpc AssignConsumerKey(MsgAssignConsumerKey) - returns (MsgAssignConsumerKeyResponse); + rpc AssignConsumerKey(MsgAssignConsumerKey) returns (MsgAssignConsumerKeyResponse); + rpc SubmitConsumerMisbehaviour(MsgSubmitConsumerMisbehaviour) returns (MsgSubmitConsumerMisbehaviourResponse); + rpc SubmitConsumerDoubleVoting(MsgSubmitConsumerDoubleVoting) returns (MsgSubmitConsumerDoubleVotingResponse); } message MsgAssignConsumerKey { @@ -25,3 +31,33 @@ message MsgAssignConsumerKey { } message MsgAssignConsumerKeyResponse {} + + +// MsgSubmitConsumerMisbehaviour defines a message that reports a light client attack, +// also known as a misbehaviour, observed on a consumer chain +message MsgSubmitConsumerMisbehaviour { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + string submitter = 1; + // The Misbehaviour of the consumer chain wrapping + // two conflicting IBC headers + ibc.lightclients.tendermint.v1.Misbehaviour misbehaviour = 2; +} + +message MsgSubmitConsumerMisbehaviourResponse {} + + +// MsgSubmitConsumerDoubleVoting defines a message that reports +// a double signing infraction observed on a consumer chain +message MsgSubmitConsumerDoubleVoting { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + string submitter = 1; + // The equivocation of the consumer chain wrapping + // an evidence of a validator that signed two conflicting votes + tendermint.types.DuplicateVoteEvidence duplicate_vote_evidence = 2; + // The light client header of the infraction block + ibc.lightclients.tendermint.v1.Header infraction_block_header = 3; +} + +message MsgSubmitConsumerDoubleVotingResponse {} diff --git a/tests/e2e/action_rapid_test.go b/tests/e2e/action_rapid_test.go index 005f52610d..49773ef883 100644 --- a/tests/e2e/action_rapid_test.go +++ b/tests/e2e/action_rapid_test.go @@ -66,7 +66,6 @@ func GetActionGen() *rapid.Generator[any] { GetSubmitConsumerAdditionProposalActionGen().AsAny(), GetSubmitConsumerRemovalProposalActionGen().AsAny(), GetSubmitParamChangeProposalActionGen().AsAny(), - GetSubmitEquivocationProposalActionGen().AsAny(), GetVoteGovProposalActionGen().AsAny(), GetStartConsumerChainActionGen().AsAny(), GetAddChainToRelayerActionGen().AsAny(), @@ -90,6 +89,9 @@ func GetActionGen() *rapid.Generator[any] { CreateLightClientEquivocationAttackActionGen().AsAny(), CreateLightClientAmnesiaAttackActionGen().AsAny(), CreateLightClientLunaticAttackActionGen().AsAny(), + GetStartConsumerEvidenceDetectorActionGen().AsAny(), + GetForkConsumerChainActionGen().AsAny(), + GetUpdateLightClientActionGen().AsAny(), ) } @@ -208,7 +210,7 @@ func GetStartChainActionGen() *rapid.Generator[StartChainAction] { Chain: GetChainIDGen().Draw(t, "Chain"), Validators: GetStartChainValidatorsGen().Draw(t, "Validators"), GenesisChanges: rapid.String().Draw(t, "GenesisChanges"), - SkipGentx: rapid.Bool().Draw(t, "SkipGentx"), + IsConsumer: rapid.Bool().Draw(t, "IsConsumer"), } }) } @@ -279,19 +281,6 @@ func GetSubmitParamChangeProposalActionGen() *rapid.Generator[submitParamChangeL }) } -func GetSubmitEquivocationProposalActionGen() *rapid.Generator[submitEquivocationProposalAction] { - return rapid.Custom(func(t *rapid.T) submitEquivocationProposalAction { - return submitEquivocationProposalAction{ - Chain: GetChainIDGen().Draw(t, "Chain"), - From: GetValidatorIDGen().Draw(t, "From"), - Deposit: rapid.Uint().Draw(t, "Deposit"), - Height: rapid.Int64().Draw(t, "Height"), - Time: GetTimeGen().Draw(t, "Time"), - Power: rapid.Int64().Draw(t, "Power"), - } - }) -} - func TestMarshalAndUnmarshalTime(t *testing.T) { rapid.Check(t, func(t *rapid.T) { time1 := GetTimeGen().Draw(t, "time") @@ -499,3 +488,33 @@ func GetSlashThrottleDequeueActionGen() *rapid.Generator[slashThrottleDequeueAct } }) } + +func GetForkConsumerChainActionGen() *rapid.Generator[forkConsumerChainAction] { + return rapid.Custom(func(t *rapid.T) forkConsumerChainAction { + return forkConsumerChainAction{ + ConsumerChain: GetChainIDGen().Draw(t, "ConsumerChain"), + ProviderChain: GetChainIDGen().Draw(t, "ProviderChain"), + Validator: GetValidatorIDGen().Draw(t, "Validator"), + RelayerConfig: rapid.String().Draw(t, "RelayerConfig"), + } + }) +} + +func GetStartConsumerEvidenceDetectorActionGen() *rapid.Generator[startConsumerEvidenceDetectorAction] { + return rapid.Custom(func(t *rapid.T) startConsumerEvidenceDetectorAction { + return startConsumerEvidenceDetectorAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + } + }) +} + +func GetUpdateLightClientActionGen() *rapid.Generator[updateLightClientAction] { + return rapid.Custom(func(t *rapid.T) updateLightClientAction { + return updateLightClientAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + HostChain: GetChainIDGen().Draw(t, "HostChain"), + RelayerConfig: rapid.String().Draw(t, "RelayerConfig"), + ClientID: rapid.String().Draw(t, "ClientID"), + } + }) +} diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 386404baaa..9dac11a608 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -15,8 +15,6 @@ import ( clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/tidwall/gjson" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/interchain-security/v3/x/ccv/provider/client" "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" @@ -67,7 +65,7 @@ type StartChainAction struct { Validators []StartChainValidator // Genesis changes specific to this action, appended to genesis changes defined in chain config GenesisChanges string - SkipGentx bool + IsConsumer bool } type StartChainValidator struct { @@ -137,7 +135,7 @@ func (tr *TestConfig) startChain( cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "/bin/bash", "/testnet-scripts/start-chain.sh", chainConfig.BinaryName, string(vals), string(chainConfig.ChainId), chainConfig.IpPrefix, genesisChanges, - fmt.Sprint(action.SkipGentx), + fmt.Sprint(action.IsConsumer), // override config/config.toml for each node on chain // usually timeout_commit and peer_gossip_sleep_duration are changed to vary the test run duration // lower timeout_commit means the blocks are produced faster making the test run shorter @@ -172,8 +170,9 @@ func (tr *TestConfig) startChain( } tr.addChainToRelayer(addChainToRelayerAction{ - Chain: action.Chain, - Validator: action.Validators[0].Id, + Chain: action.Chain, + Validator: action.Validators[0].Id, + IsConsumer: action.IsConsumer, }, verbose) // store the fact that we started the chain @@ -431,78 +430,6 @@ func (tr TestConfig) submitParamChangeProposal( tr.waitBlocks(action.Chain, 2, 60*time.Second) } -type submitEquivocationProposalAction struct { - Chain ChainID - Height int64 - Time time.Time - Power int64 - Validator ValidatorID - Deposit uint - From ValidatorID -} - -func (tr TestConfig) submitEquivocationProposal(action submitEquivocationProposalAction, verbose bool) { - val := tr.validatorConfigs[action.Validator] - providerChain := tr.chainConfigs[ChainID("provi")] - - prop := client.EquivocationProposalJSON{ - Summary: "Validator equivocation!", - EquivocationProposal: types.EquivocationProposal{ - Title: "Validator equivocation!", - Description: fmt.Sprintf("Validator: %s has committed an equivocation infraction on ChainID: %s", action.Validator, action.Chain), - Equivocations: []*evidencetypes.Equivocation{ - { - Height: action.Height, - Time: action.Time, - Power: action.Power, - ConsensusAddress: val.ValconsAddress, - }, - }, - }, - Deposit: fmt.Sprint(action.Deposit) + `stake`, - } - - bz, err := json.Marshal(prop) - if err != nil { - log.Fatal(err) - } - - jsonStr := string(bz) - if strings.Contains(jsonStr, "'") { - log.Fatal("prop json contains single quote") - } - - //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, - "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/equivocation-proposal.json")).CombinedOutput() - - if err != nil { - log.Fatal(err, "\n", string(bz)) - } - - //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - // EQUIVOCATION PROPOSAL - bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, providerChain.BinaryName, - - "tx", "gov", "submit-legacy-proposal", "equivocation", "/equivocation-proposal.json", - - `--from`, `validator`+fmt.Sprint(action.From), - `--chain-id`, string(providerChain.ChainId), - `--home`, tr.getValidatorHome(providerChain.ChainId, action.From), - `--node`, tr.getValidatorNode(providerChain.ChainId, action.From), - `--gas`, "9000000", - `--keyring-backend`, `test`, - `-y`, - ).CombinedOutput() - - if err != nil { - log.Fatal(err, "\n", string(bz)) - } - - // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(ChainID("provi"), 2, 30*time.Second) -} - type voteGovProposalAction struct { Chain ChainID From []ValidatorID @@ -586,7 +513,7 @@ func (tr *TestConfig) startConsumerChain( Chain: action.ConsumerChain, Validators: action.Validators, GenesisChanges: consumerGenesis, - SkipGentx: true, + IsConsumer: true, }, verbose) } @@ -718,8 +645,9 @@ func (tr TestConfig) startChangeover( } type addChainToRelayerAction struct { - Chain ChainID - Validator ValidatorID + Chain ChainID + Validator ValidatorID + IsConsumer bool } const hermesChainConfigTemplate = ` @@ -736,7 +664,8 @@ rpc_addr = "%s" rpc_timeout = "10s" store_prefix = "ibc" trusting_period = "14days" -websocket_addr = "%s" +event_source = { mode = "push", url = "%s", batch_delay = "50ms" } +ccv_consumer_chain = %v [chains.gas_price] denom = "stake" @@ -835,7 +764,7 @@ func (tr TestConfig) addChainToHermes( keyName, rpcAddr, wsAddr, - // action.consumer, + action.IsConsumer, ) bashCommand := fmt.Sprintf(`echo '%s' >> %s`, chainConfig, "/root/.hermes/config.toml") @@ -849,7 +778,15 @@ func (tr TestConfig) addChainToHermes( } // Save mnemonic to file within container - saveMnemonicCommand := fmt.Sprintf(`echo '%s' > %s`, tr.validatorConfigs[action.Validator].Mnemonic, "/root/.hermes/mnemonic.txt") + var mnemonic string + if tr.validatorConfigs[action.Validator].UseConsumerKey && action.IsConsumer { + mnemonic = tr.validatorConfigs[action.Validator].ConsumerMnemonic + } else { + mnemonic = tr.validatorConfigs[action.Validator].Mnemonic + } + + saveMnemonicCommand := fmt.Sprintf(`echo '%s' > %s`, mnemonic, "/root/.hermes/mnemonic.txt") + fmt.Println("Add to hermes", action.Validator) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, "bash", "-c", saveMnemonicCommand, @@ -2105,6 +2042,29 @@ func (tr TestConfig) GetPathNameForGorelayer(chainA, chainB ChainID) string { return pathName } +// Run an instance of the Hermes relayer using the "evidence" command, +// which detects evidences committed to the blocks of a consumer chain. +// Each infraction detected is reported to the provider chain using +// either a SubmitConsumerDoubleVoting or a SubmitConsumerMisbehaviour message. +type startConsumerEvidenceDetectorAction struct { + Chain ChainID +} + +func (tc TestConfig) startConsumerEvidenceDetector( + action startConsumerEvidenceDetectorAction, + verbose bool, +) { + chainConfig := tc.chainConfigs[action.Chain] + // run in detached mode so it will keep running in the background + //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. + bz, err := exec.Command("docker", "exec", "-d", tc.containerConfig.InstanceName, + "hermes", "evidence", "--chain", string(chainConfig.ChainId)).CombinedOutput() + if err != nil { + log.Fatal(err, "\n", string(bz)) + } + tc.waitBlocks("provi", 10, 2*time.Minute) +} + // WaitTime waits for the given duration. // To make sure that the new timestamp is visible on-chain, it also waits until at least one block has been // produced on each chain after waiting. diff --git a/tests/e2e/actions_consumer_misbehaviour.go b/tests/e2e/actions_consumer_misbehaviour.go new file mode 100644 index 0000000000..7d71d58d1d --- /dev/null +++ b/tests/e2e/actions_consumer_misbehaviour.go @@ -0,0 +1,98 @@ +package main + +import ( + "bufio" + "log" + "os/exec" + "strconv" + "time" +) + +// forkConsumerChainAction forks the consumer chain by cloning of a validator node +// Note that the chain fork is running in an different network +type forkConsumerChainAction struct { + ConsumerChain ChainID + ProviderChain ChainID + Validator ValidatorID + RelayerConfig string +} + +func (tc TestConfig) forkConsumerChain(action forkConsumerChainAction, verbose bool) { + valCfg := tc.validatorConfigs[action.Validator] + + //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. + configureNodeCmd := exec.Command("docker", "exec", tc.containerConfig.InstanceName, "/bin/bash", + "/testnet-scripts/fork-consumer.sh", tc.chainConfigs[action.ConsumerChain].BinaryName, + string(action.Validator), string(action.ConsumerChain), + tc.chainConfigs[action.ConsumerChain].IpPrefix, + tc.chainConfigs[action.ProviderChain].IpPrefix, + valCfg.Mnemonic, + action.RelayerConfig, + ) + + if verbose { + log.Println("forkConsumerChain - reconfigure node cmd:", configureNodeCmd.String()) + } + + cmdReader, err := configureNodeCmd.StdoutPipe() + if err != nil { + log.Fatal(err) + } + configureNodeCmd.Stderr = configureNodeCmd.Stdout + + if err := configureNodeCmd.Start(); err != nil { + log.Fatal(err) + } + + scanner := bufio.NewScanner(cmdReader) + + for scanner.Scan() { + out := scanner.Text() + if verbose { + log.Println("fork consumer validator : " + out) + } + if out == done { + break + } + } + if err := scanner.Err(); err != nil { + log.Fatal(err) + } + + time.Sleep(5 * time.Second) +} + +type updateLightClientAction struct { + Chain ChainID + HostChain ChainID + RelayerConfig string + ClientID string +} + +func (tc TestConfig) updateLightClient( + action updateLightClientAction, + verbose bool, +) { + // retrieve a trusted height of the consumer light client + trustedHeight := tc.getTrustedHeight(action.HostChain, action.ClientID, 2) + + //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. + cmd := exec.Command("docker", "exec", tc.containerConfig.InstanceName, "hermes", + "--config", action.RelayerConfig, + "update", + "client", + "--client", action.ClientID, + "--host-chain", string(action.HostChain), + "--trusted-height", strconv.Itoa(int(trustedHeight.RevisionHeight)), + ) + if verbose { + log.Println("updateLightClientAction cmd:", cmd.String()) + } + + bz, err := cmd.CombinedOutput() + if err != nil { + log.Fatal(err, "\n", string(bz)) + } + + tc.waitBlocks(action.HostChain, 5, 30*time.Second) +} diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 942bb338e7..eedd095c97 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -396,6 +396,92 @@ func ChangeoverTestConfig() TestConfig { return tr } +func ConsumerMisbehaviourTestConfig() TestConfig { + tc := TestConfig{ + name: "consumer-misbehaviour", + containerConfig: ContainerConfig{ + ContainerName: "interchain-security-container", + InstanceName: "interchain-security-instance", + CcvVersion: "1", + Now: time.Now(), + }, + validatorConfigs: map[ValidatorID]ValidatorConfig{ + ValidatorID("alice"): { + Mnemonic: "pave immune ethics wrap gain ceiling always holiday employ earth tumble real ice engage false unable carbon equal fresh sick tattoo nature pupil nuclear", + DelAddress: "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", + ValoperAddress: "cosmosvaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtrgtng", + ValconsAddress: "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + PrivValidatorKey: `{"address":"06C0F3E47CC5C748269088DC2F36411D3AAA27C6","pub_key":{"type":"tendermint/PubKeyEd25519","value":"RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uX+ZpDMg89a6gtqs/+MQpCTSqlkZ0nJQJOhLlCJvwvdGtyVDP1siGQjL+B8vjzmDc9gx6IiS7ip6jj3nvztfXQ=="}}`, + NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"fjw4/DAhyRPnwKgXns5SV7QfswRSXMWJpHS7TyULDmJ8ofUc5poQP8dgr8bZRbCV5RV8cPqDq3FPdqwpmUbmdA=="}}`, + IpSuffix: "4", + + // consumer chain assigned key + ConsumerMnemonic: "exile install vapor thing little toss immune notable lounge december final easy strike title end program interest quote cloth forget forward job october twenty", + ConsumerDelAddress: "cosmos1eeeggku6dzk3mv7wph3zq035rhtd890sjswszd", + ConsumerValoperAddress: "cosmosvaloper1eeeggku6dzk3mv7wph3zq035rhtd890shy69w7", + ConsumerValconsAddress: "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", + ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="}`, + ConsumerPrivValidatorKey: `{"address":"DF090A4880B54CD57B2A79E64D9E969BD7514B09","pub_key":{"type":"tendermint/PubKeyEd25519","value":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TRJgf7lkTjs/sj43pyweEOanyV7H7fhnVivOi0A4yjW6NjXgCCilX3TshiA8CT/nHxz3brtLh9B/z2fJ4I9N6w=="}}`, + ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"F966RL9pi20aXRzEBe4D0xRQJtZt696Xxz44XUON52cFc83FMn1WXJbP6arvA2JPyn2LA3DLKCFHSgALrCGXGA=="}}`, + UseConsumerKey: true, + }, + ValidatorID("bob"): { + Mnemonic: "glass trip produce surprise diamond spin excess gaze wash drum human solve dress minor artefact canoe hard ivory orange dinner hybrid moral potato jewel", + DelAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", + ValoperAddress: "cosmosvaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9qakmjnw", + ValconsAddress: "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", + PrivValidatorKey: `{"address":"99BD3A72EF12CD024E7584B3AC900AE3743C6ADF","pub_key":{"type":"tendermint/PubKeyEd25519","value":"mAN6RXYxSM4MNGSIriYiS7pHuwAcOHDQAy9/wnlSzOI="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"QePcwfWtOavNK7pBJrtoLMzarHKn6iBWfWPFeyV+IdmYA3pFdjFIzgw0ZIiuJiJLuke7ABw4cNADL3/CeVLM4g=="}}`, + NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TQ4vHcO/vKdzGtWpelkX53WdMQd4kTsWGFrdcatdXFvWyO215Rewn5IRP0FszPLWr2DqPzmuH8WvxYGk5aeOXw=="}}`, + IpSuffix: "5", + + // consumer chain assigned key + ConsumerMnemonic: "grunt list hour endless observe better spoil penalty lab duck only layer vague fantasy satoshi record demise topple space shaft solar practice donor sphere", + ConsumerDelAddress: "cosmos1q90l6j6lzzgt460ehjj56azknlt5yrd4s38n97", + ConsumerValoperAddress: "cosmosvaloper1q90l6j6lzzgt460ehjj56azknlt5yrd449nxfd", + ConsumerValconsAddress: "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", + ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, + ConsumerPrivValidatorKey: `{"address":"E73388E246EC9945E5E70A94FE4072BD937415C4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"OFR4w+FC6EMw5fAGTrHVexyPrjzQ7QfqgZOMgVf0izlCUb6Jh7oDJim9jXP1E0koJWUfXhD+pLPgSMZ0YKu7eg=="}}`, + ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uhPCqnL2KE8m/8OFNLQ5bN3CJr6mds+xfBi0E4umT/s2uWiJhet+vbYx88DHSdof3gGFNTIzAIxSppscBKX96w=="}}`, + UseConsumerKey: false, + }, + }, + chainConfigs: map[ChainID]ChainConfig{ + ChainID("provi"): { + ChainId: ChainID("provi"), + BinaryName: "interchain-security-pd", + IpPrefix: "7.7.7", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + // Custom slashing parameters for testing validator downtime functionality + // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking + ".app_state.slashing.params.signed_blocks_window = \"10\" | " + + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling + ".app_state.provider.params.slash_meter_replenish_period = \"3s\"", + }, + ChainID("consu"): { + ChainId: ChainID("consu"), + BinaryName: "interchain-security-cd", + IpPrefix: "7.7.8", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ".app_state.slashing.params.signed_blocks_window = \"15\" | " + + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"", + }, + }, + tendermintConfigOverride: `s/timeout_commit = "5s"/timeout_commit = "1s"/;` + + `s/peer_gossip_sleep_duration = "100ms"/peer_gossip_sleep_duration = "50ms"/;` + + // Required to start consumer chain by running a single big validator + `s/block_sync = true/block_sync = false/;`, + } + tc.Initialize() + return tc +} + func (s *TestConfig) SetDockerConfig(localSdkPath string, useGaia bool, gaiaTag string) { if localSdkPath != "" { fmt.Println("USING LOCAL SDK", localSdkPath) diff --git a/tests/e2e/json_utils.go b/tests/e2e/json_utils.go index 692c34a14f..549bfe78c9 100644 --- a/tests/e2e/json_utils.go +++ b/tests/e2e/json_utils.go @@ -95,12 +95,6 @@ func UnmarshalMapToActionType(rawAction json.RawMessage, actionTypeString string if err == nil { return a, nil } - case "main.submitEquivocationProposalAction": - var a submitEquivocationProposalAction - err := json.Unmarshal(rawAction, &a) - if err == nil { - return a, nil - } case "main.submitParamChangeLegacyProposalAction": var a submitParamChangeLegacyProposalAction err := json.Unmarshal(rawAction, &a) @@ -275,6 +269,24 @@ func UnmarshalMapToActionType(rawAction json.RawMessage, actionTypeString string if err == nil { return a, nil } + case "main.forkConsumerChainAction": + var a forkConsumerChainAction + err := json.Unmarshal(rawAction, &a) + if err == nil { + return a, nil + } + case "main.startConsumerEvidenceDetectorAction": + var a startConsumerEvidenceDetectorAction + err := json.Unmarshal(rawAction, &a) + if err == nil { + return a, nil + } + case "main.updateLightClientAction": + var a updateLightClientAction + err := json.Unmarshal(rawAction, &a) + if err == nil { + return a, nil + } default: return nil, fmt.Errorf("unknown action type: %s", actionTypeString) } @@ -354,12 +366,6 @@ func UnmarshalProposalWithType(inputMap json.RawMessage, proposalType string) (P if err == nil { return prop, nil } - case "main.EquivocationProposal": - prop := EquivocationProposal{} - err := json.Unmarshal(inputMap, &prop) - if err == nil { - return prop, nil - } case "main.ParamsProposal": prop := ParamsProposal{} err := json.Unmarshal(inputMap, &prop) diff --git a/tests/e2e/main.go b/tests/e2e/main.go index 0be163f8db..6b06bc641c 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -54,12 +54,14 @@ var ( // map the test config names to their structs to allow for easy selection of test configs, // and also to programatically set parameters, i.e. see DemocracyTestConfig testConfigs = map[string]TestConfig{ - "default": DefaultTestConfig(), - "changeover": ChangeoverTestConfig(), - "democracy": DemocracyTestConfig(false), - "democracy-reward": DemocracyTestConfig(true), - "slash-throttle": SlashThrottleTestConfig(), - "multiconsumer": MultiConsumerTestConfig(), + "default": DefaultTestConfig(), + "changeover": ChangeoverTestConfig(), + "democracy": DemocracyTestConfig(false), + "democracy-reward": DemocracyTestConfig(true), + "slash-throttle": SlashThrottleTestConfig(), + "multiconsumer": MultiConsumerTestConfig(), + "consumer-misbehaviour": ConsumerMisbehaviourTestConfig(), + "consumer-double-sign": DefaultTestConfig(), } ) @@ -114,6 +116,18 @@ var stepChoices = map[string]StepChoice{ description: "multi consumer tests", testConfig: MultiConsumerTestConfig(), }, + "consumer-misbehaviour": { + name: "consumer-misbehaviour", + steps: consumerMisbehaviourSteps, + description: "consumer light client misbehaviour tests", + testConfig: ConsumerMisbehaviourTestConfig(), + }, + "consumer-double-sign": { + name: "consumer-double-sign", + steps: consumerDoubleSignSteps, + description: "consumer double signing tests", + testConfig: DefaultTestConfig(), + }, } func executeTests(tests []testStepsWithConfig) (err error) { @@ -216,7 +230,8 @@ func getTestCases(selectedPredefinedTests, selectedTestFiles TestSet) (tests []t if len(selectedPredefinedTests) == 0 && len(selectedTestFiles) == 0 { selectedPredefinedTests = TestSet{ "changeover", "happy-path", - "democracy-reward", "democracy", "slash-throttle", + "democracy-reward", "democracy", + "slash-throttle", "consumer-double-sign", "consumer-misbehaviour", } if includeMultiConsumer != nil && *includeMultiConsumer { selectedPredefinedTests = append(selectedPredefinedTests, "multiconsumer") @@ -331,8 +346,6 @@ func (tr *TestConfig) runStep(step Step, verbose bool) { tr.submitConsumerAdditionProposal(action, verbose) case submitConsumerRemovalProposalAction: tr.submitConsumerRemovalProposal(action, verbose) - case submitEquivocationProposalAction: - tr.submitEquivocationProposal(action, verbose) case submitParamChangeLegacyProposalAction: tr.submitParamChangeProposal(action, verbose) case voteGovProposalAction: @@ -381,6 +394,12 @@ func (tr *TestConfig) runStep(step Step, verbose bool) { tr.waitForSlashThrottleDequeue(action, verbose) case startRelayerAction: tr.startRelayer(action, verbose) + case forkConsumerChainAction: + tr.forkConsumerChain(action, verbose) + case updateLightClientAction: + tr.updateLightClient(action, verbose) + case startConsumerEvidenceDetectorAction: + tr.startConsumerEvidenceDetector(action, verbose) case submitChangeRewardDenomsProposalAction: tr.submitChangeRewardDenomsProposal(action, verbose) default: diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 0febed41f7..d6ba576ec8 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -1,6 +1,7 @@ package main import ( + "bufio" "fmt" "log" "os/exec" @@ -29,6 +30,7 @@ type ChainState struct { ConsumerChainQueueSizes *map[ChainID]uint GlobalSlashQueueSize *uint RegisteredConsumerRewardDenoms *[]string + ClientsFrozenHeights *map[string]clienttypes.Height } type Proposal interface { @@ -73,16 +75,6 @@ type ConsumerRemovalProposal struct { func (p ConsumerRemovalProposal) isProposal() {} -type EquivocationProposal struct { - Height uint - Power uint - ConsensusAddress string - Deposit uint - Status string -} - -func (p EquivocationProposal) isProposal() {} - type Rewards struct { IsRewarded map[ValidatorID]bool // if true it will calculate if the validator/delegator is rewarded between 2 successive blocks, @@ -186,6 +178,14 @@ func (tr TestConfig) getChainState(chain ChainID, modelState ChainState) ChainSt chainState.RegisteredConsumerRewardDenoms = ®isteredConsumerRewardDenoms } + if modelState.ClientsFrozenHeights != nil { + chainClientsFrozenHeights := map[string]clienttypes.Height{} + for id := range *modelState.ClientsFrozenHeights { + chainClientsFrozenHeights[id] = tr.getClientFrozenHeight(chain, id) + } + chainState.ClientsFrozenHeights = &chainClientsFrozenHeights + } + if *verbose { log.Println("Done getting chain state:\n" + pretty.Sprint(chainState)) } @@ -323,6 +323,7 @@ func (tr TestConfig) getReward(chain ChainID, validator ValidatorID, blockHeight if chain != ChainID("provi") && tr.validatorConfigs[validator].UseConsumerKey { delAddresss = tr.validatorConfigs[validator].ConsumerDelAddress } + //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, @@ -459,16 +460,6 @@ func (tr TestConfig) getProposal(chain ChainID, proposal uint) Proposal { Chain: chain, StopTime: int(stopTime.Milliseconds()), } - - case "/interchain_security.ccv.provider.v1.EquivocationProposal": - return EquivocationProposal{ - Deposit: uint(deposit), - Status: status, - Height: uint(gjson.Get(string(bz), `messages.0.content.equivocations.0.height`).Uint()), - Power: uint(gjson.Get(string(bz), `messages.0.content.equivocations.0.power`).Uint()), - ConsensusAddress: gjson.Get(string(bz), `messages.0.content.equivocations.0.consensus_address`).String(), - } - case "/cosmos.params.v1beta1.ParameterChangeProposal": return ParamsProposal{ Deposit: uint(deposit), @@ -772,3 +763,87 @@ func (tr TestConfig) curlJsonRPCRequest(method, params, address string) { verbosity := false executeCommandWithVerbosity(cmd, "curlJsonRPCRequest", verbosity) } +<<<<<<< HEAD +======= + +// getClientFrozenHeight returns the frozen height for a client with the given client ID +// by querying the hosting chain with the given chainID +func (tc TestConfig) getClientFrozenHeight(chain ChainID, clientID string) clienttypes.Height { + //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. + cmd := exec.Command("docker", "exec", tc.containerConfig.InstanceName, tc.chainConfigs[ChainID("provi")].BinaryName, + "query", "ibc", "client", "state", clientID, + `--node`, tc.getQueryNode(ChainID("provi")), + `-o`, `json`, + ) + + bz, err := cmd.CombinedOutput() + if err != nil { + log.Fatal(err, "\n", string(bz)) + } + + frozenHeight := gjson.Get(string(bz), "client_state.frozen_height") + + revHeight, err := strconv.Atoi(frozenHeight.Get("revision_height").String()) + if err != nil { + log.Fatal(err, "\n", string(bz)) + } + + revNumber, err := strconv.Atoi(frozenHeight.Get("revision_number").String()) + if err != nil { + log.Fatal(err, "\n", string(bz)) + } + + return clienttypes.Height{RevisionHeight: uint64(revHeight), RevisionNumber: uint64(revNumber)} +} + +func (tc TestConfig) getTrustedHeight( + chain ChainID, + clientID string, + index int, +) clienttypes.Height { + //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. + configureNodeCmd := exec.Command("docker", "exec", tc.containerConfig.InstanceName, "hermes", + "--json", "query", "client", "consensus", "--chain", string(chain), + `--client`, clientID, + ) + + cmdReader, err := configureNodeCmd.StdoutPipe() + if err != nil { + log.Fatal(err) + } + + configureNodeCmd.Stderr = configureNodeCmd.Stdout + + if err := configureNodeCmd.Start(); err != nil { + log.Fatal(err) + } + + scanner := bufio.NewScanner(cmdReader) + + var trustedHeight gjson.Result + // iterate on the relayer's response + // and parse the the command "result" + for scanner.Scan() { + out := scanner.Text() + if len(gjson.Get(out, "result").Array()) > 0 { + trustedHeight = gjson.Get(out, "result").Array()[index] + break + } + } + + revHeight, err := strconv.Atoi(trustedHeight.Get("revision_height").String()) + if err != nil { + log.Fatal(err) + } + + revNumber, err := strconv.Atoi(trustedHeight.Get("revision_number").String()) + if err != nil { + log.Fatal(err) + } + return clienttypes.Height{RevisionHeight: uint64(revHeight), RevisionNumber: uint64(revNumber)} +} + +func uintPtr(i uint) *uint { + return &i +} +>>>>>>> 1e8512a0 (feat!: add cryptographic equivocation (#1340)) diff --git a/tests/e2e/state_rapid_test.go b/tests/e2e/state_rapid_test.go index 313e4a68ba..ebca9397a6 100644 --- a/tests/e2e/state_rapid_test.go +++ b/tests/e2e/state_rapid_test.go @@ -174,7 +174,6 @@ func GetProposalGen() *rapid.Generator[Proposal] { gen := rapid.OneOf( GetConsumerAdditionProposalGen().AsAny(), GetConsumerRemovalProposalGen().AsAny(), - GetEquivocationProposalGen().AsAny(), GetTextProposalGen().AsAny(), GetParamsProposalGen().AsAny(), ) @@ -205,18 +204,6 @@ func GetConsumerRemovalProposalGen() *rapid.Generator[ConsumerRemovalProposal] { }) } -func GetEquivocationProposalGen() *rapid.Generator[EquivocationProposal] { - return rapid.Custom(func(t *rapid.T) EquivocationProposal { - return EquivocationProposal{ - Power: rapid.Uint().Draw(t, "Power"), - Height: rapid.Uint().Draw(t, "Height"), - ConsensusAddress: rapid.String().Draw(t, "ConesnsuAddress"), - Deposit: rapid.Uint().Draw(t, "Deposit"), - Status: rapid.String().Draw(t, "Status"), - } - }) -} - func GetTextProposalGen() *rapid.Generator[TextProposal] { return rapid.Custom(func(t *rapid.T) TextProposal { return TextProposal{ diff --git a/tests/e2e/steps.go b/tests/e2e/steps.go index 21db55e3b7..783d976a3a 100644 --- a/tests/e2e/steps.go +++ b/tests/e2e/steps.go @@ -23,12 +23,10 @@ var happyPathSteps = concatSteps( stepsDowntimeWithOptOut("consu"), stepsRedelegate("consu"), stepsDowntime("consu"), - stepsRejectEquivocationProposal("consu", 2), // prop to tombstone bob is rejected - stepsDoubleSignOnProviderAndConsumer("consu"), // carol double signs on provider, bob double signs on consumer - stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted + stepsDoubleSignOnProvider("consu"), // carol double signs on provider stepsStartRelayer(), - stepsConsumerRemovalPropNotPassing("consu", 3), // submit removal prop but vote no on it - chain should stay - stepsStopChain("consu", 4), // stop chain + stepsConsumerRemovalPropNotPassing("consu", 2), // submit removal prop but vote no on it - chain should stay + stepsStopChain("consu", 3), // stop chain ) var shortHappyPathSteps = concatSteps( @@ -37,12 +35,10 @@ var shortHappyPathSteps = concatSteps( stepsUnbond("consu"), stepsRedelegateShort("consu"), stepsDowntime("consu"), - stepsRejectEquivocationProposal("consu", 2), // prop to tombstone bob is rejected - stepsDoubleSignOnProviderAndConsumer("consu"), // carol double signs on provider, bob double signs on consumer - stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted + stepsDoubleSignOnProvider("consu"), // carol double signs on provider stepsStartRelayer(), - stepsConsumerRemovalPropNotPassing("consu", 3), // submit removal prop but vote no on it - chain should stay - stepsStopChain("consu", 4), // stop chain + stepsConsumerRemovalPropNotPassing("consu", 2), // submit removal prop but vote no on it - chain should stay + stepsStopChain("consu", 3), // stop chain ) var lightClientAttackSteps = concatSteps( @@ -51,9 +47,7 @@ var lightClientAttackSteps = concatSteps( stepsUnbond("consu"), stepsRedelegateShort("consu"), stepsDowntime("consu"), - stepsRejectEquivocationProposal("consu", 2), // prop to tombstone bob is rejected stepsLightClientAttackOnProviderAndConsumer("consu"), // carol double signs on provider, bob double signs on consumer - stepsSubmitEquivocationProposal("consu", 2), // now prop to tombstone bob is submitted and accepted stepsStartRelayer(), stepsConsumerRemovalPropNotPassing("consu", 3), // submit removal prop but vote no on it - chain should stay stepsStopChain("consu", 4), // stop chain @@ -106,3 +100,17 @@ var changeoverSteps = concatSteps( stepsPostChangeoverDelegate("sover"), ) + +var consumerMisbehaviourSteps = concatSteps( + // start provider and consumer chain + stepsStartChainsWithSoftOptOut("consu"), + // make a consumer validator to misbehave and get jailed + stepsCauseConsumerMisbehaviour("consu"), +) + +var consumerDoubleSignSteps = concatSteps( + // start provider and consumer chain + stepsStartChains([]string{"consu"}, false), + // make a consumer validator double sign and get jailed + stepsCauseDoubleSignOnConsumer("consu", "provi"), +) diff --git a/tests/e2e/steps_consumer_misbehaviour.go b/tests/e2e/steps_consumer_misbehaviour.go new file mode 100644 index 0000000000..01d05f658d --- /dev/null +++ b/tests/e2e/steps_consumer_misbehaviour.go @@ -0,0 +1,287 @@ +package main + +import ( + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" +) + +// starts a provider chain and a consumer chain with two validators, +// where the voting power is distributed in order that the smallest validator +// can soft opt-out of validating the consumer chain. +func stepsStartChainsWithSoftOptOut(consumerName string) []Step { + s := []Step{ + { + // Create a provider chain with two validators, where one validator holds 96% of the voting power + // and the other validator holds 4% of the voting power. + Action: StartChainAction{ + Chain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 500000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 20000000, Allocation: 10000000000}, + }, + }, + State: State{ + ChainID("provi"): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9500000000, + ValidatorID("bob"): 9980000000, + }, + }, + }, + }, + { + Action: submitConsumerAdditionProposalAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + Deposit: 10000001, + ConsumerChain: ChainID(consumerName), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + }, + State: State{ + ChainID("provi"): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9489999999, + ValidatorID("bob"): 9980000000, + }, + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID(consumerName), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + }, + }, + }, + }, + }, + // add a consumer key before the chain starts + // the key will be present in consumer genesis initial_val_set + { + Action: assignConsumerPubKeyAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("alice"), + ConsumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="}`, + // consumer chain has not started + // we don't need to reconfigure the node + // since it will start with consumer key + ReconfigureNode: false, + }, + State: State{ + ChainID(consumerName): ChainState{ + AssignedKeys: &map[ValidatorID]string{ + ValidatorID("alice"): "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", + }, + ProviderKeys: &map[ValidatorID]string{ + ValidatorID("alice"): "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + }, + }, + }, + }, + { + Action: voteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, + Vote: []string{"yes", "yes"}, + PropNumber: 1, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID(consumerName), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_PASSED", + }, + }, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9500000000, + ValidatorID("bob"): 9980000000, + }, + }, + }, + }, + { + // start a consumer chain using a single big validator knowing that it holds more than 2/3 of the voting power + // and that the other validators hold less than 5% so they won't get jailed thanks to the sof opt-out mechanism. + Action: startConsumerChainAction{ + ConsumerChain: ChainID(consumerName), + ProviderChain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 500000000, Allocation: 10000000000}, + }, + // For consumers that're launching with the provider being on an earlier version + // of ICS before the soft opt-out threshold was introduced, we need to set the + // soft opt-out threshold to 0.05 in the consumer genesis to ensure that the + // consumer binary doesn't panic. Sdk requires that all params are set to valid + // values from the genesis file. + GenesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", + }, + State: State{ + ChainID("provi"): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9500000000, + ValidatorID("bob"): 9980000000, + }, + }, + ChainID(consumerName): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 10000000000, + }, + }, + }, + }, + { + Action: addIbcConnectionAction{ + ChainA: ChainID(consumerName), + ChainB: ChainID("provi"), + ClientA: 0, + ClientB: 0, + }, + State: State{}, + }, + { + Action: addIbcChannelAction{ + ChainA: ChainID(consumerName), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "consumer", // TODO: check port mapping + PortB: "provider", + Order: "ordered", + }, + State: State{}, + }, + // delegate some token and relay the resulting VSC packets + // in oder to initiates the CCV channel + { + Action: delegateTokensAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + To: ValidatorID("alice"), + Amount: 11000000, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 20, + }, + }, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 500, + ValidatorID("bob"): 20, + }, + }, + }, + }, + { + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 20, + }, + }, + }, + }, + } + + return s +} + +// stepsCauseConsumerMisbehaviour causes a ICS misbehaviour by forking a consumer chain. +func stepsCauseConsumerMisbehaviour(consumerName string) []Step { + consumerClientID := "07-tendermint-0" + forkRelayerConfig := "/root/.hermes/config_fork.toml" + return []Step{ + { + // fork the consumer chain by cloning the alice validator node + Action: forkConsumerChainAction{ + ConsumerChain: ChainID(consumerName), + ProviderChain: ChainID("provi"), + Validator: ValidatorID("alice"), + RelayerConfig: forkRelayerConfig, + }, + State: State{}, + }, + // start relayer to detect IBC misbehaviour + { + Action: startRelayerAction{}, + State: State{}, + }, + // run Hermes relayer instance to detect the ICS misbehaviour + // and jail alice on the provider + { + Action: startConsumerEvidenceDetectorAction{ + Chain: ChainID(consumerName), + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 20, + }, + StakedTokens: &map[ValidatorID]uint{ + ValidatorID("alice"): 511000000, + ValidatorID("bob"): 20000000, + }, + }, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 20, + }, + }, + }, + }, + { + // update the fork consumer client to create a light client attack + // which should trigger a ICS misbehaviour message + Action: updateLightClientAction{ + Chain: ChainID(consumerName), + ClientID: consumerClientID, + HostChain: ChainID("provi"), + RelayerConfig: forkRelayerConfig, // this relayer config uses the "forked" consumer + }, + State: State{ + ChainID("provi"): ChainState{ + // alice should be jailed on the provider + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 0, + ValidatorID("bob"): 20, + }, + // "alice" should be slashed on the provider, hence representative + // power is 511000000 - 0.05 * 511000000 = 485450000 + StakedTokens: &map[ValidatorID]uint{ + ValidatorID("alice"): 485450000, + ValidatorID("bob"): 20000000, + }, + // The consumer light client should be frozen on the provider + ClientsFrozenHeights: &map[string]clienttypes.Height{ + consumerClientID: { + RevisionNumber: 0, + RevisionHeight: 1, + }, + }, + }, + ChainID(consumerName): ChainState{ + // consumer should not have learned the jailing of alice + // since its light client is frozen on the provider + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 20, + }, + }, + }, + }, + } +} diff --git a/tests/e2e/steps_double_sign.go b/tests/e2e/steps_double_sign.go index 4d69569b29..8039098f36 100644 --- a/tests/e2e/steps_double_sign.go +++ b/tests/e2e/steps_double_sign.go @@ -1,7 +1,7 @@ package main -// Steps that make carol double sign on the provider, and bob double sign on a single consumer -func stepsDoubleSignOnProviderAndConsumer(consumerName string) []Step { +// Steps that make carol double sign on the provider, and this power change propagates to consumer chain `consumerName` +func stepsDoubleSignOnProvider(consumerName string) []Step { return []Step{ { // provider double sign @@ -52,76 +52,95 @@ func stepsDoubleSignOnProviderAndConsumer(consumerName string) []Step { }, }, }, + } +} + +// Steps that make bob double sign on the consumer +func stepsCauseDoubleSignOnConsumer(consumerName, providerName string) []Step { + return []Step{ { - // consumer double sign - // provider will only log the double sign slash - // stepsSubmitEquivocationProposal will cause the double sign slash to be executed Action: doublesignSlashAction{ - Chain: ChainID("consu"), + Chain: ChainID(consumerName), Validator: ValidatorID("bob"), }, State: State{ - ChainID("provi"): ChainState{ + ChainID(providerName): ChainState{ ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, + ValidatorID("alice"): 500, ValidatorID("bob"): 500, - ValidatorID("carol"): 0, + ValidatorID("carol"): 500, + }, + StakedTokens: &map[ValidatorID]uint{ + ValidatorID("alice"): 500000000, + ValidatorID("bob"): 500000000, + ValidatorID("carol"): 500000000, }, }, ChainID(consumerName): ChainState{ ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, + ValidatorID("alice"): 500, ValidatorID("bob"): 500, - ValidatorID("carol"): 0, + ValidatorID("carol"): 500, }, }, }, }, + // detect the double voting infraction + // and jail and slashing of bob on the provider { - Action: relayPacketsAction{ - ChainA: ChainID("provi"), - ChainB: ChainID(consumerName), - Port: "provider", - Channel: 0, + Action: startConsumerEvidenceDetectorAction{ + Chain: ChainID(consumerName), }, State: State{ - ChainID("provi"): ChainState{ + ChainID(providerName): ChainState{ ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 500, // not tombstoned - ValidatorID("carol"): 0, + ValidatorID("alice"): 500, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, + }, + // "bob" gets slashed on the provider chain, hence representative + // power is 500000000 - 0.05 * 500000000 = 475000000 + StakedTokens: &map[ValidatorID]uint{ + ValidatorID("alice"): 500000000, + ValidatorID("bob"): 475000000, + ValidatorID("carol"): 500000000, }, }, ChainID(consumerName): ChainState{ ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 500, // not tombstoned - ValidatorID("carol"): 0, + ValidatorID("alice"): 500, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, + // consumer learns about the jailing { - // consumer learns about the double sign Action: relayPacketsAction{ - ChainA: ChainID("provi"), + ChainA: ChainID(providerName), ChainB: ChainID(consumerName), Port: "provider", Channel: 0, }, State: State{ - ChainID("provi"): ChainState{ + ChainID(providerName): ChainState{ ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 500, - ValidatorID("carol"): 0, + ValidatorID("alice"): 500, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, + }, + StakedTokens: &map[ValidatorID]uint{ + ValidatorID("alice"): 500000000, + ValidatorID("bob"): 475000000, + ValidatorID("carol"): 500000000, }, }, ChainID(consumerName): ChainState{ ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 500, // not tombstoned - ValidatorID("carol"): 0, + ValidatorID("alice"): 500, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, }, }, }, diff --git a/tests/e2e/steps_light_client_attack.go b/tests/e2e/steps_light_client_attack.go index 284b3fafea..1d9f484b5c 100644 --- a/tests/e2e/steps_light_client_attack.go +++ b/tests/e2e/steps_light_client_attack.go @@ -55,7 +55,6 @@ func stepsLightClientAttackOnProviderAndConsumer(consumerName string) []Step { { // Consumer double sign // Provider will only log the double sign slash - // stepsSubmitEquivocationProposal will cause the double sign slash to be executed Action: lightClientEquivocationAttackAction{ Chain: ChainID(consumerName), Validator: ValidatorID("bob"), diff --git a/tests/e2e/steps_submit_equivocation_proposal.go b/tests/e2e/steps_submit_equivocation_proposal.go deleted file mode 100644 index 243c01f04d..0000000000 --- a/tests/e2e/steps_submit_equivocation_proposal.go +++ /dev/null @@ -1,150 +0,0 @@ -package main - -import "time" - -// submits an invalid equivocation proposal which should be rejected -func stepsRejectEquivocationProposal(consumerName string, propNumber uint) []Step { - return []Step{ - { - // bob submits a proposal to slash himself - Action: submitEquivocationProposalAction{ - Chain: ChainID("consu"), - From: ValidatorID("bob"), - Deposit: 10000001, - Height: 10, - Time: time.Now(), - Power: 500, - Validator: ValidatorID("bob"), - }, - State: State{ - ChainID("provi"): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 500, - ValidatorID("carol"): 495, - }, - ValBalances: &map[ValidatorID]uint{ - ValidatorID("bob"): 9500000000, - }, - Proposals: &map[uint]Proposal{ - // proposal does not exist - propNumber: TextProposal{}, - }, - }, - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 500, - ValidatorID("carol"): 495, - }, - }, - }, - }, - } -} - -// submits an equivocation proposal, votes on it, and tomstones the equivocating validator -func stepsSubmitEquivocationProposal(consumerName string, propNumber uint) []Step { - s := []Step{ - { - // bob submits a proposal to slash himself - Action: submitEquivocationProposalAction{ - Chain: ChainID("consu"), - From: ValidatorID("bob"), - Deposit: 10000001, - Height: 10, - Time: time.Now(), // not sure what time in equivocations means - Power: 500, - Validator: ValidatorID("bob"), - }, - State: State{ - ChainID("provi"): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 500, - ValidatorID("carol"): 0, - }, - ValBalances: &map[ValidatorID]uint{ - ValidatorID("bob"): 9489999999, - }, - Proposals: &map[uint]Proposal{ - propNumber: EquivocationProposal{ - Deposit: 10000001, - Status: "PROPOSAL_STATUS_VOTING_PERIOD", - ConsensusAddress: "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - Power: 500, - Height: 10, - }, - }, - }, - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 500, - ValidatorID("carol"): 0, - }, - }, - }, - }, - { - Action: voteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, - Vote: []string{"yes", "yes", "yes"}, - PropNumber: propNumber, - }, - State: State{ - ChainID("provi"): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 0, // bob is tombstoned after proposal passes - ValidatorID("carol"): 0, - }, - Proposals: &map[uint]Proposal{ - propNumber: EquivocationProposal{ - Deposit: 10000001, - Status: "PROPOSAL_STATUS_PASSED", - ConsensusAddress: "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - Power: 500, - Height: 10, - }, - }, - }, - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 500, // slash not reflected in consumer chain - ValidatorID("carol"): 0, - }, - }, - }, - }, - { - // relay power change to consumer1 - Action: relayPacketsAction{ - ChainA: ChainID("provi"), - ChainB: ChainID(consumerName), - Port: "provider", - Channel: 0, - }, - State: State{ - ChainID("provi"): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 0, - ValidatorID("carol"): 0, - }, - }, - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 0, // slash relayed to consumer chain - ValidatorID("carol"): 0, - }, - }, - }, - }, - } - - return s -} diff --git a/tests/e2e/testnet-scripts/fork-consumer.sh b/tests/e2e/testnet-scripts/fork-consumer.sh new file mode 100644 index 0000000000..7c12438b71 --- /dev/null +++ b/tests/e2e/testnet-scripts/fork-consumer.sh @@ -0,0 +1,114 @@ +#!/bin/bash +set -eux + +# The gaiad binary +BIN=$1 + +# the validator ID used to perform the fork +VAL_ID=$2 + +# The consumer chain ID +CHAIN_ID=$3 + +# chain's IP address prefix; $PROV_CHAIN_PREFIX, $CONS_CHAIN_PREFIX... +# see chain config for details +CONS_CHAIN_PREFIX=$4 + +PROV_CHAIN_PREFIX=$5 + +VAL_MNEMONIC=$6 + +FORK_HERMES_CONFIG=$7 + +FORK_NODE_DIR=/$CHAIN_ID/validatorfork + +# create directory for forking/double-signing node +mkdir $FORK_NODE_DIR +cp -r /$CHAIN_ID/validator$VAL_ID/* $FORK_NODE_DIR + +# remove persistent peers +rm -f $FORK_NODE_DIR/addrbook.json + +# add fork to hermes relayer +tee $FORK_HERMES_CONFIG< mnemonic.txt + +# Start the validator forking the consumer chain +# using the sybil IP allocation +ip netns exec $CHAIN_ID-sybil $BIN \ + --home $FORK_NODE_DIR \ + --address tcp://$CONS_CHAIN_PREFIX.252:26655 \ + --rpc.laddr tcp://$CONS_CHAIN_PREFIX.252:26658 \ + --grpc.address $CONS_CHAIN_PREFIX.252:9091 \ + --log_level info \ + --p2p.laddr tcp://$CONS_CHAIN_PREFIX.252:26656 \ + --grpc-web.enable=false start &> /consu/validatorfork/logs & + diff --git a/tests/e2e/testnet-scripts/hermes-config.toml b/tests/e2e/testnet-scripts/hermes-config.toml index eb8154d95b..89c1f0a0bb 100644 --- a/tests/e2e/testnet-scripts/hermes-config.toml +++ b/tests/e2e/testnet-scripts/hermes-config.toml @@ -1,2 +1,18 @@ [global] - log_level = "info" \ No newline at end of file +log_level = "debug" + +[mode] + +[mode.clients] +enabled = true +refresh = true +misbehaviour = true + +[mode.connections] +enabled = false + +[mode.channels] +enabled = false + +[mode.packets] +enabled = true \ No newline at end of file diff --git a/tests/e2e/testnet-scripts/start-chain.sh b/tests/e2e/testnet-scripts/start-chain.sh index 88c8455e51..e3e6b6054f 100644 --- a/tests/e2e/testnet-scripts/start-chain.sh +++ b/tests/e2e/testnet-scripts/start-chain.sh @@ -257,8 +257,12 @@ do fi done - # Remove leading comma and concat to flag - PERSISTENT_PEERS="--p2p.persistent_peers ${PERSISTENT_PEERS:1}" + + if [ "$PERSISTENT_PEERS" != "" ]; then + # Remove leading comma and concat to flag + PERSISTENT_PEERS="--p2p.persistent_peers ${PERSISTENT_PEERS:1}" + fi + ARGS="$GAIA_HOME $LISTEN_ADDRESS $RPC_ADDRESS $GRPC_ADDRESS $LOG_LEVEL $P2P_ADDRESS $ENABLE_WEBGRPC $PERSISTENT_PEERS" if [[ "$USE_COMETMOCK" == "true" ]]; then diff --git a/tests/e2e/trace_handlers_test.go b/tests/e2e/trace_handlers_test.go index 725496c51f..024daae450 100644 --- a/tests/e2e/trace_handlers_test.go +++ b/tests/e2e/trace_handlers_test.go @@ -82,6 +82,8 @@ func TestWriteExamples(t *testing.T) { "shorthappy": {shortHappyPathSteps}, "democracyRewardsSteps": {democracyRewardsSteps}, "changeover": {changeoverSteps}, + "consumer-misbehaviour": {consumerMisbehaviourSteps}, + "consumer-double-sign": {consumerDoubleSignSteps}, } dir := "tracehandler_testdata" @@ -131,7 +133,7 @@ func TestMarshalAndUnmarshalChainState(t *testing.T) { }, }, }}, - "consuemr removal proposal": {ChainState{ + "consumer removal proposal": {ChainState{ Proposals: &map[uint]Proposal{ 5: ConsumerRemovalProposal{ Deposit: 10000001, @@ -159,25 +161,6 @@ func TestMarshalAndUnmarshalChainState(t *testing.T) { 10: TextProposal{}, }, }}, - "equivocation-proposal": {ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 509, - ValidatorID("bob"): 500, - ValidatorID("carol"): 0, - }, - ValBalances: &map[ValidatorID]uint{ - ValidatorID("bob"): 9489999999, - }, - Proposals: &map[uint]Proposal{ - 5: EquivocationProposal{ - Deposit: 10000001, - Status: "PROPOSAL_STATUS_VOTING_PERIOD", - ConsensusAddress: "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - Power: 500, - Height: 10, - }, - }, - }}, } for name, tc := range tests { diff --git a/tests/e2e/tracehandler_testdata/changeover.json b/tests/e2e/tracehandler_testdata/changeover.json index d973b46fe4..d569e066a3 100644 --- a/tests/e2e/tracehandler_testdata/changeover.json +++ b/tests/e2e/tracehandler_testdata/changeover.json @@ -27,6 +27,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -56,6 +57,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -82,7 +84,7 @@ } ], "GenesisChanges": "", - "SkipGentx": false + "IsConsumer": false }, "State": { "provi": { @@ -101,6 +103,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -147,6 +150,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -188,6 +192,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -242,6 +247,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -291,6 +297,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -349,6 +356,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "sover": { @@ -367,6 +375,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -417,6 +426,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -446,6 +456,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "sover": { @@ -464,6 +475,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -493,6 +505,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -520,6 +533,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -549,6 +563,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "sover": { @@ -567,6 +582,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -596,6 +612,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } diff --git a/tests/e2e/tracehandler_testdata/consumer-double-sign.json b/tests/e2e/tracehandler_testdata/consumer-double-sign.json new file mode 100644 index 0000000000..d6d1fc7086 --- /dev/null +++ b/tests/e2e/tracehandler_testdata/consumer-double-sign.json @@ -0,0 +1,452 @@ +[ + { + "ActionType": "main.StartChainAction", + "Action": { + "Chain": "provi", + "Validators": [ + { + "Id": "bob", + "Allocation": 10000000000, + "Stake": 500000000 + }, + { + "Id": "alice", + "Allocation": 10000000000, + "Stake": 500000000 + }, + { + "Id": "carol", + "Allocation": 10000000000, + "Stake": 500000000 + } + ], + "GenesisChanges": "", + "IsConsumer": false + }, + "State": { + "provi": { + "ValBalances": { + "alice": 9500000000, + "bob": 9500000000, + "carol": 9500000000 + }, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.submitConsumerAdditionProposalAction", + "Action": { + "PreCCV": false, + "Chain": "provi", + "From": "alice", + "Deposit": 10000001, + "ConsumerChain": "consu", + "SpawnTime": 0, + "InitialHeight": { + "revision_height": 1 + }, + "DistributionChannel": "" + }, + "State": { + "provi": { + "ValBalances": { + "alice": 9489999999, + "bob": 9500000000 + }, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": { + "1": { + "RawProposal": { + "Deposit": 10000001, + "Chain": "consu", + "SpawnTime": 0, + "InitialHeight": { + "revision_height": 1 + }, + "Status": "PROPOSAL_STATUS_VOTING_PERIOD" + }, + "Type": "main.ConsumerAdditionProposal" + } + } + } + } + }, + { + "ActionType": "main.assignConsumerPubKeyAction", + "Action": { + "Chain": "consu", + "Validator": "carol", + "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}", + "ReconfigureNode": false, + "ExpectError": false, + "ExpectedError": "" + }, + "State": { + "consu": { + "ValBalances": null, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": { + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + }, + "ProviderKeys": { + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + }, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.assignConsumerPubKeyAction", + "Action": { + "Chain": "consu", + "Validator": "carol", + "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}", + "ReconfigureNode": false, + "ExpectError": true, + "ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator" + }, + "State": {} + }, + { + "ActionType": "main.assignConsumerPubKeyAction", + "Action": { + "Chain": "consu", + "Validator": "bob", + "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}", + "ReconfigureNode": false, + "ExpectError": true, + "ExpectedError": "a validator has assigned the consumer key already: consumer key is already in use by a validator" + }, + "State": { + "consu": { + "ValBalances": null, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": { + "bob": "", + "carol": "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk" + }, + "ProviderKeys": { + "carol": "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6" + }, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.voteGovProposalAction", + "Action": { + "Chain": "provi", + "From": [ + "alice", + "bob", + "carol" + ], + "Vote": [ + "yes", + "yes", + "yes" + ], + "PropNumber": 1 + }, + "State": { + "provi": { + "ValBalances": { + "alice": 9500000000, + "bob": 9500000000 + }, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": { + "1": { + "RawProposal": { + "Deposit": 10000001, + "Chain": "consu", + "SpawnTime": 0, + "InitialHeight": { + "revision_height": 1 + }, + "Status": "PROPOSAL_STATUS_PASSED" + }, + "Type": "main.ConsumerAdditionProposal" + } + } + } + } + }, + { + "ActionType": "main.startConsumerChainAction", + "Action": { + "ConsumerChain": "consu", + "ProviderChain": "provi", + "Validators": [ + { + "Id": "bob", + "Allocation": 10000000000, + "Stake": 500000000 + }, + { + "Id": "alice", + "Allocation": 10000000000, + "Stake": 500000000 + }, + { + "Id": "carol", + "Allocation": 10000000000, + "Stake": 500000000 + } + ], + "GenesisChanges": ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"" + }, + "State": { + "consu": { + "ValBalances": { + "alice": 10000000000, + "bob": 10000000000, + "carol": 10000000000 + }, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + }, + "provi": { + "ValBalances": { + "alice": 9500000000, + "bob": 9500000000, + "carol": 9500000000 + }, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.addIbcConnectionAction", + "Action": { + "ChainA": "consu", + "ChainB": "provi", + "ClientA": 0, + "ClientB": 0 + }, + "State": {} + }, + { + "ActionType": "main.addIbcChannelAction", + "Action": { + "ChainA": "consu", + "ChainB": "provi", + "ConnectionA": 0, + "PortA": "consumer", + "PortB": "provider", + "Order": "ordered", + "Version": "" + }, + "State": {} + }, + { + "ActionType": "main.doublesignSlashAction", + "Action": { + "Validator": "bob", + "Chain": "consu" + }, + "State": { + "consu": { + "ValBalances": null, + "ValPowers": { + "alice": 500, + "bob": 500, + "carol": 500 + }, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + }, + "provi": { + "ValBalances": null, + "ValPowers": { + "alice": 500, + "bob": 500, + "carol": 500 + }, + "StakedTokens": { + "alice": 500000000, + "bob": 500000000, + "carol": 500000000 + }, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.startConsumerEvidenceDetectorAction", + "Action": { + "Chain": "consu" + }, + "State": { + "consu": { + "ValBalances": null, + "ValPowers": { + "alice": 500, + "bob": 500, + "carol": 500 + }, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + }, + "provi": { + "ValBalances": null, + "ValPowers": { + "alice": 500, + "bob": 0, + "carol": 500 + }, + "StakedTokens": { + "alice": 500000000, + "bob": 475000000, + "carol": 500000000 + }, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.relayPacketsAction", + "Action": { + "ChainA": "provi", + "ChainB": "consu", + "Port": "provider", + "Channel": 0 + }, + "State": { + "consu": { + "ValBalances": null, + "ValPowers": { + "alice": 500, + "bob": 0, + "carol": 500 + }, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + }, + "provi": { + "ValBalances": null, + "ValPowers": { + "alice": 500, + "bob": 0, + "carol": 500 + }, + "StakedTokens": { + "alice": 500000000, + "bob": 475000000, + "carol": 500000000 + }, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + } +] \ No newline at end of file diff --git a/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json b/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json new file mode 100644 index 0000000000..028637934f --- /dev/null +++ b/tests/e2e/tracehandler_testdata/consumer-misbehaviour.json @@ -0,0 +1,424 @@ +[ + { + "ActionType": "main.StartChainAction", + "Action": { + "Chain": "provi", + "Validators": [ + { + "Id": "alice", + "Allocation": 10000000000, + "Stake": 500000000 + }, + { + "Id": "bob", + "Allocation": 10000000000, + "Stake": 20000000 + } + ], + "GenesisChanges": "", + "IsConsumer": false + }, + "State": { + "provi": { + "ValBalances": { + "alice": 9500000000, + "bob": 9980000000 + }, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.submitConsumerAdditionProposalAction", + "Action": { + "PreCCV": false, + "Chain": "provi", + "From": "alice", + "Deposit": 10000001, + "ConsumerChain": "consu", + "SpawnTime": 0, + "InitialHeight": { + "revision_height": 1 + }, + "DistributionChannel": "" + }, + "State": { + "provi": { + "ValBalances": { + "alice": 9489999999, + "bob": 9980000000 + }, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": { + "1": { + "RawProposal": { + "Deposit": 10000001, + "Chain": "consu", + "SpawnTime": 0, + "InitialHeight": { + "revision_height": 1 + }, + "Status": "PROPOSAL_STATUS_VOTING_PERIOD" + }, + "Type": "main.ConsumerAdditionProposal" + } + } + } + } + }, + { + "ActionType": "main.assignConsumerPubKeyAction", + "Action": { + "Chain": "consu", + "Validator": "alice", + "ConsumerPubkey": "{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes=\"}", + "ReconfigureNode": false, + "ExpectError": false, + "ExpectedError": "" + }, + "State": { + "consu": { + "ValBalances": null, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": { + "alice": "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe" + }, + "ProviderKeys": { + "alice": "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq" + }, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.voteGovProposalAction", + "Action": { + "Chain": "provi", + "From": [ + "alice", + "bob" + ], + "Vote": [ + "yes", + "yes" + ], + "PropNumber": 1 + }, + "State": { + "provi": { + "ValBalances": { + "alice": 9500000000, + "bob": 9980000000 + }, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": { + "1": { + "RawProposal": { + "Deposit": 10000001, + "Chain": "consu", + "SpawnTime": 0, + "InitialHeight": { + "revision_height": 1 + }, + "Status": "PROPOSAL_STATUS_PASSED" + }, + "Type": "main.ConsumerAdditionProposal" + } + } + } + } + }, + { + "ActionType": "main.startConsumerChainAction", + "Action": { + "ConsumerChain": "consu", + "ProviderChain": "provi", + "Validators": [ + { + "Id": "alice", + "Allocation": 10000000000, + "Stake": 500000000 + } + ], + "GenesisChanges": ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"" + }, + "State": { + "consu": { + "ValBalances": { + "alice": 10000000000 + }, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + }, + "provi": { + "ValBalances": { + "alice": 9500000000, + "bob": 9980000000 + }, + "ValPowers": null, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.addIbcConnectionAction", + "Action": { + "ChainA": "consu", + "ChainB": "provi", + "ClientA": 0, + "ClientB": 0 + }, + "State": {} + }, + { + "ActionType": "main.addIbcChannelAction", + "Action": { + "ChainA": "consu", + "ChainB": "provi", + "ConnectionA": 0, + "PortA": "consumer", + "PortB": "provider", + "Order": "ordered", + "Version": "" + }, + "State": {} + }, + { + "ActionType": "main.delegateTokensAction", + "Action": { + "Chain": "provi", + "From": "alice", + "To": "alice", + "Amount": 11000000 + }, + "State": { + "consu": { + "ValBalances": null, + "ValPowers": { + "alice": 500, + "bob": 20 + }, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + }, + "provi": { + "ValBalances": null, + "ValPowers": { + "alice": 511, + "bob": 20 + }, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.relayPacketsAction", + "Action": { + "ChainA": "provi", + "ChainB": "consu", + "Port": "provider", + "Channel": 0 + }, + "State": { + "consu": { + "ValBalances": null, + "ValPowers": { + "alice": 511, + "bob": 20 + }, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.forkConsumerChainAction", + "Action": { + "ConsumerChain": "consu", + "ProviderChain": "provi", + "Validator": "alice", + "RelayerConfig": "/root/.hermes/config_fork.toml" + }, + "State": {} + }, + { + "ActionType": "main.startRelayerAction", + "Action": {}, + "State": {} + }, + { + "ActionType": "main.startConsumerEvidenceDetectorAction", + "Action": { + "Chain": "consu" + }, + "State": { + "consu": { + "ValBalances": null, + "ValPowers": { + "alice": 511, + "bob": 20 + }, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + }, + "provi": { + "ValBalances": null, + "ValPowers": { + "alice": 511, + "bob": 20 + }, + "StakedTokens": { + "alice": 511000000, + "bob": 20000000 + }, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + } + } + }, + { + "ActionType": "main.updateLightClientAction", + "Action": { + "Chain": "consu", + "HostChain": "provi", + "RelayerConfig": "/root/.hermes/config_fork.toml", + "ClientID": "07-tendermint-0" + }, + "State": { + "consu": { + "ValBalances": null, + "ValPowers": { + "alice": 511, + "bob": 20 + }, + "StakedTokens": null, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, + "Proposals": null + }, + "provi": { + "ValBalances": null, + "ValPowers": { + "alice": 0, + "bob": 20 + }, + "StakedTokens": { + "alice": 485450000, + "bob": 20000000 + }, + "Params": null, + "Rewards": null, + "ConsumerChains": null, + "AssignedKeys": null, + "ProviderKeys": null, + "ConsumerPendingPacketQueueSize": null, + "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": { + "07-tendermint-0": { + "revision_height": 1 + } + }, + "Proposals": null + } + } + } +] \ No newline at end of file diff --git a/tests/e2e/tracehandler_testdata/democracy.json b/tests/e2e/tracehandler_testdata/democracy.json index 12993e4a38..8259eafb63 100644 --- a/tests/e2e/tracehandler_testdata/democracy.json +++ b/tests/e2e/tracehandler_testdata/democracy.json @@ -21,7 +21,7 @@ } ], "GenesisChanges": "", - "SkipGentx": false + "IsConsumer": false }, "State": { "provi": { @@ -40,6 +40,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -74,6 +75,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -118,6 +120,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -162,6 +165,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -198,6 +202,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -256,6 +261,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -274,6 +280,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -340,6 +347,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -358,6 +366,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -386,6 +395,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -415,6 +425,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -443,6 +454,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -484,6 +496,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -524,6 +537,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -546,7 +560,13 @@ }, "ValPowers": null, "StakedTokens": null, - "Params": null, + "Params": [ + { + "Subspace": "transfer", + "Key": "SendEnabled", + "Value": "false" + } + ], "Rewards": null, "ConsumerChains": null, "AssignedKeys": null, @@ -554,6 +574,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -605,6 +626,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -649,6 +671,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": [], + "ClientsFrozenHeights": null, "Proposals": null } } @@ -673,6 +696,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": [], + "ClientsFrozenHeights": null, "Proposals": null } } @@ -708,6 +732,7 @@ "RegisteredConsumerRewardDenoms": [ "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9" ], + "ClientsFrozenHeights": null, "Proposals": null } } @@ -741,6 +766,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -768,6 +794,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -786,6 +813,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -815,6 +843,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -833,6 +862,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -862,6 +892,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -889,6 +920,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -907,6 +939,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -939,6 +972,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } diff --git a/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json b/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json index 0251309ef2..5ddb802437 100644 --- a/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json +++ b/tests/e2e/tracehandler_testdata/democracyRewardsSteps.json @@ -21,7 +21,7 @@ } ], "GenesisChanges": "", - "SkipGentx": false + "IsConsumer": false }, "State": { "provi": { @@ -40,6 +40,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -74,6 +75,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -118,6 +120,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -162,6 +165,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -198,6 +202,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -256,6 +261,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -274,6 +280,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -340,6 +347,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -358,6 +366,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -386,6 +395,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -415,6 +425,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -443,6 +454,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -484,6 +496,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -524,6 +537,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -560,6 +574,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -611,6 +626,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -655,6 +671,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": [], + "ClientsFrozenHeights": null, "Proposals": null } } @@ -679,6 +696,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": [], + "ClientsFrozenHeights": null, "Proposals": null } } @@ -714,6 +732,7 @@ "RegisteredConsumerRewardDenoms": [ "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9" ], + "ClientsFrozenHeights": null, "Proposals": null } } @@ -747,6 +766,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -774,6 +794,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -792,6 +813,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -821,6 +843,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -839,6 +862,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -868,6 +892,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -895,6 +920,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -913,6 +939,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -945,6 +972,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } diff --git a/tests/e2e/tracehandler_testdata/happyPath.json b/tests/e2e/tracehandler_testdata/happyPath.json index 1f5be74833..f4b7200352 100644 --- a/tests/e2e/tracehandler_testdata/happyPath.json +++ b/tests/e2e/tracehandler_testdata/happyPath.json @@ -21,7 +21,7 @@ } ], "GenesisChanges": "", - "SkipGentx": false + "IsConsumer": false }, "State": { "provi": { @@ -40,6 +40,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -74,6 +75,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -118,6 +120,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -162,6 +165,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -198,6 +202,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -256,6 +261,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -274,6 +280,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -326,6 +333,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -344,6 +352,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -372,6 +381,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -401,6 +411,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -429,6 +440,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -466,6 +478,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -484,6 +497,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -519,6 +533,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -537,6 +552,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -566,6 +582,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -584,6 +601,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -613,6 +631,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -642,6 +661,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -660,6 +680,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -689,6 +710,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -718,6 +740,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -736,6 +759,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -765,6 +789,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -795,6 +820,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -813,6 +839,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -842,6 +869,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -869,6 +897,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -887,6 +916,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -916,6 +946,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -934,6 +965,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -964,6 +996,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -982,6 +1015,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1011,6 +1045,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1038,6 +1073,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1056,6 +1092,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1085,6 +1122,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1103,6 +1141,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1132,6 +1171,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1159,6 +1199,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1177,6 +1218,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1206,6 +1248,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1233,6 +1276,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1251,6 +1295,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1280,6 +1325,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1307,6 +1353,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1325,6 +1372,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1354,72 +1402,11 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } }, - { - "ActionType": "main.submitEquivocationProposalAction", - "Action": { - "Chain": "consu", - "Height": 10, - "Time": "2023-10-04T12:14:14.883367+02:00", - "Power": 500, - "Validator": "bob", - "Deposit": 10000001, - "From": "bob" - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 495 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": { - "bob": 9500000000 - }, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 495 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": { - "2": { - "RawProposal": { - "Title": "", - "Description": "", - "Deposit": 0, - "Status": "" - }, - "Type": "main.TextProposal" - } - } - } - } - }, { "ActionType": "main.doublesignSlashAction", "Action": { @@ -1443,6 +1430,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1461,6 +1449,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1490,6 +1479,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1508,321 +1498,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.doublesignSlashAction", - "Action": { - "Validator": "bob", - "Chain": "consu" - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.relayPacketsAction", - "Action": { - "ChainA": "provi", - "ChainB": "consu", - "Port": "provider", - "Channel": 0 - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.relayPacketsAction", - "Action": { - "ChainA": "provi", - "ChainB": "consu", - "Port": "provider", - "Channel": 0 - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.submitEquivocationProposalAction", - "Action": { - "Chain": "consu", - "Height": 10, - "Time": "2023-10-04T12:14:14.88337+02:00", - "Power": 500, - "Validator": "bob", - "Deposit": 10000001, - "From": "bob" - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": { - "bob": 9489999999 - }, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": { - "2": { - "RawProposal": { - "Height": 10, - "Power": 500, - "ConsensusAddress": "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - "Deposit": 10000001, - "Status": "PROPOSAL_STATUS_VOTING_PERIOD" - }, - "Type": "main.EquivocationProposal" - } - } - } - } - }, - { - "ActionType": "main.voteGovProposalAction", - "Action": { - "Chain": "provi", - "From": [ - "alice", - "bob", - "carol" - ], - "Vote": [ - "yes", - "yes", - "yes" - ], - "PropNumber": 2 - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 0, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": { - "2": { - "RawProposal": { - "Height": 10, - "Power": 500, - "ConsensusAddress": "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - "Deposit": 10000001, - "Status": "PROPOSAL_STATUS_PASSED" - }, - "Type": "main.EquivocationProposal" - } - } - } - } - }, - { - "ActionType": "main.relayPacketsAction", - "Action": { - "ChainA": "provi", - "ChainB": "consu", - "Port": "provider", - "Channel": 0 - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 0, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 0, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1858,8 +1534,9 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { - "3": { + "2": { "RawProposal": { "Deposit": 10000001, "Chain": "consu", @@ -1886,7 +1563,7 @@ "no", "no" ], - "PropNumber": 3 + "PropNumber": 2 }, "State": { "provi": { @@ -1905,8 +1582,9 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { - "3": { + "2": { "RawProposal": { "Deposit": 10000001, "Chain": "consu", @@ -1945,8 +1623,9 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { - "4": { + "3": { "RawProposal": { "Deposit": 10000001, "Chain": "consu", @@ -1973,7 +1652,7 @@ "yes", "yes" ], - "PropNumber": 4 + "PropNumber": 3 }, "State": { "provi": { @@ -1990,8 +1669,9 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { - "4": { + "3": { "RawProposal": { "Deposit": 10000001, "Chain": "consu", diff --git a/tests/e2e/tracehandler_testdata/multipleConsumers.json b/tests/e2e/tracehandler_testdata/multipleConsumers.json index 4774a94ad8..af7f6a06a4 100644 --- a/tests/e2e/tracehandler_testdata/multipleConsumers.json +++ b/tests/e2e/tracehandler_testdata/multipleConsumers.json @@ -21,7 +21,7 @@ } ], "GenesisChanges": "", - "SkipGentx": false + "IsConsumer": false }, "State": { "provi": { @@ -40,6 +40,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -74,6 +75,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -118,6 +120,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -162,6 +165,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -198,6 +202,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -256,6 +261,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -274,6 +280,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -331,6 +338,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "2": { "RawProposal": { @@ -375,6 +383,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -419,6 +428,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -455,6 +465,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "2": { "RawProposal": { @@ -513,6 +524,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -531,6 +543,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -583,6 +596,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -601,6 +615,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -619,6 +634,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -648,6 +664,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -666,6 +683,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -684,6 +702,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -713,6 +732,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -731,6 +751,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -749,6 +770,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -778,6 +800,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -796,6 +819,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -814,6 +838,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -843,6 +868,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -861,6 +887,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -879,6 +906,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -908,6 +936,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -926,6 +955,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -944,6 +974,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -974,6 +1005,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -992,6 +1024,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1010,6 +1043,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1039,6 +1073,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1057,6 +1092,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1075,6 +1111,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1104,6 +1141,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1122,6 +1160,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1140,6 +1179,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1167,6 +1207,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1185,6 +1226,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1203,6 +1245,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1232,6 +1275,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1250,6 +1294,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1268,6 +1313,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1297,6 +1343,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1315,6 +1362,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1344,6 +1392,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1362,6 +1411,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1389,6 +1439,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1407,6 +1458,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1425,6 +1477,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1454,6 +1507,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1472,6 +1526,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1490,6 +1545,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1519,6 +1575,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1537,6 +1594,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1555,6 +1613,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1582,6 +1641,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1600,6 +1660,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1618,6 +1679,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1647,6 +1709,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1665,6 +1728,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1683,6 +1747,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1712,6 +1777,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1730,6 +1796,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1748,6 +1815,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1775,6 +1843,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1793,6 +1862,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1811,6 +1881,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1840,6 +1911,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1858,6 +1930,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1876,6 +1949,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1905,6 +1979,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1923,6 +1998,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1941,6 +2017,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1968,6 +2045,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -1986,6 +2064,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -2004,6 +2083,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -2033,6 +2113,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -2051,6 +2132,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -2069,6 +2151,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -2098,6 +2181,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -2116,6 +2200,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -2134,6 +2219,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -2161,6 +2247,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -2179,6 +2266,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -2197,6 +2285,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -2226,6 +2315,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -2244,6 +2334,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -2262,6 +2353,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -2291,6 +2383,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -2309,6 +2402,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -2327,6 +2421,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -2356,6 +2451,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "densu": { @@ -2374,6 +2470,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } diff --git a/tests/e2e/tracehandler_testdata/shorthappy.json b/tests/e2e/tracehandler_testdata/shorthappy.json index 697af97fef..df0d68d245 100644 --- a/tests/e2e/tracehandler_testdata/shorthappy.json +++ b/tests/e2e/tracehandler_testdata/shorthappy.json @@ -21,7 +21,7 @@ } ], "GenesisChanges": "", - "SkipGentx": false + "IsConsumer": false }, "State": { "provi": { @@ -40,6 +40,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -74,6 +75,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -118,6 +120,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -162,6 +165,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -198,6 +202,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -256,6 +261,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -274,6 +280,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -326,6 +333,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -344,6 +352,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -372,6 +381,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -401,6 +411,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -429,6 +440,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -458,6 +470,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -476,6 +489,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -505,6 +519,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -535,6 +550,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -553,6 +569,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -582,6 +599,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -609,6 +627,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -627,6 +646,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -656,6 +676,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -674,6 +695,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -703,6 +725,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -730,6 +753,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -748,6 +772,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -777,6 +802,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -804,6 +830,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -822,6 +849,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -851,6 +879,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -878,6 +907,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -896,6 +926,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -925,72 +956,11 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } }, - { - "ActionType": "main.submitEquivocationProposalAction", - "Action": { - "Chain": "consu", - "Height": 10, - "Time": "2023-10-04T12:14:14.883385+02:00", - "Power": 500, - "Validator": "bob", - "Deposit": 10000001, - "From": "bob" - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 495 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": { - "bob": 9500000000 - }, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 495 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": { - "2": { - "RawProposal": { - "Title": "", - "Description": "", - "Deposit": 0, - "Status": "" - }, - "Type": "main.TextProposal" - } - } - } - } - }, { "ActionType": "main.doublesignSlashAction", "Action": { @@ -1014,6 +984,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1032,6 +1003,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1061,6 +1033,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -1079,321 +1052,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.doublesignSlashAction", - "Action": { - "Validator": "bob", - "Chain": "consu" - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.relayPacketsAction", - "Action": { - "ChainA": "provi", - "ChainB": "consu", - "Port": "provider", - "Channel": 0 - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.relayPacketsAction", - "Action": { - "ChainA": "provi", - "ChainB": "consu", - "Port": "provider", - "Channel": 0 - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.submitEquivocationProposalAction", - "Action": { - "Chain": "consu", - "Height": 10, - "Time": "2023-10-04T12:14:14.883388+02:00", - "Power": 500, - "Validator": "bob", - "Deposit": 10000001, - "From": "bob" - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": { - "bob": 9489999999 - }, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": { - "2": { - "RawProposal": { - "Height": 10, - "Power": 500, - "ConsensusAddress": "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - "Deposit": 10000001, - "Status": "PROPOSAL_STATUS_VOTING_PERIOD" - }, - "Type": "main.EquivocationProposal" - } - } - } - } - }, - { - "ActionType": "main.voteGovProposalAction", - "Action": { - "Chain": "provi", - "From": [ - "alice", - "bob", - "carol" - ], - "Vote": [ - "yes", - "yes", - "yes" - ], - "PropNumber": 2 - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 500, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 0, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": { - "2": { - "RawProposal": { - "Height": 10, - "Power": 500, - "ConsensusAddress": "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - "Deposit": 10000001, - "Status": "PROPOSAL_STATUS_PASSED" - }, - "Type": "main.EquivocationProposal" - } - } - } - } - }, - { - "ActionType": "main.relayPacketsAction", - "Action": { - "ChainA": "provi", - "ChainB": "consu", - "Port": "provider", - "Channel": 0 - }, - "State": { - "consu": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 0, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "Proposals": null - }, - "provi": { - "ValBalances": null, - "ValPowers": { - "alice": 509, - "bob": 0, - "carol": 0 - }, - "StakedTokens": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerChainQueueSizes": null, - "GlobalSlashQueueSize": null, - "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -1429,8 +1088,9 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { - "3": { + "2": { "RawProposal": { "Deposit": 10000001, "Chain": "consu", @@ -1457,7 +1117,7 @@ "no", "no" ], - "PropNumber": 3 + "PropNumber": 2 }, "State": { "provi": { @@ -1476,8 +1136,9 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { - "3": { + "2": { "RawProposal": { "Deposit": 10000001, "Chain": "consu", @@ -1516,8 +1177,9 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { - "4": { + "3": { "RawProposal": { "Deposit": 10000001, "Chain": "consu", @@ -1544,7 +1206,7 @@ "yes", "yes" ], - "PropNumber": 4 + "PropNumber": 3 }, "State": { "provi": { @@ -1561,8 +1223,9 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { - "4": { + "3": { "RawProposal": { "Deposit": 10000001, "Chain": "consu", diff --git a/tests/e2e/tracehandler_testdata/slashThrottle.json b/tests/e2e/tracehandler_testdata/slashThrottle.json index ea8306fd4c..447bdaedc2 100644 --- a/tests/e2e/tracehandler_testdata/slashThrottle.json +++ b/tests/e2e/tracehandler_testdata/slashThrottle.json @@ -21,7 +21,7 @@ } ], "GenesisChanges": "", - "SkipGentx": false + "IsConsumer": false }, "State": { "provi": { @@ -40,6 +40,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -74,6 +75,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -118,6 +120,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -162,6 +165,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -198,6 +202,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "1": { "RawProposal": { @@ -256,6 +261,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -274,6 +280,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -326,6 +333,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -344,6 +352,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -372,6 +381,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -401,6 +411,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -429,6 +440,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -456,6 +468,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -474,6 +487,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -503,6 +517,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -523,6 +538,7 @@ }, "GlobalSlashQueueSize": 0, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -550,6 +566,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -568,6 +585,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -597,6 +615,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -617,6 +636,7 @@ }, "GlobalSlashQueueSize": 1, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -646,6 +666,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null }, "provi": { @@ -715,6 +736,7 @@ }, "GlobalSlashQueueSize": 0, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": null } } @@ -745,6 +767,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "2": { "RawProposal": { @@ -790,6 +813,7 @@ "ConsumerChainQueueSizes": null, "GlobalSlashQueueSize": null, "RegisteredConsumerRewardDenoms": null, + "ClientsFrozenHeights": null, "Proposals": { "2": { "RawProposal": { diff --git a/tests/integration/double_vote.go b/tests/integration/double_vote.go new file mode 100644 index 0000000000..af05c745df --- /dev/null +++ b/tests/integration/double_vote.go @@ -0,0 +1,395 @@ +package integration + +import ( + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + tmcrypto "github.com/cometbft/cometbft/crypto" + tmtypes "github.com/cometbft/cometbft/types" + + testutil "github.com/cosmos/interchain-security/v3/testutil/crypto" + "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" +) + +// TestHandleConsumerDoubleVoting verifies that handling a double voting evidence +// of a consumer chain results in the expected tombstoning, jailing, and slashing of the misbehaved validator +func (s *CCVTestSuite) TestHandleConsumerDoubleVoting() { + s.SetupCCVChannel(s.path) + // required to have the consumer client revision height greater than 0 + s.SendEmptyVSCPacket() + + // create signing info for all validators + for _, v := range s.providerChain.Vals.Validators { + s.setDefaultValSigningInfo(*v) + } + + consuValSet, err := tmtypes.ValidatorSetFromProto(s.consumerChain.LastHeader.ValidatorSet) + s.Require().NoError(err) + consuVal := consuValSet.Validators[0] + consuSigner := s.consumerChain.Signers[consuVal.Address.String()] + + provValSet, err := tmtypes.ValidatorSetFromProto(s.providerChain.LastHeader.ValidatorSet) + s.Require().NoError(err) + + provVal := provValSet.Validators[0] + provSigner := s.providerChain.Signers[provVal.Address.String()] + + blockID1 := testutil.MakeBlockID([]byte("blockhash"), 1000, []byte("partshash")) + blockID2 := testutil.MakeBlockID([]byte("blockhash2"), 1000, []byte("partshash")) + + // Set the equivocation evidence min height to the previous block height + equivocationEvidenceMinHeight := uint64(s.consumerCtx().BlockHeight() - 1) + s.providerApp.GetProviderKeeper().SetEquivocationEvidenceMinHeight( + s.providerCtx(), + s.consumerChain.ChainID, + equivocationEvidenceMinHeight, + ) + + // Note that votes are signed along with the chain ID + // see VoteSignBytes in https://github.com/cometbft/cometbft/blob/v0.37.2/types/vote.go#L93 + + // create two votes using the consumer validator key + consuVote := testutil.MakeAndSignVote( + blockID1, + s.consumerCtx().BlockHeight(), + s.consumerCtx().BlockTime(), + consuValSet, + consuSigner, + s.consumerChain.ChainID, + ) + + consuBadVote := testutil.MakeAndSignVote( + blockID2, + s.consumerCtx().BlockHeight(), + s.consumerCtx().BlockTime(), + consuValSet, + consuSigner, + s.consumerChain.ChainID, + ) + + // create two votes using the provider validator key + provVote := testutil.MakeAndSignVote( + blockID1, + s.consumerCtx().BlockHeight(), + s.consumerCtx().BlockTime(), + provValSet, + provSigner, + s.consumerChain.ChainID, + ) + + provBadVote := testutil.MakeAndSignVote( + blockID2, + s.consumerCtx().BlockHeight(), + s.consumerCtx().BlockTime(), + provValSet, + provSigner, + s.consumerChain.ChainID, + ) + + // create a vote using the consumer validator key + // with block height that is smaller than the equivocation evidence min height + consuVoteOld := testutil.MakeAndSignVote( + blockID1, + int64(equivocationEvidenceMinHeight-1), + s.consumerCtx().BlockTime(), + consuValSet, + consuSigner, + s.consumerChain.ChainID, + ) + + testCases := []struct { + name string + ev *tmtypes.DuplicateVoteEvidence + chainID string + pubkey tmcrypto.PubKey + expPass bool + }{ + { + "cannot find consumer chain for the given chain ID - shouldn't pass", + &tmtypes.DuplicateVoteEvidence{ + VoteA: consuVote, + VoteB: consuBadVote, + ValidatorPower: consuVal.VotingPower, + TotalVotingPower: consuVal.VotingPower, + Timestamp: s.consumerCtx().BlockTime(), + }, + "chainID", + consuVal.PubKey, + false, + }, + { + "evidence is older than equivocation evidence min height - shouldn't pass", + &tmtypes.DuplicateVoteEvidence{ + VoteA: consuVoteOld, + VoteB: consuBadVote, + ValidatorPower: consuVal.VotingPower, + TotalVotingPower: consuVal.VotingPower, + Timestamp: s.consumerCtx().BlockTime(), + }, + s.consumerChain.ChainID, + consuVal.PubKey, + false, + }, + { + "the votes in the evidence are for different height - shouldn't pass", + &tmtypes.DuplicateVoteEvidence{ + VoteA: consuVote, + VoteB: consuVoteOld, + ValidatorPower: consuVal.VotingPower, + TotalVotingPower: consuVal.VotingPower, + Timestamp: s.consumerCtx().BlockTime(), + }, + s.consumerChain.ChainID, + consuVal.PubKey, + false, + }, + { + "wrong public key - shouldn't pass", + &tmtypes.DuplicateVoteEvidence{ + VoteA: consuVote, + VoteB: consuVote, + ValidatorPower: consuVal.VotingPower, + TotalVotingPower: consuVal.VotingPower, + Timestamp: s.consumerCtx().BlockTime(), + }, + s.consumerChain.ChainID, + provVal.PubKey, + false, + }, + { + // create an invalid evidence containing two identical votes + "invalid double voting evidence with identical votes - shouldn't pass", + &tmtypes.DuplicateVoteEvidence{ + VoteA: consuVote, + VoteB: consuVote, + ValidatorPower: consuVal.VotingPower, + TotalVotingPower: consuVal.VotingPower, + Timestamp: s.consumerCtx().BlockTime(), + }, + s.consumerChain.ChainID, + consuVal.PubKey, + false, + }, + { + // In order to create an evidence for a consumer chain, + // we create two votes that only differ by their Block IDs and + // signed them using the same validator private key and chain ID + // of the consumer chain + "valid double voting evidence 1 - should pass", + &tmtypes.DuplicateVoteEvidence{ + VoteA: consuVote, + VoteB: consuBadVote, + ValidatorPower: consuVal.VotingPower, + TotalVotingPower: consuVal.VotingPower, + Timestamp: s.consumerCtx().BlockTime(), + }, + s.consumerChain.ChainID, + consuVal.PubKey, + true, + }, + { + // create a double voting evidence using the provider validator key + "valid double voting evidence 2 - should pass", + &tmtypes.DuplicateVoteEvidence{ + VoteA: provVote, + VoteB: provBadVote, + ValidatorPower: consuVal.VotingPower, + TotalVotingPower: consuVal.VotingPower, + Timestamp: s.consumerCtx().BlockTime(), + }, + s.consumerChain.ChainID, + provVal.PubKey, + true, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + consuAddr := types.NewConsumerConsAddress(sdk.ConsAddress(tc.ev.VoteA.ValidatorAddress.Bytes())) + provAddr := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.consumerChain.ChainID, consuAddr) + + validator, _ := s.providerApp.GetTestStakingKeeper().GetValidator(s.providerCtx(), provAddr.ToSdkConsAddr().Bytes()) + initialTokens := sdk.NewDecFromInt(validator.GetTokens()) + + // reset context for each run + provCtx, _ := s.providerCtx().CacheContext() + + // if the evidence was built using the validator provider address and key, + // we remove the consumer key assigned to the validator otherwise + // HandleConsumerDoubleVoting uses the consumer key to verify the signature + if tc.ev.VoteA.ValidatorAddress.String() != consuVal.Address.String() { + s.providerApp.GetProviderKeeper().DeleteKeyAssignments(provCtx, s.consumerChain.ChainID) + } + + // convert validator public key + pk, err := cryptocodec.FromTmPubKeyInterface(tc.pubkey) + s.Require().NoError(err) + + err = s.providerApp.GetProviderKeeper().HandleConsumerDoubleVoting( + provCtx, + tc.ev, + tc.chainID, + pk, + ) + + if tc.expPass { + s.Require().NoError(err) + + // verifies that the jailing and tombstoning has occurred + s.Require().True(s.providerApp.GetTestStakingKeeper().IsValidatorJailed(provCtx, provAddr.ToSdkConsAddr())) + s.Require().True(s.providerApp.GetTestSlashingKeeper().IsTombstoned(provCtx, provAddr.ToSdkConsAddr())) + + // verifies that the val gets slashed and has fewer tokens after the slashing + val, _ := s.providerApp.GetTestStakingKeeper().GetValidator(provCtx, provAddr.ToSdkConsAddr().Bytes()) + slashFraction := s.providerApp.GetTestSlashingKeeper().SlashFractionDoubleSign(provCtx) + actualTokens := sdk.NewDecFromInt(val.GetTokens()) + s.Require().True(initialTokens.Sub(initialTokens.Mul(slashFraction)).Equal(actualTokens)) + } else { + s.Require().Error(err) + + // verifies that no jailing and no tombstoning has occurred + s.Require().False(s.providerApp.GetTestStakingKeeper().IsValidatorJailed(provCtx, provAddr.ToSdkConsAddr())) + s.Require().False(s.providerApp.GetTestSlashingKeeper().IsTombstoned(provCtx, provAddr.ToSdkConsAddr())) + } + }) + } +} + +// TestHandleConsumerDoubleVotingSlashesUndelegationsAndRelegations verifies that handling a successful double voting +// evidence of a consumer chain results in the expected slashing of the misbehave validator undelegations +func (s *CCVTestSuite) TestHandleConsumerDoubleVotingSlashesUndelegationsAndRelegations() { + s.SetupCCVChannel(s.path) + // required to have the consumer client revision height greater than 0 + s.SendEmptyVSCPacket() + + // create signing info for all validators + for _, v := range s.providerChain.Vals.Validators { + s.setDefaultValSigningInfo(*v) + } + + consuValSet, err := tmtypes.ValidatorSetFromProto(s.consumerChain.LastHeader.ValidatorSet) + s.Require().NoError(err) + consuVal := consuValSet.Validators[0] + consuVal2 := consuValSet.Validators[1] + consuSigner := s.consumerChain.Signers[consuVal.Address.String()] + + blockID1 := testutil.MakeBlockID([]byte("blockhash"), 1000, []byte("partshash")) + blockID2 := testutil.MakeBlockID([]byte("blockhash2"), 1000, []byte("partshash")) + + // create two votes using the consumer validator key + consuVote := testutil.MakeAndSignVote( + blockID1, + s.consumerCtx().BlockHeight(), + s.consumerCtx().BlockTime(), + consuValSet, + consuSigner, + s.consumerChain.ChainID, + ) + + consuBadVote := testutil.MakeAndSignVote( + blockID2, + s.consumerCtx().BlockHeight(), + s.consumerCtx().BlockTime(), + consuValSet, + consuSigner, + s.consumerChain.ChainID, + ) + + // In order to create an evidence for a consumer chain, + // we create two votes that only differ by their Block IDs and + // signed them using the same validator private key and chain ID + // of the consumer chain + evidence := &tmtypes.DuplicateVoteEvidence{ + VoteA: consuVote, + VoteB: consuBadVote, + ValidatorPower: consuVal.VotingPower, + TotalVotingPower: consuVal.VotingPower, + Timestamp: s.consumerCtx().BlockTime(), + } + + chainID := s.consumerChain.ChainID + pubKey := consuVal.PubKey + + consuAddr := types.NewConsumerConsAddress(sdk.ConsAddress(consuVal.Address.Bytes())) + provAddr := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.consumerChain.ChainID, consuAddr) + + consuAddr2 := types.NewConsumerConsAddress(sdk.ConsAddress(consuVal2.Address.Bytes())) + provAddr2 := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.consumerChain.ChainID, consuAddr2) + + validator, found := s.providerApp.GetTestStakingKeeper().GetValidator(s.providerCtx(), provAddr.ToSdkConsAddr().Bytes()) + s.Require().True(found) + + validator2, found := s.providerApp.GetTestStakingKeeper().GetValidator(s.providerCtx(), provAddr2.ToSdkConsAddr().Bytes()) + s.Require().True(found) + + s.Run("slash undelegations and redelegations when getting double voting evidence", func() { + // convert validator public key + pk, err := cryptocodec.FromTmPubKeyInterface(pubKey) + s.Require().NoError(err) + + // perform a delegation and an undelegation of the whole amount + bondAmt := sdk.NewInt(10000000) + delAddr := s.providerChain.SenderAccount.GetAddress() + + // in order to perform a delegation we need to know the validator's `idx` (that might not be 0) + // loop through all validators to find the right `idx` + idx := 0 + for i := 0; i <= len(s.providerChain.Vals.Validators); i++ { + _, valAddr := s.getValByIdx(i) + if validator.OperatorAddress == valAddr.String() { + idx = i + break + } + } + + // delegate bond amount + _, shares, _ := delegateByIdx(s, delAddr, bondAmt, idx) + s.Require().NotZero(shares) + + // undelegate 1/2 of the bound amount + undelegate(s, delAddr, validator.GetOperator(), shares.Quo(sdk.NewDec(4))) + undelegate(s, delAddr, validator.GetOperator(), shares.Quo(sdk.NewDec(4))) + + // check that undelegations were successful + ubds, _ := s.providerApp.GetTestStakingKeeper().GetUnbondingDelegation(s.providerCtx(), delAddr, validator.GetOperator()) + // should have a single entry since undelegations are merged + s.Require().Len(ubds.Entries, 1) + + // save the delegation shares of the validator to redelegate to + // Note this shares should not be slashed! + delShares := s.providerApp.GetTestStakingKeeper().Delegation(s.providerCtx(), delAddr, validator2.GetOperator()).GetShares() + + // redelegate 1/2 of the bound amount + redelegate(s, delAddr, validator.GetOperator(), validator2.GetOperator(), shares.Quo(sdk.NewDec(4))) + redelegate(s, delAddr, validator.GetOperator(), validator2.GetOperator(), shares.Quo(sdk.NewDec(4))) + + // check that redelegation was successful + rdel := s.providerApp.GetTestStakingKeeper().GetRedelegations(s.providerCtx(), delAddr, uint16(10)) + s.Require().Len(rdel[0].Entries, 2) + + redelShares := rdel[0].Entries[0].SharesDst.Add(rdel[0].Entries[1].SharesDst) + + // cause double voting + err = s.providerApp.GetProviderKeeper().HandleConsumerDoubleVoting( + s.providerCtx(), + evidence, + chainID, + pk, + ) + s.Require().NoError(err) + + slashFraction := s.providerApp.GetTestSlashingKeeper().SlashFractionDoubleSign(s.providerCtx()) + + // check undelegations are slashed + ubds, _ = s.providerApp.GetTestStakingKeeper().GetUnbondingDelegation(s.providerCtx(), delAddr, validator.GetOperator()) + s.Require().True(len(ubds.Entries) > 0) + for _, unb := range ubds.Entries { + initialBalance := sdk.NewDecFromInt(unb.InitialBalance) + currentBalance := sdk.NewDecFromInt(unb.Balance) + s.Require().True(initialBalance.Sub(initialBalance.Mul(slashFraction)).Equal(currentBalance)) + } + // check that redelegations are slashed + delegations := s.providerApp.GetTestStakingKeeper().Delegation(s.providerCtx(), delAddr, validator2.GetOperator()) + s.Require().Equal(delegations.GetShares(), delShares.Add(redelShares).Sub(redelShares.Mul(slashFraction))) + }) +} diff --git a/tests/integration/misbehaviour.go b/tests/integration/misbehaviour.go new file mode 100644 index 0000000000..c0f2cf10b9 --- /dev/null +++ b/tests/integration/misbehaviour.go @@ -0,0 +1,551 @@ +package integration + +import ( + "time" + + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + + sdk "github.com/cosmos/cosmos-sdk/types" + + tmtypes "github.com/cometbft/cometbft/types" + + testutil "github.com/cosmos/interchain-security/v3/testutil/crypto" + "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" +) + +// TestHandleConsumerMisbehaviour tests that handling a valid misbehaviour, +// with conflicting headers forming an equivocation, results in the jailing of the validators +func (s *CCVTestSuite) TestHandleConsumerMisbehaviour() { + s.SetupCCVChannel(s.path) + // required to have the consumer client revision height greater than 0 + s.SendEmptyVSCPacket() + + for _, v := range s.providerChain.Vals.Validators { + s.setDefaultValSigningInfo(*v) + } + + altTime := s.providerCtx().BlockTime().Add(time.Minute) + + clientHeight := s.consumerChain.LastHeader.TrustedHeight + clientTMValset := tmtypes.NewValidatorSet(s.consumerChain.Vals.Validators) + clientSigners := s.consumerChain.Signers + + misb := &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime, + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ), + // create a different header by changing the header timestamp only + // in order to create an equivocation, i.e. both headers have the same deterministic states + Header2: s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime.Add(10*time.Second), + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ), + } + + // we assume that all validators have the same number of initial tokens + validator, _ := s.getValByIdx(0) + initialTokens := sdk.NewDecFromInt(validator.GetTokens()) + + err := s.providerApp.GetProviderKeeper().HandleConsumerMisbehaviour(s.providerCtx(), *misb) + s.NoError(err) + + // verify that validators are jailed, tombstoned, and slashed + for _, v := range clientTMValset.Validators { + consuAddr := sdk.ConsAddress(v.Address.Bytes()) + provAddr := s.providerApp.GetProviderKeeper().GetProviderAddrFromConsumerAddr(s.providerCtx(), s.consumerChain.ChainID, types.NewConsumerConsAddress(consuAddr)) + val, ok := s.providerApp.GetTestStakingKeeper().GetValidatorByConsAddr(s.providerCtx(), provAddr.Address) + s.Require().True(ok) + s.Require().True(val.Jailed) + s.Require().True(s.providerApp.GetTestSlashingKeeper().IsTombstoned(s.providerCtx(), provAddr.ToSdkConsAddr())) + + validator, _ := s.providerApp.GetTestStakingKeeper().GetValidator(s.providerCtx(), provAddr.ToSdkConsAddr().Bytes()) + slashFraction := s.providerApp.GetTestSlashingKeeper().SlashFractionDoubleSign(s.providerCtx()) + actualTokens := sdk.NewDecFromInt(validator.GetTokens()) + s.Require().True(initialTokens.Sub(initialTokens.Mul(slashFraction)).Equal(actualTokens)) + } +} + +func (s *CCVTestSuite) TestGetByzantineValidators() { + s.SetupCCVChannel(s.path) + // required to have the consumer client revision height greater than 0 + s.SendEmptyVSCPacket() + + altTime := s.providerCtx().BlockTime().Add(time.Minute) + + // Get the consumer client validator set + clientHeight := s.consumerChain.LastHeader.TrustedHeight + clientTMValset := tmtypes.NewValidatorSet(s.consumerChain.Vals.Validators) + clientSigners := s.consumerChain.Signers + + // Create a subset of the consumer client validator set + altValset := tmtypes.NewValidatorSet(s.consumerChain.Vals.Validators[0:3]) + altSigners := make(map[string]tmtypes.PrivValidator, 3) + altSigners[clientTMValset.Validators[0].Address.String()] = clientSigners[clientTMValset.Validators[0].Address.String()] + altSigners[clientTMValset.Validators[1].Address.String()] = clientSigners[clientTMValset.Validators[1].Address.String()] + altSigners[clientTMValset.Validators[2].Address.String()] = clientSigners[clientTMValset.Validators[2].Address.String()] + + // create a consumer client header + clientHeader := s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime, + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ) + + testCases := []struct { + name string + getMisbehaviour func() *ibctmtypes.Misbehaviour + expByzantineValidators []*tmtypes.Validator + expPass bool + }{ + { + "invalid misbehaviour - Header1 is empty", + func() *ibctmtypes.Misbehaviour { + return &ibctmtypes.Misbehaviour{ + Header1: &ibctmtypes.Header{}, + Header2: clientHeader, + } + }, + nil, + false, + }, + { + "invalid headers - Header2 is empty", + func() *ibctmtypes.Misbehaviour { + return &ibctmtypes.Misbehaviour{ + Header1: clientHeader, + Header2: &ibctmtypes.Header{}, + } + }, + nil, + false, + }, + { + "incorrect valset - shouldn't pass", + func() *ibctmtypes.Misbehaviour { + clientHeader := s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime.Add(time.Minute), + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ) + + clientHeaderWithCorruptedValset := s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime.Add(time.Hour), + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ) + + // change a validator public key in one the second header + testutil.CorruptValidatorPubkeyInHeader(clientHeaderWithCorruptedValset, clientTMValset.Validators[0].Address) + + return &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: clientHeader, + Header2: clientHeaderWithCorruptedValset, + } + }, + []*tmtypes.Validator{}, + false, + }, + { + "incorrect valset 2 - shouldn't pass", + func() *ibctmtypes.Misbehaviour { + clientHeader := s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime.Add(time.Minute), + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ) + + clientHeaderWithCorruptedSigs := s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime.Add(time.Hour), + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ) + + // change the valset in the header + vs, _ := altValset.ToProto() + clientHeader.ValidatorSet.Validators = vs.Validators[:3] + clientHeaderWithCorruptedSigs.ValidatorSet.Validators = vs.Validators[:3] + + return &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: clientHeader, + Header2: clientHeaderWithCorruptedSigs, + } + }, + []*tmtypes.Validator{}, + false, + }, + { + "incorrect signatures - shouldn't pass", + func() *ibctmtypes.Misbehaviour { + clientHeader := s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime.Add(time.Minute), + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ) + + clientHeaderWithCorruptedSigs := s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime.Add(time.Hour), + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ) + + // change the signature of one of the validator in the header + testutil.CorruptCommitSigsInHeader(clientHeaderWithCorruptedSigs, clientTMValset.Validators[0].Address) + + return &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: clientHeader, + Header2: clientHeaderWithCorruptedSigs, + } + }, + []*tmtypes.Validator{}, + false, + }, + { + "light client attack - lunatic attack", + func() *ibctmtypes.Misbehaviour { + return &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: clientHeader, + // the resulting header contains invalid fields + // i.e. ValidatorsHash, NextValidatorsHash. + Header2: s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime, + altValset, + altValset, + clientTMValset, + altSigners, + ), + } + }, + // Expect to get only the validators + // who signed both headers + altValset.Validators, + true, + }, + { + "light client attack - equivocation", + func() *ibctmtypes.Misbehaviour { + return &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: clientHeader, + // the resulting header contains a different BlockID + Header2: s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime.Add(time.Minute), + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ), + } + }, + // Expect to get the entire valset since + // all validators double-signed + clientTMValset.Validators, + true, + }, + { + "light client attack - amnesia", + func() *ibctmtypes.Misbehaviour { + // create a valid header with a different hash + // and commit round + amnesiaHeader := s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + altTime.Add(time.Minute), + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ) + amnesiaHeader.Commit.Round = 2 + + return &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: clientHeader, + Header2: amnesiaHeader, + } + }, + // Expect no validators + // since amnesia attacks are dropped + []*tmtypes.Validator{}, + true, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + byzantineValidators, err := s.providerApp.GetProviderKeeper().GetByzantineValidators( + s.providerCtx(), + *tc.getMisbehaviour(), + ) + if tc.expPass { + s.NoError(err) + s.Equal(len(tc.expByzantineValidators), len(byzantineValidators)) + + // For both lunatic and equivocation attacks, all the validators + // who signed both headers + if len(tc.expByzantineValidators) > 0 { + equivocatingVals := tc.getMisbehaviour().Header2.ValidatorSet + s.Equal(len(equivocatingVals.Validators), len(byzantineValidators)) + + vs, err := tmtypes.ValidatorSetFromProto(equivocatingVals) + s.NoError(err) + + for _, v := range tc.expByzantineValidators { + idx, _ := vs.GetByAddress(v.Address) + s.True(idx >= 0) + } + } + } else { + s.Error(err) + } + }) + } +} + +func (s *CCVTestSuite) TestCheckMisbehaviour() { + s.SetupCCVChannel(s.path) + // required to have the consumer client revision height greater than 0 + s.SendEmptyVSCPacket() + + // create signing info for all validators + for _, v := range s.providerChain.Vals.Validators { + s.setDefaultValSigningInfo(*v) + } + + // create a new header timestamp + headerTs := s.providerCtx().BlockTime().Add(time.Minute) + + // get trusted validators and height + clientHeight := s.consumerChain.LastHeader.TrustedHeight + clientTMValset := tmtypes.NewValidatorSet(s.consumerChain.Vals.Validators) + clientSigners := s.consumerChain.Signers + + // create a valid client header + clientHeader := s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + headerTs, + clientTMValset, + clientTMValset, + clientTMValset, + clientSigners, + ) + + // create an alternative validator set using more than 1/3 of the trusted validator set + altValset := tmtypes.NewValidatorSet(s.consumerChain.Vals.Validators[0:2]) + altSigners := make(map[string]tmtypes.PrivValidator, 2) + altSigners[clientTMValset.Validators[0].Address.String()] = clientSigners[clientTMValset.Validators[0].Address.String()] + altSigners[clientTMValset.Validators[1].Address.String()] = clientSigners[clientTMValset.Validators[1].Address.String()] + + // create a conflicting client with different block ID using + // to alternative validator set + clientHeaderWithDiffBlockID := s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + headerTs, + altValset, + altValset, + clientTMValset, // trusted valset stays the same + altSigners, + ) + + // create an alternative validator set using less than 1/3 of the trusted validator set + altValset2 := tmtypes.NewValidatorSet(s.consumerChain.Vals.Validators[0:1]) + altSigners2 := make(map[string]tmtypes.PrivValidator, 1) + altSigners2[clientTMValset.Validators[0].Address.String()] = clientSigners[clientTMValset.Validators[0].Address.String()] + + // create a conflicting client header with insufficient voting power + clientHeaderWithInsufficientVotingPower := s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+1), + clientHeight, + // use a different block time to change the header BlockID + headerTs.Add(time.Hour), + altValset2, + altValset2, + clientTMValset, + altSigners2, + ) + + // Set the equivocation evidence min height to the previous block height + equivocationEvidenceMinHeight := clientHeight.RevisionHeight + 1 + s.providerApp.GetProviderKeeper().SetEquivocationEvidenceMinHeight( + s.providerCtx(), + s.consumerChain.ChainID, + equivocationEvidenceMinHeight, + ) + + testCases := []struct { + name string + misbehaviour *ibctmtypes.Misbehaviour + expPass bool + }{ + { + "identical headers - shouldn't pass", + &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: clientHeader, + Header2: clientHeader, + }, + false, + }, + { + "misbehaviour isn't for a consumer chain - shouldn't pass", + &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: s.consumerChain.CreateTMClientHeader( + "aChainID", + int64(clientHeight.RevisionHeight+1), + clientHeight, + headerTs, + altValset, + altValset, + clientTMValset, + altSigners, + ), + Header2: clientHeader, + }, + false, + }, + { + "client ID doesn't correspond to the client ID of consumer chain - shouldn't pass", + &ibctmtypes.Misbehaviour{ + ClientId: "clientID", + Header1: clientHeader, + Header2: clientHeaderWithDiffBlockID, + }, + false, + }, + { + "invalid misbehaviour with different header height - shouldn't pass", + &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: clientHeader, + Header2: s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(clientHeight.RevisionHeight+2), + clientHeight, + headerTs, + altValset, + altValset, + clientTMValset, + altSigners, + ), + }, + false, + }, + { + "invalid misbehaviour older than the min equivocation evidence height - shouldn't pass", + &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: s.consumerChain.CreateTMClientHeader( + s.consumerChain.ChainID, + int64(equivocationEvidenceMinHeight-1), + clientHeight, + headerTs, + altValset, + altValset, + clientTMValset, + altSigners, + ), + Header2: clientHeader, + }, + false, + }, + { + "one header of the misbehaviour has insufficient voting power - shouldn't pass", + &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: clientHeader, + Header2: clientHeaderWithInsufficientVotingPower, + }, + false, + }, + { + "valid misbehaviour - should pass", + &ibctmtypes.Misbehaviour{ + ClientId: s.path.EndpointA.ClientID, + Header1: clientHeader, + // create header using a different validator set + Header2: clientHeaderWithDiffBlockID, + }, + true, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + err := s.providerApp.GetProviderKeeper().CheckMisbehaviour(s.providerCtx(), *tc.misbehaviour) + cs, ok := s.providerApp.GetIBCKeeper().ClientKeeper.GetClientState(s.providerCtx(), s.path.EndpointA.ClientID) + s.Require().True(ok) + // verify that the client wasn't frozen + s.Require().Zero(cs.(*ibctmtypes.ClientState).FrozenHeight) + if tc.expPass { + s.NoError(err) + } else { + s.Error(err) + } + }) + } +} diff --git a/testutil/crypto/evidence.go b/testutil/crypto/evidence.go new file mode 100644 index 0000000000..653f20824e --- /dev/null +++ b/testutil/crypto/evidence.go @@ -0,0 +1,135 @@ +package crypto + +import ( + "time" + + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + + "github.com/cometbft/cometbft/crypto/tmhash" + "github.com/cometbft/cometbft/libs/bytes" + tmtypes "github.com/cometbft/cometbft/types" +) + +// utility function duplicated from CometBFT +// see https://github.com/cometbft/cometbft/blob/main/evidence/verify_test.go#L554 +func MakeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) tmtypes.BlockID { + var ( + h = make([]byte, tmhash.Size) + psH = make([]byte, tmhash.Size) + ) + copy(h, hash) + copy(psH, partSetHash) + return tmtypes.BlockID{ + Hash: h, + PartSetHeader: tmtypes.PartSetHeader{ + Total: partSetSize, + Hash: psH, + }, + } +} + +func MakeAndSignVote( + blockID tmtypes.BlockID, + blockHeight int64, + blockTime time.Time, + valSet *tmtypes.ValidatorSet, + signer tmtypes.PrivValidator, + chainID string, +) *tmtypes.Vote { + vote, err := tmtypes.MakeVote( + blockHeight, + blockID, + valSet, + signer, + chainID, + blockTime, + ) + if err != nil { + panic(err) + } + + v := vote.ToProto() + err = signer.SignVote(chainID, v) + if err != nil { + panic(err) + } + + vote.Signature = v.Signature + return vote +} + +// MakeAndSignVoteWithForgedValAddress makes and signs a vote using two different keys: +// one to derive the validator address in the vote and a second to sign it. +func MakeAndSignVoteWithForgedValAddress( + blockID tmtypes.BlockID, + blockHeight int64, + blockTime time.Time, + valSet *tmtypes.ValidatorSet, + signer tmtypes.PrivValidator, + valAddressSigner tmtypes.PrivValidator, + chainID string, +) *tmtypes.Vote { + // create the vote using a different key than the signing key + vote, err := tmtypes.MakeVote( + blockHeight, + blockID, + valSet, + valAddressSigner, + chainID, + blockTime, + ) + if err != nil { + panic(err) + } + + // sign vote using the given private key + v := vote.ToProto() + err = signer.SignVote(chainID, v) + if err != nil { + panic(err) + } + + vote.Signature = v.Signature + return vote +} + +// CorruptCommitSigsInHeader corrupts the header by changing the value +// of the commit signature for given validator address. +// Note that this method is solely used for testing purposes +func CorruptCommitSigsInHeader(header *ibctmtypes.Header, valAddress bytes.HexBytes) { + commit, err := tmtypes.CommitFromProto(header.Commit) + if err != nil { + panic(err) + } + + for idx, sig := range commit.Signatures { + if sig.ValidatorAddress.String() == valAddress.String() { + sig.Signature = []byte("randomsig") + commit.Signatures[idx] = sig + } + } + // update the commit in client the header + header.SignedHeader.Commit = commit.ToProto() +} + +// CorruptValidatorPubkeyInHeader corrupts the header by changing the validator pubkey +// of the given validator address in the validator set. +// Note that this method is solely used for testing purposes +func CorruptValidatorPubkeyInHeader(header *ibctmtypes.Header, valAddress bytes.HexBytes) { + valset, err := tmtypes.ValidatorSetFromProto(header.ValidatorSet) + if err != nil { + panic(err) + } + + for _, v := range valset.Validators { + if v.Address.String() == valAddress.String() { + v.PubKey = tmtypes.NewMockPV().PrivKey.PubKey() + } + } + + vs, err := valset.ToProto() + if err != nil { + panic(err) + } + header.ValidatorSet = vs +} diff --git a/testutil/integration/debug_test.go b/testutil/integration/debug_test.go index 6b9415440e..13d006f494 100644 --- a/testutil/integration/debug_test.go +++ b/testutil/integration/debug_test.go @@ -258,6 +258,33 @@ func TestRecycleTransferChannel(t *testing.T) { } // +// Misbehaviour tests +// + +func TestHandleConsumerMisbehaviour(t *testing.T) { + runCCVTestByName(t, "TestHandleConsumerMisbehaviour") +} + +func TestGetByzantineValidators(t *testing.T) { + runCCVTestByName(t, "TestGetByzantineValidators") +} + +func TestCheckMisbehaviour(t *testing.T) { + runCCVTestByName(t, "TestCheckMisbehaviour") +} + +// +// Consumer Equivocation test +// + +func TestHandleConsumerDoubleVoting(t *testing.T) { + runCCVTestByName(t, "TestHandleConsumerDoubleVoting") +} + +func TestHandleConsumerDoubleVotingSlashesUndelegationsAndRelegations(t *testing.T) { + runCCVTestByName(t, "TestHandleConsumerDoubleVotingSlashesUndelegationsAndRelegations") +} + // Throttle retry tests // diff --git a/testutil/keeper/expectations.go b/testutil/keeper/expectations.go index 7814fe0fcf..9494b66936 100644 --- a/testutil/keeper/expectations.go +++ b/testutil/keeper/expectations.go @@ -11,6 +11,8 @@ import ( "github.com/golang/mock/gomock" extra "github.com/oxyno-zeta/gomock-extra-matcher" + math "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -156,3 +158,64 @@ func GetMocksForSendIBCPacket(ctx sdk.Context, mocks MockedKeepers, channelID st ).Return(uint64(888), nil).Times(times), } } + +func GetMocksForSlashValidator( + ctx sdk.Context, + mocks MockedKeepers, + validator stakingtypes.Validator, + consAddr sdk.ConsAddress, + undelegations []stakingtypes.UnbondingDelegation, + redelegations []stakingtypes.Redelegation, + powerReduction math.Int, + slashFraction math.LegacyDec, + currentPower, + expectedInfractionHeight, + expectedSlashPower int64, +) []*gomock.Call { + return []*gomock.Call{ + mocks.MockStakingKeeper.EXPECT(). + GetUnbondingDelegationsFromValidator(ctx, validator.GetOperator()). + Return(undelegations), + mocks.MockStakingKeeper.EXPECT(). + GetRedelegationsFromSrcValidator(ctx, validator.GetOperator()). + Return(redelegations), + mocks.MockStakingKeeper.EXPECT(). + GetLastValidatorPower(ctx, validator.GetOperator()). + Return(currentPower), + mocks.MockStakingKeeper.EXPECT(). + PowerReduction(ctx). + Return(powerReduction), + mocks.MockStakingKeeper.EXPECT(). + SlashUnbondingDelegation(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). + DoAndReturn( + func(_ sdk.Context, undelegation stakingtypes.UnbondingDelegation, _ int64, _ sdk.Dec) math.Int { + sum := sdk.NewInt(0) + for _, r := range undelegation.Entries { + if r.IsMature(ctx.BlockTime()) { + continue + } + sum = sum.Add(sdk.NewInt(r.InitialBalance.Int64())) + } + return sum + }).AnyTimes(), + mocks.MockStakingKeeper.EXPECT(). + SlashRedelegation(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). + DoAndReturn( + func(_ sdk.Context, _ stakingtypes.Validator, redelegation stakingtypes.Redelegation, _ int64, _ sdk.Dec) math.Int { + sum := sdk.NewInt(0) + for _, r := range redelegation.Entries { + if r.IsMature(ctx.BlockTime()) { + continue + } + sum = sum.Add(sdk.NewInt(r.InitialBalance.Int64())) + } + return sum + }).AnyTimes(), + mocks.MockSlashingKeeper.EXPECT(). + SlashFractionDoubleSign(ctx). + Return(slashFraction), + mocks.MockStakingKeeper.EXPECT(). + SlashWithInfractionReason(ctx, consAddr, expectedInfractionHeight, expectedSlashPower, slashFraction, stakingtypes.Infraction_INFRACTION_DOUBLE_SIGN). + Times(1), + } +} diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index b075819cc4..b00678a50a 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks.go @@ -14,13 +14,12 @@ import ( types0 "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/x/auth/types" types2 "github.com/cosmos/cosmos-sdk/x/capability/types" - types3 "github.com/cosmos/cosmos-sdk/x/evidence/types" - types4 "github.com/cosmos/cosmos-sdk/x/slashing/types" - types5 "github.com/cosmos/cosmos-sdk/x/staking/types" - types6 "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - types7 "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - types8 "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" - types9 "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + types3 "github.com/cosmos/cosmos-sdk/x/slashing/types" + types4 "github.com/cosmos/cosmos-sdk/x/staking/types" + types5 "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + types6 "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + types7 "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" + types8 "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" exported "github.com/cosmos/ibc-go/v7/modules/core/exported" gomock "github.com/golang/mock/gomock" ) @@ -63,10 +62,10 @@ func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call } // Delegation mocks base method. -func (m *MockStakingKeeper) Delegation(ctx types0.Context, addr types0.AccAddress, valAddr types0.ValAddress) types5.DelegationI { +func (m *MockStakingKeeper) Delegation(ctx types0.Context, addr types0.AccAddress, valAddr types0.ValAddress) types4.DelegationI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Delegation", ctx, addr, valAddr) - ret0, _ := ret[0].(types5.DelegationI) + ret0, _ := ret[0].(types4.DelegationI) return ret0 } @@ -105,10 +104,10 @@ func (mr *MockStakingKeeperMockRecorder) GetLastValidatorPower(ctx, operator int } // GetLastValidators mocks base method. -func (m *MockStakingKeeper) GetLastValidators(ctx types0.Context) []types5.Validator { +func (m *MockStakingKeeper) GetLastValidators(ctx types0.Context) []types4.Validator { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetLastValidators", ctx) - ret0, _ := ret[0].([]types5.Validator) + ret0, _ := ret[0].([]types4.Validator) return ret0 } @@ -118,11 +117,39 @@ func (mr *MockStakingKeeperMockRecorder) GetLastValidators(ctx interface{}) *gom return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLastValidators", reflect.TypeOf((*MockStakingKeeper)(nil).GetLastValidators), ctx) } +// GetRedelegationsFromSrcValidator mocks base method. +func (m *MockStakingKeeper) GetRedelegationsFromSrcValidator(ctx types0.Context, valAddr types0.ValAddress) []types4.Redelegation { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetRedelegationsFromSrcValidator", ctx, valAddr) + ret0, _ := ret[0].([]types4.Redelegation) + return ret0 +} + +// GetRedelegationsFromSrcValidator indicates an expected call of GetRedelegationsFromSrcValidator. +func (mr *MockStakingKeeperMockRecorder) GetRedelegationsFromSrcValidator(ctx, valAddr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRedelegationsFromSrcValidator", reflect.TypeOf((*MockStakingKeeper)(nil).GetRedelegationsFromSrcValidator), ctx, valAddr) +} + +// GetUnbondingDelegationsFromValidator mocks base method. +func (m *MockStakingKeeper) GetUnbondingDelegationsFromValidator(ctx types0.Context, valAddr types0.ValAddress) []types4.UnbondingDelegation { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUnbondingDelegationsFromValidator", ctx, valAddr) + ret0, _ := ret[0].([]types4.UnbondingDelegation) + return ret0 +} + +// GetUnbondingDelegationsFromValidator indicates an expected call of GetUnbondingDelegationsFromValidator. +func (mr *MockStakingKeeperMockRecorder) GetUnbondingDelegationsFromValidator(ctx, valAddr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUnbondingDelegationsFromValidator", reflect.TypeOf((*MockStakingKeeper)(nil).GetUnbondingDelegationsFromValidator), ctx, valAddr) +} + // GetUnbondingType mocks base method. -func (m *MockStakingKeeper) GetUnbondingType(ctx types0.Context, id uint64) (types5.UnbondingType, bool) { +func (m *MockStakingKeeper) GetUnbondingType(ctx types0.Context, id uint64) (types4.UnbondingType, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetUnbondingType", ctx, id) - ret0, _ := ret[0].(types5.UnbondingType) + ret0, _ := ret[0].(types4.UnbondingType) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -134,10 +161,10 @@ func (mr *MockStakingKeeperMockRecorder) GetUnbondingType(ctx, id interface{}) * } // GetValidator mocks base method. -func (m *MockStakingKeeper) GetValidator(ctx types0.Context, addr types0.ValAddress) (types5.Validator, bool) { +func (m *MockStakingKeeper) GetValidator(ctx types0.Context, addr types0.ValAddress) (types4.Validator, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetValidator", ctx, addr) - ret0, _ := ret[0].(types5.Validator) + ret0, _ := ret[0].(types4.Validator) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -149,10 +176,10 @@ func (mr *MockStakingKeeperMockRecorder) GetValidator(ctx, addr interface{}) *go } // GetValidatorByConsAddr mocks base method. -func (m *MockStakingKeeper) GetValidatorByConsAddr(ctx types0.Context, consAddr types0.ConsAddress) (types5.Validator, bool) { +func (m *MockStakingKeeper) GetValidatorByConsAddr(ctx types0.Context, consAddr types0.ConsAddress) (types4.Validator, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetValidatorByConsAddr", ctx, consAddr) - ret0, _ := ret[0].(types5.Validator) + ret0, _ := ret[0].(types4.Validator) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -204,7 +231,7 @@ func (mr *MockStakingKeeperMockRecorder) IterateLastValidatorPowers(ctx, cb inte } // IterateValidators mocks base method. -func (m *MockStakingKeeper) IterateValidators(ctx types0.Context, f func(int64, types5.ValidatorI) bool) { +func (m *MockStakingKeeper) IterateValidators(ctx types0.Context, f func(int64, types4.ValidatorI) bool) { m.ctrl.T.Helper() m.ctrl.Call(m, "IterateValidators", ctx, f) } @@ -283,8 +310,36 @@ func (mr *MockStakingKeeperMockRecorder) Slash(arg0, arg1, arg2, arg3, arg4 inte return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Slash", reflect.TypeOf((*MockStakingKeeper)(nil).Slash), arg0, arg1, arg2, arg3, arg4) } +// SlashRedelegation mocks base method. +func (m *MockStakingKeeper) SlashRedelegation(arg0 types0.Context, arg1 types4.Validator, arg2 types4.Redelegation, arg3 int64, arg4 types0.Dec) math.Int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SlashRedelegation", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(math.Int) + return ret0 +} + +// SlashRedelegation indicates an expected call of SlashRedelegation. +func (mr *MockStakingKeeperMockRecorder) SlashRedelegation(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SlashRedelegation", reflect.TypeOf((*MockStakingKeeper)(nil).SlashRedelegation), arg0, arg1, arg2, arg3, arg4) +} + +// SlashUnbondingDelegation mocks base method. +func (m *MockStakingKeeper) SlashUnbondingDelegation(arg0 types0.Context, arg1 types4.UnbondingDelegation, arg2 int64, arg3 types0.Dec) math.Int { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SlashUnbondingDelegation", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(math.Int) + return ret0 +} + +// SlashUnbondingDelegation indicates an expected call of SlashUnbondingDelegation. +func (mr *MockStakingKeeperMockRecorder) SlashUnbondingDelegation(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SlashUnbondingDelegation", reflect.TypeOf((*MockStakingKeeper)(nil).SlashUnbondingDelegation), arg0, arg1, arg2, arg3) +} + // SlashWithInfractionReason mocks base method. -func (m *MockStakingKeeper) SlashWithInfractionReason(arg0 types0.Context, arg1 types0.ConsAddress, arg2, arg3 int64, arg4 types0.Dec, arg5 types5.Infraction) math.Int { +func (m *MockStakingKeeper) SlashWithInfractionReason(arg0 types0.Context, arg1 types0.ConsAddress, arg2, arg3 int64, arg4 types0.Dec, arg5 types4.Infraction) math.Int { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SlashWithInfractionReason", arg0, arg1, arg2, arg3, arg4, arg5) ret0, _ := ret[0].(math.Int) @@ -338,10 +393,10 @@ func (mr *MockStakingKeeperMockRecorder) Unjail(ctx, addr interface{}) *gomock.C } // Validator mocks base method. -func (m *MockStakingKeeper) Validator(ctx types0.Context, addr types0.ValAddress) types5.ValidatorI { +func (m *MockStakingKeeper) Validator(ctx types0.Context, addr types0.ValAddress) types4.ValidatorI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Validator", ctx, addr) - ret0, _ := ret[0].(types5.ValidatorI) + ret0, _ := ret[0].(types4.ValidatorI) return ret0 } @@ -352,10 +407,10 @@ func (mr *MockStakingKeeperMockRecorder) Validator(ctx, addr interface{}) *gomoc } // ValidatorByConsAddr mocks base method. -func (m *MockStakingKeeper) ValidatorByConsAddr(ctx types0.Context, consAddr types0.ConsAddress) types5.ValidatorI { +func (m *MockStakingKeeper) ValidatorByConsAddr(ctx types0.Context, consAddr types0.ConsAddress) types4.ValidatorI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ValidatorByConsAddr", ctx, consAddr) - ret0, _ := ret[0].(types5.ValidatorI) + ret0, _ := ret[0].(types4.ValidatorI) return ret0 } @@ -365,41 +420,6 @@ func (mr *MockStakingKeeperMockRecorder) ValidatorByConsAddr(ctx, consAddr inter return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidatorByConsAddr", reflect.TypeOf((*MockStakingKeeper)(nil).ValidatorByConsAddr), ctx, consAddr) } -// MockEvidenceKeeper is a mock of EvidenceKeeper interface. -type MockEvidenceKeeper struct { - ctrl *gomock.Controller - recorder *MockEvidenceKeeperMockRecorder -} - -// MockEvidenceKeeperMockRecorder is the mock recorder for MockEvidenceKeeper. -type MockEvidenceKeeperMockRecorder struct { - mock *MockEvidenceKeeper -} - -// NewMockEvidenceKeeper creates a new mock instance. -func NewMockEvidenceKeeper(ctrl *gomock.Controller) *MockEvidenceKeeper { - mock := &MockEvidenceKeeper{ctrl: ctrl} - mock.recorder = &MockEvidenceKeeperMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockEvidenceKeeper) EXPECT() *MockEvidenceKeeperMockRecorder { - return m.recorder -} - -// HandleEquivocationEvidence mocks base method. -func (m *MockEvidenceKeeper) HandleEquivocationEvidence(ctx types0.Context, evidence *types3.Equivocation) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "HandleEquivocationEvidence", ctx, evidence) -} - -// HandleEquivocationEvidence indicates an expected call of HandleEquivocationEvidence. -func (mr *MockEvidenceKeeperMockRecorder) HandleEquivocationEvidence(ctx, evidence interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleEquivocationEvidence", reflect.TypeOf((*MockEvidenceKeeper)(nil).HandleEquivocationEvidence), ctx, evidence) -} - // MockSlashingKeeper is a mock of SlashingKeeper interface. type MockSlashingKeeper struct { ctrl *gomock.Controller @@ -438,10 +458,10 @@ func (mr *MockSlashingKeeperMockRecorder) DowntimeJailDuration(arg0 interface{}) } // GetValidatorSigningInfo mocks base method. -func (m *MockSlashingKeeper) GetValidatorSigningInfo(ctx types0.Context, address types0.ConsAddress) (types4.ValidatorSigningInfo, bool) { +func (m *MockSlashingKeeper) GetValidatorSigningInfo(ctx types0.Context, address types0.ConsAddress) (types3.ValidatorSigningInfo, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetValidatorSigningInfo", ctx, address) - ret0, _ := ret[0].(types4.ValidatorSigningInfo) + ret0, _ := ret[0].(types3.ValidatorSigningInfo) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -556,28 +576,34 @@ func (mr *MockChannelKeeperMockRecorder) ChanCloseInit(ctx, portID, channelID, c } // GetChannel mocks base method. -func (m *MockChannelKeeper) GetChannel(ctx types0.Context, srcPort, srcChan string) (types9.Channel, bool) { +func (m *MockChannelKeeper) GetChannel(ctx types0.Context, srcPort, srcChan string) (types8.Channel, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetChannel", ctx, srcPort, srcChan) - ret0, _ := ret[0].(types9.Channel) + ret0, _ := ret[0].(types8.Channel) ret1, _ := ret[1].(bool) return ret0, ret1 } +// GetChannel indicates an expected call of GetChannel. +func (mr *MockChannelKeeperMockRecorder) GetChannel(ctx, srcPort, srcChan interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChannel", reflect.TypeOf((*MockChannelKeeper)(nil).GetChannel), ctx, srcPort, srcChan) +} + +// GetChannelConnection mocks base method. func (m *MockChannelKeeper) GetChannelConnection(ctx types0.Context, portID, channelID string) (string, exported.ConnectionI, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetChannelConnection", ctx, portID, channelID) ret0, _ := ret[0].(string) - ret1, _ := ret[0].(exported.ConnectionI) - ret2, _ := ret[1].(error) - + ret1, _ := ret[1].(exported.ConnectionI) + ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetChannel indicates an expected call of GetChannel. -func (mr *MockChannelKeeperMockRecorder) GetChannel(ctx, srcPort, srcChan interface{}) *gomock.Call { +// GetChannelConnection indicates an expected call of GetChannelConnection. +func (mr *MockChannelKeeperMockRecorder) GetChannelConnection(ctx, portID, channelID interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChannel", reflect.TypeOf((*MockChannelKeeper)(nil).GetChannel), ctx, srcPort, srcChan) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetChannelConnection", reflect.TypeOf((*MockChannelKeeper)(nil).GetChannelConnection), ctx, portID, channelID) } // GetNextSequenceSend mocks base method. @@ -596,7 +622,7 @@ func (mr *MockChannelKeeperMockRecorder) GetNextSequenceSend(ctx, portID, channe } // SendPacket mocks base method. -func (m *MockChannelKeeper) SendPacket(ctx types0.Context, chanCap *types2.Capability, sourcePort, sourceChannel string, timeoutHeight types7.Height, timeoutTimestamp uint64, data []byte) (uint64, error) { +func (m *MockChannelKeeper) SendPacket(ctx types0.Context, chanCap *types2.Capability, sourcePort, sourceChannel string, timeoutHeight types6.Height, timeoutTimestamp uint64, data []byte) (uint64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendPacket", ctx, chanCap, sourcePort, sourceChannel, timeoutHeight, timeoutTimestamp, data) ret0, _ := ret[0].(uint64) @@ -685,10 +711,10 @@ func (m *MockConnectionKeeper) EXPECT() *MockConnectionKeeperMockRecorder { } // GetConnection mocks base method. -func (m *MockConnectionKeeper) GetConnection(ctx types0.Context, connectionID string) (types8.ConnectionEnd, bool) { +func (m *MockConnectionKeeper) GetConnection(ctx types0.Context, connectionID string) (types7.ConnectionEnd, bool) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetConnection", ctx, connectionID) - ret0, _ := ret[0].(types8.ConnectionEnd) + ret0, _ := ret[0].(types7.ConnectionEnd) ret1, _ := ret[1].(bool) return ret0, ret1 } @@ -722,6 +748,20 @@ func (m *MockClientKeeper) EXPECT() *MockClientKeeperMockRecorder { return m.recorder } +// ClientStore mocks base method. +func (m *MockClientKeeper) ClientStore(ctx types0.Context, clientID string) types0.KVStore { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ClientStore", ctx, clientID) + ret0, _ := ret[0].(types0.KVStore) + return ret0 +} + +// ClientStore indicates an expected call of ClientStore. +func (mr *MockClientKeeperMockRecorder) ClientStore(ctx, clientID interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClientStore", reflect.TypeOf((*MockClientKeeper)(nil).ClientStore), ctx, clientID) +} + // CreateClient mocks base method. func (m *MockClientKeeper) CreateClient(ctx types0.Context, clientState exported.ClientState, consensusState exported.ConsensusState) (string, error) { m.ctrl.T.Helper() @@ -737,6 +777,21 @@ func (mr *MockClientKeeperMockRecorder) CreateClient(ctx, clientState, consensus return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateClient", reflect.TypeOf((*MockClientKeeper)(nil).CreateClient), ctx, clientState, consensusState) } +// GetClientConsensusState mocks base method. +func (m *MockClientKeeper) GetClientConsensusState(ctx types0.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetClientConsensusState", ctx, clientID, height) + ret0, _ := ret[0].(exported.ConsensusState) + ret1, _ := ret[1].(bool) + return ret0, ret1 +} + +// GetClientConsensusState indicates an expected call of GetClientConsensusState. +func (mr *MockClientKeeperMockRecorder) GetClientConsensusState(ctx, clientID, height interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClientConsensusState", reflect.TypeOf((*MockClientKeeper)(nil).GetClientConsensusState), ctx, clientID, height) +} + // GetClientState mocks base method. func (m *MockClientKeeper) GetClientState(ctx types0.Context, clientID string) (exported.ClientState, bool) { m.ctrl.T.Helper() @@ -782,6 +837,18 @@ func (mr *MockClientKeeperMockRecorder) GetSelfConsensusState(ctx, height interf return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSelfConsensusState", reflect.TypeOf((*MockClientKeeper)(nil).GetSelfConsensusState), ctx, height) } +// SetClientState mocks base method. +func (m *MockClientKeeper) SetClientState(ctx types0.Context, clientID string, clientState exported.ClientState) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetClientState", ctx, clientID, clientState) +} + +// SetClientState indicates an expected call of SetClientState. +func (mr *MockClientKeeperMockRecorder) SetClientState(ctx, clientID, clientState interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetClientState", reflect.TypeOf((*MockClientKeeper)(nil).SetClientState), ctx, clientID, clientState) +} + // MockDistributionKeeper is a mock of DistributionKeeper interface. type MockDistributionKeeper struct { ctrl *gomock.Controller @@ -982,10 +1049,10 @@ func (m *MockIBCTransferKeeper) EXPECT() *MockIBCTransferKeeperMockRecorder { } // Transfer mocks base method. -func (m *MockIBCTransferKeeper) Transfer(arg0 context.Context, arg1 *types6.MsgTransfer) (*types6.MsgTransferResponse, error) { +func (m *MockIBCTransferKeeper) Transfer(arg0 context.Context, arg1 *types5.MsgTransfer) (*types5.MsgTransferResponse, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Transfer", arg0, arg1) - ret0, _ := ret[0].(*types6.MsgTransferResponse) + ret0, _ := ret[0].(*types5.MsgTransferResponse) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -1020,10 +1087,10 @@ func (m *MockIBCCoreKeeper) EXPECT() *MockIBCCoreKeeperMockRecorder { } // ChannelOpenInit mocks base method. -func (m *MockIBCCoreKeeper) ChannelOpenInit(goCtx context.Context, msg *types9.MsgChannelOpenInit) (*types9.MsgChannelOpenInitResponse, error) { +func (m *MockIBCCoreKeeper) ChannelOpenInit(goCtx context.Context, msg *types8.MsgChannelOpenInit) (*types8.MsgChannelOpenInitResponse, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ChannelOpenInit", goCtx, msg) - ret0, _ := ret[0].(*types9.MsgChannelOpenInitResponse) + ret0, _ := ret[0].(*types8.MsgChannelOpenInitResponse) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index b58d6d2471..e35b02b4f8 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -87,7 +87,6 @@ type MockedKeepers struct { *MockBankKeeper *MockIBCTransferKeeper *MockIBCCoreKeeper - *MockEvidenceKeeper *MockDistributionKeeper } @@ -105,7 +104,6 @@ func NewMockedKeepers(ctrl *gomock.Controller) MockedKeepers { MockBankKeeper: NewMockBankKeeper(ctrl), MockIBCTransferKeeper: NewMockIBCTransferKeeper(ctrl), MockIBCCoreKeeper: NewMockIBCCoreKeeper(ctrl), - MockEvidenceKeeper: NewMockEvidenceKeeper(ctrl), MockDistributionKeeper: NewMockDistributionKeeper(ctrl), } } @@ -124,7 +122,6 @@ func NewInMemProviderKeeper(params InMemKeeperParams, mocks MockedKeepers) provi mocks.MockStakingKeeper, mocks.MockSlashingKeeper, mocks.MockAccountKeeper, - mocks.MockEvidenceKeeper, mocks.MockDistributionKeeper, mocks.MockBankKeeper, authtypes.FeeCollectorName, diff --git a/x/ccv/provider/client/cli/tx.go b/x/ccv/provider/client/cli/tx.go index 0d37ef52a9..78fbaaf9df 100644 --- a/x/ccv/provider/client/cli/tx.go +++ b/x/ccv/provider/client/cli/tx.go @@ -1,14 +1,21 @@ package cli import ( + "encoding/json" "fmt" + "os" + "strings" + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/version" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" ) @@ -24,6 +31,8 @@ func GetTxCmd() *cobra.Command { } cmd.AddCommand(NewAssignConsumerKeyCmd()) + cmd.AddCommand(NewSubmitConsumerMisbehaviourCmd()) + cmd.AddCommand(NewSubmitConsumerDoubleVotingCmd()) return cmd } @@ -65,3 +74,121 @@ func NewAssignConsumerKeyCmd() *cobra.Command { return cmd } + +func NewSubmitConsumerMisbehaviourCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "submit-consumer-misbehaviour [misbehaviour]", + Short: "submit an IBC misbehaviour for a consumer chain", + Long: strings.TrimSpace( + fmt.Sprintf(`Submit an IBC misbehaviour detected on a consumer chain. +An IBC misbehaviour contains two conflicting IBC client headers, which are used to form a light client attack evidence. +The misbehaviour type definition can be found in the IBC client messages, see ibc-go/proto/ibc/core/client/v1/tx.proto. + +Example: +%s tx provider submit-consumer-misbehaviour [path/to/misbehaviour.json] --from node0 --home ../node0 --chain-id $CID + `, version.AppName)), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return err + } + txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + submitter := clientCtx.GetFromAddress() + var misbehaviour ibctmtypes.Misbehaviour + if err := clientCtx.Codec.UnmarshalInterfaceJSON([]byte(args[1]), &misbehaviour); err != nil { + return err + } + + msg, err := types.NewMsgSubmitConsumerMisbehaviour(submitter, &misbehaviour) + if err != nil { + return err + } + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + + return cmd +} + +func NewSubmitConsumerDoubleVotingCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "submit-consumer-double-voting [evidence] [infraction_header]", + Short: "submit a double voting evidence for a consumer chain", + Long: strings.TrimSpace( + fmt.Sprintf(`Submit a Tendermint duplicate vote evidence detected on a consumer chain with + the IBC light client header for the infraction height. + The DuplicateVoteEvidence type definition can be found in the Tendermint messages, + see cometbft/proto/tendermint/types/evidence.proto and the IBC header + definition can be found in the IBC messages, see ibc-go/proto/ibc/lightclients/tendermint/v1/tendermint.proto. + +Example: +%s tx provider submit-consumer-double-voting [path/to/evidence.json] [path/to/infraction_header.json] --from node0 --home ../node0 --chain-id $CID +`, version.AppName)), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return err + } + txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + + submitter := clientCtx.GetFromAddress() + + ev := tmproto.DuplicateVoteEvidence{} + evidenceJson, err := os.ReadFile(args[0]) + if err != nil { + return err + } + + if err := json.Unmarshal(evidenceJson, &ev); err != nil { + return fmt.Errorf("duplicate vote evidence unmarshalling failed: %s", err) + } + + headerRaw, err := os.ReadFile(args[1]) + if err != nil { + return err + } + + header := ibctmtypes.Header{} + if err := types.ModuleCdc.UnmarshalJSON(headerRaw, &header); err != nil { + return fmt.Errorf("infraction IBC header unmarshalling failed: %s", err) + } + + msg, err := types.NewMsgSubmitConsumerDoubleVoting(submitter, &ev, &header) + if err != nil { + return err + } + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + _ = cmd.MarkFlagRequired(flags.FlagFrom) + + return cmd +} diff --git a/x/ccv/provider/client/proposal_handler.go b/x/ccv/provider/client/proposal_handler.go index 2b28c63466..bfd04af4c2 100644 --- a/x/ccv/provider/client/proposal_handler.go +++ b/x/ccv/provider/client/proposal_handler.go @@ -26,7 +26,6 @@ import ( var ( ConsumerAdditionProposalHandler = govclient.NewProposalHandler(SubmitConsumerAdditionPropTxCmd) ConsumerRemovalProposalHandler = govclient.NewProposalHandler(SubmitConsumerRemovalProposalTxCmd) - EquivocationProposalHandler = govclient.NewProposalHandler(SubmitEquivocationProposalTxCmd) ChangeRewardDenomsProposalHandler = govclient.NewProposalHandler(SubmitChangeRewardDenomsProposalTxCmd) ) @@ -167,69 +166,6 @@ Where proposal.json contains: } } -// SubmitEquivocationProposalTxCmd returns a CLI command handler for submitting -// a equivocation proposal via a transaction. -func SubmitEquivocationProposalTxCmd() *cobra.Command { - return &cobra.Command{ - Use: "equivocation [proposal-file]", - Args: cobra.ExactArgs(1), - Short: "Submit an equivocation proposal", - Long: fmt.Sprintf(`Submit an equivocation proposal along with an initial deposit. -The proposal details must be supplied via a JSON file. - -Example: -$ tx gov submit-legacy-proposal equivocation --from= - -Where proposal.json contains: -{ - "title": "Equivoque Foo validator", - "summary": "He double-signs on the Foobar consumer chain", - "equivocations": [ - { - "height": 10420042, - "time": "2023-01-27T15:59:50.121607-08:00", - "power": 10, - "consensus_address": "%s1s5afhd6gxevu37mkqcvvsj8qeylhn0rz46zdlq" - } - ], - "deposit": "10000stake" -} -`, sdk.GetConfig().GetBech32ConsensusAddrPrefix()), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - proposal, err := ParseEquivocationProposalJSON(args[0]) - if err != nil { - return err - } - - content := types.NewEquivocationProposal(proposal.Title, proposal.Summary, proposal.Equivocations) - - from := clientCtx.GetFromAddress() - - msgContent, err := govv1.NewLegacyContent(content, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) - if err != nil { - return err - } - - msg, err := govv1.NewMsgSubmitProposal([]sdk.Msg{msgContent}, deposit, from.String(), "", content.GetTitle(), proposal.Summary) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } -} - // SubmitChangeRewardDenomsProposalTxCmd returns a CLI command handler for submitting // a change reward denoms proposal via a transaction. func SubmitChangeRewardDenomsProposalTxCmd() *cobra.Command { @@ -378,38 +314,6 @@ func ParseConsumerRemovalProposalJSON(proposalFile string) (ConsumerRemovalPropo return proposal, nil } -type EquivocationProposalJSON struct { - // evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - Summary string `json:"summary"` - types.EquivocationProposal - - Deposit string `json:"deposit"` -} - -type EquivocationProposalReq struct { - Proposer sdk.AccAddress `json:"proposer"` - - // evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - types.EquivocationProposal - - Deposit sdk.Coins `json:"deposit"` -} - -func ParseEquivocationProposalJSON(proposalFile string) (EquivocationProposalJSON, error) { - proposal := EquivocationProposalJSON{} - - contents, err := os.ReadFile(filepath.Clean(proposalFile)) - if err != nil { - return proposal, err - } - - if err := json.Unmarshal(contents, &proposal); err != nil { - return proposal, err - } - - return proposal, nil -} - type ChangeRewardDenomsProposalJSON struct { Summary string `json:"summary"` types.ChangeRewardDenomsProposal @@ -535,34 +439,4 @@ func postConsumerRemovalProposalHandlerFn(clientCtx client.Context) http.Handler tx.WriteGeneratedTxResponse(clientCtx, w, req.BaseReq, msg) } } - -func postEquivocationProposalHandlerFn(clientCtx client.Context) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req EquivocationProposalReq - if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) { - return - } - - req.BaseReq = req.BaseReq.Sanitize() - if !req.BaseReq.ValidateBasic(w) { - return - } - - content := types.NewEquivocationProposal(req.Title, req.Description, req.Equivocations) - - msg, err := govtypes.NewMsgSubmitProposal(content, req.Deposit, req.Proposer) - if rest.CheckBadRequestError(w, err) { - return - } - - if rest.CheckBadRequestError(w, msg.ValidateBasic()) { - return - } - - tx.WriteGeneratedTxResponse(clientCtx, w, req.BaseReq, msg) - } -} - - - */ diff --git a/x/ccv/provider/handler.go b/x/ccv/provider/handler.go index 067d896cda..69b18e9af1 100644 --- a/x/ccv/provider/handler.go +++ b/x/ccv/provider/handler.go @@ -20,6 +20,12 @@ func NewHandler(k *keeper.Keeper) sdk.Handler { case *types.MsgAssignConsumerKey: res, err := msgServer.AssignConsumerKey(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgSubmitConsumerMisbehaviour: + res, err := msgServer.SubmitConsumerMisbehaviour(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgSubmitConsumerDoubleVoting: + res, err := msgServer.SubmitConsumerDoubleVoting(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) default: return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } diff --git a/x/ccv/provider/keeper/consumer_equivocation.go b/x/ccv/provider/keeper/consumer_equivocation.go new file mode 100644 index 0000000000..53232b4205 --- /dev/null +++ b/x/ccv/provider/keeper/consumer_equivocation.go @@ -0,0 +1,480 @@ +package keeper + +import ( + "bytes" + "encoding/binary" + "fmt" + + ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + + errorsmod "cosmossdk.io/errors" + "cosmossdk.io/math" + + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + tmtypes "github.com/cometbft/cometbft/types" + + "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" +) + +// +// Double Voting section +// + +// HandleConsumerDoubleVoting verifies a double voting evidence for a given a consumer chain ID +// and a public key and, if successful, executes the slashing, jailing, and tombstoning of the malicious validator. +func (k Keeper) HandleConsumerDoubleVoting( + ctx sdk.Context, + evidence *tmtypes.DuplicateVoteEvidence, + chainID string, + pubkey cryptotypes.PubKey, +) error { + // verifies the double voting evidence using the consumer chain public key + if err := k.VerifyDoubleVotingEvidence(*evidence, chainID, pubkey); err != nil { + return err + } + + // get the validator's consensus address on the provider + providerAddr := k.GetProviderAddrFromConsumerAddr( + ctx, + chainID, + types.NewConsumerConsAddress(sdk.ConsAddress(evidence.VoteA.ValidatorAddress.Bytes())), + ) + + if err := k.SlashValidator(ctx, providerAddr); err != nil { + return err + } + if err := k.JailAndTombstoneValidator(ctx, providerAddr); err != nil { + return err + } + + k.Logger(ctx).Info( + "confirmed equivocation", + "byzantine validator address", providerAddr.String(), + ) + + return nil +} + +// VerifyDoubleVotingEvidence verifies a double voting evidence +// for a given chain id and a validator public key +func (k Keeper) VerifyDoubleVotingEvidence( + evidence tmtypes.DuplicateVoteEvidence, + chainID string, + pubkey cryptotypes.PubKey, +) error { + if pubkey == nil { + return fmt.Errorf("validator public key cannot be empty") + } + + // check that the validator address in the evidence is derived from the provided public key + if !bytes.Equal(pubkey.Address(), evidence.VoteA.ValidatorAddress) { + return errorsmod.Wrapf( + ccvtypes.ErrInvalidDoubleVotingEvidence, + "public key %s doesn't correspond to the validator address %s in double vote evidence", + pubkey.String(), evidence.VoteA.ValidatorAddress.String(), + ) + } + + // Note the age of the evidence isn't checked. + + // height/round/type must be the same + if evidence.VoteA.Height != evidence.VoteB.Height || + evidence.VoteA.Round != evidence.VoteB.Round || + evidence.VoteA.Type != evidence.VoteB.Type { + return errorsmod.Wrapf( + ccvtypes.ErrInvalidDoubleVotingEvidence, + "height/round/type are not the same: %d/%d/%v vs %d/%d/%v", + evidence.VoteA.Height, evidence.VoteA.Round, evidence.VoteA.Type, + evidence.VoteB.Height, evidence.VoteB.Round, evidence.VoteB.Type) + } + + // Addresses must be the same + if !bytes.Equal(evidence.VoteA.ValidatorAddress, evidence.VoteB.ValidatorAddress) { + return errorsmod.Wrapf( + ccvtypes.ErrInvalidDoubleVotingEvidence, + "validator addresses do not match: %X vs %X", + evidence.VoteA.ValidatorAddress, + evidence.VoteB.ValidatorAddress, + ) + } + + // BlockIDs must be different + if evidence.VoteA.BlockID.Equals(evidence.VoteB.BlockID) { + return errorsmod.Wrapf( + ccvtypes.ErrInvalidDoubleVotingEvidence, + "block IDs are the same (%v) - not a real duplicate vote", + evidence.VoteA.BlockID, + ) + } + + va := evidence.VoteA.ToProto() + vb := evidence.VoteB.ToProto() + + // signatures must be valid + if !pubkey.VerifySignature(tmtypes.VoteSignBytes(chainID, va), evidence.VoteA.Signature) { + return fmt.Errorf("verifying VoteA: %w", tmtypes.ErrVoteInvalidSignature) + } + if !pubkey.VerifySignature(tmtypes.VoteSignBytes(chainID, vb), evidence.VoteB.Signature) { + return fmt.Errorf("verifying VoteB: %w", tmtypes.ErrVoteInvalidSignature) + } + + return nil +} + +// +// Light Client Attack (IBC misbehavior) section +// + +// HandleConsumerMisbehaviour checks if the given IBC misbehaviour corresponds to an equivocation light client attack, +// and in this case, slashes, jails, and tombstones +func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) error { + logger := k.Logger(ctx) + + // Check that the misbehaviour is valid and that the client consensus states at trusted heights are within trusting period + if err := k.CheckMisbehaviour(ctx, misbehaviour); err != nil { + logger.Info("Misbehaviour rejected", err.Error()) + + return err + } + + // Since the misbehaviour packet was received within the trusting period + // w.r.t to the trusted consensus states the infraction age + // isn't too old. see ibc-go/modules/light-clients/07-tendermint/types/misbehaviour_handle.go + + // Get Byzantine validators from the conflicting headers + byzantineValidators, err := k.GetByzantineValidators(ctx, misbehaviour) + if err != nil { + return err + } + + provAddrs := make([]types.ProviderConsAddress, len(byzantineValidators)) + + // slash, jail, and tombstone the Byzantine validators + for _, v := range byzantineValidators { + providerAddr := k.GetProviderAddrFromConsumerAddr( + ctx, + misbehaviour.Header1.Header.ChainID, + types.NewConsumerConsAddress(sdk.ConsAddress(v.Address.Bytes())), + ) + err := k.SlashValidator(ctx, providerAddr) + if err != nil { + logger.Error("failed to slash validator: %s", err) + continue + } + err = k.JailAndTombstoneValidator(ctx, providerAddr) + // JailAndTombstoneValidator should never return an error if + // SlashValidator succeeded because both methods fail if the malicious + // validator is either or both !found, unbonded and tombstoned. + if err != nil { + panic(err) + } + + provAddrs = append(provAddrs, providerAddr) + } + + // Return an error if no validators were punished + if len(provAddrs) == 0 { + return fmt.Errorf("failed to slash, jail, or tombstone all validators: %v", byzantineValidators) + } + + logger.Info( + "confirmed equivocation light client attack", + "byzantine validators slashed, jailed and tombstoned", provAddrs, + ) + + return nil +} + +// GetByzantineValidators returns the validators that signed both headers. +// If the misbehavior is an equivocation light client attack, then these +// validators are the Byzantine validators. +func (k Keeper) GetByzantineValidators(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) (validators []*tmtypes.Validator, err error) { + // construct the trusted and conflicted light blocks + lightBlock1, err := headerToLightBlock(*misbehaviour.Header1) + if err != nil { + return validators, err + } + lightBlock2, err := headerToLightBlock(*misbehaviour.Header2) + if err != nil { + return validators, err + } + + // Check if the misbehaviour corresponds to an Amnesia attack, + // meaning that the conflicting headers have both valid state transitions + // and different commit rounds. In this case, we return no validators as + // we can't identify the byzantine validators. + // + // Note that we cannot differentiate which of the headers is trusted or malicious, + if !headersStateTransitionsAreConflicting(*lightBlock1.Header, *lightBlock2.Header) && lightBlock1.Commit.Round != lightBlock2.Commit.Round { + return validators, nil + } + + // compare the signatures of the headers + // and return the intersection of validators who signed both + + // create a map with the validators' address that signed header1 + header1Signers := map[string]int{} + for idx, sign := range lightBlock1.Commit.Signatures { + if sign.Absent() { + continue + } + header1Signers[sign.ValidatorAddress.String()] = idx + } + + // iterate over the header2 signers and check if they signed header1 + for sigIdxHeader2, sign := range lightBlock2.Commit.Signatures { + if sign.Absent() { + continue + } + if sigIdxHeader1, ok := header1Signers[sign.ValidatorAddress.String()]; ok { + if err := verifyLightBlockCommitSig(*lightBlock1, sigIdxHeader1); err != nil { + return nil, err + } + + if err := verifyLightBlockCommitSig(*lightBlock2, sigIdxHeader2); err != nil { + return nil, err + } + + _, val := lightBlock1.ValidatorSet.GetByAddress(sign.ValidatorAddress) + validators = append(validators, val) + } + } + + return validators, nil +} + +// headerToLightBlock returns a CometBFT light block from the given IBC header +func headerToLightBlock(h ibctmtypes.Header) (*tmtypes.LightBlock, error) { + sh, err := tmtypes.SignedHeaderFromProto(h.SignedHeader) + if err != nil { + return nil, err + } + + vs, err := tmtypes.ValidatorSetFromProto(h.ValidatorSet) + if err != nil { + return nil, err + } + + return &tmtypes.LightBlock{ + SignedHeader: sh, + ValidatorSet: vs, + }, nil +} + +// CheckMisbehaviour checks that headers in the given misbehaviour forms +// a valid light client attack on a light client that tracks an ICS consumer chain +func (k Keeper) CheckMisbehaviour(ctx sdk.Context, misbehaviour ibctmtypes.Misbehaviour) error { + // check that the misbehaviour is for an ICS consumer chain + clientId, found := k.GetConsumerClientId(ctx, misbehaviour.Header1.Header.ChainID) + if !found { + return fmt.Errorf("incorrect misbehaviour with conflicting headers from a non-existent consumer chain: %s", misbehaviour.Header1.Header.ChainID) + } else if misbehaviour.ClientId != clientId { + return fmt.Errorf("incorrect misbehaviour: expected client ID for consumer chain %s is %s got %s", + misbehaviour.Header1.Header.ChainID, + clientId, + misbehaviour.ClientId, + ) + } + + clientState, found := k.clientKeeper.GetClientState(ctx, clientId) + if !found { + return errorsmod.Wrapf(ibcclienttypes.ErrClientNotFound, "cannot find client state for client with ID %s", clientId) + } + + clientStore := k.clientKeeper.ClientStore(ctx, clientId) + + // Check that the headers are at the same height to ensure that + // the misbehaviour is for a light client attack and not a time violation, + // see CheckForMisbehaviour in ibc-go/blob/v7.3.0/modules/light-clients/07-tendermint/misbehaviour_handle.go#L73 + if !misbehaviour.Header1.GetHeight().EQ(misbehaviour.Header2.GetHeight()) { + return errorsmod.Wrap(ibcclienttypes.ErrInvalidMisbehaviour, "headers are not at same height") + } + + // CheckForMisbehaviour verifies that the headers have different blockID hashes + ok := clientState.CheckForMisbehaviour(ctx, k.cdc, clientStore, &misbehaviour) + if !ok { + return errorsmod.Wrapf(ibcclienttypes.ErrInvalidMisbehaviour, "invalid misbehaviour for client-id: %s", misbehaviour.ClientId) + } + + // VerifyClientMessage calls verifyMisbehaviour which verifies that the headers in the misbehaviour + // are valid against their respective trusted consensus states and that at least a TrustLevel of the validator set signed their commit, + // see checkMisbehaviourHeader in ibc-go/blob/v7.3.0/modules/light-clients/07-tendermint/misbehaviour_handle.go#L126 + if err := clientState.VerifyClientMessage(ctx, k.cdc, clientStore, &misbehaviour); err != nil { + return err + } + + return nil +} + +// Check if the given block headers have conflicting state transitions. +// Note that this method was copied from ConflictingHeaderIsInvalid in CometBFT, +// see https://github.com/cometbft/cometbft/blob/v0.34.27/types/evidence.go#L285 +func headersStateTransitionsAreConflicting(h1, h2 tmtypes.Header) bool { + return !bytes.Equal(h1.ValidatorsHash, h2.ValidatorsHash) || + !bytes.Equal(h1.NextValidatorsHash, h2.NextValidatorsHash) || + !bytes.Equal(h1.ConsensusHash, h2.ConsensusHash) || + !bytes.Equal(h1.AppHash, h2.AppHash) || + !bytes.Equal(h1.LastResultsHash, h2.LastResultsHash) +} + +func verifyLightBlockCommitSig(lightBlock tmtypes.LightBlock, sigIdx int) error { + // get signature + sig := lightBlock.Commit.Signatures[sigIdx] + + // get validator + idx, val := lightBlock.ValidatorSet.GetByAddress(sig.ValidatorAddress) + if idx == -1 { + return fmt.Errorf("incorrect signature: validator address %s isn't part of the validator set", sig.ValidatorAddress.String()) + } + + // verify validator pubkey corresponds to signature validator address + if !bytes.Equal(val.PubKey.Address(), sig.ValidatorAddress) { + return fmt.Errorf("validator public key doesn't correspond to signature validator address: %s!= %s", val.PubKey.Address(), sig.ValidatorAddress) + } + + // validate signature + voteSignBytes := lightBlock.Commit.VoteSignBytes(lightBlock.ChainID, int32(sigIdx)) + if !val.PubKey.VerifySignature(voteSignBytes, sig.Signature) { + return fmt.Errorf("wrong signature (#%d): %X", sigIdx, sig.Signature) + } + + return nil +} + +// +// Punish Validator section +// + +// JailAndTombstoneValidator jails and tombstones the validator with the given provider consensus address +func (k Keeper) JailAndTombstoneValidator(ctx sdk.Context, providerAddr types.ProviderConsAddress) error { + validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, providerAddr.ToSdkConsAddr()) + if !found { + return errorsmod.Wrapf(slashingtypes.ErrNoValidatorForAddress, "provider consensus address: %s", providerAddr.String()) + } + + if validator.IsUnbonded() { + return fmt.Errorf("validator is unbonded. provider consensus address: %s", providerAddr.String()) + } + + if k.slashingKeeper.IsTombstoned(ctx, providerAddr.ToSdkConsAddr()) { + return fmt.Errorf("validator is tombstoned. provider consensus address: %s", providerAddr.String()) + } + + // jail validator if not already + if !validator.IsJailed() { + k.stakingKeeper.Jail(ctx, providerAddr.ToSdkConsAddr()) + } + + k.slashingKeeper.JailUntil(ctx, providerAddr.ToSdkConsAddr(), evidencetypes.DoubleSignJailEndTime) + + // Tombstone the validator so that we cannot slash the validator more than once + // Note that we cannot simply use the fact that a validator is jailed to avoid slashing more than once + // because then a validator could i) perform an equivocation, ii) get jailed (e.g., through downtime) + // and in such a case the validator would not get slashed when we call `SlashValidator`. + k.slashingKeeper.Tombstone(ctx, providerAddr.ToSdkConsAddr()) + + return nil +} + +// ComputePowerToSlash computes the power to be slashed based on the tokens in non-matured `undelegations` and +// `redelegations`, as well as the current `power` of the validator. +// Note that this method does not perform any slashing. +func (k Keeper) ComputePowerToSlash(ctx sdk.Context, validator stakingtypes.Validator, undelegations []stakingtypes.UnbondingDelegation, + redelegations []stakingtypes.Redelegation, power int64, powerReduction math.Int, +) int64 { + // compute the total numbers of tokens currently being undelegated + undelegationsInTokens := sdk.NewInt(0) + + // Note that we use a **cached** context to avoid any actual slashing of undelegations or redelegations. + cachedCtx, _ := ctx.CacheContext() + for _, u := range undelegations { + amountSlashed := k.stakingKeeper.SlashUnbondingDelegation(cachedCtx, u, 0, sdk.NewDec(1)) + undelegationsInTokens = undelegationsInTokens.Add(amountSlashed) + } + + // compute the total numbers of tokens currently being redelegated + redelegationsInTokens := sdk.NewInt(0) + for _, r := range redelegations { + amountSlashed := k.stakingKeeper.SlashRedelegation(cachedCtx, validator, r, 0, sdk.NewDec(1)) + redelegationsInTokens = redelegationsInTokens.Add(amountSlashed) + } + + // The power we pass to staking's keeper `Slash` method is the current power of the validator together with the total + // power of all the currently undelegated and redelegated tokens (see docs/docs/adrs/adr-013-equivocation-slashing.md). + undelegationsAndRedelegationsInPower := sdk.TokensToConsensusPower( + undelegationsInTokens.Add(redelegationsInTokens), powerReduction) + + return power + undelegationsAndRedelegationsInPower +} + +// SlashValidator slashes validator with given provider Address +func (k Keeper) SlashValidator(ctx sdk.Context, providerAddr types.ProviderConsAddress) error { + validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, providerAddr.ToSdkConsAddr()) + if !found { + return errorsmod.Wrapf(slashingtypes.ErrNoValidatorForAddress, "provider consensus address: %s", providerAddr.String()) + } + + if validator.IsUnbonded() { + return fmt.Errorf("validator is unbonded. provider consensus address: %s", providerAddr.String()) + } + + if k.slashingKeeper.IsTombstoned(ctx, providerAddr.ToSdkConsAddr()) { + return fmt.Errorf("validator is tombstoned. provider consensus address: %s", providerAddr.String()) + } + + undelegations := k.stakingKeeper.GetUnbondingDelegationsFromValidator(ctx, validator.GetOperator()) + redelegations := k.stakingKeeper.GetRedelegationsFromSrcValidator(ctx, validator.GetOperator()) + lastPower := k.stakingKeeper.GetLastValidatorPower(ctx, validator.GetOperator()) + powerReduction := k.stakingKeeper.PowerReduction(ctx) + totalPower := k.ComputePowerToSlash(ctx, validator, undelegations, redelegations, lastPower, powerReduction) + slashFraction := k.slashingKeeper.SlashFractionDoubleSign(ctx) + + consAdrr, err := validator.GetConsAddr() + if err != nil { + panic(err) + } + + k.stakingKeeper.SlashWithInfractionReason(ctx, consAdrr, 0, totalPower, slashFraction, stakingtypes.Infraction_INFRACTION_DOUBLE_SIGN) + + return nil +} + +// +// CRUD section +// + +// SetEquivocationEvidenceMinHeight sets the the minimum height +// of a valid consumer equivocation evidence for a given consumer chain ID +func (k Keeper) SetEquivocationEvidenceMinHeight(ctx sdk.Context, chainID string, height uint64) { + store := ctx.KVStore(k.storeKey) + heightBytes := make([]byte, 8) + binary.BigEndian.PutUint64(heightBytes, height) + + store.Set(types.EquivocationEvidenceMinHeightKey(chainID), heightBytes) +} + +// GetEquivocationEvidenceMinHeight returns the the minimum height +// of a valid consumer equivocation evidence for a given consumer chain ID +func (k Keeper) GetEquivocationEvidenceMinHeight(ctx sdk.Context, chainID string) uint64 { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.EquivocationEvidenceMinHeightKey(chainID)) + if bz == nil { + return 0 + } + + return binary.BigEndian.Uint64(bz) +} + +// DeleteEquivocationEvidenceMinHeight deletes the the minimum height +// of a valid consumer equivocation evidence for a given consumer chain ID +func (k Keeper) DeleteEquivocationEvidenceMinHeight(ctx sdk.Context, chainID string) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.EquivocationEvidenceMinHeightKey(chainID)) +} diff --git a/x/ccv/provider/keeper/consumer_equivocation_test.go b/x/ccv/provider/keeper/consumer_equivocation_test.go new file mode 100644 index 0000000000..f7a736dff1 --- /dev/null +++ b/x/ccv/provider/keeper/consumer_equivocation_test.go @@ -0,0 +1,790 @@ +package keeper_test + +import ( + "fmt" + "testing" + "time" + + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + + "cosmossdk.io/math" + + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + tmtypes "github.com/cometbft/cometbft/types" + + cryptotestutil "github.com/cosmos/interchain-security/v3/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v3/testutil/keeper" + "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" +) + +func TestVerifyDoubleVotingEvidence(t *testing.T) { + keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "consumer" + + signer1 := tmtypes.NewMockPV() + signer2 := tmtypes.NewMockPV() + + val1 := tmtypes.NewValidator(signer1.PrivKey.PubKey(), 1) + val2 := tmtypes.NewValidator(signer2.PrivKey.PubKey(), 1) + + valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{val1, val2}) + + blockID1 := cryptotestutil.MakeBlockID([]byte("blockhash"), 1000, []byte("partshash")) + blockID2 := cryptotestutil.MakeBlockID([]byte("blockhash2"), 1000, []byte("partshash")) + + ctx = ctx.WithBlockTime(time.Now()) + + valPubkey1, err := cryptocodec.FromTmPubKeyInterface(val1.PubKey) + require.NoError(t, err) + + valPubkey2, err := cryptocodec.FromTmPubKeyInterface(val2.PubKey) + require.NoError(t, err) + + testCases := []struct { + name string + votes []*tmtypes.Vote + chainID string + pubkey cryptotypes.PubKey + expPass bool + }{ + { + "invalid verifying public key - shouldn't pass", + []*tmtypes.Vote{ + cryptotestutil.MakeAndSignVote( + blockID1, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + cryptotestutil.MakeAndSignVote( + blockID2, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + }, + chainID, + nil, + false, + }, + { + "verifying public key doesn't correspond to validator address", + []*tmtypes.Vote{ + cryptotestutil.MakeAndSignVoteWithForgedValAddress( + blockID1, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + signer2, + chainID, + ), + cryptotestutil.MakeAndSignVoteWithForgedValAddress( + blockID2, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + signer2, + chainID, + ), + }, + chainID, + valPubkey1, + false, + }, + { + "evidence has votes with different block height - shouldn't pass", + []*tmtypes.Vote{ + cryptotestutil.MakeAndSignVote( + blockID1, + ctx.BlockHeight()+1, + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + cryptotestutil.MakeAndSignVote( + blockID2, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + }, + chainID, + valPubkey1, + false, + }, + { + "evidence has votes with different validator address - shouldn't pass", + []*tmtypes.Vote{ + cryptotestutil.MakeAndSignVote( + blockID1, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + cryptotestutil.MakeAndSignVote( + blockID2, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer2, + chainID, + ), + }, + chainID, + valPubkey1, + false, + }, + { + "evidence has votes with same block IDs - shouldn't pass", + []*tmtypes.Vote{ + cryptotestutil.MakeAndSignVote( + blockID1, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + cryptotestutil.MakeAndSignVote( + blockID1, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + }, + chainID, + valPubkey1, + false, + }, + { + "given chain ID isn't the same as the one used to sign the votes - shouldn't pass", + []*tmtypes.Vote{ + cryptotestutil.MakeAndSignVote( + blockID1, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + cryptotestutil.MakeAndSignVote( + blockID2, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + }, + "WrongChainID", + valPubkey1, + false, + }, + { + "voteA is signed using the wrong chain ID - shouldn't pass", + []*tmtypes.Vote{ + cryptotestutil.MakeAndSignVote( + blockID1, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + "WrongChainID", + ), + cryptotestutil.MakeAndSignVote( + blockID2, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + }, + chainID, + valPubkey1, + false, + }, + { + "voteB is signed using the wrong chain ID - shouldn't pass", + []*tmtypes.Vote{ + cryptotestutil.MakeAndSignVote( + blockID1, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + cryptotestutil.MakeAndSignVote( + blockID2, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + "WrongChainID", + ), + }, + chainID, + valPubkey1, + false, + }, + { + "wrong public key - shouldn't pass", + []*tmtypes.Vote{ + cryptotestutil.MakeAndSignVote( + blockID1, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + cryptotestutil.MakeAndSignVote( + blockID2, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + }, + chainID, + valPubkey2, + false, + }, + { + "valid double voting evidence should pass", + []*tmtypes.Vote{ + cryptotestutil.MakeAndSignVote( + blockID1, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + cryptotestutil.MakeAndSignVote( + blockID2, + ctx.BlockHeight(), + ctx.BlockTime(), + valSet, + signer1, + chainID, + ), + }, + chainID, + valPubkey1, + true, + }, + } + + for _, tc := range testCases { + err = keeper.VerifyDoubleVotingEvidence( + tmtypes.DuplicateVoteEvidence{ + VoteA: tc.votes[0], + VoteB: tc.votes[1], + ValidatorPower: val1.VotingPower, + TotalVotingPower: val1.VotingPower, + Timestamp: tc.votes[0].Timestamp, + }, + tc.chainID, + tc.pubkey, + ) + if tc.expPass { + require.NoError(t, err) + } else { + require.Error(t, err) + } + } +} + +// TestJailAndTombstoneValidator tests that the jailing of a validator is only executed +// under the conditions that the validator is neither unbonded, nor jailed, nor tombstoned. +func TestJailAndTombstoneValidator(t *testing.T) { + providerConsAddr := cryptotestutil.NewCryptoIdentityFromIntSeed(7842334).ProviderConsAddress() + testCases := []struct { + name string + provAddr types.ProviderConsAddress + expectedCalls func(sdk.Context, testkeeper.MockedKeepers, types.ProviderConsAddress) []*gomock.Call + }{ + { + "unfound validator", + providerConsAddr, + func(ctx sdk.Context, mocks testkeeper.MockedKeepers, + provAddr types.ProviderConsAddress, + ) []*gomock.Call { + return []*gomock.Call{ + // We only expect a single call to GetValidatorByConsAddr. + // Method will return once validator is not found. + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( + ctx, providerConsAddr.ToSdkConsAddr()).Return( + stakingtypes.Validator{}, false, // false = Not found. + ).Times(1), + } + }, + }, + { + "unbonded validator", + providerConsAddr, + func(ctx sdk.Context, mocks testkeeper.MockedKeepers, + provAddr types.ProviderConsAddress, + ) []*gomock.Call { + return []*gomock.Call{ + // We only expect a single call to GetValidatorByConsAddr. + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( + ctx, providerConsAddr.ToSdkConsAddr()).Return( + stakingtypes.Validator{Status: stakingtypes.Unbonded}, true, + ).Times(1), + } + }, + }, + { + "tombstoned validator", + providerConsAddr, + func(ctx sdk.Context, mocks testkeeper.MockedKeepers, + provAddr types.ProviderConsAddress, + ) []*gomock.Call { + return []*gomock.Call{ + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( + ctx, providerConsAddr.ToSdkConsAddr()).Return( + stakingtypes.Validator{}, true, + ).Times(1), + mocks.MockSlashingKeeper.EXPECT().IsTombstoned( + ctx, providerConsAddr.ToSdkConsAddr()).Return( + true, + ).Times(1), + } + }, + }, + { + "jailed validator", + providerConsAddr, + func(ctx sdk.Context, mocks testkeeper.MockedKeepers, + provAddr types.ProviderConsAddress, + ) []*gomock.Call { + return []*gomock.Call{ + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( + ctx, providerConsAddr.ToSdkConsAddr()).Return( + stakingtypes.Validator{Jailed: true}, true, + ).Times(1), + mocks.MockSlashingKeeper.EXPECT().IsTombstoned( + ctx, providerConsAddr.ToSdkConsAddr()).Return( + false, + ).Times(1), + mocks.MockSlashingKeeper.EXPECT().JailUntil( + ctx, providerConsAddr.ToSdkConsAddr(), evidencetypes.DoubleSignJailEndTime). + Times(1), + mocks.MockSlashingKeeper.EXPECT().Tombstone( + ctx, providerConsAddr.ToSdkConsAddr()). + Times(1), + } + }, + }, + { + "bonded validator", + providerConsAddr, + func(ctx sdk.Context, mocks testkeeper.MockedKeepers, + provAddr types.ProviderConsAddress, + ) []*gomock.Call { + return []*gomock.Call{ + mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr( + ctx, providerConsAddr.ToSdkConsAddr()).Return( + stakingtypes.Validator{Status: stakingtypes.Bonded}, true, + ).Times(1), + mocks.MockSlashingKeeper.EXPECT().IsTombstoned( + ctx, providerConsAddr.ToSdkConsAddr()).Return( + false, + ).Times(1), + mocks.MockStakingKeeper.EXPECT().Jail( + ctx, providerConsAddr.ToSdkConsAddr()). + Times(1), + mocks.MockSlashingKeeper.EXPECT().JailUntil( + ctx, providerConsAddr.ToSdkConsAddr(), evidencetypes.DoubleSignJailEndTime). + Times(1), + mocks.MockSlashingKeeper.EXPECT().Tombstone( + ctx, providerConsAddr.ToSdkConsAddr()). + Times(1), + } + }, + }, + } + + for _, tc := range testCases { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx( + t, testkeeper.NewInMemKeeperParams(t)) + + // Setup expected mock calls + gomock.InOrder(tc.expectedCalls(ctx, mocks, tc.provAddr)...) + + // Execute method and assert expected mock calls + providerKeeper.JailAndTombstoneValidator(ctx, tc.provAddr) + + ctrl.Finish() + } +} + +// createUndelegation creates an undelegation with `len(initialBalances)` entries +func createUndelegation(initialBalances []int64, completionTimes []time.Time) stakingtypes.UnbondingDelegation { + var entries []stakingtypes.UnbondingDelegationEntry + for i, balance := range initialBalances { + entry := stakingtypes.UnbondingDelegationEntry{ + InitialBalance: sdk.NewInt(balance), + CompletionTime: completionTimes[i], + } + entries = append(entries, entry) + } + + return stakingtypes.UnbondingDelegation{Entries: entries} +} + +// createRedelegation creates a redelegation with `len(initialBalances)` entries +func createRedelegation(initialBalances []int64, completionTimes []time.Time) stakingtypes.Redelegation { + var entries []stakingtypes.RedelegationEntry + for i, balance := range initialBalances { + entry := stakingtypes.RedelegationEntry{ + InitialBalance: sdk.NewInt(balance), + CompletionTime: completionTimes[i], + } + entries = append(entries, entry) + } + + return stakingtypes.Redelegation{Entries: entries} +} + +// TestComputePowerToSlash tests that `ComputePowerToSlash` computes the correct power to be slashed based on +// the tokens in non-mature undelegation and redelegation entries, as well as the current power of the validator +func TestComputePowerToSlash(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + // undelegation or redelegation entries with completion time `now` have matured + now := ctx.BlockHeader().Time + // undelegation or redelegation entries with completion time one hour in the future have not yet matured + nowPlus1Hour := now.Add(time.Hour) + + testCases := []struct { + name string + undelegations []stakingtypes.UnbondingDelegation + redelegations []stakingtypes.Redelegation + power int64 + powerReduction math.Int + expectedPower int64 + }{ + { + "both undelegations and redelegations 1", + // 1000 total undelegation tokens + []stakingtypes.UnbondingDelegation{ + createUndelegation([]int64{250, 250}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + createUndelegation([]int64{500}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + }, + // 1000 total redelegation tokens + []stakingtypes.Redelegation{ + createRedelegation([]int64{500}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + createRedelegation([]int64{250, 250}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + }, + int64(1000), + sdk.NewInt(1), + int64(2000/1 + 1000), + }, + { + "both undelegations and redelegations 2", + // 2000 total undelegation tokens + []stakingtypes.UnbondingDelegation{ + createUndelegation([]int64{250, 250}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + createUndelegation([]int64{}, []time.Time{}), + createUndelegation([]int64{100, 100}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + createUndelegation([]int64{800}, []time.Time{nowPlus1Hour}), + createUndelegation([]int64{500}, []time.Time{nowPlus1Hour}), + }, + // 3500 total redelegation tokens + []stakingtypes.Redelegation{ + createRedelegation([]int64{}, []time.Time{}), + createRedelegation([]int64{1600}, []time.Time{nowPlus1Hour}), + createRedelegation([]int64{350, 250}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + createRedelegation([]int64{700, 200}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + createRedelegation([]int64{}, []time.Time{}), + createRedelegation([]int64{400}, []time.Time{nowPlus1Hour}), + }, + int64(8391), + sdk.NewInt(2), + int64((2000+3500)/2 + 8391), + }, + { + "no undelegations or redelegations, return provided power", + []stakingtypes.UnbondingDelegation{}, + []stakingtypes.Redelegation{}, + int64(3000), + sdk.NewInt(5), + int64(3000), // expectedPower is 0/5 + 3000 + }, + { + "no undelegations", + []stakingtypes.UnbondingDelegation{}, + // 2000 total redelegation tokens + []stakingtypes.Redelegation{ + createRedelegation([]int64{}, []time.Time{}), + createRedelegation([]int64{500}, []time.Time{nowPlus1Hour}), + createRedelegation([]int64{250, 250}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + createRedelegation([]int64{700, 200}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + createRedelegation([]int64{}, []time.Time{}), + createRedelegation([]int64{100}, []time.Time{nowPlus1Hour}), + }, + int64(17), + sdk.NewInt(3), + int64(2000/3 + 17), + }, + { + "no redelegations", + // 2000 total undelegation tokens + []stakingtypes.UnbondingDelegation{ + createUndelegation([]int64{250, 250}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + createUndelegation([]int64{}, []time.Time{}), + createUndelegation([]int64{100, 100}, []time.Time{nowPlus1Hour, nowPlus1Hour}), + createUndelegation([]int64{800}, []time.Time{nowPlus1Hour}), + createUndelegation([]int64{500}, []time.Time{nowPlus1Hour}), + }, + []stakingtypes.Redelegation{}, + int64(1), + sdk.NewInt(3), + int64(2000/3 + 1), + }, + { + "both (mature) undelegations and redelegations", + // 2000 total undelegation tokens, 250 + 100 + 500 = 850 of those are from mature undelegations, + // so 2000 - 850 = 1150 + []stakingtypes.UnbondingDelegation{ + createUndelegation([]int64{250, 250}, []time.Time{nowPlus1Hour, now}), + createUndelegation([]int64{}, []time.Time{}), + createUndelegation([]int64{100, 100}, []time.Time{now, nowPlus1Hour}), + createUndelegation([]int64{800}, []time.Time{nowPlus1Hour}), + createUndelegation([]int64{500}, []time.Time{now}), + }, + // 3500 total redelegation tokens, 350 + 200 + 400 = 950 of those are from mature redelegations + // so 3500 - 950 = 2550 + []stakingtypes.Redelegation{ + createRedelegation([]int64{}, []time.Time{}), + createRedelegation([]int64{1600}, []time.Time{nowPlus1Hour}), + createRedelegation([]int64{350, 250}, []time.Time{now, nowPlus1Hour}), + createRedelegation([]int64{700, 200}, []time.Time{nowPlus1Hour, now}), + createRedelegation([]int64{}, []time.Time{}), + createRedelegation([]int64{400}, []time.Time{now}), + }, + int64(8391), + sdk.NewInt(2), + int64((1150+2550)/2 + 8391), + }, + } + + pubKey, _ := cryptocodec.FromTmPubKeyInterface(tmtypes.NewMockPV().PrivKey.PubKey()) + validator, _ := stakingtypes.NewValidator(pubKey.Address().Bytes(), pubKey, stakingtypes.Description{}) + + for _, tc := range testCases { + gomock.InOrder(mocks.MockStakingKeeper.EXPECT(). + SlashUnbondingDelegation(gomock.Any(), gomock.Any(), int64(0), sdk.NewDec(1)). + DoAndReturn( + func(_ sdk.Context, undelegation stakingtypes.UnbondingDelegation, _ int64, _ sdk.Dec) math.Int { + sum := sdk.NewInt(0) + for _, r := range undelegation.Entries { + if r.IsMature(ctx.BlockTime()) { + continue + } + sum = sum.Add(sdk.NewInt(r.InitialBalance.Int64())) + } + return sum + }).AnyTimes(), + mocks.MockStakingKeeper.EXPECT(). + SlashRedelegation(gomock.Any(), gomock.Any(), gomock.Any(), int64(0), sdk.NewDec(1)). + DoAndReturn( + func(ctx sdk.Context, _ stakingtypes.Validator, redelegation stakingtypes.Redelegation, _ int64, _ sdk.Dec) math.Int { + sum := sdk.NewInt(0) + for _, r := range redelegation.Entries { + if r.IsMature(ctx.BlockTime()) { + continue + } + sum = sum.Add(sdk.NewInt(r.InitialBalance.Int64())) + } + return sum + }).AnyTimes(), + ) + + actualPower := providerKeeper.ComputePowerToSlash(ctx, validator, + tc.undelegations, tc.redelegations, tc.power, tc.powerReduction) + + if tc.expectedPower != actualPower { + require.Fail(t, fmt.Sprintf("\"%s\" failed", tc.name), + "expected is %d but actual is %d", tc.expectedPower, actualPower) + } + } +} + +// TestSlashValidator asserts that `SlashValidator` calls the staking module's `Slash` method +// with the correct arguments (i.e., `infractionHeight` of 0 and the expected slash power) +func TestSlashValidator(t *testing.T) { + keeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + // undelegation or redelegation entries with completion time `now` have matured + now := ctx.BlockHeader().Time + // undelegation or redelegation entries with completion time one hour in the future have not yet matured + nowPlus1Hour := now.Add(time.Hour) + + keeperParams := testkeeper.NewInMemKeeperParams(t) + testkeeper.NewInMemProviderKeeper(keeperParams, mocks) + + pubKey, _ := cryptocodec.FromTmPubKeyInterface(tmtypes.NewMockPV().PrivKey.PubKey()) + + validator, err := stakingtypes.NewValidator( + sdk.ValAddress(pubKey.Address().Bytes()), + pubKey, + stakingtypes.NewDescription("", "", "", "", ""), + ) + require.NoError(t, err) + validator.Status = stakingtypes.Bonded + + consAddr, _ := validator.GetConsAddr() + providerAddr := types.NewProviderConsAddress(consAddr) + + // we create 1000 tokens worth of undelegations, 750 of them are non-matured + // we also create 1000 tokens worth of redelegations, 750 of them are non-matured + undelegations := []stakingtypes.UnbondingDelegation{ + createUndelegation([]int64{250, 250}, []time.Time{nowPlus1Hour, now}), + createUndelegation([]int64{500}, []time.Time{nowPlus1Hour}), + } + redelegations := []stakingtypes.Redelegation{ + createRedelegation([]int64{250, 250}, []time.Time{now, nowPlus1Hour}), + createRedelegation([]int64{500}, []time.Time{nowPlus1Hour}), + } + + // validator's current power + currentPower := int64(3000) + + powerReduction := sdk.NewInt(2) + slashFraction, _ := sdk.NewDecFromStr("0.5") + + // the call to `Slash` should provide an `infractionHeight` of 0 and an expected power of + // (750 (undelegations) + 750 (redelegations)) / 2 (= powerReduction) + 3000 (currentPower) = 3750 + expectedInfractionHeight := int64(0) + expectedSlashPower := int64(3750) + + expectedCalls := []*gomock.Call{ + mocks.MockStakingKeeper.EXPECT(). + GetValidatorByConsAddr(ctx, gomock.Any()). + Return(validator, true), + mocks.MockSlashingKeeper.EXPECT(). + IsTombstoned(ctx, consAddr). + Return(false), + mocks.MockStakingKeeper.EXPECT(). + GetUnbondingDelegationsFromValidator(ctx, validator.GetOperator()). + Return(undelegations), + mocks.MockStakingKeeper.EXPECT(). + GetRedelegationsFromSrcValidator(ctx, validator.GetOperator()). + Return(redelegations), + mocks.MockStakingKeeper.EXPECT(). + GetLastValidatorPower(ctx, validator.GetOperator()). + Return(currentPower), + mocks.MockStakingKeeper.EXPECT(). + PowerReduction(ctx). + Return(powerReduction), + mocks.MockStakingKeeper.EXPECT(). + SlashUnbondingDelegation(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). + DoAndReturn( + func(_ sdk.Context, undelegation stakingtypes.UnbondingDelegation, _ int64, _ sdk.Dec) math.Int { + sum := sdk.NewInt(0) + for _, r := range undelegation.Entries { + if r.IsMature(ctx.BlockTime()) { + continue + } + sum = sum.Add(sdk.NewInt(r.InitialBalance.Int64())) + } + return sum + }).AnyTimes(), + mocks.MockStakingKeeper.EXPECT(). + SlashRedelegation(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()). + DoAndReturn( + func(_ sdk.Context, _ stakingtypes.Validator, redelegation stakingtypes.Redelegation, _ int64, _ sdk.Dec) math.Int { + sum := sdk.NewInt(0) + for _, r := range redelegation.Entries { + if r.IsMature(ctx.BlockTime()) { + continue + } + sum = sum.Add(sdk.NewInt(r.InitialBalance.Int64())) + } + return sum + }).AnyTimes(), + mocks.MockSlashingKeeper.EXPECT(). + SlashFractionDoubleSign(ctx). + Return(slashFraction), + mocks.MockStakingKeeper.EXPECT(). + SlashWithInfractionReason(ctx, consAddr, expectedInfractionHeight, expectedSlashPower, slashFraction, stakingtypes.Infraction_INFRACTION_DOUBLE_SIGN). + Times(1), + } + + gomock.InOrder(expectedCalls...) + keeper.SlashValidator(ctx, providerAddr) +} + +// TestSlashValidatorDoesNotSlashIfValidatorIsUnbonded asserts that `SlashValidator` does not call +// the staking module's `Slash` method if the validator to be slashed is unbonded +func TestSlashValidatorDoesNotSlashIfValidatorIsUnbonded(t *testing.T) { + keeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + keeperParams := testkeeper.NewInMemKeeperParams(t) + testkeeper.NewInMemProviderKeeper(keeperParams, mocks) + + pubKey, _ := cryptocodec.FromTmPubKeyInterface(tmtypes.NewMockPV().PrivKey.PubKey()) + + // validator is initially unbonded + validator, _ := stakingtypes.NewValidator(pubKey.Address().Bytes(), pubKey, stakingtypes.Description{}) + + consAddr, _ := validator.GetConsAddr() + providerAddr := types.NewProviderConsAddress(consAddr) + + expectedCalls := []*gomock.Call{ + mocks.MockStakingKeeper.EXPECT(). + GetValidatorByConsAddr(ctx, gomock.Any()). + Return(validator, true), + } + + gomock.InOrder(expectedCalls...) + keeper.SlashValidator(ctx, providerAddr) +} + +func TestEquivocationEvidenceMinHeightCRUD(t *testing.T) { + chainID := consumer + expMinHeight := uint64(12) + keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + height := keeper.GetEquivocationEvidenceMinHeight(ctx, chainID) + require.Zero(t, height, "equivocation evidence min height should be 0") + + keeper.SetEquivocationEvidenceMinHeight(ctx, chainID, expMinHeight) + height = keeper.GetEquivocationEvidenceMinHeight(ctx, chainID) + require.Equal(t, height, expMinHeight) + + keeper.DeleteEquivocationEvidenceMinHeight(ctx, chainID) + height = keeper.GetEquivocationEvidenceMinHeight(ctx, chainID) + require.Zero(t, height, "equivocation evidence min height should be 0") +} diff --git a/x/ccv/provider/keeper/hooks.go b/x/ccv/provider/keeper/hooks.go index 35c9b96301..da2daa7512 100644 --- a/x/ccv/provider/keeper/hooks.go +++ b/x/ccv/provider/keeper/hooks.go @@ -167,3 +167,7 @@ func (h Hooks) AfterValidatorBeginUnbonding(_ sdk.Context, _ sdk.ConsAddress, _ func (h Hooks) BeforeDelegationRemoved(_ sdk.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { return nil } + +func (h Hooks) BeforeTokenizeShareRecordRemoved(_ sdk.Context, _ uint64) error { + return nil +} diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index d4470ec0aa..0148354b93 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -41,7 +41,6 @@ type Keeper struct { clientKeeper ccv.ClientKeeper stakingKeeper ccv.StakingKeeper slashingKeeper ccv.SlashingKeeper - evidenceKeeper ccv.EvidenceKeeper distributionKeeper ccv.DistributionKeeper bankKeeper ccv.BankKeeper feeCollectorName string @@ -53,8 +52,8 @@ func NewKeeper( channelKeeper ccv.ChannelKeeper, portKeeper ccv.PortKeeper, connectionKeeper ccv.ConnectionKeeper, clientKeeper ccv.ClientKeeper, stakingKeeper ccv.StakingKeeper, slashingKeeper ccv.SlashingKeeper, - accountKeeper ccv.AccountKeeper, evidenceKeeper ccv.EvidenceKeeper, - distributionKeeper ccv.DistributionKeeper, bankKeeper ccv.BankKeeper, + accountKeeper ccv.AccountKeeper, distributionKeeper ccv.DistributionKeeper, + bankKeeper ccv.BankKeeper, feeCollectorName string, ) Keeper { // set KeyTable if it has not already been set @@ -74,7 +73,6 @@ func NewKeeper( stakingKeeper: stakingKeeper, slashingKeeper: slashingKeeper, accountKeeper: accountKeeper, - evidenceKeeper: evidenceKeeper, distributionKeeper: distributionKeeper, bankKeeper: bankKeeper, feeCollectorName: feeCollectorName, @@ -94,8 +92,8 @@ func (k *Keeper) SetParamSpace(ctx sdk.Context, ps paramtypes.Subspace) { // non-nil values for all its fields. Otherwise this method will panic. func (k Keeper) mustValidateFields() { // Ensures no fields are missed in this validation - if reflect.ValueOf(k).NumField() != 15 { - panic("number of fields in provider keeper is not 15") + if reflect.ValueOf(k).NumField() != 14 { + panic("number of fields in provider keeper is not 14") } ccv.PanicIfZeroOrNil(k.cdc, "cdc") // 1 @@ -109,10 +107,9 @@ func (k Keeper) mustValidateFields() { ccv.PanicIfZeroOrNil(k.clientKeeper, "clientKeeper") // 9 ccv.PanicIfZeroOrNil(k.stakingKeeper, "stakingKeeper") // 10 ccv.PanicIfZeroOrNil(k.slashingKeeper, "slashingKeeper") // 11 - ccv.PanicIfZeroOrNil(k.evidenceKeeper, "evidenceKeeper") // 12 - ccv.PanicIfZeroOrNil(k.distributionKeeper, "distributionKeeper") // 13 - ccv.PanicIfZeroOrNil(k.bankKeeper, "bankKeeper") // 14 - ccv.PanicIfZeroOrNil(k.feeCollectorName, "feeCollectorName") // 15 + ccv.PanicIfZeroOrNil(k.distributionKeeper, "distributionKeeper") // 12 + ccv.PanicIfZeroOrNil(k.bankKeeper, "bankKeeper") // 13 + ccv.PanicIfZeroOrNil(k.feeCollectorName, "feeCollectorName") // 14 } // Logger returns a module-specific logger. diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index fecbdc8c36..03b98403bc 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -6,12 +6,15 @@ import ( errorsmod "cosmossdk.io/errors" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" + ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) type msgServer struct { @@ -26,7 +29,6 @@ func NewMsgServerImpl(keeper *Keeper) types.MsgServer { var _ types.MsgServer = msgServer{} -// CreateValidator defines a method for creating a new validator func (k msgServer) AssignConsumerKey(goCtx context.Context, msg *types.MsgAssignConsumerKey) (*types.MsgAssignConsumerKeyResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -107,3 +109,72 @@ func (k msgServer) AssignConsumerKey(goCtx context.Context, msg *types.MsgAssign return &types.MsgAssignConsumerKeyResponse{}, nil } + +func (k msgServer) SubmitConsumerMisbehaviour(goCtx context.Context, msg *types.MsgSubmitConsumerMisbehaviour) (*types.MsgSubmitConsumerMisbehaviourResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.Keeper.HandleConsumerMisbehaviour(ctx, *msg.Misbehaviour); err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + ccvtypes.EventTypeSubmitConsumerMisbehaviour, + sdk.NewAttribute(ccvtypes.AttributeConsumerMisbehaviour, msg.Misbehaviour.String()), + sdk.NewAttribute(ccvtypes.AttributeSubmitterAddress, msg.Submitter), + sdk.NewAttribute(ccvtypes.AttributeMisbehaviourClientId, msg.Misbehaviour.ClientId), + sdk.NewAttribute(ccvtypes.AttributeMisbehaviourHeight1, msg.Misbehaviour.Header1.GetHeight().String()), + sdk.NewAttribute(ccvtypes.AttributeMisbehaviourHeight2, msg.Misbehaviour.Header2.GetHeight().String()), + ), + }) + + return &types.MsgSubmitConsumerMisbehaviourResponse{}, nil +} + +func (k msgServer) SubmitConsumerDoubleVoting(goCtx context.Context, msg *types.MsgSubmitConsumerDoubleVoting) (*types.MsgSubmitConsumerDoubleVotingResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + evidence, err := tmtypes.DuplicateVoteEvidenceFromProto(msg.DuplicateVoteEvidence) + if err != nil { + return nil, err + } + + // parse the validator set of the infraction block header in order + // to find the public key of the validator who double voted + + // get validator set + valset, err := tmtypes.ValidatorSetFromProto(msg.InfractionBlockHeader.ValidatorSet) + if err != nil { + return nil, err + } + + // look for the malicious validator in the validator set + _, validator := valset.GetByAddress(evidence.VoteA.ValidatorAddress) + if validator == nil { + return nil, errorsmod.Wrapf( + ccvtypes.ErrInvalidDoubleVotingEvidence, + "misbehaving validator %s cannot be found in the infraction block header validator set", + evidence.VoteA.ValidatorAddress) + } + + pubkey, err := cryptocodec.FromTmPubKeyInterface(validator.PubKey) + if err != nil { + return nil, err + } + + // handle the double voting evidence using the chain ID of the infraction block header + // and the malicious validator's public key + if err := k.Keeper.HandleConsumerDoubleVoting(ctx, evidence, msg.InfractionBlockHeader.Header.ChainID, pubkey); err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + ccvtypes.EventTypeSubmitConsumerDoubleVoting, + sdk.NewAttribute(ccvtypes.AttributeConsumerDoubleVoting, msg.DuplicateVoteEvidence.String()), + sdk.NewAttribute(ccvtypes.AttributeChainID, msg.InfractionBlockHeader.Header.ChainID), + sdk.NewAttribute(ccvtypes.AttributeSubmitterAddress, msg.Submitter), + ), + }) + + return &types.MsgSubmitConsumerDoubleVotingResponse{}, nil +} diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 436398b6fb..d9baad8e91 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -605,18 +605,6 @@ func (k Keeper) StopConsumerChainInCachedCtx(ctx sdk.Context, p types.ConsumerRe return } -// HandleEquivocationProposal handles an equivocation proposal. -// Proposal will be accepted if a record in the SlashLog exists for a given validator address. -func (k Keeper) HandleEquivocationProposal(ctx sdk.Context, p *types.EquivocationProposal) error { - for _, ev := range p.Equivocations { - if !k.GetSlashLog(ctx, types.NewProviderConsAddress(ev.GetConsensusAddress())) { - return fmt.Errorf("no equivocation record found for validator %s", ev.GetConsensusAddress().String()) - } - k.evidenceKeeper.HandleEquivocationEvidence(ctx, ev) - } - return nil -} - func (k Keeper) HandleConsumerRewardDenomProposal(ctx sdk.Context, p *types.ChangeRewardDenomsProposal) error { for _, denomToAdd := range p.DenomsToAdd { // Log error and move on if one of the denoms is already registered diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index d98ca74f7c..be3f5eaae8 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -14,7 +14,6 @@ import ( "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" abci "github.com/cometbft/cometbft/abci/types" @@ -1097,63 +1096,3 @@ func TestBeginBlockCCR(t *testing.T) { ctx, invalidProp.ChainId, invalidProp.StopTime) require.False(t, found) } - -func TestHandleEquivocationProposal(t *testing.T) { - equivocations := []*evidencetypes.Equivocation{ - { - Time: time.Now(), - Height: 1, - Power: 1, - ConsensusAddress: "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", - }, - { - Time: time.Now(), - Height: 1, - Power: 1, - ConsensusAddress: "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", - }, - } - - prop := &providertypes.EquivocationProposal{ - Equivocations: []*evidencetypes.Equivocation{equivocations[0], equivocations[1]}, - } - - testCases := []struct { - name string - setSlashLogs bool - expectEquivsHandled bool - expectErr bool - }{ - {name: "slash logs not set", setSlashLogs: false, expectEquivsHandled: false, expectErr: true}, - {name: "slash logs set", setSlashLogs: true, expectEquivsHandled: true, expectErr: false}, - } - for _, tc := range testCases { - - keeperParams := testkeeper.NewInMemKeeperParams(t) - keeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - - if tc.setSlashLogs { - // Set slash logs according to cons addrs in equivocations - consAddr := equivocations[0].GetConsensusAddress() - require.NotNil(t, consAddr, "consensus address could not be parsed") - keeper.SetSlashLog(ctx, providertypes.NewProviderConsAddress(consAddr)) - consAddr = equivocations[1].GetConsensusAddress() - require.NotNil(t, consAddr, "consensus address could not be parsed") - keeper.SetSlashLog(ctx, providertypes.NewProviderConsAddress(consAddr)) - } - - if tc.expectEquivsHandled { - mocks.MockEvidenceKeeper.EXPECT().HandleEquivocationEvidence(ctx, equivocations[0]) - mocks.MockEvidenceKeeper.EXPECT().HandleEquivocationEvidence(ctx, equivocations[1]) - } - - err := keeper.HandleEquivocationProposal(ctx, prop) - - if tc.expectErr { - require.Error(t, err) - } else { - require.NoError(t, err) - } - ctrl.Finish() - } -} diff --git a/x/ccv/provider/proposal_handler.go b/x/ccv/provider/proposal_handler.go index 7af7ec4e5f..b5bd4a6597 100644 --- a/x/ccv/provider/proposal_handler.go +++ b/x/ccv/provider/proposal_handler.go @@ -12,7 +12,7 @@ import ( ) // NewProviderProposalHandler defines the handler for consumer addition, -// consumer removal and equivocation proposals. +// consumer removal, and consumer reward denom proposals. // Passed proposals are executed during EndBlock. func NewProviderProposalHandler(k keeper.Keeper) govv1beta1.Handler { return func(ctx sdk.Context, content govv1beta1.Content) error { @@ -21,8 +21,6 @@ func NewProviderProposalHandler(k keeper.Keeper) govv1beta1.Handler { return k.HandleConsumerAdditionProposal(ctx, c) case *types.ConsumerRemovalProposal: return k.HandleConsumerRemovalProposal(ctx, c) - case *types.EquivocationProposal: - return k.HandleEquivocationProposal(ctx, c) case *types.ChangeRewardDenomsProposal: return k.HandleConsumerRewardDenomProposal(ctx, c) default: diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 8f1322b3d2..7e4d586097 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -10,7 +10,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" testkeeper "github.com/cosmos/interchain-security/v3/testutil/keeper" @@ -19,12 +18,11 @@ import ( ) // TestProviderProposalHandler tests the highest level handler for proposals -// concerning creating, stopping consumer chains and submitting equivocations. +// concerning creating, stopping consumer chains and changing reward denom. func TestProviderProposalHandler(t *testing.T) { // Snapshot times asserted in tests now := time.Now().UTC() hourFromNow := now.Add(time.Hour).UTC() - equivocation := &evidencetypes.Equivocation{Height: 42} testCases := []struct { name string @@ -32,7 +30,6 @@ func TestProviderProposalHandler(t *testing.T) { blockTime time.Time expValidConsumerAddition bool expValidConsumerRemoval bool - expValidEquivocation bool expValidChangeRewardDenom bool }{ { @@ -58,21 +55,6 @@ func TestProviderProposalHandler(t *testing.T) { blockTime: hourFromNow, expValidConsumerRemoval: true, }, - { - // no slash log for equivocation - name: "invalid equivocation proposal", - content: providertypes.NewEquivocationProposal( - "title", "description", []*evidencetypes.Equivocation{equivocation}), - blockTime: hourFromNow, - expValidEquivocation: false, - }, - { - name: "valid equivocation proposal", - content: providertypes.NewEquivocationProposal( - "title", "description", []*evidencetypes.Equivocation{equivocation}), - blockTime: hourFromNow, - expValidEquivocation: true, - }, { name: "valid change reward denoms proposal", content: providertypes.NewChangeRewardDenomsProposal( @@ -118,10 +100,6 @@ func TestProviderProposalHandler(t *testing.T) { // assert mocks for expected calls to `StopConsumerChain` when closing the underlying channel gomock.InOrder(testkeeper.GetMocksForStopConsumerChainWithCloseChannel(ctx, &mocks)...) - - case tc.expValidEquivocation: - providerKeeper.SetSlashLog(ctx, providertypes.NewProviderConsAddress(equivocation.GetConsensusAddress())) - mocks.MockEvidenceKeeper.EXPECT().HandleEquivocationEvidence(ctx, equivocation) case tc.expValidChangeRewardDenom: // Nothing to mock } @@ -131,7 +109,7 @@ func TestProviderProposalHandler(t *testing.T) { err := proposalHandler(ctx, tc.content) if tc.expValidConsumerAddition || tc.expValidConsumerRemoval || - tc.expValidEquivocation || tc.expValidChangeRewardDenom { + tc.expValidChangeRewardDenom { require.NoError(t, err) } else { require.Error(t, err) diff --git a/x/ccv/provider/types/codec.go b/x/ccv/provider/types/codec.go index ceed3bf789..d1b9203efb 100644 --- a/x/ccv/provider/types/codec.go +++ b/x/ccv/provider/types/codec.go @@ -35,7 +35,14 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*govv1beta1.Content)(nil), &ChangeRewardDenomsProposal{}, ) - + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgSubmitConsumerMisbehaviour{}, + ) + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgSubmitConsumerDoubleVoting{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index ee4c11015b..95b5b4b820 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -138,6 +138,10 @@ const ( // handled in the current block VSCMaturedHandledThisBlockBytePrefix + // EquivocationEvidenceMinHeightBytePrefix is the byte prefix storing the mapping from consumer chain IDs + // to the minimum height of a valid consumer equivocation evidence + EquivocationEvidenceMinHeightBytePrefix + // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go ) @@ -377,6 +381,12 @@ func ConsumerRewardDenomsKey(denom string) []byte { return append([]byte{ConsumerRewardDenomsBytePrefix}, []byte(denom)...) } +// EquivocationEvidenceMinHeightKey returns the key storing the minimum height +// of a valid consumer equivocation evidence for a given consumer chain ID +func EquivocationEvidenceMinHeightKey(consumerChainID string) []byte { + return append([]byte{EquivocationEvidenceMinHeightBytePrefix}, []byte(consumerChainID)...) +} + // NOTE: DO NOT ADD FULLY DEFINED KEY FUNCTIONS WITHOUT ADDING THEM TO getAllFullyDefinedKeys() IN keys_test.go // diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 9f470f4a82..6b263a4fdb 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -54,6 +54,7 @@ func getAllKeyPrefixes() []byte { providertypes.ConsumerAddrsToPruneBytePrefix, providertypes.SlashLogBytePrefix, providertypes.VSCMaturedHandledThisBlockBytePrefix, + providertypes.EquivocationEvidenceMinHeightBytePrefix, } } @@ -98,6 +99,7 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.ConsumerAddrsToPruneKey("chainID", 88), providertypes.SlashLogKey(providertypes.NewProviderConsAddress([]byte{0x05})), providertypes.VSCMaturedHandledThisBlockKey(), + providertypes.EquivocationEvidenceMinHeightKey("chainID"), } } diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index 901aa03600..c2551f9ceb 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -2,17 +2,33 @@ package types import ( "encoding/json" + "fmt" "strings" + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + tmtypes "github.com/cometbft/cometbft/proto/tendermint/types" + + ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) // provider message types const ( - TypeMsgAssignConsumerKey = "assign_consumer_key" + TypeMsgAssignConsumerKey = "assign_consumer_key" + TypeMsgSubmitConsumerMisbehaviour = "submit_consumer_misbehaviour" + TypeMsgSubmitConsumerDoubleVoting = "submit_consumer_double_vote" ) -var _ sdk.Msg = &MsgAssignConsumerKey{} +var ( + _ sdk.Msg = &MsgAssignConsumerKey{} + _ sdk.Msg = &MsgSubmitConsumerMisbehaviour{} + _ sdk.Msg = &MsgSubmitConsumerDoubleVoting{} +) // NewMsgAssignConsumerKey creates a new MsgAssignConsumerKey instance. // Delegator address and validator address are the same. @@ -49,7 +65,7 @@ func (msg MsgAssignConsumerKey) GetSigners() []sdk.AccAddress { // GetSignBytes returns the message bytes to sign over. func (msg MsgAssignConsumerKey) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) + bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) return sdk.MustSortJSON(bz) } @@ -93,3 +109,99 @@ func ParseConsumerKeyFromJson(jsonStr string) (pkType, key string, err error) { } return pubKey.Type, pubKey.Key, nil } + +func NewMsgSubmitConsumerMisbehaviour(submitter sdk.AccAddress, misbehaviour *ibctmtypes.Misbehaviour) (*MsgSubmitConsumerMisbehaviour, error) { + return &MsgSubmitConsumerMisbehaviour{Submitter: submitter.String(), Misbehaviour: misbehaviour}, nil +} + +// Route implements the sdk.Msg interface. +func (msg MsgSubmitConsumerMisbehaviour) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgSubmitConsumerMisbehaviour) Type() string { + return TypeMsgSubmitConsumerMisbehaviour +} + +// Type implements the sdk.Msg interface. +func (msg MsgSubmitConsumerMisbehaviour) ValidateBasic() error { + if msg.Submitter == "" { + return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, msg.Submitter) + } + + if err := msg.Misbehaviour.ValidateBasic(); err != nil { + return err + } + return nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgSubmitConsumerMisbehaviour) GetSignBytes() []byte { + bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// Type implements the sdk.Msg interface. +func (msg MsgSubmitConsumerMisbehaviour) GetSigners() []sdk.AccAddress { + addr, err := sdk.AccAddressFromBech32(msg.Submitter) + if err != nil { + // same behavior as in cosmos-sdk + panic(err) + } + return []sdk.AccAddress{addr} +} + +func NewMsgSubmitConsumerDoubleVoting(submitter sdk.AccAddress, ev *tmtypes.DuplicateVoteEvidence, header *ibctmtypes.Header) (*MsgSubmitConsumerDoubleVoting, error) { + return &MsgSubmitConsumerDoubleVoting{Submitter: submitter.String(), DuplicateVoteEvidence: ev, InfractionBlockHeader: header}, nil +} + +// Route implements the sdk.Msg interface. +func (msg MsgSubmitConsumerDoubleVoting) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgSubmitConsumerDoubleVoting) Type() string { + return TypeMsgSubmitConsumerDoubleVoting +} + +// Type implements the sdk.Msg interface. +func (msg MsgSubmitConsumerDoubleVoting) ValidateBasic() error { + if msg.Submitter == "" { + return errorsmod.Wrap(sdkerrors.ErrInvalidAddress, msg.Submitter) + } + if msg.DuplicateVoteEvidence == nil { + return fmt.Errorf("double voting evidence cannot be nil") + } + + if msg.InfractionBlockHeader == nil { + return fmt.Errorf("infraction block header cannot be nil") + } + + if msg.InfractionBlockHeader.SignedHeader == nil { + return fmt.Errorf("signed header in infraction block header cannot be nil") + } + + if msg.InfractionBlockHeader.SignedHeader.Header == nil { + return fmt.Errorf("invalid signed header in infraction block header, 'SignedHeader.Header' is nil") + } + + if msg.InfractionBlockHeader.ValidatorSet == nil { + return fmt.Errorf("invalid infraction block header, validator set is nil") + } + + return nil +} + +// Type implements the sdk.Msg interface. +func (msg MsgSubmitConsumerDoubleVoting) GetSignBytes() []byte { + bz := ccvtypes.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// Type implements the sdk.Msg interface. +func (msg MsgSubmitConsumerDoubleVoting) GetSigners() []sdk.AccAddress { + addr, err := sdk.AccAddressFromBech32(msg.Submitter) + if err != nil { + // same behavior as in cosmos-sdk + panic(err) + } + return []sdk.AccAddress{addr} +} diff --git a/x/ccv/provider/types/proposal.go b/x/ccv/provider/types/proposal.go index b2286d4adf..d1755852ef 100644 --- a/x/ccv/provider/types/proposal.go +++ b/x/ccv/provider/types/proposal.go @@ -27,15 +27,15 @@ const ( var ( _ govv1beta1.Content = &ConsumerAdditionProposal{} _ govv1beta1.Content = &ConsumerRemovalProposal{} - _ govv1beta1.Content = &EquivocationProposal{} _ govv1beta1.Content = &ChangeRewardDenomsProposal{} + _ govv1beta1.Content = &EquivocationProposal{} ) func init() { govv1beta1.RegisterProposalType(ProposalTypeConsumerAddition) govv1beta1.RegisterProposalType(ProposalTypeConsumerRemoval) - govv1beta1.RegisterProposalType(ProposalTypeEquivocation) govv1beta1.RegisterProposalType(ProposalTypeChangeRewardDenoms) + govv1beta1.RegisterProposalType(ProposalTypeEquivocation) } // NewConsumerAdditionProposal creates a new consumer addition proposal. @@ -204,6 +204,8 @@ func (sccp *ConsumerRemovalProposal) ValidateBasic() error { } // NewEquivocationProposal creates a new equivocation proposal. +// [DEPRECATED]: do not use because equivocations can be submitted +// and verified automatically on the provider. func NewEquivocationProposal(title, description string, equivocations []*evidencetypes.Equivocation) govv1beta1.Content { return &EquivocationProposal{ Title: title, diff --git a/x/ccv/provider/types/proposal_test.go b/x/ccv/provider/types/proposal_test.go index 357c555d0e..d8f10766dd 100644 --- a/x/ccv/provider/types/proposal_test.go +++ b/x/ccv/provider/types/proposal_test.go @@ -12,7 +12,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -307,62 +306,6 @@ func TestConsumerAdditionProposalString(t *testing.T) { require.Equal(t, expect, proposal.String(), "string method for ConsumerAdditionProposal returned unexpected string") } -func TestEquivocationProposalValidateBasic(t *testing.T) { - tests := []struct { - name string - proposal govv1beta1.Content - expectedError string - }{ - { - name: "fail: validate abstract - empty title", - proposal: types.NewEquivocationProposal("", "", nil), - expectedError: "proposal title cannot be blank: invalid proposal content", - }, - { - name: "fail: equivocations is empty", - proposal: types.NewEquivocationProposal("title", "desc", nil), - expectedError: "invalid equivocation proposal: empty equivocations", - }, - { - name: "fail: invalid equivocation", - proposal: types.NewEquivocationProposal("title", "desc", - []*evidencetypes.Equivocation{ - { - Time: time.Now(), - Height: 1, - Power: 1, - ConsensusAddress: "addr", - }, - {}, // invalid one - }), - expectedError: "invalid equivocation time: 0001-01-01 00:00:00 +0000 UTC", - }, - { - name: "ok", - proposal: types.NewEquivocationProposal("title", "desc", - []*evidencetypes.Equivocation{ - { - Time: time.Now(), - Height: 1, - Power: 1, - ConsensusAddress: "addr", - }, - }), - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.proposal.ValidateBasic() - - if tt.expectedError != "" { - require.EqualError(t, err, tt.expectedError) - return - } - require.NoError(t, err) - }) - } -} - func TestChangeRewardDenomsProposalValidateBasic(t *testing.T) { tcs := []struct { name string diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 3e3b1aa6f0..2d800c5275 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -205,6 +205,10 @@ func (m *ConsumerRemovalProposal) GetStopTime() time.Time { // punish a validator for equivocation on a consumer chain. // // This type is only used internally to the consumer CCV module. +// WARNING: This message is deprecated now that equivocations can be submitted +// and verified automatically on the provider. (see SubmitConsumerDoubleVoting in proto/interchain-security/ccv/provider/v1/tx.proto). +// +// Deprecated: Do not use. type EquivocationProposal struct { // the title of the proposal Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -1421,113 +1425,113 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1690 bytes of a gzipped FileDescriptorProto + // 1694 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x72, 0x1b, 0xc7, - 0x11, 0xe6, 0x12, 0x20, 0x45, 0x34, 0xf8, 0xa7, 0x25, 0x6d, 0x81, 0x0a, 0x03, 0x52, 0xeb, 0xd8, - 0x61, 0xca, 0xe5, 0x45, 0x48, 0x55, 0xaa, 0x5c, 0xaa, 0xb8, 0x5c, 0x24, 0x28, 0x5b, 0x14, 0x63, - 0x8b, 0x5e, 0x32, 0x54, 0x25, 0x39, 0x6c, 0x0d, 0x66, 0x47, 0xc0, 0x14, 0x77, 0x77, 0x56, 0x33, - 0xb3, 0x2b, 0xe3, 0x92, 0x73, 0x8e, 0xce, 0xcd, 0x95, 0x5c, 0x9c, 0xbc, 0x40, 0xce, 0x79, 0x03, + 0x11, 0xe6, 0x12, 0x20, 0x45, 0x34, 0xf8, 0xa7, 0x25, 0x6d, 0x2d, 0x15, 0x06, 0xa4, 0xd6, 0xb1, + 0xc3, 0x94, 0xcb, 0x8b, 0x90, 0xaa, 0x54, 0xb9, 0x54, 0x71, 0xb9, 0x48, 0x50, 0xb6, 0x28, 0xc6, + 0x16, 0xbd, 0x64, 0xa8, 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, 0x0e, 0xd0, 0xb8, 0x7a, 0x00, 0xfb, 0x6f, 0x06, 0xac, 0x57, 0xbd, + 0x8a, 0x33, 0x76, 0xc2, 0xe3, 0x90, 0xbc, 0xca, 0x7b, 0xd9, 0x7e, 0xb3, 0xd5, 0xf6, 0x7b, 0x0a, + 0xcb, 0xb5, 0xa0, 0x44, 0x76, 0x1b, 0xbf, 0x9c, 0xaa, 0xc6, 0x2a, 0xec, 0xea, 0x2e, 0x55, 0xcf, + 0x21, 0x0e, 0x9e, 0x7e, 0x7b, 0xd9, 0x31, 0xbe, 0xbb, 0xec, 0x18, 0xff, 0xbe, 0xec, 0x18, 0x5f, + 0xbd, 0xec, 0xcc, 0x7c, 0xf7, 0xb2, 0x33, 0xf3, 0xaf, 0x97, 0x9d, 0x99, 0xdf, 0x7f, 0x34, 0xa0, + 0x72, 0x18, 0xf7, 0x1d, 0xcc, 0x46, 0xdd, 0xec, 0xa7, 0x7d, 0xe9, 0xeb, 0x83, 0xe2, 0x7f, 0x8f, + 0xe4, 0x7e, 0xf7, 0xcb, 0xfa, 0xbf, 0x2a, 0x72, 0x1c, 0x11, 0xd1, 0x9f, 0xd7, 0xac, 0x70, 0xff, + 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa7, 0xa1, 0xa2, 0x88, 0x86, 0x11, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { diff --git a/x/ccv/provider/types/tx.pb.go b/x/ccv/provider/types/tx.pb.go index 80487a06c9..b89c515dd3 100644 --- a/x/ccv/provider/types/tx.pb.go +++ b/x/ccv/provider/types/tx.pb.go @@ -6,9 +6,13 @@ package types import ( context "context" fmt "fmt" + types "github.com/cometbft/cometbft/proto/tendermint/types" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + _07_tendermint "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -108,9 +112,171 @@ func (m *MsgAssignConsumerKeyResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAssignConsumerKeyResponse proto.InternalMessageInfo +// MsgSubmitConsumerMisbehaviour defines a message that reports a light client attack, +// also known as a misbehaviour, observed on a consumer chain +type MsgSubmitConsumerMisbehaviour struct { + Submitter string `protobuf:"bytes,1,opt,name=submitter,proto3" json:"submitter,omitempty"` + // The Misbehaviour of the consumer chain wrapping + // two conflicting IBC headers + Misbehaviour *_07_tendermint.Misbehaviour `protobuf:"bytes,2,opt,name=misbehaviour,proto3" json:"misbehaviour,omitempty"` +} + +func (m *MsgSubmitConsumerMisbehaviour) Reset() { *m = MsgSubmitConsumerMisbehaviour{} } +func (m *MsgSubmitConsumerMisbehaviour) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitConsumerMisbehaviour) ProtoMessage() {} +func (*MsgSubmitConsumerMisbehaviour) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{2} +} +func (m *MsgSubmitConsumerMisbehaviour) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitConsumerMisbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitConsumerMisbehaviour.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSubmitConsumerMisbehaviour) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitConsumerMisbehaviour.Merge(m, src) +} +func (m *MsgSubmitConsumerMisbehaviour) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitConsumerMisbehaviour) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitConsumerMisbehaviour.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitConsumerMisbehaviour proto.InternalMessageInfo + +type MsgSubmitConsumerMisbehaviourResponse struct { +} + +func (m *MsgSubmitConsumerMisbehaviourResponse) Reset() { *m = MsgSubmitConsumerMisbehaviourResponse{} } +func (m *MsgSubmitConsumerMisbehaviourResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitConsumerMisbehaviourResponse) ProtoMessage() {} +func (*MsgSubmitConsumerMisbehaviourResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{3} +} +func (m *MsgSubmitConsumerMisbehaviourResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitConsumerMisbehaviourResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitConsumerMisbehaviourResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSubmitConsumerMisbehaviourResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitConsumerMisbehaviourResponse.Merge(m, src) +} +func (m *MsgSubmitConsumerMisbehaviourResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitConsumerMisbehaviourResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitConsumerMisbehaviourResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitConsumerMisbehaviourResponse proto.InternalMessageInfo + +// MsgSubmitConsumerDoubleVoting defines a message that reports +// a double signing infraction observed on a consumer chain +type MsgSubmitConsumerDoubleVoting struct { + Submitter string `protobuf:"bytes,1,opt,name=submitter,proto3" json:"submitter,omitempty"` + // The equivocation of the consumer chain wrapping + // an evidence of a validator that signed two conflicting votes + DuplicateVoteEvidence *types.DuplicateVoteEvidence `protobuf:"bytes,2,opt,name=duplicate_vote_evidence,json=duplicateVoteEvidence,proto3" json:"duplicate_vote_evidence,omitempty"` + // The light client header of the infraction block + InfractionBlockHeader *_07_tendermint.Header `protobuf:"bytes,3,opt,name=infraction_block_header,json=infractionBlockHeader,proto3" json:"infraction_block_header,omitempty"` +} + +func (m *MsgSubmitConsumerDoubleVoting) Reset() { *m = MsgSubmitConsumerDoubleVoting{} } +func (m *MsgSubmitConsumerDoubleVoting) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitConsumerDoubleVoting) ProtoMessage() {} +func (*MsgSubmitConsumerDoubleVoting) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{4} +} +func (m *MsgSubmitConsumerDoubleVoting) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitConsumerDoubleVoting) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitConsumerDoubleVoting.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSubmitConsumerDoubleVoting) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitConsumerDoubleVoting.Merge(m, src) +} +func (m *MsgSubmitConsumerDoubleVoting) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitConsumerDoubleVoting) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitConsumerDoubleVoting.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitConsumerDoubleVoting proto.InternalMessageInfo + +type MsgSubmitConsumerDoubleVotingResponse struct { +} + +func (m *MsgSubmitConsumerDoubleVotingResponse) Reset() { *m = MsgSubmitConsumerDoubleVotingResponse{} } +func (m *MsgSubmitConsumerDoubleVotingResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitConsumerDoubleVotingResponse) ProtoMessage() {} +func (*MsgSubmitConsumerDoubleVotingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{5} +} +func (m *MsgSubmitConsumerDoubleVotingResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitConsumerDoubleVotingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitConsumerDoubleVotingResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSubmitConsumerDoubleVotingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitConsumerDoubleVotingResponse.Merge(m, src) +} +func (m *MsgSubmitConsumerDoubleVotingResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitConsumerDoubleVotingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitConsumerDoubleVotingResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitConsumerDoubleVotingResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgAssignConsumerKey)(nil), "interchain_security.ccv.provider.v1.MsgAssignConsumerKey") proto.RegisterType((*MsgAssignConsumerKeyResponse)(nil), "interchain_security.ccv.provider.v1.MsgAssignConsumerKeyResponse") + proto.RegisterType((*MsgSubmitConsumerMisbehaviour)(nil), "interchain_security.ccv.provider.v1.MsgSubmitConsumerMisbehaviour") + proto.RegisterType((*MsgSubmitConsumerMisbehaviourResponse)(nil), "interchain_security.ccv.provider.v1.MsgSubmitConsumerMisbehaviourResponse") + proto.RegisterType((*MsgSubmitConsumerDoubleVoting)(nil), "interchain_security.ccv.provider.v1.MsgSubmitConsumerDoubleVoting") + proto.RegisterType((*MsgSubmitConsumerDoubleVotingResponse)(nil), "interchain_security.ccv.provider.v1.MsgSubmitConsumerDoubleVotingResponse") } func init() { @@ -118,28 +284,46 @@ func init() { } var fileDescriptor_43221a4391e9fbf4 = []byte{ - // 328 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00,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c2, 0x5a, 0x2b, 0x8e, 0x8e, - 0x05, 0xf2, 0x0c, 0x2f, 0x16, 0xc8, 0x33, 0x28, 0xc9, 0x71, 0xc9, 0x60, 0x73, 0x58, 0x50, 0x6a, - 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0xd1, 0x4c, 0x46, 0x2e, 0x66, 0xdf, 0xe2, 0x74, 0xa1, 0x89, - 0x8c, 0x5c, 0x82, 0x98, 0xce, 0xb7, 0xd4, 0x23, 0x22, 0x4c, 0xf4, 0xb0, 0x59, 0x20, 0xe5, 0x48, - 0xb6, 0x56, 0x98, 0xdb, 0x9c, 0xc2, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, - 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, - 0xca, 0x36, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0x39, 0xbf, 0x38, - 0x37, 0xbf, 0x58, 0x1f, 0x61, 0x9b, 0x2e, 0x3c, 0xaa, 0xcb, 0x8c, 0xf5, 0x2b, 0x50, 0xe3, 0xbb, - 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0x6b, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xb3, 0xd9, 0x75, 0xa5, 0x20, 0x02, 0x00, 0x00, + // 610 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcf, 0x4f, 0xd4, 0x4e, + 0x14, 0xdf, 0x42, 0xf2, 0xfd, 0xc2, 0x80, 0x26, 0x36, 0x10, 0x60, 0x83, 0x5d, 0x5d, 0xa3, 0x78, + 0xc0, 0x99, 0x00, 0x07, 0x23, 0x89, 0x07,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0xff, 0xec, 0x39, 0x37, 0xbf, 0x44, 0xf0, + 0x9f, 0x39, 0x86, 0x1b, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x5a, 0x31, 0xaa, 0xff, 0x05, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -155,6 +339,8 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { AssignConsumerKey(ctx context.Context, in *MsgAssignConsumerKey, opts ...grpc.CallOption) (*MsgAssignConsumerKeyResponse, error) + SubmitConsumerMisbehaviour(ctx context.Context, in *MsgSubmitConsumerMisbehaviour, opts ...grpc.CallOption) (*MsgSubmitConsumerMisbehaviourResponse, error) + SubmitConsumerDoubleVoting(ctx context.Context, in *MsgSubmitConsumerDoubleVoting, opts ...grpc.CallOption) (*MsgSubmitConsumerDoubleVotingResponse, error) } type msgClient struct { @@ -174,9 +360,29 @@ func (c *msgClient) AssignConsumerKey(ctx context.Context, in *MsgAssignConsumer return out, nil } +func (c *msgClient) SubmitConsumerMisbehaviour(ctx context.Context, in *MsgSubmitConsumerMisbehaviour, opts ...grpc.CallOption) (*MsgSubmitConsumerMisbehaviourResponse, error) { + out := new(MsgSubmitConsumerMisbehaviourResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/SubmitConsumerMisbehaviour", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SubmitConsumerDoubleVoting(ctx context.Context, in *MsgSubmitConsumerDoubleVoting, opts ...grpc.CallOption) (*MsgSubmitConsumerDoubleVotingResponse, error) { + out := new(MsgSubmitConsumerDoubleVotingResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/SubmitConsumerDoubleVoting", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { AssignConsumerKey(context.Context, *MsgAssignConsumerKey) (*MsgAssignConsumerKeyResponse, error) + SubmitConsumerMisbehaviour(context.Context, *MsgSubmitConsumerMisbehaviour) (*MsgSubmitConsumerMisbehaviourResponse, error) + SubmitConsumerDoubleVoting(context.Context, *MsgSubmitConsumerDoubleVoting) (*MsgSubmitConsumerDoubleVotingResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -186,6 +392,12 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) AssignConsumerKey(ctx context.Context, req *MsgAssignConsumerKey) (*MsgAssignConsumerKeyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AssignConsumerKey not implemented") } +func (*UnimplementedMsgServer) SubmitConsumerMisbehaviour(ctx context.Context, req *MsgSubmitConsumerMisbehaviour) (*MsgSubmitConsumerMisbehaviourResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitConsumerMisbehaviour not implemented") +} +func (*UnimplementedMsgServer) SubmitConsumerDoubleVoting(ctx context.Context, req *MsgSubmitConsumerDoubleVoting) (*MsgSubmitConsumerDoubleVotingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitConsumerDoubleVoting not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -209,6 +421,42 @@ func _Msg_AssignConsumerKey_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Msg_SubmitConsumerMisbehaviour_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitConsumerMisbehaviour) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitConsumerMisbehaviour(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/SubmitConsumerMisbehaviour", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitConsumerMisbehaviour(ctx, req.(*MsgSubmitConsumerMisbehaviour)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SubmitConsumerDoubleVoting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitConsumerDoubleVoting) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitConsumerDoubleVoting(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/SubmitConsumerDoubleVoting", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitConsumerDoubleVoting(ctx, req.(*MsgSubmitConsumerDoubleVoting)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "interchain_security.ccv.provider.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -217,6 +465,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "AssignConsumerKey", Handler: _Msg_AssignConsumerKey_Handler, }, + { + MethodName: "SubmitConsumerMisbehaviour", + Handler: _Msg_SubmitConsumerMisbehaviour_Handler, + }, + { + MethodName: "SubmitConsumerDoubleVoting", + Handler: _Msg_SubmitConsumerDoubleVoting_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "interchain_security/ccv/provider/v1/tx.proto", @@ -289,6 +545,148 @@ func (m *MsgAssignConsumerKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *MsgSubmitConsumerMisbehaviour) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSubmitConsumerMisbehaviour) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitConsumerMisbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Misbehaviour != nil { + { + size, err := m.Misbehaviour.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Submitter) > 0 { + i -= len(m.Submitter) + copy(dAtA[i:], m.Submitter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitConsumerMisbehaviourResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSubmitConsumerMisbehaviourResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitConsumerMisbehaviourResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSubmitConsumerDoubleVoting) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSubmitConsumerDoubleVoting) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitConsumerDoubleVoting) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.InfractionBlockHeader != nil { + { + size, err := m.InfractionBlockHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.DuplicateVoteEvidence != nil { + { + size, err := m.DuplicateVoteEvidence.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Submitter) > 0 { + i -= len(m.Submitter) + copy(dAtA[i:], m.Submitter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Submitter))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitConsumerDoubleVotingResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSubmitConsumerDoubleVotingResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitConsumerDoubleVotingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -330,17 +728,73 @@ func (m *MsgAssignConsumerKeyResponse) Size() (n int) { return n } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func (m *MsgSubmitConsumerMisbehaviour) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Submitter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Misbehaviour != nil { + l = m.Misbehaviour.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n } -func (m *MsgAssignConsumerKey) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx + +func (m *MsgSubmitConsumerMisbehaviourResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSubmitConsumerDoubleVoting) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Submitter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.DuplicateVoteEvidence != nil { + l = m.DuplicateVoteEvidence.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.InfractionBlockHeader != nil { + l = m.InfractionBlockHeader.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitConsumerDoubleVotingResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgAssignConsumerKey) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -532,6 +986,378 @@ func (m *MsgAssignConsumerKeyResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgSubmitConsumerMisbehaviour) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitConsumerMisbehaviour: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitConsumerMisbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Submitter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Misbehaviour", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Misbehaviour == nil { + m.Misbehaviour = &_07_tendermint.Misbehaviour{} + } + if err := m.Misbehaviour.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitConsumerMisbehaviourResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitConsumerMisbehaviourResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitConsumerMisbehaviourResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitConsumerDoubleVoting) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitConsumerDoubleVoting: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitConsumerDoubleVoting: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Submitter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DuplicateVoteEvidence", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DuplicateVoteEvidence == nil { + m.DuplicateVoteEvidence = &types.DuplicateVoteEvidence{} + } + if err := m.DuplicateVoteEvidence.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InfractionBlockHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InfractionBlockHeader == nil { + m.InfractionBlockHeader = &_07_tendermint.Header{} + } + if err := m.InfractionBlockHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitConsumerDoubleVotingResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitConsumerDoubleVotingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitConsumerDoubleVotingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/types/errors.go b/x/ccv/types/errors.go index b719e60479..e492984e48 100644 --- a/x/ccv/types/errors.go +++ b/x/ccv/types/errors.go @@ -6,14 +6,20 @@ import ( // CCV sentinel errors var ( - ErrInvalidPacketData = errorsmod.Register(ModuleName, 1, "invalid CCV packet data") - ErrInvalidVersion = errorsmod.Register(ModuleName, 2, "invalid CCV version") - ErrInvalidChannelFlow = errorsmod.Register(ModuleName, 3, "invalid message sent to channel end") - ErrInvalidGenesis = errorsmod.Register(ModuleName, 4, "invalid genesis state") - ErrDuplicateChannel = errorsmod.Register(ModuleName, 5, "CCV channel already exists") - ErrInvalidVSCMaturedId = errorsmod.Register(ModuleName, 6, "invalid vscId for VSC packet") - ErrInvalidVSCMaturedTime = errorsmod.Register(ModuleName, 7, "invalid maturity time for VSC packet") - ErrInvalidHandshakeMetadata = errorsmod.Register(ModuleName, 8, "invalid provider handshake metadata") - ErrChannelNotFound = errorsmod.Register(ModuleName, 9, "channel not found") - ErrClientNotFound = errorsmod.Register(ModuleName, 10, "client not found") + ErrInvalidPacketData = errorsmod.Register(ModuleName, 1, "invalid CCV packet data") + ErrInvalidVersion = errorsmod.Register(ModuleName, 2, "invalid CCV version") + ErrInvalidChannelFlow = errorsmod.Register(ModuleName, 3, "invalid message sent to channel end") + ErrInvalidGenesis = errorsmod.Register(ModuleName, 4, "invalid genesis state") + ErrDuplicateChannel = errorsmod.Register(ModuleName, 5, "CCV channel already exists") + ErrInvalidVSCMaturedId = errorsmod.Register(ModuleName, 6, "invalid vscId for VSC packet") + ErrInvalidVSCMaturedTime = errorsmod.Register(ModuleName, 7, "invalid maturity time for VSC packet") + ErrInvalidHandshakeMetadata = errorsmod.Register(ModuleName, 8, "invalid provider handshake metadata") + ErrChannelNotFound = errorsmod.Register(ModuleName, 9, "channel not found") + ErrClientNotFound = errorsmod.Register(ModuleName, 10, "client not found") + ErrInvalidConsumerState = errorsmod.Register(ModuleName, 11, "provider chain has invalid state for consumer chain") + ErrInvalidConsumerClient = errorsmod.Register(ModuleName, 12, "ccv channel is not built on correct client") + ErrInvalidProposal = errorsmod.Register(ModuleName, 13, "invalid proposal") + ErrDuplicateConsumerChain = errorsmod.Register(ModuleName, 14, "consumer chain already exists") + ErrConsumerChainNotFound = errorsmod.Register(ModuleName, 15, "consumer chain not found") + ErrInvalidDoubleVotingEvidence = errorsmod.Register(ModuleName, 16, "invalid consumer double voting evidence") ) diff --git a/x/ccv/types/events.go b/x/ccv/types/events.go index 7c7343021e..4c597ded56 100644 --- a/x/ccv/types/events.go +++ b/x/ccv/types/events.go @@ -2,17 +2,41 @@ package types // CCV events const ( - EventTypeTimeout = "timeout" - EventTypePacket = "ccv_packet" - EventTypeChannelEstablished = "channel_established" + EventTypeTimeout = "timeout" + EventTypePacket = "ccv_packet" + EventTypeChannelEstablished = "channel_established" + EventTypeFeeTransferChannelOpened = "fee_transfer_channel_opened" + EventTypeConsumerClientCreated = "consumer_client_created" + EventTypeAssignConsumerKey = "assign_consumer_key" + EventTypeAddConsumerRewardDenom = "add_consumer_reward_denom" + EventTypeRemoveConsumerRewardDenom = "remove_consumer_reward_denom" + EventTypeSubmitConsumerMisbehaviour = "submit_consumer_misbehaviour" + EventTypeSubmitConsumerDoubleVoting = "submit_consumer_double_voting" + EventTypeExecuteConsumerChainSlash = "execute_consumer_chain_slash" + EventTypeFeeDistribution = "fee_distribution" + EventTypeConsumerSlashRequest = "consumer_slash_request" + EventTypeVSCMatured = "vsc_matured" - AttributeKeyAckSuccess = "success" - AttributeKeyAck = "acknowledgement" - AttributeKeyAckError = "error" - - AttributeChainID = "chain_id" - AttributeValidatorAddress = "validator_address" - AttributeInfractionType = "infraction_type" - - AttributeValSetUpdateID = "valset_update_id" + AttributeKeyAckSuccess = "success" + AttributeKeyAck = "acknowledgement" + AttributeKeyAckError = "error" + AttributeInfractionHeight = "infraction_height" + AttributeConsumerHeight = "consumer_height" + AttributeTimestamp = "timestamp" + AttributeInitialHeight = "initial_height" + AttributeInitializationTimeout = "initialization_timeout" + AttributeTrustingPeriod = "trusting_period" + AttributeUnbondingPeriod = "unbonding_period" + AttributeProviderValidatorAddress = "provider_validator_address" + AttributeConsumerConsensusPubKey = "consumer_consensus_pub_key" + AttributeSubmitterAddress = "submitter_address" + AttributeConsumerMisbehaviour = "consumer_misbehaviour" + AttributeMisbehaviourClientId = "misbehaviour_client_id" + AttributeMisbehaviourHeight1 = "misbehaviour_height_1" + AttributeMisbehaviourHeight2 = "misbehaviour_height_2" + AttributeConsumerDoubleVoting = "consumer_double_voting" + AttributeChainID = "chain_id" + AttributeValidatorAddress = "validator_address" + AttributeInfractionType = "infraction_type" + AttributeValSetUpdateID = "valset_update_id" ) diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index 2f203a47ea..5b2f3f7a53 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -15,7 +15,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" auth "github.com/cosmos/cosmos-sdk/x/auth/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -31,10 +30,11 @@ type StakingKeeper interface { UnbondingTime(ctx sdk.Context) time.Duration GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (validator stakingtypes.Validator, found bool) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) (power int64) - // slash the validator and delegators of the validator, specifying offence height, offence power, and slash fraction Jail(sdk.Context, sdk.ConsAddress) // jail a validator Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec) math.Int SlashWithInfractionReason(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec, stakingtypes.Infraction) math.Int + SlashUnbondingDelegation(sdk.Context, stakingtypes.UnbondingDelegation, int64, sdk.Dec) math.Int + SlashRedelegation(sdk.Context, stakingtypes.Validator, stakingtypes.Redelegation, int64, sdk.Dec) math.Int Unjail(ctx sdk.Context, addr sdk.ConsAddress) GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool) IterateLastValidatorPowers(ctx sdk.Context, cb func(addr sdk.ValAddress, power int64) (stop bool)) @@ -48,12 +48,10 @@ type StakingKeeper interface { MaxValidators(ctx sdk.Context) uint32 GetLastTotalPower(ctx sdk.Context) math.Int GetLastValidators(ctx sdk.Context) (validators []stakingtypes.Validator) - GetUnbondingType(ctx sdk.Context, id uint64) (unbondingType stakingtypes.UnbondingType, found bool) BondDenom(ctx sdk.Context) (res string) -} - -type EvidenceKeeper interface { - HandleEquivocationEvidence(ctx sdk.Context, evidence *evidencetypes.Equivocation) + GetUnbondingDelegationsFromValidator(ctx sdk.Context, valAddr sdk.ValAddress) (ubds []stakingtypes.UnbondingDelegation) + GetRedelegationsFromSrcValidator(ctx sdk.Context, valAddr sdk.ValAddress) (reds []stakingtypes.Redelegation) + GetUnbondingType(ctx sdk.Context, id uint64) (unbondingType stakingtypes.UnbondingType, found bool) } // SlashingKeeper defines the contract expected to perform ccv slashing @@ -101,6 +99,9 @@ type ClientKeeper interface { GetClientState(ctx sdk.Context, clientID string) (ibcexported.ClientState, bool) GetLatestClientConsensusState(ctx sdk.Context, clientID string) (ibcexported.ConsensusState, bool) GetSelfConsensusState(ctx sdk.Context, height ibcexported.Height) (ibcexported.ConsensusState, error) + ClientStore(ctx sdk.Context, clientID string) sdk.KVStore + SetClientState(ctx sdk.Context, clientID string, clientState ibcexported.ClientState) + GetClientConsensusState(ctx sdk.Context, clientID string, height ibcexported.Height) (ibcexported.ConsensusState, bool) } // DistributionKeeper defines the expected interface of the distribution keeper