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

chore: remove AllowUpdateAfterProposal #1940

Merged
merged 79 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
a4b5b8f
chore: Remove GetClientID() From Misbehaviour Interface (#897)
notbdu Mar 9, 2022
841d21d
chore: add 668 functions to localhost client (#908)
notbdu Mar 9, 2022
18abb79
chore: rename 06-solomachine type Misbehaviour to DuplicateSignatures…
damiannolan Mar 10, 2022
a333a73
chore: reverting renaming of Misbehaviour (#1099)
damiannolan Mar 11, 2022
daa01db
remove GetClientID from 07-tendermint misbehaviour (#1097)
colin-axner Mar 11, 2022
2de5f1d
chore: remove GetClientID from 06-solomachine type Misbehaviour (#1100)
damiannolan Mar 11, 2022
12f4ed2
client-02 update to latest from main (#1106)
seantking Mar 11, 2022
ebf40bb
02-client: merge misbehavior & header interfaces (#1107)
seantking Mar 15, 2022
b0fa240
chore: 06-solomachine rename checkHeader to VerifyClientMessage (#1109)
damiannolan Mar 16, 2022
5e9785e
refactor: modify VerifyUpgradeAndUpdateState to set upgraded client a…
colin-axner Mar 16, 2022
4c8b7c5
chore: 06-solomachine rename update to UpdateState (#1110)
damiannolan Mar 16, 2022
bdbaa91
chore: 06-solomachine adding CheckForMisbehaviour and UpdateStateOnMi…
damiannolan Mar 16, 2022
f4480fb
chore: 02-client-refactor: merge main into feature branch (#1149)
seantking Mar 21, 2022
5e3bac0
02-client-refactor: rename update to UpdateState for 07-tendermint (#…
colin-axner Mar 24, 2022
efbc5a1
chore: adding UpdateStateOnMisbehaviour to 07-tendermint (#1168)
damiannolan Mar 24, 2022
b0dd49d
chore: add solomachine client storage (#1144)
damiannolan Mar 28, 2022
17209f7
refactor: adding CheckForMisbehaviour to 07-tendermint client (#1163)
damiannolan Mar 28, 2022
fadd9d0
02-client refactor: Adding VerifyClientMessage helper fn (#1119)
seantking Mar 28, 2022
c2602a5
refactor: removing GetRoot from ConsensusState interface (#1186)
seantking Mar 30, 2022
40183b4
Adding VerifyClientMessage to ClientState interface (#1196)
seantking Mar 30, 2022
a4b3d09
chore: CheckSubstituteAndUpdateState stores client state in lightclie…
damiannolan Mar 30, 2022
2e2bfab
chore: 07-tendermint set client/consensus states in UpdateState (#1199)
damiannolan Mar 30, 2022
18f1382
chore: update 07-tendermint GetConsensusState to return bool over err…
damiannolan Mar 30, 2022
3c7358b
feat: adding UpdateStateOnMisbehaviour to ClientState interface (#1198)
seantking Mar 31, 2022
5cf6528
refactor: remove localhost client implementation (#1187)
seantking Mar 31, 2022
eb48e54
chore: adding UpdateState to ClientState interface (#1206)
damiannolan Mar 31, 2022
d2be6d5
feat: adding CheckForMisbehaviour to ClientState interface (#1197)
seantking Mar 31, 2022
e2f37b8
Replace CheckHeaderAndUpdateState with new ClientState functions (#1208)
colin-axner Apr 1, 2022
8a9978c
refactor: removing CheckHeaderAndUpdateState from ClientState (#1210)
seantking Apr 4, 2022
c43af66
refactor: routing MsgSubmitMisbehaviour to UpdateClient keeper fn (#1…
seantking Apr 4, 2022
e249518
refactor: removing CheckMisbehaviourAndUpdateState from ClientState i…
seantking Apr 4, 2022
e91ee68
fix: rm AllowUpdateAfter... check (#1118)
charleenfei Apr 25, 2022
e1ec9f4
chore: update 02-client-refactor branch with latest main (#1286)
damiannolan Apr 26, 2022
cf893c2
chore: remove GetHeight from ClientMessage interface (#1285)
damiannolan Apr 27, 2022
55b115a
update godoc for VerifyClientMessage (#1281)
colin-axner Apr 27, 2022
48882a9
Add VerifyMembership to 07-tendermint (#1297)
colin-axner Apr 28, 2022
8f46821
chore: MsgUpdateClient rename header to client_message (#1316)
damiannolan May 9, 2022
e1f2103
Add migration docs for 02-client refactor (#1287)
catShaark May 10, 2022
31b6ead
Add revision number tests for 07-tendermint (#1302)
colin-axner May 10, 2022
d120044
ADR 005: update client consensus height events (#1315)
damiannolan May 10, 2022
e2bdd1f
feat: VerifyNonMembership 07-tendermint implementation (#1611)
seantking Jun 30, 2022
aab9ca2
chore: making changes based on nits from 02-client refactor audit (#1…
chatton Jun 30, 2022
4def196
chore: add generic proof verification methods to ClientState interfac…
damiannolan Jul 4, 2022
32c4827
chore: add GetTimestampAtHeight to client state #888 (#1659)
charleenfei Jul 6, 2022
1617de7
chore: modify connection keeper GetTimestampAtHeight to use the clien…
charleenfei Jul 7, 2022
3987a5b
refactor: replace usage of verification funcs in 03-connection (#1647)
damiannolan Jul 7, 2022
81a7cae
Check that client state is zeroed out for ibc client upgrade proposal…
chatton Jul 11, 2022
60e5305
Zero out client state before upgrading client proof (#1674)
chatton Jul 11, 2022
549c181
chore: restructuring 07-tendermint lightclient directory layout (#1677)
damiannolan Jul 12, 2022
04df7cd
chore: adding upgrade handler for 09-localhost removal (#1671)
damiannolan Jul 15, 2022
d8ac28a
Emit event upon setting upgrade consensus state (#1741)
chatton Jul 27, 2022
d3d91ed
chore: removing GetHeight legacy method from 06-solomachine (#1810)
damiannolan Jul 29, 2022
b0a58a8
refactor: solomachine generic verification methods and signbytes simp…
damiannolan Aug 2, 2022
7237c43
bump version from 3 to 5
colin-axner Aug 2, 2022
6cdcc63
merge main
colin-axner Aug 2, 2022
0d8f408
fix merge conflicts
colin-axner Aug 2, 2022
a7d23fd
fix build
colin-axner Aug 3, 2022
f861e0e
go imports
colin-axner Aug 3, 2022
607458a
make format
colin-axner Aug 3, 2022
e9a7fac
fix linter
colin-axner Aug 3, 2022
18eee1a
apply review suggestions
colin-axner Aug 3, 2022
197c2bd
Merge branch 'main' into updated-02-client-refactor
colin-axner Aug 3, 2022
2da9e65
fix: import changes for 02-client-refactor (#1875)
colin-axner Aug 4, 2022
68e8e79
apply suggested changes (#1877)
colin-axner Aug 4, 2022
3d33e8b
documentation fixes (#1876)
colin-axner Aug 4, 2022
163b706
fix: complete changes for CheckSubstituteAndUpdateState (#1878)
colin-axner Aug 4, 2022
3cb1ba8
Merge branch 'main' of github.com:cosmos/ibc-go into updated-02-clien…
colin-axner Aug 4, 2022
81f2d09
02-client refactor: fix changelog (#1873)
seantking Aug 4, 2022
311a563
fix: revert unnecessary change in 02-client-refactor branch (#1883)
colin-axner Aug 5, 2022
277e774
rm bools, update CHANGELOG
charleenfei Aug 8, 2022
fa10c98
Merge branch 'main' into charly/rm_allow_update_after_proposal
charleenfei Aug 8, 2022
c1dcbc0
Merge branch 'main' into charly/rm_allow_update_after_proposal
charleenfei Aug 9, 2022
4ad7372
Merge branch 'main' into charly/rm_allow_update_after_proposal
charleenfei Aug 9, 2022
ab15c23
rm unnnecessary test
charleenfei Aug 9, 2022
923a29f
Merge branch 'main' into charly/rm_allow_update_after_proposal
charleenfei Aug 9, 2022
59e89df
rm test checking for deprecated param
charleenfei Aug 9, 2022
d1f068a
make format
charleenfei Aug 9, 2022
a299772
Merge branch 'main' into charly/rm_allow_update_after_proposal
charleenfei Aug 9, 2022
4fcef91
Merge branch 'main' into charly/rm_allow_update_after_proposal
charleenfei Aug 9, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (07-tendermint) [\#1097](https://github.com/cosmos/ibc-go/pull/1097) Remove `GetClientID` function from 07-tendermint `Misbehaviour` type.
* (07-tendermint) [\#1097](https://github.com/cosmos/ibc-go/pull/1097) Deprecate `ClientId` field in 07-tendermint `Misbehaviour` type.
* (modules/core/exported) [\#1107](https://github.com/cosmos/ibc-go/pull/1107) Merging the `Header` and `Misbehaviour` interfaces into a single `ClientMessage` type.
* (06-solomachine)[\#1906](https://github.com/cosmos/ibc-go/pull/1906/files) Removed `AllowUpdateAfterProposal` boolean as it has been deprecated (see 01_concepts of the solo machine spec for more details).
* (07-tendermint) [\#1896](https://github.com/cosmos/ibc-go/pull/1896) Remove error return from `IterateConsensusStateAscending` in `07-tendermint`.

### State Machine Breaking
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/keeper/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (suite *KeeperTestSuite) TestCreateClient() {
expPass bool
}{
{"success", ibctm.NewClientState(testChainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, testClientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false), true},
{"client type not supported", solomachinetypes.NewClientState(0, &solomachinetypes.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time}, false), false},
{"client type not supported", solomachinetypes.NewClientState(0, &solomachinetypes.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time}), false},
}

for i, tc := range cases {
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (suite *KeeperTestSuite) TestValidateSelfClient() {
},
{
"invalid client type",
solomachinetypes.NewClientState(0, &solomachinetypes.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time}, false),
solomachinetypes.NewClientState(0, &solomachinetypes.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time}),
false,
},
{
Expand Down
1 change: 0 additions & 1 deletion modules/core/02-client/legacy/v100/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func (suite *LegacyTestSuite) TestMigrateGenesisSolomachine() {
Diversifier: clientState.ConsensusState.Diversifier,
Timestamp: clientState.ConsensusState.Timestamp,
},
AllowUpdateAfterProposal: clientState.AllowUpdateAfterProposal,
}

// set client state
Expand Down
1 change: 0 additions & 1 deletion modules/core/02-client/legacy/v100/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ func migrateSolomachine(clientState *ClientState) *smtypes.ClientState {
Sequence: clientState.Sequence,
IsFrozen: isFrozen,
ConsensusState: consensusState,
AllowUpdateAfterProposal: clientState.AllowUpdateAfterProposal,
}
}

Expand Down
1 change: 0 additions & 1 deletion modules/core/02-client/legacy/v100/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func (suite *LegacyTestSuite) TestMigrateStoreSolomachine() {
Diversifier: clientState.ConsensusState.Diversifier,
Timestamp: clientState.ConsensusState.Timestamp,
},
AllowUpdateAfterProposal: clientState.AllowUpdateAfterProposal,
}

// set client state
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (suite *TypesTestSuite) TestValidateGenesis() {
types.NewIdentifiedClientState(
soloMachineClientID, ibctm.NewClientState(suite.chainA.ChainID, ibctm.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
),
types.NewIdentifiedClientState(tmClientID0, solomachinetypes.NewClientState(0, &solomachinetypes.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time}, false)),
types.NewIdentifiedClientState(tmClientID0, solomachinetypes.NewClientState(0, &solomachinetypes.ConsensusState{suite.solomachine.ConsensusState().PublicKey, suite.solomachine.Diversifier, suite.solomachine.Time})),
},
nil,
nil,
Expand Down
1 change: 0 additions & 1 deletion modules/core/legacy/v100/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func (suite *LegacyTestSuite) TestMigrateGenesisSolomachine() {
Diversifier: clientState.ConsensusState.Diversifier,
Timestamp: clientState.ConsensusState.Timestamp,
},
AllowUpdateAfterProposal: clientState.AllowUpdateAfterProposal,
}

// set client state
Expand Down
15 changes: 7 additions & 8 deletions modules/light-clients/06-solomachine/client_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import (
var _ exported.ClientState = (*ClientState)(nil)

// NewClientState creates a new ClientState instance.
func NewClientState(latestSequence uint64, consensusState *ConsensusState, allowUpdateAfterProposal bool) *ClientState {
func NewClientState(latestSequence uint64, consensusState *ConsensusState) *ClientState {
return &ClientState{
Sequence: latestSequence,
IsFrozen: false,
ConsensusState: consensusState,
AllowUpdateAfterProposal: allowUpdateAfterProposal,
Sequence: latestSequence,
IsFrozen: false,
ConsensusState: consensusState,
// AllowUpdateAfterProposal has been DEPRECATED. See 01_concepts in the solo machine spec repo for more details.
}
}

Expand Down Expand Up @@ -75,11 +75,10 @@ func (cs ClientState) Validate() error {
return cs.ConsensusState.ValidateBasic()
}

// ZeroCustomFields returns solomachine client state with client-specific fields FrozenSequence,
// and AllowUpdateAfterProposal zeroed out
// ZeroCustomFields returns solomachine client state with client-specific field FrozenSequence zeroed out
func (cs ClientState) ZeroCustomFields() exported.ClientState {
return NewClientState(
cs.Sequence, cs.ConsensusState, false,
cs.Sequence, cs.ConsensusState,
)
}

Expand Down
30 changes: 22 additions & 8 deletions modules/light-clients/06-solomachine/client_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ func (suite *SoloMachineTestSuite) TestClientStateValidateBasic() {
},
{
"sequence is zero",
solomachine.NewClientState(0, &solomachine.ConsensusState{sm.ConsensusState().PublicKey, sm.Diversifier, sm.Time}, false),
solomachine.NewClientState(0, &solomachine.ConsensusState{sm.ConsensusState().PublicKey, sm.Diversifier, sm.Time}),
false,
},
{
"timestamp is zero",
solomachine.NewClientState(1, &solomachine.ConsensusState{sm.ConsensusState().PublicKey, sm.Diversifier, 0}, false),
solomachine.NewClientState(1, &solomachine.ConsensusState{sm.ConsensusState().PublicKey, sm.Diversifier, 0}),
false,
},
{
"diversifier is blank",
solomachine.NewClientState(1, &solomachine.ConsensusState{sm.ConsensusState().PublicKey, " ", 1}, false),
solomachine.NewClientState(1, &solomachine.ConsensusState{sm.ConsensusState().PublicKey, " ", 1}),
false,
},
{
"pubkey is empty",
solomachine.NewClientState(1, &solomachine.ConsensusState{nil, sm.Diversifier, sm.Time}, false),
solomachine.NewClientState(1, &solomachine.ConsensusState{nil, sm.Diversifier, sm.Time}),
false,
},
}
Expand Down Expand Up @@ -447,6 +447,13 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
},
true,
},
{
"consensus state in client state is nil",
func() {
clientState = solomachine.NewClientState(1, nil)
},
false,
},
colin-axner marked this conversation as resolved.
Show resolved Hide resolved
{
"client state latest height is less than sequence",
func() {
Expand All @@ -455,7 +462,7 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
PublicKey: sm.ConsensusState().PublicKey,
}

clientState = solomachine.NewClientState(sm.Sequence-1, consensusState, false)
clientState = solomachine.NewClientState(sm.Sequence-1, consensusState)
},
false,
},
Expand Down Expand Up @@ -492,7 +499,7 @@ func (suite *SoloMachineTestSuite) TestVerifyMembership() {
PublicKey: sm.ConsensusState().PublicKey,
}

clientState = solomachine.NewClientState(sm.Sequence, consensusState, false)
clientState = solomachine.NewClientState(sm.Sequence, consensusState)
},
false,
},
Expand Down Expand Up @@ -658,6 +665,13 @@ func (suite *SoloMachineTestSuite) TestVerifyNonMembership() {
},
true,
},
{
"consensus state in client state is nil",
func() {
clientState = solomachine.NewClientState(1, nil)
},
false,
},
colin-axner marked this conversation as resolved.
Show resolved Hide resolved
{
"client state latest height is less than sequence",
func() {
Expand All @@ -666,7 +680,7 @@ func (suite *SoloMachineTestSuite) TestVerifyNonMembership() {
PublicKey: sm.ConsensusState().PublicKey,
}

clientState = solomachine.NewClientState(sm.Sequence-1, consensusState, false)
clientState = solomachine.NewClientState(sm.Sequence-1, consensusState)
},
false,
},
Expand Down Expand Up @@ -703,7 +717,7 @@ func (suite *SoloMachineTestSuite) TestVerifyNonMembership() {
PublicKey: sm.ConsensusState().PublicKey,
}

clientState = solomachine.NewClientState(sm.Sequence, consensusState, false)
clientState = solomachine.NewClientState(sm.Sequence, consensusState)
},
false,
},
Expand Down
4 changes: 0 additions & 4 deletions modules/light-clients/06-solomachine/proposal_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ func (cs ClientState) CheckSubstituteAndUpdateState(
ctx sdk.Context, cdc codec.BinaryCodec, subjectClientStore,
_ sdk.KVStore, substituteClient exported.ClientState,
) error {
if !cs.AllowUpdateAfterProposal {
return sdkerrors.Wrapf(clienttypes.ErrUpdateClientFailed, "solo machine client is not allowed to updated with a proposal")
}

substituteClientState, ok := substituteClient.(*ClientState)
if !ok {
return sdkerrors.Wrapf(clienttypes.ErrInvalidClientType, "substitute client state type %T, expected %T", substituteClient, &ClientState{})
Expand Down
3 changes: 2 additions & 1 deletion modules/light-clients/06-solomachine/spec/01_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ If the update is successful:
An update by a governance proposal will only succeed if:

- the substitute provided is parseable to solo machine client state
- the `AllowUpdateAfterProposal` client parameter is set to `true`
- the new consensus state public key does not equal the current consensus state public key

If the update is successful:
Expand All @@ -142,6 +141,8 @@ If the update is successful:
- the subject consensus state is updated to the substitute consensus state
- the client is unfrozen (if it was previously frozen)

NOTE: Previously, `AllowUpdateAfterProposal` was used to signal the update/recovery options for the solo machine client. However, this has now been deprecated because a code migration can overwrite the client and consensus states regardless of the value of this parameter. If governance would vote to overwrite a client or consensus state, it is likely that governance would also be willing to perform a code migration to do the same.

## Misbehaviour

Misbehaviour handling will only succeed if:
Expand Down
5 changes: 2 additions & 3 deletions testing/solomachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ func GenerateKeys(t *testing.T, n uint64) ([]cryptotypes.PrivKey, []cryptotypes.
return privKeys, pubKeys, pk
}

// ClientState returns a new solo machine ClientState instance. Default usage does not allow update
// after governance proposal
// ClientState returns a new solo machine ClientState instance.
func (solo *Solomachine) ClientState() *solomachinetypes.ClientState {
return solomachinetypes.NewClientState(solo.Sequence, solo.ConsensusState(), false)
return solomachinetypes.NewClientState(solo.Sequence, solo.ConsensusState())
}

// ConsensusState returns a new solo machine ConsensusState instance
Expand Down