diff --git a/internal/consensus/common_test.go b/internal/consensus/common_test.go index ec85c9f7df..4a9ec2647a 100644 --- a/internal/consensus/common_test.go +++ b/internal/consensus/common_test.go @@ -24,7 +24,6 @@ import ( cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cfg "github.com/cometbft/cometbft/config" "github.com/cometbft/cometbft/crypto" - "github.com/cometbft/cometbft/crypto/bls12381" cstypes "github.com/cometbft/cometbft/internal/consensus/types" cmtos "github.com/cometbft/cometbft/internal/os" "github.com/cometbft/cometbft/internal/test" @@ -298,7 +297,7 @@ func signAddVotes( _ bool, vss ...*validatorStub, ) { - extEnabled := false // disable vote extensions in Bearchain + extEnabled := false // disable vote extensions in Berachain votes := signVotes(voteType, chainID, blockID, extEnabled, vss...) addVotes(to, votes...) } @@ -524,10 +523,10 @@ func randState(nValidators int) (*State, []*validatorStub) { func randStateWithAppWithHeight( nValidators int, app abci.Application, - height int64, + _ int64, ) (*State, []*validatorStub) { c := test.ConsensusParams() - //c.Feature.VoteExtensionsEnableHeight = height + c.Feature.VoteExtensionsEnableHeight = 0 // disable vote extensions in Berachain return randStateWithAppImpl(nValidators, app, c) } @@ -891,10 +890,7 @@ func randConsensusNetWithPeers( require.NoError(t, err) tempStateFile, err := os.CreateTemp("", "priv_validator_state_") require.NoError(t, err) - keyGen := func() (crypto.PrivKey, error) { - return bls12381.GenPrivKey() - } - privVal, err = privval.GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), keyGen) + privVal, err = privval.GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), nil) require.NoError(t, err) } diff --git a/internal/consensus/reactor_test.go b/internal/consensus/reactor_test.go index 6451333b2f..86cbe07f98 100644 --- a/internal/consensus/reactor_test.go +++ b/internal/consensus/reactor_test.go @@ -307,6 +307,7 @@ func TestReactorReceivePanicsIfInitPeerHasntBeenCalledYet(t *testing.T) { // TestSwitchToConsensusVoteExtensions tests that the SwitchToConsensus correctly // checks for vote extension data when required. func TestSwitchToConsensusVoteExtensions(t *testing.T) { + t.Skip("No point in testing vote extensions in Berachain") for _, testCase := range []struct { name string storedHeight int64 @@ -360,7 +361,7 @@ func TestSwitchToConsensusVoteExtensions(t *testing.T) { cs.state.LastBlockHeight = testCase.storedHeight cs.state.LastValidators = cs.state.Validators.Copy() - //cs.state.ConsensusParams.Feature.VoteExtensionsEnableHeight = testCase.initialRequiredHeight + cs.state.ConsensusParams.Feature.VoteExtensionsEnableHeight = testCase.initialRequiredHeight propBlock, err := cs.createProposalBlock(ctx) require.NoError(t, err) diff --git a/internal/consensus/state_test.go b/internal/consensus/state_test.go index 0388123d36..3613f2cc68 100644 --- a/internal/consensus/state_test.go +++ b/internal/consensus/state_test.go @@ -2139,6 +2139,7 @@ func TestProcessProposalAccept(t *testing.T) { // TestExtendVoteCalledWhenEnabled tests that the vote extension methods are called at the // correct point in the consensus algorithm when vote extensions are enabled. func TestExtendVoteCalledWhenEnabled(t *testing.T) { + t.Skip("No point in testing vote extensions in Berachain") for _, testCase := range []struct { name string enabled bool @@ -2239,6 +2240,7 @@ func TestExtendVoteCalledWhenEnabled(t *testing.T) { // TestVerifyVoteExtensionNotCalledOnAbsentPrecommit tests that the VerifyVoteExtension // method is not called for a validator's vote that is never delivered. func TestVerifyVoteExtensionNotCalledOnAbsentPrecommit(t *testing.T) { + t.Skip("No point in testing vote extensions in Berachain") m := abcimocks.NewApplication(t) m.On("PrepareProposal", mock.Anything, mock.Anything).Return(&abci.PrepareProposalResponse{}, nil) m.On("ProcessProposal", mock.Anything, mock.Anything).Return(&abci.ProcessProposalResponse{Status: abci.PROCESS_PROPOSAL_STATUS_ACCEPT}, nil) @@ -2252,7 +2254,7 @@ func TestVerifyVoteExtensionNotCalledOnAbsentPrecommit(t *testing.T) { m.On("Commit", mock.Anything, mock.Anything).Return(&abci.CommitResponse{}, nil).Maybe() cs1, vss := randStateWithApp(4, m) height, round, chainID := cs1.Height, cs1.Round, cs1.state.ChainID - //cs1.state.ConsensusParams.Feature.VoteExtensionsEnableHeight = cs1.Height + cs1.state.ConsensusParams.Feature.VoteExtensionsEnableHeight = cs1.Height proposalCh := subscribe(cs1.eventBus, types.EventQueryCompleteProposal) newRoundCh := subscribe(cs1.eventBus, types.EventQueryNewRound) @@ -2311,6 +2313,7 @@ func TestVerifyVoteExtensionNotCalledOnAbsentPrecommit(t *testing.T) { // is the proposer again and ensures that the mock application receives the set of // vote extensions from the previous consensus instance. func TestPrepareProposalReceivesVoteExtensions(t *testing.T) { + t.Skip("No point in testing vote extensions in Berachain") // create a list of vote extensions, one for each validator. voteExtensions := [][]byte{ []byte("extension 0"), @@ -2555,7 +2558,7 @@ func TestVoteExtensionEnableHeight(t *testing.T) { m.On("Commit", mock.Anything, mock.Anything).Return(&abci.CommitResponse{}, nil).Maybe() cs1, vss := randStateWithAppWithHeight(numValidators, m, testCase.enableHeight) height, round, chainID := cs1.Height, cs1.Round, cs1.state.ChainID - //cs1.state.ConsensusParams.Feature.VoteExtensionsEnableHeight = testCase.enableHeight + cs1.state.ConsensusParams.Feature.VoteExtensionsEnableHeight = 0 // disable vote extensions in Berachain timeoutCh := subscribe(cs1.eventBus, types.EventQueryTimeoutPropose) proposalCh := subscribe(cs1.eventBus, types.EventQueryCompleteProposal) diff --git a/privval/file.go b/privval/file.go index 088dca9c68..65952dcb4d 100644 --- a/privval/file.go +++ b/privval/file.go @@ -11,7 +11,7 @@ import ( cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cometbft/cometbft/crypto" - "github.com/cometbft/cometbft/crypto/ed25519" + "github.com/cometbft/cometbft/crypto/bls12381" cmtos "github.com/cometbft/cometbft/internal/os" "github.com/cometbft/cometbft/internal/tempfile" cmtbytes "github.com/cometbft/cometbft/libs/bytes" @@ -186,7 +186,7 @@ func NewFilePV(privKey crypto.PrivKey, keyFilePath, stateFilePath string) *FileP func GenFilePV(keyFilePath, stateFilePath string, keyGen func() (crypto.PrivKey, error)) (*FilePV, error) { if keyGen == nil { keyGen = func() (crypto.PrivKey, error) { - return ed25519.GenPrivKey(), nil + return bls12381.GenPrivKey() } } key, err := keyGen() diff --git a/state/execution_test.go b/state/execution_test.go index 8dfb76211f..446489fc81 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -1011,6 +1011,7 @@ func TestPrepareProposalErrorOnPrepareProposalError(t *testing.T) { // call correctly panics when the vote extension data is missing from the extended commit // data that the method receives. func TestCreateProposalAbsentVoteExtensions(t *testing.T) { + t.Skip("No point in testing vote extensions in Berachain") for _, testCase := range []struct { name string @@ -1063,7 +1064,7 @@ func TestCreateProposalAbsentVoteExtensions(t *testing.T) { stateStore := sm.NewStore(stateDB, sm.StoreOptions{ DiscardABCIResponses: false, }) - // state.ConsensusParams.Feature.VoteExtensionsEnableHeight = testCase.extensionEnableHeight + state.ConsensusParams.Feature.VoteExtensionsEnableHeight = testCase.extensionEnableHeight mp := &mpmocks.Mempool{} mp.On("Lock").Return() mp.On("Unlock").Return() diff --git a/types/params.go b/types/params.go index aed1f06825..8cc40e7e20 100644 --- a/types/params.go +++ b/types/params.go @@ -2,7 +2,6 @@ package types import ( "errors" - "flag" "fmt" "math" "time" @@ -177,10 +176,11 @@ func DefaultValidatorParams() ValidatorParams { params := ValidatorParams{ PubKeyTypes: []string{ABCIPubKeyTypeBls12381}, } - // If we are running tests, enable ed25519. - if flag.Lookup("test.v") != nil { - params.PubKeyTypes = append(params.PubKeyTypes, ABCIPubKeyTypeEd25519) - } + // TODO Clean up + // // If we are running tests, enable ed25519. + // if flag.Lookup("test.v") != nil { + // params.PubKeyTypes = append(params.PubKeyTypes, ABCIPubKeyTypeEd25519) + // } return params } @@ -285,7 +285,8 @@ func (params ConsensusParams) ValidateBasic() error { } // If we are running in production, we only allow BLS keys - if flag.Lookup("test.v") == nil { + // TODO Clean up + if true { // flag.Lookup("test.v") == nil { if !(len(params.Validator.PubKeyTypes) == 1 && params.Validator.PubKeyTypes[0] == ABCIPubKeyTypeBls12381) { return errors.New("only BLS key type is allowed") } @@ -444,7 +445,7 @@ func (params ConsensusParams) Update(params2 *cmtproto.ConsensusParams) Consensu } if params2.Feature != nil { if params2.Feature.VoteExtensionsEnableHeight != nil { - res.Feature.VoteExtensionsEnableHeight = 0 //params2.Feature.GetVoteExtensionsEnableHeight().Value + res.Feature.VoteExtensionsEnableHeight = 0 // disable vote extensions in Berachain } if params2.Feature.PbtsEnableHeight != nil {