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: Remove BeforeUnbondingOpCompleted #711

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
1be6bc9
Merge branch 'marius/ccv' into marius/710-ccv-staking-hooks
mpoke May 10, 2022
9f20338
cleanup method names
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
70 changes: 24 additions & 46 deletions spec/app/ics-028-cross-chain-validation/technical_specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ Before describing the data structures and sub-protocols of the CCV protocol, we
// get validator updates from the provider Staking module
GetValidatorUpdates(): [ValidatorUpdate]

// notify the Staking module of unboding operations that
// have matured from the consumer chain's perspective
CompleteStoppedUnbonding(id: uint64)
// request the Staking module to put on hold
// the completion of an unbonding operation
PutUnbondingOnHold(id: uint64)

// notify the Staking module of an unboding operation that
// has matured from the perspective of the consumer chains
UnbondingCanComplete(id: uint64)
}
```

Expand All @@ -96,15 +100,11 @@ Before describing the data structures and sub-protocols of the CCV protocol, we
}
```

- The following hooks enable the provider CCV module to register operations to be execute when certain events occur within the provider Staking module:
- The following hook enables the provider CCV module to register operations to be execute when certain events occur within the provider Staking module:
```typescript
// invoked by the Staking module after
// initiating an unbonding operation
function AfterUnbondingOpInitiated(opId: uint64);

// invoked by the Staking module before
// completing an unbonding operation
function BeforeUnbondingOpCompleted(opId: uint64): Bool;
function AfterUnbondingInitiated(opId: uint64);
```

