Skip to content

Commit 895de62

Browse files
charleenfeioshorefueled
authored andcommitted
fix: rm AllowUpdateAfter... check (cosmos#1118)
* update code & test * update proto and adr026 * update CHANGELOG * update cli docs * update broken milestone link
1 parent be68f1e commit 895de62

File tree

9 files changed

+101
-208
lines changed

9 files changed

+101
-208
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
4343
### State Machine Breaking
4444

4545
### Improvements
46+
* (modules/light-clients/07-tendermint) [\#1118](https://github.com/cosmos/ibc-go/pull/1118) Deprecating `AllowUpdateAfterExpiry and AllowUpdateAfterMisbehaviour`. See ADR-026 for context.
4647
* (modules/core/02-client) [\#1188](https://github.com/cosmos/ibc-go/pull/1188/files) Routing `MsgSubmitMisbehaviour` to `UpdateClient` keeper function. Deprecating `SubmitMisbehaviour` endpoint.
4748
* (modules/core/02-client) [\#1208](https://github.com/cosmos/ibc-go/pull/1208) Replace `CheckHeaderAndUpdateState` usage in 02-client with calls to `VerifyClientMessage`, `CheckForMisbehaviour`, `UpdateStateOnMisbehaviour` and `UpdateState`.
4849
* (modules/light-clients/09-localhost) [\#1187](https://github.com/cosmos/ibc-go/pull/1187/) Removing localhost light client implementation as it is not functional.

docs/architecture/adr-026-ibc-client-recovery-mechanisms.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- 2020/08/06: Revisions per review & to reference version
77
- 2021/01/15: Revision to support substitute clients for unfreezing
88
- 2021/05/20: Revision to simplify consensus state copying, remove initial height
9+
- 2022/04/08: Revision to deprecate AllowUpdateAfterExpiry and AllowUpdateAfterMisbehaviour
910

1011
## Status
1112

@@ -35,21 +36,20 @@ Two-thirds of the validator set (the quorum for governance, module participation
3536
We elect not to deal with chains which have actually halted, which is necessarily Byzantine behaviour and in which case token recovery is not likely possible anyways (in-flight packets cannot be timed-out, but the relative impact of that is minor).
3637

3738
1. Require Tendermint light clients (ICS 07) to be created with the following additional flags
38-
1. `allow_governance_override_after_expiry` (boolean, default false)
39+
1. `allow_update_after_expiry` (boolean, default true). Note that this flag has been deprecated, it remains to signal intent but checks against this value will not be enforced.
3940
1. Require Tendermint light clients (ICS 07) to expose the following additional internal query functions
4041
1. `Expired() boolean`, which returns whether or not the client has passed the trusting period since the last update (in which case no headers can be validated)
4142
1. Require Tendermint light clients (ICS 07) & solo machine clients (ICS 06) to be created with the following additional flags
42-
1. `allow_governance_override_after_misbehaviour` (boolean, default false)
43+
1. `allow_update_after_misbehaviour` (boolean, default true). Note that this flag has been deprecated, it remains to signal intent but checks against this value will not be enforced.
4344
1. Require Tendermint light clients (ICS 07) to expose the following additional state mutation functions
4445
1. `Unfreeze()`, which unfreezes a light client after misbehaviour and clears any frozen height previously set
4546
1. Add a new governance proposal type, `ClientUpdateProposal`, in the `x/ibc` module
4647
1. Extend the base `Proposal` with two client identifiers (`string`).
4748
1. The first client identifier is the proposed client to be updated. This client must be either frozen or expired.
4849
1. The second client is a substitute client. It carries all the state for the client which may be updated. It must have identitical client and chain parameters to the client which may be updated (except for latest height, frozen height, and chain-id). It should be continually updated during the voting period.
49-
1. If this governance proposal passes, the client on trial will be updated to the latest state of the substitute, if and only if:
50-
1. `allow_governance_override_after_expiry` is true and the client has expired (`Expired()` returns true)
51-
1. `allow_governance_override_after_misbehaviour` is true and the client has been frozen (`Frozen()` returns true)
52-
1. In this case, additionally, the client is unfrozen by calling `Unfreeze()`
50+
1. If this governance proposal passes, the client on trial will be updated to the latest state of the substitute.
51+
52+
Previously, AllowUpdateAfterExpiry and AllowUpdateAfterMisbehaviour were used to signal the recovery options for an expired or frozen client, and governance proposals were not allowed to overwrite the client if these parameters were set to false. However, this has now been deprecated because a code migration can overwrite the client and consensus states regardless of the value of these parameters. If governance would vote to overwrite a client or consensus state, it is likely that governance would also willing to perform a code migration to do the same.
5353

5454

5555
Note that clients frozen due to misbehaviour must wait for the evidence to expire to avoid becoming refrozen.
@@ -62,7 +62,6 @@ This ADR does not address planned upgrades, which are handled separately as per
6262

6363
- Establishes a mechanism for client recovery in the case of expiry
6464
- Establishes a mechanism for client recovery in the case of misbehaviour
65-
- Clients can elect to disallow this recovery mechanism if they do not wish to allow for it
6665
- Constructing an ClientUpdate Proposal is as difficult as creating a new client
6766

6867
### Negative

docs/ibc/proposals.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ See also the relevant documentation: [ADR-026, IBC client recovery mechanisms](.
4646

4747
### Preconditions
4848
- The chain is updated with ibc-go >= v1.1.0.
49-
- Recovery parameters are set to `true` for the Tendermint light client (this determines if a governance proposal can be used). If the recovery parameters are set to `false`, recovery will require custom migration code.
5049
- The client identifier of an active client for the same counterparty chain.
5150
- The governance deposit.
5251

@@ -67,7 +66,7 @@ Check if the client is attached to the expected `chain-id`. For example, for an
6766
}
6867
```
6968

70-
The client is attached to the expected Akash `chain-id` and the recovery parameters (`allow_update_after_expiry` and `allow_update_after_misbehaviour`) are set to `true`.
69+
The client is attached to the expected Akash `chain-id`. Note that although the parameters (`allow_update_after_expiry` and `allow_update_after_misbehaviour`) exist to signal intent, these parameters have been deprecated and will not enforce any checks on the revival of client. See ADR-026 for more context on this deprecation.
7170

7271
### Step 2
7372

docs/ibc/proto-docs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4174,8 +4174,8 @@ and a possible frozen height.
41744174
| `latest_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | Latest height the client was updated to |
41754175
| `proof_specs` | [ics23.ProofSpec](#ics23.ProofSpec) | repeated | Proof specifications used in verifying counterparty state |
41764176
| `upgrade_path` | [string](#string) | repeated | Path at which next upgraded client will be committed. Each element corresponds to the key for a single CommitmentProof in the chained proof. NOTE: ClientState must stored under `{upgradePath}/{upgradeHeight}/clientState` ConsensusState must be stored under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using the default upgrade module, upgrade_path should be []string{"upgrade", "upgradedIBCState"}` |
4177-
| `allow_update_after_expiry` | [bool](#bool) | | This flag, when set to true, will allow governance to recover a client which has expired |
4178-
| `allow_update_after_misbehaviour` | [bool](#bool) | | This flag, when set to true, will allow governance to unfreeze a client whose chain has experienced a misbehaviour event |
4177+
| `allow_update_after_expiry` | [bool](#bool) | | **Deprecated.** allow_update_after_expiry is deprecated |
4178+
| `allow_update_after_misbehaviour` | [bool](#bool) | | **Deprecated.** allow_update_after_misbehaviour is deprecated |
41794179

41804180

41814181

docs/roadmap/roadmap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ During this quarter we will also probably release versions that bump the Cosmos
5959

6060
### H2 January
6161

62-
- [`v2.0.a`](https://github.com/cosmos/ibc-go/milestone/14)
62+
- [`v2.0.a`](https://github.com/cosmos/ibc-go/milestone/11)
6363
- [`v3.0.0-beta1`](https://github.com/cosmos/ibc-go/milestone/12): Beta 1 release of `v3.0.0` including Interchain Accounts, an update of Golang from `v1.15` to `v1.17`, and some core improvements. This is a Go-API breaking release because of [#472](https://github.com/cosmos/ibc-go/issues/472) and [#675](https://github.com/cosmos/ibc-go/pull/675).
6464

6565
### H1 February

modules/light-clients/07-tendermint/types/proposal_handle.go

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ import (
1212
)
1313

1414
// CheckSubstituteAndUpdateState will try to update the client with the state of the
15-
// substitute if and only if the proposal passes and one of the following conditions are
16-
// satisfied:
17-
// 1) AllowUpdateAfterMisbehaviour and Status() == Frozen
18-
// 2) AllowUpdateAfterExpiry=true and Status() == Expired
15+
// substitute.
1916
//
17+
// AllowUpdateAfterMisbehaviour and AllowUpdateAfterExpiry have been deprecated.
18+
// Please see ADR 026 for more information.
19+
//
2020
// The following must always be true:
2121
// - The substitute client is the same type as the subject client
2222
// - The subject and substitute client states match in all parameters (expect frozen height, latest height, and chain-id)
2323
//
2424
// In case 1) before updating the client, the client will be unfrozen by resetting
25-
// the FrozenHeight to the zero Height. If a client is frozen and AllowUpdateAfterMisbehaviour
26-
// is set to true, the client will be unexpired even if AllowUpdateAfterExpiry is set to false.
25+
// the FrozenHeight to the zero Height.
2726
func (cs ClientState) CheckSubstituteAndUpdateState(
2827
ctx sdk.Context, cdc codec.BinaryCodec, subjectClientStore,
2928
substituteClientStore sdk.KVStore, substituteClient exported.ClientState,
@@ -39,23 +38,9 @@ func (cs ClientState) CheckSubstituteAndUpdateState(
3938
return nil, sdkerrors.Wrap(clienttypes.ErrInvalidSubstitute, "subject client state does not match substitute client state")
4039
}
4140

42-
switch cs.Status(ctx, subjectClientStore, cdc) {
43-
44-
case exported.Frozen:
45-
if !cs.AllowUpdateAfterMisbehaviour {
46-
return nil, sdkerrors.Wrap(clienttypes.ErrUpdateClientFailed, "client is not allowed to be unfrozen")
47-
}
48-
41+
if cs.Status(ctx, subjectClientStore, cdc) == exported.Frozen {
4942
// unfreeze the client
5043
cs.FrozenHeight = clienttypes.ZeroHeight()
51-
52-
case exported.Expired:
53-
if !cs.AllowUpdateAfterExpiry {
54-
return nil, sdkerrors.Wrap(clienttypes.ErrUpdateClientFailed, "client is not allowed to be unexpired")
55-
}
56-
57-
default:
58-
return nil, sdkerrors.Wrap(clienttypes.ErrUpdateClientFailed, "client cannot be updated with proposal")
5944
}
6045

6146
// copy consensus states and processed time from substitute to subject

modules/light-clients/07-tendermint/types/proposal_handle_test.go

Lines changed: 7 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -82,133 +82,45 @@ func (suite *TendermintTestSuite) TestCheckSubstituteAndUpdateState() {
8282
expPass bool
8383
}{
8484
{
85-
name: "not allowed to be updated, not frozen or expired",
86-
AllowUpdateAfterExpiry: false,
87-
AllowUpdateAfterMisbehaviour: false,
88-
FreezeClient: false,
89-
ExpireClient: false,
90-
expPass: false,
91-
},
92-
{
93-
name: "not allowed to be updated, client is frozen",
94-
AllowUpdateAfterExpiry: false,
95-
AllowUpdateAfterMisbehaviour: false,
96-
FreezeClient: true,
97-
ExpireClient: false,
98-
expPass: false,
99-
},
100-
{
101-
name: "not allowed to be updated, client is expired",
102-
AllowUpdateAfterExpiry: false,
103-
AllowUpdateAfterMisbehaviour: false,
104-
FreezeClient: false,
105-
ExpireClient: true,
106-
expPass: false,
107-
},
108-
{
109-
name: "not allowed to be updated, client is frozen and expired",
85+
name: "PASS: update checks are deprecated, client is frozen and expired",
11086
AllowUpdateAfterExpiry: false,
11187
AllowUpdateAfterMisbehaviour: false,
11288
FreezeClient: true,
11389
ExpireClient: true,
114-
expPass: false,
115-
},
116-
{
117-
name: "allowed to be updated only after misbehaviour, not frozen or expired",
118-
AllowUpdateAfterExpiry: false,
119-
AllowUpdateAfterMisbehaviour: true,
120-
FreezeClient: false,
121-
ExpireClient: false,
122-
expPass: false,
123-
},
124-
{
125-
name: "allowed to be updated only after misbehaviour, client is expired",
126-
AllowUpdateAfterExpiry: false,
127-
AllowUpdateAfterMisbehaviour: true,
128-
FreezeClient: false,
129-
ExpireClient: true,
130-
expPass: false,
131-
},
132-
{
133-
name: "allowed to be updated only after expiry, not frozen or expired",
134-
AllowUpdateAfterExpiry: true,
135-
AllowUpdateAfterMisbehaviour: false,
136-
FreezeClient: false,
137-
ExpireClient: false,
138-
expPass: false,
139-
},
140-
{
141-
name: "allowed to be updated only after expiry, client is frozen",
142-
AllowUpdateAfterExpiry: true,
143-
AllowUpdateAfterMisbehaviour: false,
144-
FreezeClient: true,
145-
ExpireClient: false,
146-
expPass: false,
147-
},
148-
{
149-
name: "PASS: allowed to be updated only after misbehaviour, client is frozen",
150-
AllowUpdateAfterExpiry: false,
151-
AllowUpdateAfterMisbehaviour: true,
152-
FreezeClient: true,
153-
ExpireClient: false,
15490
expPass: true,
15591
},
15692
{
157-
name: "PASS: allowed to be updated only after misbehaviour, client is frozen and expired",
93+
name: "PASS: update checks are deprecated, not frozen or expired",
15894
AllowUpdateAfterExpiry: false,
15995
AllowUpdateAfterMisbehaviour: true,
160-
FreezeClient: true,
161-
ExpireClient: true,
162-
expPass: true,
163-
},
164-
{
165-
name: "PASS: allowed to be updated only after expiry, client is expired",
166-
AllowUpdateAfterExpiry: true,
167-
AllowUpdateAfterMisbehaviour: false,
16896
FreezeClient: false,
169-
ExpireClient: true,
97+
ExpireClient: false,
17098
expPass: true,
17199
},
172100
{
173-
name: "allowed to be updated only after expiry, client is frozen and expired",
101+
name: "PASS: update checks are deprecated, not frozen or expired",
174102
AllowUpdateAfterExpiry: true,
175103
AllowUpdateAfterMisbehaviour: false,
176-
FreezeClient: true,
177-
ExpireClient: true,
178-
expPass: false,
179-
},
180-
{
181-
name: "allowed to be updated after expiry and misbehaviour, not frozen or expired",
182-
AllowUpdateAfterExpiry: true,
183-
AllowUpdateAfterMisbehaviour: true,
184104
FreezeClient: false,
185105
ExpireClient: false,
186-
expPass: false,
106+
expPass: true,
187107
},
188108
{
189-
name: "PASS: allowed to be updated after expiry and misbehaviour, client is frozen",
109+
name: "PASS: update checks are deprecated, client is frozen",
190110
AllowUpdateAfterExpiry: true,
191111
AllowUpdateAfterMisbehaviour: true,
192112
FreezeClient: true,
193113
ExpireClient: false,
194114
expPass: true,
195115
},
196116
{
197-
name: "PASS: allowed to be updated after expiry and misbehaviour, client is expired",
117+
name: "PASS: update checks are deprecated, client is expired",
198118
AllowUpdateAfterExpiry: true,
199119
AllowUpdateAfterMisbehaviour: true,
200120
FreezeClient: false,
201121
ExpireClient: true,
202122
expPass: true,
203123
},
204-
{
205-
name: "PASS: allowed to be updated after expiry and misbehaviour, client is frozen and expired",
206-
AllowUpdateAfterExpiry: true,
207-
AllowUpdateAfterMisbehaviour: true,
208-
FreezeClient: true,
209-
ExpireClient: true,
210-
expPass: true,
211-
},
212124
}
213125

214126
for _, tc := range testCases {

0 commit comments

Comments
 (0)