Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #32 from bnb-chain/develop
Browse files Browse the repository at this point in the history
release: draft release v0.0.4
  • Loading branch information
keefel authored Apr 20, 2023
2 parents 6d5e271 + 47f82a1 commit 2f3a22a
Show file tree
Hide file tree
Showing 10 changed files with 242 additions and 444 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v0.0.4

This is a maintenance release.

* [\#30](https://github.com/bnb-chain/greenfield-tendermint/pull/30) chore: remove challenger address in tendermint

## v0.0.3

This is a maintenance release.
Expand Down
418 changes: 182 additions & 236 deletions abci/types/types.pb.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion proto/tendermint/abci/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ message ValidatorUpdate {
int64 power = 2;
bytes bls_key = 3;
bytes relayer_address = 4;
bytes challenger_address = 5;
}

// VoteInfo
Expand Down
182 changes: 37 additions & 145 deletions proto/tendermint/types/validator.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions proto/tendermint/types/validator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ message Validator {
int64 proposer_priority = 4;
bytes bls_key = 5;
bytes relayer_address = 6;
bytes challenger_address = 7;
}

message SimpleValidator {
tendermint.crypto.PublicKey pub_key = 1;
int64 voting_power = 2;
bytes bls_key = 3;
bytes relayer_address = 4;
bytes challenger_address = 5;
}
21 changes: 3 additions & 18 deletions state/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,6 @@ func TestValidateValidatorUpdates(t *testing.T) {
defaultValidatorParams,
false,
},
{
"updating a validator with challenger address is OK",
[]abci.ValidatorUpdate{{PubKey: pk1, Power: 20, ChallengerAddress: ([]byte)("challenger")}},
defaultValidatorParams,
false,
},
{
"removing a validator is OK",
[]abci.ValidatorUpdate{{PubKey: pk2, Power: 0}},
Expand Down Expand Up @@ -313,8 +307,6 @@ func TestUpdateValidators(t *testing.T) {
updated.SetBlsKey(blsPubKey)
relayer := ed25519.GenPrivKey().PubKey().Address().Bytes()
updated.SetRelayerAddress(relayer)
challenger := ed25519.GenPrivKey().PubKey().Address().Bytes()
updated.SetChallengerAddress(challenger)

testCases := []struct {
name string
Expand Down Expand Up @@ -354,10 +346,9 @@ func TestUpdateValidators(t *testing.T) {
true,
},
{
"updating a validator with relayer bls public key, relayer and challenger address is OK",
"updating a validator with bls public key, and relayer address is OK",
types.NewValidatorSet([]*types.Validator{val1}),
[]abci.ValidatorUpdate{{PubKey: pk, Power: 20,
BlsKey: blsPubKey, RelayerAddress: relayer, ChallengerAddress: challenger}},
[]abci.ValidatorUpdate{{PubKey: pk, Power: 20, BlsKey: blsPubKey, RelayerAddress: relayer}},
types.NewValidatorSet([]*types.Validator{updated}),
false,
},
Expand All @@ -379,13 +370,11 @@ func TestUpdateValidators(t *testing.T) {
assert.Equal(t, tc.resultingSet.Validators[0].Address, tc.currentSet.Validators[0].Address)
assert.Equal(t, tc.resultingSet.Validators[0].BlsKey, tc.currentSet.Validators[0].BlsKey)
assert.Equal(t, tc.resultingSet.Validators[0].RelayerAddress, tc.currentSet.Validators[0].RelayerAddress)
assert.Equal(t, tc.resultingSet.Validators[0].ChallengerAddress, tc.currentSet.Validators[0].ChallengerAddress)

if tc.resultingSet.Size() > 1 {
assert.Equal(t, tc.resultingSet.Validators[1].Address, tc.currentSet.Validators[1].Address)
assert.Equal(t, tc.resultingSet.Validators[1].BlsKey, tc.currentSet.Validators[1].BlsKey)
assert.Equal(t, tc.resultingSet.Validators[1].RelayerAddress, tc.currentSet.Validators[1].RelayerAddress)
assert.Equal(t, tc.resultingSet.Validators[1].ChallengerAddress, tc.currentSet.Validators[1].ChallengerAddress)
}

}
Expand Down Expand Up @@ -442,12 +431,10 @@ func TestEndBlockValidatorUpdates(t *testing.T) {
currentValPower := currentVal.VotingPower
blsPubKey := ed25519.GenPrivKey().PubKey().Bytes()
relayer := ed25519.GenPrivKey().PubKey().Address().Bytes()
challenger := ed25519.GenPrivKey().PubKey().Address().Bytes()

app.ValidatorUpdates = []abci.ValidatorUpdate{
{PubKey: pk, Power: 10}, // add a new validator
{PubKey: currentValPk, Power: currentValPower,
BlsKey: blsPubKey, RelayerAddress: relayer, ChallengerAddress: challenger}, // updating a validator's bls pub key and addresses
{PubKey: currentValPk, Power: currentValPower, BlsKey: blsPubKey, RelayerAddress: relayer}, // updating a validator's bls pub key and addresses
}

state, _, err = blockExec.ApplyBlock(state, blockID, block)
Expand All @@ -467,7 +454,6 @@ func TestEndBlockValidatorUpdates(t *testing.T) {
}
assert.Equal(t, blsPubKey, val.BlsKey)
assert.Equal(t, relayer, val.RelayerAddress)
assert.Equal(t, challenger, val.ChallengerAddress)
}

// test we threw an event
Expand All @@ -481,7 +467,6 @@ func TestEndBlockValidatorUpdates(t *testing.T) {

assert.Equal(t, blsPubKey, event.ValidatorUpdates[1].BlsKey)
assert.EqualValues(t, relayer, event.ValidatorUpdates[1].RelayerAddress)
assert.EqualValues(t, challenger, event.ValidatorUpdates[1].ChallengerAddress)
}
case <-updatesSub.Cancelled():
t.Fatalf("updatesSub was cancelled (reason: %v)", updatesSub.Err())
Expand Down
1 change: 0 additions & 1 deletion types/protobuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ func (pb2tm) ValidatorUpdates(vals []abci.ValidatorUpdate) ([]*Validator, error)
updated := NewValidator(pub, v.Power)
updated.SetBlsKey(v.BlsKey)
updated.SetRelayerAddress(v.RelayerAddress)
updated.SetChallengerAddress(v.ChallengerAddress)
tmVals[i] = updated
}
return tmVals, nil
Expand Down
Loading

0 comments on commit 2f3a22a

Please sign in to comment.