Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: add cryptographic equivocation #1340

Merged
merged 88 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 80 commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
42279c8
docs: cleanup changelog for v2.0.0 on release/v2.0.x (#987)
shaspitz Jun 1, 2023
8ce740f
chore: Hardcode golangci-lint version (backport #990) (#1013)
mergify[bot] Jun 13, 2023
e8230bc
fix: proper consumer key prefix ordering (backport #991) (#1011)
mergify[bot] Jun 13, 2023
42f916e
feat: Remove consumer genesis migration on provider (backport #997) (…
mergify[bot] Jun 13, 2023
2395b6f
fix: limit vsc matured packets handled per endblocker (backport #1004…
mergify[bot] Jun 13, 2023
163da4e
feat: integrate cometmock (backport #989) (#1030)
mergify[bot] Jun 16, 2023
afa541f
feat!: Add DistributionTransmissionChannel to ConsumerAdditionProposa…
shaspitz Jun 16, 2023
362b7c0
refactor: log when constructing IBC err ack (backport #1090) (#1094)
mergify[bot] Jun 28, 2023
16e71ab
fix: `AttributeDistributionTotal` in event emit (backport #1097) (#1114)
mergify[bot] Jul 6, 2023
8a1b3ca
docs: update broken md links (backport #1130) (#1142)
mergify[bot] Jul 13, 2023
a77eea1
feat!: add ICS misbehaviour handling (#826)
sainoe Aug 14, 2023
309bd85
deps!: support cosmos-sdk-v45-ics-lsm integration (#1120)
MSalopek Aug 16, 2023
2573975
docs: add v2.0.0-lsm changelog section (#1210)
mpoke Aug 16, 2023
6b0a94a
deps: bump SDK to v0.45.16-ics-lsm (#1212)
mpoke Aug 18, 2023
21e3d83
feat: improve ICS misbehaviour E2E testing coverage (#1225)
sainoe Aug 23, 2023
292ad75
refactor: address comments of ICS Misbehaviour PRs #826 and #1148 (#…
sainoe Aug 23, 2023
f168b9b
feat: add handler for consumer double voting (#1232)
sainoe Aug 28, 2023
f12a5c0
fix: tiny bug in `NewSubmitConsumerDoubleVotingCmd` (#1247)
sainoe Aug 31, 2023
2501e83
fix: make `HandleConsumerDoubleVoting` works with provider pubkeys (#…
sainoe Sep 4, 2023
eb6a079
fix: verify equivocation using validator pubkey in `SubmitConsumerDou…
sainoe Sep 6, 2023
98af9c0
refactor: update the E2E tests to work with Hermes relayer v1.6.0 (#1…
sainoe Sep 8, 2023
c881a1a
test: add E2E tests for double voting evidence handling (#1256)
sainoe Sep 11, 2023
494c4d2
feat!: provider proposal for changing reward denoms (backport #1280) …
mergify[bot] Sep 12, 2023
a71f1fe
save
sainoe Sep 13, 2023
3be76ad
fix nits
sainoe Sep 14, 2023
691d206
Merge remote-tracking branch 'upstream/release/v2.1.x-lsm' into feat/…
sainoe Sep 14, 2023
88e0717
update changelog and fix nits
sainoe Sep 14, 2023
022cd5d
feat: implement slashing functionality on the provider chain (ADR-013…
insumity Sep 27, 2023
a8f6b11
make build pass
sainoe Sep 28, 2023
04ca9a1
fix e2e happy-path-short test
sainoe Sep 28, 2023
8163735
make consumer misbehaviour and double signing tests pass
sainoe Sep 28, 2023
ac9f3ff
currently debugging democracy-reward
sainoe Sep 29, 2023
1fbaf09
fix e2e democ test
sainoe Sep 29, 2023
517cdb4
refactor: remove equivocation proposal (#1294)
insumity Sep 29, 2023
dddcd1b
add equivo removal failing tests
sainoe Oct 2, 2023
d9903a2
fix democ e2e tests
sainoe Oct 2, 2023
67b8c31
make mem tests pass
insumity Sep 27, 2023
1fd8409
lint
sainoe Oct 3, 2023
e424e47
refactor for SDK v47 and merge with main branch
sainoe Oct 3, 2023
e27b7b7
fix Dockerfile
sainoe Oct 3, 2023
e7a8e7b
update changelog
sainoe Oct 3, 2023
7868be6
Merge branch 'main' into feat/ics-misbehaviour-handling
sainoe Oct 3, 2023
8349b82
fix nits
sainoe Oct 3, 2023
ea545b4
update rapid test
sainoe Oct 4, 2023
92a9d17
fix democ tests
sainoe Oct 4, 2023
f8f1029
update test traces
sainoe Oct 4, 2023
00d4f2f
update changelog
sainoe Oct 4, 2023
e29cb92
fix CHANGELOG.md
sainoe Oct 4, 2023
d35c983
nits
sainoe Oct 4, 2023
9688154
Update docs/docs/features/slashing.md
sainoe Oct 12, 2023
108fe33
Update proto/interchain_security/ccv/provider/v1/tx.proto
sainoe Oct 12, 2023
1aaea88
Update x/ccv/provider/client/cli/tx.go
sainoe Oct 12, 2023
1d511b4
Update x/ccv/provider/client/cli/tx.go
sainoe Oct 12, 2023
991181a
Update x/ccv/provider/keeper/misbehaviour.go
sainoe Oct 12, 2023
c858173
Update x/ccv/provider/keeper/punish_validator.go
sainoe Oct 12, 2023
fb92af9
Update x/ccv/provider/keeper/punish_validator.go
sainoe Oct 12, 2023
28e0c14
Update x/ccv/provider/keeper/punish_validator.go
sainoe Oct 12, 2023
9f23165
check verifying pubkey against validator address
sainoe Oct 13, 2023
7092914
add tests
sainoe Oct 13, 2023
f886a7b
update checkMisbehaviour tests
sainoe Nov 8, 2023
a290d76
save
sainoe Nov 8, 2023
7dc78bb
update all misbehaviour memory tests
sainoe Nov 8, 2023
ecd796f
fix misb verify valset sigs test
sainoe Nov 9, 2023
6769af5
revert misb check fix for ibc 7
sainoe Nov 9, 2023
e070f3b
nit fix
sainoe Nov 9, 2023
80e9d25
fix nit
sainoe Nov 9, 2023
310788e
fix: add equivocation proposal message back in protos (#1394)
sainoe Nov 6, 2023
f2c1a3f
fix!: verify the signatures of byzantine validators in misbehaviour h…
sainoe Nov 13, 2023
a22030b
Merge branch 'main' into feat/ics-misbehaviour-handling
sainoe Nov 14, 2023
84955b9
feat: update misbehaviour handling using IBC-Go 7 (#1401)
sainoe Nov 15, 2023
12c1bda
nit
sainoe Nov 16, 2023
c72fa09
Update x/ccv/provider/keeper/double_vote.go
sainoe Nov 16, 2023
74a3314
Update x/ccv/provider/keeper/double_vote.go
sainoe Nov 16, 2023
481f0cc
Update x/ccv/provider/keeper/misbehaviour.go
sainoe Nov 16, 2023
eabf667
Update x/ccv/provider/keeper/misbehaviour.go
sainoe Nov 16, 2023
6c3d1b5
Update tests/integration/double_vote.go
sainoe Nov 16, 2023
9037e30
Update x/ccv/provider/client/cli/tx.go
sainoe Nov 16, 2023
d458eda
Update x/ccv/provider/client/cli/tx.go
sainoe Nov 16, 2023
af531f3
address comments
sainoe Nov 16, 2023
26c1b11
address comments
sainoe Nov 16, 2023
7440b43
Update x/ccv/provider/types/proposal.go
sainoe Nov 21, 2023
d61f474
Update tests/integration/double_vote.go
sainoe Nov 21, 2023
1895f87
Port: (feat!) [#1435](https://github.com/cosmos/interchain-security/p…
sainoe Nov 21, 2023
695bd6e
fix: update consumer double vote cmd (#1439)
sainoe Nov 20, 2023
8caad9f
update CHANGELOG
sainoe Nov 21, 2023
3310d91
update changelog
sainoe Nov 21, 2023
2d476c2
update changelog entries
sainoe Nov 21, 2023
03aada4
nits
sainoe Nov 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Add the cryptographic verification of equivocation feature to the
provider (cf. ADR-005 & ADR-013) and remove the equivocation proposal.
([\#1340](https://github.com/cosmos/interchain-security/pull/1340))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add the cryptographic verification of equivocation feature to the provider
(cf. ADR-005 & ADR-013). ([\#1340](https://github.com/cosmos/interchain-security/pull/1340))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add the cryptographic verification of equivocation feature to the provider
(cf. ADR-005 & ADR-013). ([\#1340](https://github.com/cosmos/interchain-security/pull/1340))
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
# CHANGELOG

## [Unreleased for Provider]

Add an entry to the unreleased provider section whenever merging a PR to main that is not targeted at a specific release. These entries will eventually be included in a provider release.

* (feature!) [#1280](https://github.com/cosmos/interchain-security/pull/1280) provider proposal for changing reward denoms
* (feature!) [#1244](https://github.com/cosmos/interchain-security/pull/1244) Update the default consumer unbonding period to 2 weeks.
* (deps) [#1259](https://github.com/cosmos/interchain-security/pull/1259) Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5).
* (deps!) [#1258](https://github.com/cosmos/interchain-security/pull/1258) Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v7.3.0](https://github.com/cosmos/ibc-go/releases/tag/v7.3.0).
* (deps) [#1258](https://github.com/cosmos/interchain-security/pull/1258) Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.47.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.4).
* (deps!) [#1196](https://github.com/cosmos/interchain-security/pull/1196) Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v7.2.0](https://github.com/cosmos/ibc-go/releases/tag/v7.2.0).
* `[x/ccv/provider]` (fix) [#1076](https://github.com/cosmos/interchain-security/pull/1076) Add `InitTimeoutTimestamps` and `ExportedVscSendTimestamps` to exported genesis.
* (fix!) [#1422](https://github.com/cosmos/interchain-security/pull/1422) Fix the misbehaviour handling by verifying the signatures of byzantine validators.

## v2.2.0-provider-lsm

### Cryptographic verification of equivocation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linked EPIC's task list also contains slashing issues, so it might make sense to put it in the title here as well?

* New feature enabling the provider chain to verify equivocation evidence on its own instead of trusting consumer chains, see [EPIC](https://github.com/cosmos/interchain-security/issues/732).

## [Unreleased for Consumer]

Add an entry to the unreleased consumer section whenever merging a PR to main that is not targeted at a specific release. These entries will eventually be included in a consumer release.

## v3.2.0-consumer

Date September 6th, 2023

A minor version upgrade to the CONSUMER CCV module. This release includes various changes involving throttling v2 functionality, validation, and bumps to deps like cosmos-sdk and ibc-go.

Note:

* This release is ONLY RELEVANT TO CONSUMERS. The most recent provider release is v3.1.0, and will eventually be a release postfixed with `-provider`.
* this is the first upgrade to the consumer module with a separate semver cycle from the provider module. See [contributing.md](./CONTRIBUTING.md#semantic-versioning) and [associated ADR](docs/docs/adrs/adr-012-separate-releasing.md) for more info.

Changes:

* (feat) [#1295](https://github.com/cosmos/interchain-security/pull/1295) increment consumer consensus version and register consumer packet migration.
* (fix!) [#1262](https://github.com/cosmos/interchain-security/pull/1262) Remove incorrect address validation on `ProviderFeePoolAddrStr` param.
* (feature!) [#1244](https://github.com/cosmos/interchain-security/pull/1244) Update the default consumer unbonding period to 2 weeks.
* (fix!) [#1244](https://github.com/cosmos/interchain-security/pull/1244) Validate token transfer messages before calling `Transfer()`.
* (deps) [#1259](https://github.com/cosmos/interchain-security/pull/1259) Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5).
* (deps!) [#1258](https://github.com/cosmos/interchain-security/pull/1258) Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v7.3.0](https://github.com/cosmos/ibc-go/releases/tag/v7.3.0).
* (deps) [#1258](https://github.com/cosmos/interchain-security/pull/1258) Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.47.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.4).
* (deps!) [#1196](https://github.com/cosmos/interchain-security/pull/1196) Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v7.2.0](https://github.com/cosmos/ibc-go/releases/tag/v7.2.0).
* (feat!) [#1024](https://github.com/cosmos/interchain-security/pull/1024) Throttle with retries, consumer changes.
* (fix!) [#1150](https://github.com/cosmos/interchain-security/pull/1150) Revert consumer packet data changes from #1037.
* (fix!) [#1146](https://github.com/cosmos/interchain-security/pull/1146) Proper deletion of pending packets.
* (feat!) [#1037](https://github.com/cosmos/interchain-security/pull/1037) Optimize pending packets storage on consumer, with migration.
* (feat) [#1164](https://github.com/cosmos/interchain-security/pull/1164) Introduce the gRPC query `/interchain_security/ccv/consumer/provider-info` and CLI command `interchain-security-cd q ccvconsumer provider-info` to retrieve provider info from the consumer chain.

## v3.1.0

Date July 11th, 2023
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be replaced with a released version of Hermes.


# Get CometMock
FROM ghcr.io/informalsystems/cometmock:v0.37.x as cometmock-builder
Expand Down
20 changes: 10 additions & 10 deletions app/provider/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ var (
ibcclientclient.UpgradeProposalHandler,
ibcproviderclient.ConsumerAdditionProposalHandler,
ibcproviderclient.ConsumerRemovalProposalHandler,
ibcproviderclient.EquivocationProposalHandler,
ibcproviderclient.ChangeRewardDenomsProposalHandler,
},
),
Expand Down Expand Up @@ -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],
Expand All @@ -424,7 +415,6 @@ func New(
app.StakingKeeper,
app.SlashingKeeper,
app.AccountKeeper,
app.EvidenceKeeper,
app.DistrKeeper,
app.BankKeeper,
authtypes.FeeCollectorName,
Expand Down Expand Up @@ -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
Expand Down
58 changes: 0 additions & 58 deletions docs/docs/features/proposals.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<consensus address ON THE PROVIDER>"
}
]
}
```

## 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.
Expand All @@ -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.
17 changes: 5 additions & 12 deletions docs/docs/features/slashing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
:::

<!-- markdown-link-check-disable-next-line -->
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.
4 changes: 0 additions & 4 deletions docs/docs/introduction/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/validators/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion proto/interchain_security/ccv/provider/v1/provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove those at some point? With a next release or so? If yes, then it would make sense to create an issue so we don't forget to do so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing them would require a migration since an equivocation prop exists in states (prop 818).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meaning we should do this if we have a release coming up that needs a migration anyways?

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;
Expand Down
40 changes: 38 additions & 2 deletions proto/interchain_security/ccv/provider/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {}
49 changes: 34 additions & 15 deletions tests/e2e/action_rapid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func GetActionGen() *rapid.Generator[any] {
GetSubmitConsumerAdditionProposalActionGen().AsAny(),
GetSubmitConsumerRemovalProposalActionGen().AsAny(),
GetSubmitParamChangeProposalActionGen().AsAny(),
GetSubmitEquivocationProposalActionGen().AsAny(),
GetVoteGovProposalActionGen().AsAny(),
GetStartConsumerChainActionGen().AsAny(),
GetAddChainToRelayerActionGen().AsAny(),
Expand All @@ -91,6 +90,9 @@ func GetActionGen() *rapid.Generator[any] {
CreateLightClientEquivocationAttackActionGen().AsAny(),
CreateLightClientAmnesiaAttackActionGen().AsAny(),
CreateLightClientLunaticAttackActionGen().AsAny(),
GetStartConsumerEvidenceDetectorActionGen().AsAny(),
GetForkConsumerChainActionGen().AsAny(),
GetUpdateLightClientActionGen().AsAny(),
)
}

Expand Down Expand Up @@ -209,7 +211,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"),
}
})
}
Expand Down Expand Up @@ -280,19 +282,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")
Expand Down Expand Up @@ -506,3 +495,33 @@ func GetWaitTimeAction() *rapid.Generator[waitTimeAction] {
}
})
}

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"),
}
})
}
Loading
Loading