- The consumer CCV module defines the following hooks that enable other modules to register operations to execute when certain events have occurred within CCV:
Expand Down Expand Up @@ -298,7 +298,7 @@ This section describes the internal state of the CCV module. For simplicity, the
It enables the mapping from consumer heights to provider heights.
- `VSCtoH: Map<uint64, Height>` is a mapping from VSC IDs to heights on the provider chain. It enables the mapping from consumer heights to provider heights,
i.e., the voting power at height `VSCtoH[id]` on the provider chain was last updated by the validator updates contained in the VSC with ID `id`.
- `unbondingOps: Map<uint64, UnbondingOperation>` is a mapping that enables accessing for every unbonding operation the list of consumer chains that are still unbonding. When unbonding operations are initiated, the Staking module calls the `AfterUnbondingOpInitiated()` [hook](#ccv-pcf-hook-afubopcr1); this leads to the creation of a new `UnbondingOperation`, which is defined as
- `unbondingOps: Map<uint64, UnbondingOperation>` is a mapping that enables accessing for every unbonding operation the list of consumer chains that are still unbonding. When unbonding operations are initiated, the Staking module calls the `AfterUnbondingInitiated()` [hook](#ccv-pcf-hook-afubopcr1); this leads to the creation of a new `UnbondingOperation`, which is defined as
```typescript
interface UnbondingOperation {
id: uint64
Expand Down Expand Up @@ -1467,14 +1467,14 @@ function onRecvVSCMaturedPacket(packet: Packet): bytes {

// iterate over the unbonding operations mapped to
// this chainId and vscId (i.e., packet.data.id)
foreach op in GetUnbondingOpsFromVSC(chainId, packet.data.id) {
foreach op in GetUnbondingsFromVSC(chainId, packet.data.id) {
// remove the consumer chain from
// the list of consumer chain that are still unbonding
op.unbondingChainIds.Remove(chainId)
// if the unbonding operation has unbonded on all consumer chains
if op.unbondingChainIds.IsEmpty() {
// attempt to complete unbonding in Staking module
stakingKeeper.CompleteStoppedUnbonding(op.id)
// notify the Staking module that the unbonding can complete
stakingKeeper.UnbondingCanComplete(op.id)
// remove unbonding operation
unbondingOps.Remove(op.id)
}
Expand All @@ -1494,22 +1494,22 @@ function onRecvVSCMaturedPacket(packet: Packet): bytes {
- **Postcondition**
- The transaction is aborted if the channel on which the packet was received is not an established CCV channel (i.e., not in `channelToChain`).
- `chainId` is set to the ID of the consumer chain mapped to the channel on which the packet was received.
- For each unbonding operation `op` returned by `GetUnbondingOpsFromVSC(chainId, packet.data.id)`
- For each unbonding operation `op` returned by `GetUnbondingsFromVSC(chainId, packet.data.id)`
- `chainId` is removed from `op.unbondingChainIds`;
- if `op.unbondingChainIds` is empty,
- the `CompleteStoppedUnbonding()` method of the Staking module is invoked;
- the `UnbondingCanComplete()` method of the Staking module is invoked;
- the entry `op` is removed from `unbondingOps`.
- `(chainId, vscId)` is removed from `vscToUnbondingOps`.
- A successful acknowledgment is returned.
- **Error Condition**
- None.

<!-- omit in toc -->
#### **[CCV-PCF-GETUBOPS.1]**
#### **[CCV-PCF-GETUBS.1]**
```typescript
// PCF: Provider Chain Function
// Utility method
function GetUnbondingOpsFromVSC(
function GetUnbondingsFromVSC(
chainId: Identifier,
_vscId: uint64): [UnbondingOperation] {
// get all unbonding operations associated with (chainId, _vscId)
Expand Down Expand Up @@ -1539,7 +1539,7 @@ function GetUnbondingOpsFromVSC(
```typescript
// PCF: Provider Chain Function
// implements a Staking module hook
function AfterUnbondingOpInitiated(opId: uint64) {
function AfterUnbondingInitiated(opId: uint64) {
// get the IDs of all consumer chains registered with this provider chain
chainIds = chainToClient.Keys()
// create and store a new unbonding operation
Expand All @@ -1551,6 +1551,10 @@ function AfterUnbondingOpInitiated(opId: uint64) {
foreach chainId in chainIds {
vscToUnbondingOps[(chainId, vscId)].Append(opId)
}

// ask the Staking module to wait for this operation
// to reach maturity on the consumer chains
stakingKeeper.PutUnbondingOnHold(opId)
}
```
- **Caller**
Expand All @@ -1561,34 +1565,8 @@ function AfterUnbondingOpInitiated(opId: uint64) {
- True.
- **Postcondition**
- An `UnbondingOperation` `op` is created and added to `unbondingOps`, such that `op.id = opId` and `op.unbondingChainIds` is the list of all consumer chains registered with this provider chain, i.e., `chainToClient.Keys()`.
- The ID of the created unbonding operation is appended to every list in `vscToUnbondingOps[(chainId, vscId)]`, where `chainId` is an ID of a consumer chains registered with this provider chain and `vscId` is the current VSC ID.
- **Error Condition**
- None.


<!-- omit in toc -->
#### **[CCV-PCF-HOOK-BFUBOPCO.1]**
```typescript
// PCF: Provider Chain Function
// implements a Staking module hook
function BeforeUnbondingOpCompleted(opId: uint64): Bool {
if opId in unbondingOps.Keys() {
// the unbonding operation is still unbonding
// on at least one consumer chain
return true
}
return false
}
```
- **Caller**
- The Staking module.
- **Trigger Event**
- An unbonding operation with ID `opId` has matured on the provider chain.
- **Precondition**
- True.
- **Postcondition**
- If there is an unboding operation with ID `opId` in `unbondingOps`, then true is returned.
- Otherwise, false is returned.
- `opId` is appended to every list in `vscToUnbondingOps[(chainId, vscId)]`, where `chainId` is an ID of a consumer chains registered with this provider chain and `vscId` is the current VSC ID.
- The `PutUnbondingOnHold(opId)` of the Staking module is invoked.
- **Error Condition**
- None.

Expand Down