diff --git a/dot/interfaces.go b/dot/interfaces.go index 880b258f26..33beecb61c 100644 --- a/dot/interfaces.go +++ b/dot/interfaces.go @@ -27,7 +27,7 @@ type ServiceRegisterer interface { // BlockJustificationVerifier has a verification method for block justifications. type BlockJustificationVerifier interface { - VerifyBlockJustification(common.Hash, []byte) (round uint64, setID uint64, err error) + VerifyBlockJustification(common.Hash, []byte) error } // Telemetry is the telemetry client to send telemetry messages. diff --git a/dot/state/block.go b/dot/state/block.go index c8ed6afd76..789cfb7c00 100644 --- a/dot/state/block.go +++ b/dot/state/block.go @@ -492,21 +492,6 @@ func (bs *BlockState) AddBlockWithArrivalTime(block *types.Block, arrivalTime ti return nil } -// AddBlockToBlockTree adds the given block to the blocktree. It does not write it to the database. -// TODO: remove this func and usage from sync (after sync refactor?) -func (bs *BlockState) AddBlockToBlockTree(block *types.Block) error { - bs.Lock() - defer bs.Unlock() - - arrivalTime, err := bs.GetArrivalTime(block.Header.Hash()) - if err != nil { - arrivalTime = time.Now() - } - - bs.unfinalisedBlocks.store(block) - return bs.bt.AddBlock(&block.Header, arrivalTime) -} - // GetAllBlocksAtNumber returns all unfinalised blocks with the given number func (bs *BlockState) GetAllBlocksAtNumber(num uint) ([]common.Hash, error) { header, err := bs.GetHeaderByNumber(num) diff --git a/dot/state/block_test.go b/dot/state/block_test.go index 8243bf586e..ced6cd4263 100644 --- a/dot/state/block_test.go +++ b/dot/state/block_test.go @@ -635,26 +635,6 @@ func TestAddBlock_WithReOrg(t *testing.T) { require.Equal(t, header3a.Hash(), block3hash) } -func TestAddBlockToBlockTree(t *testing.T) { - bs := newTestBlockState(t, newTriesEmpty()) - - header := &types.Header{ - Number: 1, - Digest: createPrimaryBABEDigest(t), - ParentHash: testGenesisHeader.Hash(), - } - - err := bs.setArrivalTime(header.Hash(), time.Now()) - require.NoError(t, err) - - err = bs.AddBlockToBlockTree(&types.Block{ - Header: *header, - Body: types.Body{}, - }) - require.NoError(t, err) - require.Equal(t, bs.BestBlockHash(), header.Hash()) -} - func TestNumberIsFinalised(t *testing.T) { tries := newTriesEmpty() diff --git a/dot/sync/chain_sync.go b/dot/sync/chain_sync.go index 979f73f7ab..eea6301a89 100644 --- a/dot/sync/chain_sync.go +++ b/dot/sync/chain_sync.go @@ -816,33 +816,25 @@ func (cs *chainSync) handleReadyBlock(bd *types.BlockData, origin blockOrigin) e // processBlockData processes the BlockData from a BlockResponse and // returns the index of the last BlockData it handled on success, // or the index of the block data that errored on failure. +// TODO: https://github.com/ChainSafe/gossamer/issues/3468 func (cs *chainSync) processBlockData(blockData types.BlockData, origin blockOrigin) error { // while in bootstrap mode we don't need to broadcast block announcements announceImportedBlock := cs.getSyncMode() == tip - var blockDataJustification []byte - if blockData.Justification != nil { - blockDataJustification = *blockData.Justification - } if blockData.Header != nil { - round, setID, err := cs.verifyJustification(blockData.Header.Hash(), blockDataJustification) - if err != nil { - return err - } - if blockData.Body != nil { - err = cs.processBlockDataWithHeaderAndBody(blockData, origin, announceImportedBlock) + err := cs.processBlockDataWithHeaderAndBody(blockData, origin, announceImportedBlock) if err != nil { return fmt.Errorf("processing block data with header and body: %w", err) } } - err = cs.finalizeAndSetJustification( - blockData.Header, - round, setID, - blockDataJustification) - if err != nil { - return fmt.Errorf("while setting justification: %w", err) + if blockData.Justification != nil && len(*blockData.Justification) > 0 { + logger.Infof("handling justification for block %s (#%d)", blockData.Hash.Short(), blockData.Number()) + err := cs.handleJustification(blockData.Header, *blockData.Justification) + if err != nil { + return fmt.Errorf("handling justification: %w", err) + } } } @@ -854,16 +846,6 @@ func (cs *chainSync) processBlockData(blockData types.BlockData, origin blockOri return nil } -func (cs *chainSync) verifyJustification(headerHash common.Hash, justification []byte) ( - round uint64, setID uint64, err error) { - if len(justification) > 0 { - round, setID, err = cs.finalityGadget.VerifyBlockJustification(headerHash, justification) - return round, setID, err - } - - return 0, 0, nil -} - func (cs *chainSync) processBlockDataWithHeaderAndBody(blockData types.BlockData, origin blockOrigin, announceImportedBlock bool) (err error) { @@ -900,27 +882,21 @@ func (cs *chainSync) handleBody(body *types.Body) { blockSizeGauge.Set(float64(acc)) } -func (cs *chainSync) finalizeAndSetJustification(header *types.Header, - round, setID uint64, justification []byte) (err error) { - if len(justification) > 0 { - err = cs.blockState.SetFinalisedHash(header.Hash(), round, setID) - if err != nil { - return fmt.Errorf("setting finalised hash: %w", err) - } - - logger.Debugf( - "finalised block with hash #%d (%s), round %d and set id %d", - header.Number, header.Hash(), round, setID) +func (cs *chainSync) handleJustification(header *types.Header, justification []byte) (err error) { + logger.Debugf("handling justification for block %d...", header.Number) - err = cs.blockState.SetJustification(header.Hash(), justification) - if err != nil { - return fmt.Errorf("setting justification for block number %d: %w", - header.Number, err) - } + headerHash := header.Hash() + err = cs.finalityGadget.VerifyBlockJustification(headerHash, justification) + if err != nil { + return fmt.Errorf("verifying block number %d justification: %w", header.Number, err) + } - logger.Infof("🔨 finalised block number #%d (%s)", header.Number, header.Hash()) + err = cs.blockState.SetJustification(headerHash, justification) + if err != nil { + return fmt.Errorf("setting justification for block number %d: %w", header.Number, err) } + logger.Infof("🔨 finalised block number %d with hash %s", header.Number, headerHash) return nil } diff --git a/dot/sync/chain_sync_test.go b/dot/sync/chain_sync_test.go index 3da8dae5da..f4fb045074 100644 --- a/dot/sync/chain_sync_test.go +++ b/dot/sync/chain_sync_test.go @@ -1676,8 +1676,9 @@ func TestChainSync_getHighestBlock(t *testing.T) { }) } } - func TestChainSync_BootstrapSync_SuccessfulSync_WithInvalidJusticationBlock(t *testing.T) { + // TODO: https://github.com/ChainSafe/gossamer/issues/3468 + t.Skip() t.Parallel() ctrl := gomock.NewController(t) diff --git a/dot/sync/interfaces.go b/dot/sync/interfaces.go index 29ac858ee6..bfc0575d3f 100644 --- a/dot/sync/interfaces.go +++ b/dot/sync/interfaces.go @@ -29,7 +29,6 @@ type BlockState interface { GetMessageQueue(common.Hash) ([]byte, error) GetJustification(common.Hash) ([]byte, error) SetJustification(hash common.Hash, data []byte) error - AddBlockToBlockTree(block *types.Block) error GetHashByNumber(blockNumber uint) (common.Hash, error) GetBlockByHash(common.Hash) (*types.Block, error) GetRuntime(blockHash common.Hash) (runtime runtime.Instance, err error) @@ -39,7 +38,6 @@ type BlockState interface { GetHeaderByNumber(num uint) (*types.Header, error) GetAllBlocksAtNumber(num uint) ([]common.Hash, error) IsDescendantOf(parent, child common.Hash) (bool, error) - SetFinalisedHash(common.Hash, uint64, uint64) error } // StorageState is the interface for the storage state @@ -60,7 +58,7 @@ type BabeVerifier interface { // FinalityGadget implements justification verification functionality type FinalityGadget interface { - VerifyBlockJustification(common.Hash, []byte) (round uint64, setID uint64, err error) + VerifyBlockJustification(common.Hash, []byte) error } // BlockImportHandler is the interface for the handler of newly imported blocks diff --git a/dot/sync/mocks_test.go b/dot/sync/mocks_test.go index f1827ed6e6..9ab3ea3acb 100644 --- a/dot/sync/mocks_test.go +++ b/dot/sync/mocks_test.go @@ -43,20 +43,6 @@ func (m *MockBlockState) EXPECT() *MockBlockStateMockRecorder { return m.recorder } -// AddBlockToBlockTree mocks base method. -func (m *MockBlockState) AddBlockToBlockTree(arg0 *types.Block) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddBlockToBlockTree", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// AddBlockToBlockTree indicates an expected call of AddBlockToBlockTree. -func (mr *MockBlockStateMockRecorder) AddBlockToBlockTree(arg0 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddBlockToBlockTree", reflect.TypeOf((*MockBlockState)(nil).AddBlockToBlockTree), arg0) -} - // BestBlockHeader mocks base method. func (m *MockBlockState) BestBlockHeader() (*types.Header, error) { m.ctrl.T.Helper() @@ -340,20 +326,6 @@ func (mr *MockBlockStateMockRecorder) RangeInMemory(arg0, arg1 any) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RangeInMemory", reflect.TypeOf((*MockBlockState)(nil).RangeInMemory), arg0, arg1) } -// SetFinalisedHash mocks base method. -func (m *MockBlockState) SetFinalisedHash(arg0 common.Hash, arg1, arg2 uint64) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetFinalisedHash", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// SetFinalisedHash indicates an expected call of SetFinalisedHash. -func (mr *MockBlockStateMockRecorder) SetFinalisedHash(arg0, arg1, arg2 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetFinalisedHash", reflect.TypeOf((*MockBlockState)(nil).SetFinalisedHash), arg0, arg1, arg2) -} - // SetJustification mocks base method. func (m *MockBlockState) SetJustification(arg0 common.Hash, arg1 []byte) error { m.ctrl.T.Helper() @@ -538,13 +510,11 @@ func (m *MockFinalityGadget) EXPECT() *MockFinalityGadgetMockRecorder { } // VerifyBlockJustification mocks base method. -func (m *MockFinalityGadget) VerifyBlockJustification(arg0 common.Hash, arg1 []byte) (uint64, uint64, error) { +func (m *MockFinalityGadget) VerifyBlockJustification(arg0 common.Hash, arg1 []byte) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "VerifyBlockJustification", arg0, arg1) - ret0, _ := ret[0].(uint64) - ret1, _ := ret[1].(uint64) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 + ret0, _ := ret[0].(error) + return ret0 } // VerifyBlockJustification indicates an expected call of VerifyBlockJustification. diff --git a/dot/sync/syncer_integration_test.go b/dot/sync/syncer_integration_test.go index 09f7ba9c5a..ac4ddf34e4 100644 --- a/dot/sync/syncer_integration_test.go +++ b/dot/sync/syncer_integration_test.go @@ -111,10 +111,9 @@ func newTestSyncer(t *testing.T) *Service { cfg.LogLvl = log.Trace mockFinalityGadget := NewMockFinalityGadget(ctrl) mockFinalityGadget.EXPECT().VerifyBlockJustification(gomock.AssignableToTypeOf(common.Hash{}), - gomock.AssignableToTypeOf([]byte{})).DoAndReturn( - func(hash common.Hash, justification []byte) (uint64, uint64, error) { - return 1, 1, nil - }).AnyTimes() + gomock.AssignableToTypeOf([]byte{})).DoAndReturn(func(hash common.Hash, justification []byte) error { + return nil + }).AnyTimes() cfg.FinalityGadget = mockFinalityGadget cfg.Network = NewMockNetwork(ctrl) diff --git a/lib/grandpa/message_handler.go b/lib/grandpa/message_handler.go index 6d7cf472fd..cb5105324f 100644 --- a/lib/grandpa/message_handler.go +++ b/lib/grandpa/message_handler.go @@ -402,55 +402,54 @@ func (h *MessageHandler) verifyPreCommitJustification(msg *CatchUpResponse) erro return nil } -// VerifyBlockJustification verifies the finality justification for a block, -// if the justification is valid the return the round and set id otherwise error -func (s *Service) VerifyBlockJustification(hash common.Hash, justification []byte) ( - round uint64, setID uint64, err error) { +// VerifyBlockJustification verifies the finality justification for a block, returns scale encoded justification with +// any extra bytes removed. +func (s *Service) VerifyBlockJustification(hash common.Hash, justification []byte) error { fj := Justification{} - err = scale.Unmarshal(justification, &fj) + err := scale.Unmarshal(justification, &fj) if err != nil { - return 0, 0, err + return err } if hash != fj.Commit.Hash { - return 0, 0, fmt.Errorf("%w: justification %s and block hash %s", + return fmt.Errorf("%w: justification %s and block hash %s", ErrJustificationMismatch, fj.Commit.Hash.Short(), hash.Short()) } - setID, err = s.grandpaState.GetSetIDByBlockNumber(uint(fj.Commit.Number)) + setID, err := s.grandpaState.GetSetIDByBlockNumber(uint(fj.Commit.Number)) if err != nil { - return 0, 0, fmt.Errorf("cannot get set ID from block number: %w", err) + return fmt.Errorf("cannot get set ID from block number: %w", err) } has, err := s.blockState.HasFinalisedBlock(fj.Round, setID) if err != nil { - return 0, 0, fmt.Errorf("checking if round and set id has finalised block: %w", err) + return fmt.Errorf("checking if round and set id has finalised block: %w", err) } if has { storedFinalisedHash, err := s.blockState.GetFinalisedHash(fj.Round, setID) if err != nil { - return 0, 0, fmt.Errorf("getting finalised hash: %w", err) + return fmt.Errorf("getting finalised hash: %w", err) } if storedFinalisedHash != hash { - return 0, 0, fmt.Errorf("%w, setID=%d and round=%d", errFinalisedBlocksMismatch, setID, fj.Round) + return fmt.Errorf("%w, setID=%d and round=%d", errFinalisedBlocksMismatch, setID, fj.Round) } - return fj.Round, setID, nil + return nil } isDescendant, err := isDescendantOfHighestFinalisedBlock(s.blockState, fj.Commit.Hash) if err != nil { - return 0, 0, fmt.Errorf("checking if descendant of highest block: %w", err) + return fmt.Errorf("checking if descendant of highest block: %w", err) } if !isDescendant { - return 0, 0, errVoteBlockMismatch + return errVoteBlockMismatch } auths, err := s.grandpaState.GetAuthorities(setID) if err != nil { - return 0, 0, fmt.Errorf("cannot get authorities for set ID: %w", err) + return fmt.Errorf("cannot get authorities for set ID: %w", err) } // threshold is two-thirds the number of authorities, @@ -458,7 +457,7 @@ func (s *Service) VerifyBlockJustification(hash common.Hash, justification []byt threshold := (2 * len(auths) / 3) if len(fj.Commit.Precommits) < threshold { - return 0, 0, ErrMinVotesNotMet + return ErrMinVotesNotMet } authPubKeys := make([]AuthData, len(fj.Commit.Precommits)) @@ -478,20 +477,20 @@ func (s *Service) VerifyBlockJustification(hash common.Hash, justification []byt // check if vote was for descendant of committed block isDescendant, err := s.blockState.IsDescendantOf(hash, just.Vote.Hash) if err != nil { - return 0, 0, err + return err } if !isDescendant { - return 0, 0, ErrPrecommitBlockMismatch + return ErrPrecommitBlockMismatch } publicKey, err := ed25519.NewPublicKey(just.AuthorityID[:]) if err != nil { - return 0, 0, err + return err } if !isInAuthSet(publicKey, auths) { - return 0, 0, ErrAuthorityNotInSet + return ErrAuthorityNotInSet } // verify signature for each precommit @@ -502,16 +501,16 @@ func (s *Service) VerifyBlockJustification(hash common.Hash, justification []byt SetID: setID, }) if err != nil { - return 0, 0, err + return err } ok, err := publicKey.Verify(msg, just.Signature[:]) if err != nil { - return 0, 0, err + return err } if !ok { - return 0, 0, ErrInvalidSignature + return ErrInvalidSignature } if _, ok := equivocatoryVoters[just.AuthorityID]; ok { @@ -522,21 +521,30 @@ func (s *Service) VerifyBlockJustification(hash common.Hash, justification []byt } if count+len(equivocatoryVoters) < threshold { - return 0, 0, ErrMinVotesNotMet + return ErrMinVotesNotMet } err = verifyBlockHashAgainstBlockNumber(s.blockState, fj.Commit.Hash, uint(fj.Commit.Number)) if err != nil { - return 0, 0, fmt.Errorf("verifying block hash against block number: %w", err) + return fmt.Errorf("verifying block hash against block number: %w", err) } for _, preCommit := range fj.Commit.Precommits { err := verifyBlockHashAgainstBlockNumber(s.blockState, preCommit.Vote.Hash, uint(preCommit.Vote.Number)) if err != nil { - return 0, 0, fmt.Errorf("verifying block hash against block number: %w", err) + return fmt.Errorf("verifying block hash against block number: %w", err) } } - return fj.Round, setID, nil + + err = s.blockState.SetFinalisedHash(hash, fj.Round, setID) + if err != nil { + return fmt.Errorf("setting finalised hash: %w", err) + } + + logger.Debugf( + "set finalised block with hash %s, round %d and set id %d", + hash, fj.Round, setID) + return nil } func verifyBlockHashAgainstBlockNumber(bs BlockState, hash common.Hash, number uint) error { diff --git a/lib/grandpa/message_handler_integration_test.go b/lib/grandpa/message_handler_integration_test.go index 2368051944..d1321b0a01 100644 --- a/lib/grandpa/message_handler_integration_test.go +++ b/lib/grandpa/message_handler_integration_test.go @@ -772,11 +772,8 @@ func TestMessageHandler_VerifyBlockJustification_WithEquivocatoryVotes(t *testin just := newJustification(round, testHash, number, precommits) data, err := scale.Marshal(*just) require.NoError(t, err) - - actualRound, actualSetID, err := gs.VerifyBlockJustification(testHash, data) + err = gs.VerifyBlockJustification(testHash, data) require.NoError(t, err) - require.Equal(t, round, actualRound) - require.Equal(t, setID, actualSetID) } func TestMessageHandler_VerifyBlockJustification(t *testing.T) { @@ -843,10 +840,8 @@ func TestMessageHandler_VerifyBlockJustification(t *testing.T) { just := newJustification(round, testHash, number, precommits) data, err := scale.Marshal(*just) require.NoError(t, err) - actualRound, actualSetID, err := gs.VerifyBlockJustification(testHash, data) + err = gs.VerifyBlockJustification(testHash, data) require.NoError(t, err) - require.Equal(t, round, actualRound) - require.Equal(t, setID, actualSetID) // use wrong hash, shouldn't verify precommits = buildTestJustification(t, 2, round+1, setID, kr, precommit) @@ -854,7 +849,7 @@ func TestMessageHandler_VerifyBlockJustification(t *testing.T) { just.Commit.Precommits[0].Vote.Hash = testHeader2.Hash() data, err = scale.Marshal(*just) require.NoError(t, err) - _, _, err = gs.VerifyBlockJustification(testHash, data) + err = gs.VerifyBlockJustification(testHash, data) require.Equal(t, ErrPrecommitBlockMismatch, err) } @@ -904,7 +899,7 @@ func TestMessageHandler_VerifyBlockJustification_invalid(t *testing.T) { just.Commit.Precommits[0].Vote.Hash = genhash data, err := scale.Marshal(*just) require.NoError(t, err) - _, _, err = gs.VerifyBlockJustification(testHash, data) + err = gs.VerifyBlockJustification(testHash, data) require.Equal(t, ErrPrecommitBlockMismatch, err) // use wrong round, shouldn't verify @@ -912,7 +907,7 @@ func TestMessageHandler_VerifyBlockJustification_invalid(t *testing.T) { just = newJustification(round+2, testHash, number, precommits) data, err = scale.Marshal(*just) require.NoError(t, err) - _, _, err = gs.VerifyBlockJustification(testHash, data) + err = gs.VerifyBlockJustification(testHash, data) require.Equal(t, ErrInvalidSignature, err) // add authority not in set, shouldn't verify @@ -920,7 +915,7 @@ func TestMessageHandler_VerifyBlockJustification_invalid(t *testing.T) { just = newJustification(round+1, testHash, number, precommits) data, err = scale.Marshal(*just) require.NoError(t, err) - _, _, err = gs.VerifyBlockJustification(testHash, data) + err = gs.VerifyBlockJustification(testHash, data) require.Equal(t, ErrAuthorityNotInSet, err) // not enough signatures, shouldn't verify @@ -928,7 +923,7 @@ func TestMessageHandler_VerifyBlockJustification_invalid(t *testing.T) { just = newJustification(round+1, testHash, number, precommits) data, err = scale.Marshal(*just) require.NoError(t, err) - _, _, err = gs.VerifyBlockJustification(testHash, data) + err = gs.VerifyBlockJustification(testHash, data) require.Equal(t, ErrMinVotesNotMet, err) // mismatch justification header and block header @@ -937,7 +932,7 @@ func TestMessageHandler_VerifyBlockJustification_invalid(t *testing.T) { data, err = scale.Marshal(*just) require.NoError(t, err) otherHeader := types.NewEmptyHeader() - _, _, err = gs.VerifyBlockJustification(otherHeader.Hash(), data) + err = gs.VerifyBlockJustification(otherHeader.Hash(), data) require.ErrorIs(t, err, ErrJustificationMismatch) expectedErr := fmt.Sprintf("%s: justification %s and block hash %s", ErrJustificationMismatch, @@ -1006,7 +1001,7 @@ func TestMessageHandler_VerifyBlockJustification_ErrFinalisedBlockMismatch(t *te just := newJustification(round, testHash, number, precommits) data, err := scale.Marshal(*just) require.NoError(t, err) - _, _, err = gs.VerifyBlockJustification(testHash, data) + err = gs.VerifyBlockJustification(testHash, data) require.ErrorIs(t, err, errFinalisedBlocksMismatch) } @@ -1522,6 +1517,8 @@ func TestService_VerifyBlockJustification(t *testing.T) { //nolint mockBlockState.EXPECT().IsDescendantOf(testHash, testHash). Return(true, nil).Times(3) mockBlockState.EXPECT().GetHeader(testHash).Return(testHeader, nil).Times(3) + mockBlockState.EXPECT().SetFinalisedHash(testHash, uint64(1), + uint64(0)).Return(nil) return mockBlockState }, grandpaStateBuilder: func(ctrl *gomock.Controller) GrandpaState { @@ -1550,6 +1547,8 @@ func TestService_VerifyBlockJustification(t *testing.T) { //nolint mockBlockState.EXPECT().IsDescendantOf(testHash, testHash). Return(true, nil).Times(3) mockBlockState.EXPECT().GetHeader(testHash).Return(testHeader, nil).Times(3) + mockBlockState.EXPECT().SetFinalisedHash(testHash, uint64(1), + uint64(0)).Return(nil) return mockBlockState }, grandpaStateBuilder: func(ctrl *gomock.Controller) GrandpaState { @@ -1579,7 +1578,7 @@ func TestService_VerifyBlockJustification(t *testing.T) { //nolint blockState: tt.fields.blockStateBuilder(ctrl), grandpaState: tt.fields.grandpaStateBuilder(ctrl), } - _, _, err := s.VerifyBlockJustification(tt.args.hash, tt.args.justification) + err := s.VerifyBlockJustification(tt.args.hash, tt.args.justification) if tt.wantErr != nil { assert.ErrorContains(t, err, tt.wantErr.Error()) } else { diff --git a/lib/grandpa/votes_tracker_test.go b/lib/grandpa/votes_tracker_test.go index 54857b3678..91a9b220b8 100644 --- a/lib/grandpa/votes_tracker_test.go +++ b/lib/grandpa/votes_tracker_test.go @@ -5,22 +5,16 @@ package grandpa import ( "container/list" - "fmt" "sort" "testing" "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/crypto/ed25519" - "github.com/ChainSafe/gossamer/pkg/scale" "github.com/libp2p/go-libp2p/core/peer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func TestA(t *testing.T) { - fmt.Println(scale.MustMarshal([]byte{})) -} - // buildVoteMessage creates a test vote message using the // given block hash and authority ID only. func buildVoteMessage(blockHash common.Hash,