diff --git a/app/encoding.go b/app/encoding.go index e87ec971..766295be 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -28,6 +28,7 @@ func TmpAppOptions() simsutils.AppOptionsMap { return appOpts } +// NewTmpBabylonApp returns a new BabylonApp func NewTmpBabylonApp() *BabylonApp { tbs, _ := signer.SetupTestBlsSigner() blsSigner := checkpointingtypes.BlsSigner(tbs) diff --git a/app/signer/private.go b/app/signer/private.go index b6d95040..9c91e6d4 100644 --- a/app/signer/private.go +++ b/app/signer/private.go @@ -12,6 +12,7 @@ import ( checkpointingtypes "github.com/babylonlabs-io/babylon/x/checkpointing/types" ) +// ConsensusKey represents the consensus keys type ConsensusKey struct { Comet *cmtprivval.FilePVKey Bls *privval.BlsPVKey diff --git a/x/checkpointing/types/errors.go b/x/checkpointing/types/errors.go index f212924c..2971bd5c 100644 --- a/x/checkpointing/types/errors.go +++ b/x/checkpointing/types/errors.go @@ -19,4 +19,5 @@ var ( ErrConflictingCheckpoint = errorsmod.Register(ModuleName, 1213, "Conflicting checkpoint is found") ErrInvalidAppHash = errorsmod.Register(ModuleName, 1214, "Provided app hash is Invalid") ErrInsufficientVotingPower = errorsmod.Register(ModuleName, 1215, "Accumulated voting power is not greater than 2/3 of total power") + ErrValAddrDoesNotExist = errorsmod.Register(ModuleName, 1216, "Validator address does not exist") ) diff --git a/x/checkpointing/vote_ext_test.go b/x/checkpointing/vote_ext_test.go index 0a4dcc9d..a0001b89 100644 --- a/x/checkpointing/vote_ext_test.go +++ b/x/checkpointing/vote_ext_test.go @@ -175,40 +175,3 @@ func FuzzExtendVote_InvalidBlockHash(f *testing.F) { require.NoError(t, err) }) } - -// FuzzExtendVote_EmptyBLSPrivKey tests the case where the -// BLS private key of the private signer is missing -func FuzzExtendVote_EmptyBLSPrivKey(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 10) - - f.Fuzz(func(t *testing.T, seed int64) { - r := rand.New(rand.NewSource(seed)) - // generate the validator set with 10 validators as genesis - genesisValSet, ps, err := datagen.GenesisValidatorSetWithPrivSigner(10) - require.NoError(t, err) - - // set the BLS private key to be nil to trigger panic - ps.PV.Bls.PrivKey = nil - helper := testhelper.NewHelperWithValSet(t, genesisValSet, ps) - ek := helper.App.EpochingKeeper - - epoch := ek.GetEpoch(helper.Ctx) - require.Equal(t, uint64(1), epoch.EpochNumber) - - // go to block 10, reaching epoch boundary - interval := ek.GetParams(helper.Ctx).EpochInterval - for i := uint64(0); i < interval-2; i++ { - _, err := helper.ApplyEmptyBlockWithVoteExtension(r) - require.NoError(t, err) - } - - req := &abci.RequestExtendVote{ - Hash: datagen.GenRandomByteArray(r, types.HashSize), - Height: 10, - } - - // error is expected due to nil BLS private key - _, err = helper.App.ExtendVote(helper.Ctx, req) - require.Error(t, err) - }) -}