Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
517c694
remove the `InfractionParameters` from proto
Pantani Feb 4, 2026
c3f5e95
Merge branch 'main' into feat/review-slash-validation
Pantani Feb 4, 2026
61207d1
fix `NewMsgCreateConsumer`
Pantani Feb 4, 2026
0ca97be
remove unused keys
Pantani Feb 4, 2026
67cecdf
fix query infraction parameters
Pantani Feb 4, 2026
2a85945
remove infraction_parameters from tx cli
Pantani Feb 4, 2026
edef519
remove unused error
Pantani Feb 4, 2026
b66b38c
update docs, summary and plan
Pantani Feb 5, 2026
faf7fe3
Merge branch 'main' into feat/review-slash-validation
Pantani Feb 5, 2026
1f8f978
Merge branch 'main' into feat/review-slash-validation
Pantani Feb 6, 2026
f22e1f3
Merge remote-tracking branch 'origin/main' into feat/review-slash-val…
Pantani Feb 6, 2026
81408ac
Merge branch 'main' into feat/review-slash-validation
Pantani Feb 10, 2026
897bd30
- Make repeated evidence submissions idempotent when the validator is…
Pantani Feb 13, 2026
a822f1d
fix potencial issues and panics
Pantani Feb 13, 2026
db6b7b1
Merge branch 'main' into feat/review-slash-validation
Pantani Feb 19, 2026
df28ed1
Update x/vaas/provider/types/submit_msgs_test.go
Pantani Feb 19, 2026
28fced6
fix missbehaviur check
Pantani Feb 24, 2026
e12841d
fix wrong valset header
Pantani Feb 24, 2026
eda673e
Merge branch 'main' into feat/review-slash-validation
Pantani Mar 3, 2026
d409f0d
fix tests
Pantani Mar 3, 2026
40c66ec
apply code review
Pantani Mar 10, 2026
16e4f9c
fix proto numbers
Pantani Mar 10, 2026
7e9c87a
remove from json
Pantani Mar 23, 2026
2fa6246
Merge remote-tracking branch 'origin/main' into feat/review-slash-val…
Pantani Apr 6, 2026
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ consumer-init: build-apps
consumer-create:
@echo "Creating consumer chain on provider..."
@mkdir -p /tmp/vaas-test
@echo '{"chain_id": "consumer-localnet", "metadata": {"name": "consumer", "description": "test consumer chain", "metadata": "{}"}, "initialization_parameters": {"initial_height": {"revision_number": 0, "revision_height": 1}, "genesis_hash": "", "binary_hash": "", "spawn_time": "2024-01-01T00:00:00Z", "unbonding_period": 1728000000000000, "vaas_timeout_period": 2419200000000000, "historical_entries": 10000, "connection_id": ""}, "infraction_parameters": {"double_sign": {"slash_fraction": "0.05", "jail_duration": 9223372036854775807, "tombstone": true}, "downtime": {"slash_fraction": "0.0001", "jail_duration": 600000000000, "tombstone": false}}}' > /tmp/vaas-test/create_consumer.json
@echo '{"chain_id": "consumer-localnet", "metadata": {"name": "consumer", "description": "test consumer chain", "metadata": "{}"}, "initialization_parameters": {"initial_height": {"revision_number": 0, "revision_height": 1}, "genesis_hash": "", "binary_hash": "", "spawn_time": "2024-01-01T00:00:00Z", "unbonding_period": 1728000000000000, "vaas_timeout_period": 2419200000000000, "historical_entries": 10000, "connection_id": ""}}' > /tmp/vaas-test/create_consumer.json
$(providerd) tx provider create-consumer /tmp/vaas-test/create_consumer.json --from val --gas auto --gas-adjustment 1.5 --fees 10000uatone -y
@echo "Consumer chain created. Wait for spawn time, then run 'make consumer-genesis' to fetch the genesis."

