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

ICS28: Update SlashPacketData #728

Merged
merged 97 commits into from
May 10, 2022
Merged
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
604b3ae
Create README.md
mpoke Jan 17, 2022
a9b6dad
Add files with CCV spec
mpoke Jan 17, 2022
312d108
fix links to ICS 4
mpoke Jan 17, 2022
4f2b2f8
fix links to ICS 7
mpoke Jan 17, 2022
0f826ac
add ICS 28 to main README.md
mpoke Jan 17, 2022
4c4550a
adding tech spec for unbonding delegations
mpoke Jan 18, 2022
106afe0
add context on unbonding operations
mpoke Jan 18, 2022
06a2eb2
add unbonding operation diagram
mpoke Jan 19, 2022
6085697
Update spec/app/ics-028-cross-chain-validation/overview_and_basic_con…
mpoke Jan 25, 2022
d2b7377
Update spec/app/ics-028-cross-chain-validation/overview_and_basic_con…
mpoke Jan 25, 2022
b132122
Update spec/app/ics-028-cross-chain-validation/system_model_and_prope…
mpoke Jan 25, 2022
e470c84
Update spec/app/ics-028-cross-chain-validation/technical_specificatio…
mpoke Jan 25, 2022
28e7131
Update spec/app/ics-028-cross-chain-validation/README.md
mpoke Jan 25, 2022
4bdcd8b
Update spec/app/ics-028-cross-chain-validation/README.md
mpoke Jan 25, 2022
dee8d30
minor, remove confusing phrasing
mpoke Jan 25, 2022
db69640
child -> consumer; parent -> provider
mpoke Jan 25, 2022
35cdcd8
clarify which staking module
mpoke Jan 25, 2022
ab41f91
extend staking assumptions, remove redundant inv, prove staking props…
mpoke Jan 25, 2022
45b038c
modify staking hooks spec to cover other unbonding ops
mpoke Jan 20, 2022
faac42c
Merge branch 'marius/ccv-init-and-vsc' into marius/ccv-staking-hooks
mpoke Jan 25, 2022
9631aba
provider Staking module
mpoke Jan 25, 2022
4c3f2db
Merge branch 'marius/ccv-staking-hooks' of github.com:cosmos/ibc into…
mpoke Jan 25, 2022
9ef5aef
break long lines
mpoke Jan 25, 2022
bdf3c48
break long lines
mpoke Jan 25, 2022
0d9edad
remove dependecies to Cosmos SDK
mpoke Jan 26, 2022
6afb942
Merge branch 'marius/ccv-init-and-vsc' into marius/ccv-staking-hooks
mpoke Jan 26, 2022
08ceb8a
changes in the security model
mpoke Jan 27, 2022
5c7da62
specify multiple consumer chains
mpoke Jan 27, 2022
9d25746
channel init overview
mpoke Jan 27, 2022
270cae8
Merge branch 'marius/ccv-init-and-vsc' into marius/ccv-staking-hooks
mpoke Jan 27, 2022
69b0a1f
address issues #27 and #33 from cosmos/interchain-security repo
mpoke Feb 10, 2022
01b7a3b
Merge branch 'marius/ccv-staking-hooks' of github.com:cosmos/ibc into…
mpoke Feb 10, 2022
495c8db
resolve merge conflict
mpoke Feb 10, 2022
ff8c173
extend consumer InitGenesis
mpoke Feb 14, 2022
69763bc
describe mechanism to disseminate genesis state
mpoke Feb 15, 2022
7db4308
describe mapping heights provider <> consumer
mpoke Feb 15, 2022
5b0302b
remove ExportGenesis and restarted chains
mpoke Feb 16, 2022
fccb14d
add overview of consumer initiated slashing
mpoke Feb 16, 2022
51872a6
add slashing invariant
mpoke Feb 17, 2022
cb1707a
add assumptions needed by evidence
mpoke Feb 17, 2022
a09d008
Update spec/app/ics-028-cross-chain-validation/overview_and_basic_con…
mpoke Feb 17, 2022
9982f76
draft CCV props for slashing
mpoke Feb 17, 2022
744ea88
replace time w/ height; add HtoVSC and VSCtoH
mpoke Feb 17, 2022
16dc913
replace time with height in invariants and properties
mpoke Feb 17, 2022
5a873e1
validate channel IDs on provider genesis
mpoke Feb 21, 2022
263d890
prove Slashing Invariant
mpoke Feb 21, 2022
29babea
enable mapping from consumer to provider heights
mpoke Feb 21, 2022
5977701
fix conflic: merge with marius/ccv-init-genesis
mpoke Feb 21, 2022
4166744
technical spec for slashing
mpoke Feb 22, 2022
fcc1c14
minor changes
mpoke Feb 22, 2022
9902ecd
fix links to tendermint spec
mpoke Feb 23, 2022
0484d32
clarify Staking vs Slashing modules
mpoke Feb 23, 2022
bda9108
replace VSC acks w/ VSCMaturedPackets
mpoke Feb 23, 2022
ee33c48
fix some TODOs
mpoke Feb 23, 2022
c983620
fix properties
mpoke Feb 24, 2022
7283049
Merge branch 'marius/ccv' into marius/ccv-staking-hooks
mpoke Feb 24, 2022
078fa97
Merge branch 'marius/ccv-staking-hooks' into marius/ccv-init-genesis
mpoke Feb 24, 2022
44b058a
Merge branch 'marius/ccv-init-genesis' into marius/ccv-evidence
mpoke Feb 24, 2022
3221e79
HtoVSC and VSCtoH from () to []
mpoke Feb 25, 2022
7ecb10e
fix infraction height and add intuition diagram
mpoke Feb 28, 2022
110e799
resolve merge conflict
mpoke Feb 28, 2022
8b0915b
keep ValidatorSet in consumer CCV module state
mpoke Mar 7, 2022
c904c21
remove CCV channel status
mpoke Mar 7, 2022
6889441
add outstanding downtime flag and decouple from validatorSet
mpoke Mar 8, 2022
72ae68f
adressing Josef's comment
mpoke Mar 8, 2022
e4aac3e
update init methods and ics26 methods
mpoke Mar 9, 2022
754aefd
fix merge conflicts
mpoke Mar 10, 2022
4608ab5
updating ValSet Update methods
mpoke Mar 10, 2022
4b20b7a
Merge branch 'marius/ccv-evidence' into marius/668-ccv-channel-state
mpoke Mar 10, 2022
d0293b4
updating Consumer Initiated Slashing methods
mpoke Mar 10, 2022
f2fbb66
fix issues pointed by Simon
mpoke Mar 11, 2022
e0401ee
dealing with downtime slashing atomicity
mpoke Mar 11, 2022
974224c
Merge branch 'marius/ccv-evidence' into marius/668-ccv-channel-state
mpoke Mar 11, 2022
cabc738
resolve merge conflict
mpoke Mar 11, 2022
9791e36
resolve conflicts when merging base
mpoke Mar 23, 2022
1328fa4
handle pending proposals
mpoke Mar 23, 2022
31c4568
remove genesis hash
mpoke Mar 23, 2022
4f7652b
remove details of genesis state dissemination
mpoke Mar 30, 2022
b098826
add overview of reward distribution
mpoke Mar 31, 2022
043d7d9
add CCVHandshakeMetadata and update channel handshake methods signatures
mpoke Mar 31, 2022
5692d8d
initiate opening handshake for transfer channel
mpoke Mar 31, 2022
8a321e1
add DistributeRewards() method
mpoke Apr 4, 2022
2499584
resolve merge conflict
mpoke Apr 4, 2022
11b93c5
set initH in onChanOpenConfirm
mpoke Apr 4, 2022
ef06edd
address review comments
mpoke Apr 6, 2022
2a15d41
add distribution invariant
mpoke Apr 7, 2022
ed461e5
Merge branch 'marius/ccv-distribution' into marius/702-ccv-inith
mpoke Apr 7, 2022
24acf57
stopping a consumer chain
mpoke Apr 7, 2022
8ba5dc1
remove BeforeUnbondingOpCompleted hook
mpoke Apr 11, 2022
9ed8e8b
resolve merge conflict
mpoke Apr 20, 2022
ea6919b
deal with timeouts on the consumer side
mpoke Apr 20, 2022
704e9de
fix typo
mpoke Apr 29, 2022
e5e79aa
add note on how to shut down the consumer
mpoke Apr 29, 2022
3f24b4b
add note on safety implication of lockUnbondingOnTimeout
mpoke May 2, 2022
07f9243
Merge branch 'marius/651-ccv-remove-consumer' into marius/710-ccv-sta…
mpoke May 2, 2022
8c47588
update SlashPacket
mpoke May 2, 2022
5a80490
resolve merge conflict
mpoke May 10, 2022
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
37 changes: 21 additions & 16 deletions spec/app/ics-028-cross-chain-validation/technical_specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,20 @@ Before describing the data structures and sub-protocols of the CCV protocol, we
The interaction is defined by the following interface:
```typescript
interface SlashingKeeper {
// request the Staking module to slash a validator
// query the Slashing module for the slashing factor,
// which may be different for downtime infractions
GetSlashFactor(downtime: Bool): int64

// request the Slashing module to slash a validator
Slash(valAddress: string,
infractionHeight: int64,
power: int64,
slashFactor: int64)

// query the Slashing module for the jailing time,
// which may be different for downtime infractions
GetJailTime(downtime: Bool): int64

// request the Slashing module to jail a validator until time
JailUntil(valAddress: string, time: uint64)
}
Expand Down Expand Up @@ -234,8 +242,7 @@ The following packet data types are required by the CCV module:
valAddress: string // validator address, i.e., the hash of its public key
valPower: int64
vscId: uint64
slashFactor: int64
jailTime: uint64
downtime: Bool
}
```
> Note that for brevity we use e.g., `VSCPacket` to refer to a packet with `VSCPacketData` as its data.
Expand Down Expand Up @@ -1636,6 +1643,8 @@ function onRecvVSCPacket(packet: Packet): bytes {
pendingChanges.Append(packet.data.updates)

// calculate and store the maturity timestamp for the VSC
// TODO governance and CCV params (UnbondingPeriod)
// see https://github.com/cosmos/ibc/issues/673
maturityTimestamp = currentTimestamp().Add(UnbondingPeriod)
maturingVSCs.Add(packet.data.id, maturityTimestamp)

Expand Down Expand Up @@ -1879,15 +1888,18 @@ function onRecvSlashPacket(packet: Packet): bytes {
}

// request the Slashing module to slash the validator
// using the slashFactor set on the provider chain
slashFactor = slashingKeeper.GetSlashFactor(packet.data.downtime)
slashingKeeper.Slash(
packet.data.valAddress,
infractionHeight,
packet.data.valPower,
packet.data.slashFactor))
slashFactor))