Expand Down
2 changes: 1 addition & 1 deletion PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Rewrite `x/vaas/provider` and `x/vaas/consumer` in a new `vaas` folder as a **ne
| Partial Set Security (PSS) | **REMOVE** | All validators validate all consumers (no opt-in/out) |
| Power Shaping | **REMOVE** | No caps, allowlists, denylists, etc. |
| Key Assignment | **KEEP** | Validators can use different keys per consumer |
| Per-Consumer Infraction Parameters | **KEEP** | Customizable slash/jail params per consumer |
| Per-Consumer Infraction Parameters | **REMOVE** | Use provider defaults; no per-consumer customization |
| Slash Packet Throttling | **REMOVE** | Remove all slash-related functionality |
| Consumer Reward Distribution | **REMOVE** | No cross-chain rewards |
| Double Voting Evidence | **KEEP** | Handle double voting evidence from consumers |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ VAAS allows Cosmos blockchains to lease their proof-of-stake security to consume
|---------|-------------|
| Consumer Lifecycle | Full lifecycle management (REGISTERED → INITIALIZED → LAUNCHED → STOPPED → DELETED) |
| Key Assignment | Validators can use different consensus keys per consumer chain |
| Per-Consumer Infraction Parameters | Customizable slash/jail parameters per consumer |
| Slashing Parameters | Uses provider defaults; per-consumer customization removed |
| VSC Packets | Validator set updates sent at epoch boundaries |
| Double Voting Evidence | Handle double voting evidence from consumers |
| Light Client Misbehavior | Detection and logging of misbehavior |
Expand Down
2 changes: 1 addition & 1 deletion REWRITE_SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The rewrite simplifies the interchain security modules by removing several featu
### Provider Module
- Consumer Lifecycle Management (REGISTERED → INITIALIZED → LAUNCHED → STOPPED → DELETED)
- Key Assignment (validators can use different keys per consumer)
- Per-Consumer Infraction Parameters (custom slash/jail params per consumer)
- Provider Slashing Parameters only (per-consumer customization removed)
- VSC Packet Generation at epoch boundaries
- IBC Channel Management
- Double Voting Evidence handling
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.25
replace (
cosmossdk.io/x/evidence => github.com/atomone-hub/cosmos-sdk/x/evidence v0.1.1
cosmossdk.io/x/upgrade => github.com/atomone-hub/cosmos-sdk/x/upgrade v0.1.5-atomone.1.0.20251218143825-cbb67818e94a
github.com/bytedance/sonic => github.com/bytedance/sonic v1.12.7
github.com/bytedance/sonic => github.com/bytedance/sonic v1.15.0
github.com/cosmos/cosmos-sdk => github.com/atomone-hub/cosmos-sdk v0.50.14-atomone.1.0.20251218143825-cbb67818e94a
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
)
Comment thread
Pantani marked this conversation as resolved.
Expand Down Expand Up @@ -79,12 +79,13 @@ require (
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.2.0 // indirect
github.com/bits-and-blooms/bitset v1.22.0 // indirect
github.com/bytedance/gopkg v0.1.3 // indirect
github.com/bytedance/sonic v1.13.2 // indirect
github.com/bytedance/sonic/loader v0.2.4 // indirect
github.com/bytedance/sonic/loader v0.5.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect
github.com/cloudwego/base64x v0.1.6 // indirect
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a // indirect
Expand Down
20 changes: 9 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/
github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE=
github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY=
github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE=
github.com/bytedance/sonic v1.12.7 h1:CQU8pxOy9HToxhndH0Kx/S1qU/CuS9GnKYrGioDcU1Q=
github.com/bytedance/sonic v1.12.7/go.mod h1:tnbal4mxOMju17EGfknm2XyYcpyCnIROYOEYuemj13I=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
github.com/bytedance/sonic v1.15.0 h1:/PXeWFaR5ElNcVE84U0dOHjiMHQOwNIx3K4ymzh/uSE=
github.com/bytedance/sonic v1.15.0/go.mod h1:tFkWrPz0/CUCLEF4ri4UkHekCIcdnkqXw9VduqpJh0k=
github.com/bytedance/sonic/loader v0.5.0 h1:gXH3KVnatgY7loH5/TkeVyXPfESoqSBSBEiDd5VjlgE=
github.com/bytedance/sonic/loader v0.5.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
Expand All @@ -182,9 +183,8 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
Expand Down Expand Up @@ -546,10 +546,8 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs
github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
Expand Down Expand Up @@ -792,6 +790,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
Expand Down Expand Up @@ -1143,7 +1142,6 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
nhooyr.io/websocket v1.8.11 h1:f/qXNc2/3DpoSZkHt1DQu6rj4zGC8JmkkLkWss0MgN0=
nhooyr.io/websocket v1.8.11/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk=
pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
Expand Down
5 changes: 1 addition & 4 deletions proto/vaas/provider/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ message Chain {
// The metadata of the consumer chain
ConsumerMetadata metadata = 4 [(gogoproto.nullable) = false ];
string consumer_id = 5;
// Infraction parameters for slashing and jailing
InfractionParameters infraction_parameters = 6;
}

message QueryValidatorConsumerAddrRequest {
Expand Down Expand Up @@ -257,10 +255,9 @@ message QueryConsumerChainResponse {
string phase = 4;
ConsumerMetadata metadata = 5 [ (gogoproto.nullable) = false ];
ConsumerInitializationParameters init_params = 6;
InfractionParameters infraction_parameters = 7;

// corresponds to the id of the client that is created during launch
string client_id = 8;
string client_id = 7;
}

message QueryConsumerGenesisTimeRequest {
Expand Down
6 changes: 0 additions & 6 deletions proto/vaas/provider/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ message MsgCreateConsumer {
ConsumerMetadata metadata = 3 [ (gogoproto.nullable) = false ];

ConsumerInitializationParameters initialization_parameters = 4;

// infraction parameters for slashing and jailing
InfractionParameters infraction_parameters = 5;
}

// MsgCreateConsumerResponse defines response type for MsgCreateConsumer
Expand Down Expand Up @@ -161,9 +158,6 @@ message MsgUpdateConsumer {
// the chain id CANNOT be updated.
// This field is optional and can remain empty (i.e., `new_chain_id = ""`) or correspond to the chain id the chain already has.
string new_chain_id = 6;

// infraction parameters for slashing and jailing
InfractionParameters infraction_parameters = 7;
}

// MsgUpdateConsumerResponse defines response type for MsgUpdateConsumer messages
Expand Down
12 changes: 0 additions & 12 deletions tests/e2e/testdata/create_consumer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,5 @@
"vaas_timeout_period": 2419200000000000,
"historical_entries": 10000,
"connection_id": ""
},
"infraction_parameters": {
"double_sign": {
"slash_fraction": "0.05",
"jail_duration": 9223372036854775807,
"tombstone": true
},
"downtime": {
"slash_fraction": "0.0001",
"jail_duration": 600000000000,
"tombstone": false
}
}
}
43 changes: 9 additions & 34 deletions x/vaas/provider/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,23 +238,11 @@ where create_consumer.json has the following structure:
"ccv_timeout_period": 2419200000000000,
"historical_entries": 10000,
"connection_id": ""
},
"infraction_parameters":{
"double_sign":{
"slash_fraction": "0.05",
"jail_duration": 9223372036854775807,
"tombstone": true
},
"downtime":{
"slash_fraction": "0.0001",
"jail_duration": 600000000000,
"tombstone": false
}
}
}

Note that both 'chain_id' and 'metadata' are mandatory;
and 'initialization_parameters' and 'infraction_parameters' are optional.
and 'initialization_parameters' is optional.
The parameters not provided are set to their zero value.
`, version.AppName)),
Args: cobra.ExactArgs(1),
Expand All @@ -281,8 +269,7 @@ The parameters not provided are set to their zero value.
return fmt.Errorf("consumer data unmarshalling failed: %w", err)
}

msg, err := types.NewMsgCreateConsumer(submitter, consCreate.ChainId, consCreate.Metadata, consCreate.InitializationParameters,
consCreate.InfractionParameters)
msg, err := types.NewMsgCreateConsumer(submitter, consCreate.ChainId, consCreate.Metadata, consCreate.InitializationParameters)
if err != nil {
return err
}
Expand Down Expand Up @@ -328,30 +315,18 @@ where update_consumer.json has the following structure:
},
"genesis_hash": "",
"binary_hash": "",
"spawn_time": "2024-08-29T12:26:16.529913Z",
"unbonding_period": 1728000000000000,
"ccv_timeout_period": 2419200000000000,
"historical_entries": 10000,
"connection_id": ""
},
"infraction_parameters":{
"double_sign":{
"slash_fraction": "0.05",
"jail_duration": 9223372036854775807,
"tombstone": true
},
"downtime":{
"slash_fraction": "0.0001",
"jail_duration": 600000000000,
"tombstone": false
}
"spawn_time": "2024-08-29T12:26:16.529913Z",
"unbonding_period": 1728000000000000,
"ccv_timeout_period": 2419200000000000,
"historical_entries": 10000,
"connection_id": ""
},
"new_chain_id": "newConsumer-1" // is optional and can be empty (i.e., "new_chain_id": "")
}

Note that only 'consumer_id' is mandatory. The others are optional.
Not providing one of them will leave the existing values unchanged.
Providing one of 'metadata', 'initialization_parameters', or 'infraction_parameters'
Providing one of 'metadata' or 'initialization_parameters'
will update all the containing fields.
If one of the fields is missing, it will be set to its zero value.
`, version.AppName)),
Expand Down Expand Up @@ -385,7 +360,7 @@ If one of the fields is missing, it will be set to its zero value.
}