// request the Slashing module to jail the validator
timestamp = currentTimestamp() + data.jailTime
slashingKeeper.JailUntil(packet.data.valAddress, timestamp)
// using the jailTime set on the provider chain
jailTime = slashingKeeper.GetJailTime(packet.data.downtime)
slashingKeeper.JailUntil(packet.data.valAddress, currentTimestamp() + jailTime)

// add validator to list of slash requests for chainId
slashRequests[chainId].Append(packet.data.valAddress)
Expand All @@ -1908,8 +1920,8 @@ function onRecvSlashPacket(packet: Packet): bytes {
- Otherwise,
- if `packet.data.vscId == 0`, `infractionHeight` is set to `initialHeights[chainId]`, with `chainId = channelToChain[packet.getDestinationChannel()]`, i.e., the height when the CCV channel to this consumer chain is established;
- otherwise, `infractionHeight` is set to `VSCtoH[packet.data.vscId]`, i.e., the height at which the voting power was last updated by the validator updates in the VSC with ID `packet.data.vscId`;
- a request is made to the Slashing module to slash the validator with address `packet.data.valAddress` for misbehaving at height `infractionHeight`;
- a request is made to the Slashing module to jail the validator with address `packet.data.valAddress` for a period `data.jailTime`;
- a request is made to the Slashing module to slash `slashFactor` of the tokens bonded at `infractionHeight` by the validator with address `packet.data.valAddress`, where `slashFactor` is the slashing factor set on the provider chain;
- a request is made to the Slashing module to jail the validator with address `packet.data.valAddress` for a period `jailTime`, where `jailTime` is the jailing time set on the provider chain;
- the validator's address `packet.data.valAddress` is added to the list of slash requests from this `chainId`;
- a successful acknowledgment is returned.
- **Error Condition**
Expand Down Expand Up @@ -1978,18 +1990,12 @@ function SendSlashRequest(
return
}

// TODO governance and CCV params
// see https://github.com/cosmos/ibc/issues/673
slashFactor = TBA
jailTime = TBA

// create SlashPacket data
packetData = SlashPacketData{
valAddress: valAddress,
valPower: power,
vscId: HtoVSC[infractionHeight],
slashFactor: slashFactor,
jailTime: jailTime
downtime: downtime
}

// check whether the CCV channel to the provider chain is established
Expand Down Expand Up @@ -2024,7 +2030,6 @@ function SendSlashRequest(
- **Postcondition**
- If the request is for downtime and there is an outstanding request to slash this validator for downtime, then the state is not changed.
- Otherwise,
- both `slashFactor` and `jailTime` parameters are set;
- a `SlashPacket` data `packetData` is created, such that `packetData.vscId = VSCtoH[infractionHeight]`;
- if the CCV channel to the provider chain is established, then
- a packet with the `packetData` is sent to the provider chain;
Expand Down