msg, err := types.NewMsgUpdateConsumer(owner, consUpdate.ConsumerId, consUpdate.NewOwnerAddress, consUpdate.Metadata,
consUpdate.InitializationParameters, consUpdate.NewChainId, consUpdate.InfractionParameters)
consUpdate.InitializationParameters, consUpdate.NewChainId)
if err != nil {
return err
}
Expand Down
56 changes: 22 additions & 34 deletions x/vaas/provider/keeper/consumer_equivocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,31 @@ func (k Keeper) HandleConsumerDoubleVoting(
return err
}

alreadyTombstoned := false
if err = k.SlashValidator(ctx, providerAddr, infractionParams.DoubleSign); err != nil {
return err
// Make repeated (already-processed) evidence submissions idempotent.
if errors.Is(err, slashingtypes.ErrValidatorTombstoned) {
alreadyTombstoned = true
} else {
return err
}
}
if err = k.JailAndTombstoneValidator(ctx, providerAddr, infractionParams.DoubleSign); err != nil {
return err
if !alreadyTombstoned {
if err = k.JailAndTombstoneValidator(ctx, providerAddr, infractionParams.DoubleSign); err != nil {
if errors.Is(err, slashingtypes.ErrValidatorTombstoned) {
alreadyTombstoned = true
} else {
return err
}
}
}

k.Logger(ctx).Info(
"confirmed equivocation",
"consumerId", consumerId,
"chainId", chainId,
"byzantine validator address", providerAddr.String(),
"already_tombstoned", alreadyTombstoned,
)

return nil
Expand Down Expand Up @@ -166,14 +179,14 @@ func (k Keeper) VerifyDoubleVotingEvidence(
// 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
// HandleConsumerMisbehaviour checks if the given IBC misbehaviour corresponds to an equivocation light client attack.
// VAAS only validates and logs misbehaviour submissions (no slashing/jailing/tombstoning).
func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, consumerId string, 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, consumerId, misbehaviour); err != nil {
logger.Info("Misbehaviour rejected", err.Error())
logger.Info("misbehaviour rejected", "error", err.Error())

return err
}
Expand All @@ -189,45 +202,20 @@ func (k Keeper) HandleConsumerMisbehaviour(ctx sdk.Context, consumerId string, m
}

provAddrs := make([]types.ProviderConsAddress, 0, len(byzantineValidators))

// get default infraction parameters (per-consumer params removed)
infractionParams, err := types.DefaultConsumerInfractionParameters(ctx, k.slashingKeeper)
if err != nil {
return err
}

// slash, jail, and tombstone the Byzantine validators
for _, v := range byzantineValidators {
providerAddr := k.GetProviderAddrFromConsumerAddr(
ctx,
consumerId,
types.NewConsumerConsAddress(sdk.ConsAddress(v.Address.Bytes())),
)
err := k.SlashValidator(ctx, providerAddr, infractionParams.DoubleSign)
if err != nil {
logger.Error("failed to slash validator: %s", err)
continue
}
err = k.JailAndTombstoneValidator(ctx, providerAddr, infractionParams.DoubleSign)
// 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)
}

Comment thread
Pantani marked this conversation as resolved.
// 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",
"confirmed equivocation light client attack (no slashing applied)",
"consumerId", consumerId,
"byzantine validators slashed, jailed and tombstoned", provAddrs,
"chainId", misbehaviour.Header1.Header.ChainID,
Comment thread
Pantani marked this conversation as resolved.
"byzantine_validators", provAddrs,
Comment thread
Pantani marked this conversation as resolved.
)

return nil
Expand Down
Loading
Loading