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

feat(lib/babe): implement secondary slot block production #2260

Merged
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e41869d
feat(lib/babe): implement secondary slot block production
kishansagathiya Jan 31, 2022
ea2729c
Initialize the map
kishansagathiya Feb 3, 2022
9d691a7
Merge branch 'development' into kishan/feat/secondary-slot-block-prod…
kishansagathiya Feb 3, 2022
a42b712
adjusting to new babe changes
kishansagathiya Feb 3, 2022
a3d7d4a
adjusting to new babe changes
kishansagathiya Feb 3, 2022
25bddae
fixed some errors and addressed reviews
kishansagathiya Feb 4, 2022
1c09237
Pass pre runtime digest through functions
kishansagathiya Feb 7, 2022
c25d9d6
adjusting some tests
kishansagathiya Feb 7, 2022
a9c0d07
removing unused params
kishansagathiya Feb 7, 2022
454eab2
attempting to stress test
kishansagathiya Feb 7, 2022
151482c
addressed reviews
kishansagathiya Feb 8, 2022
25d7a92
fixing some more errors
kishansagathiya Feb 9, 2022
d771a94
rename
kishansagathiya Feb 9, 2022
1bd089b
Small changes and TODO comments while debugging
kishansagathiya Feb 14, 2022
aea4766
pass lint
kishansagathiya Feb 14, 2022
8e23302
small changes
kishansagathiya Feb 15, 2022
a7e027f
Update lib/babe/epoch_handler.go
kishansagathiya Feb 15, 2022
f2a407f
Merge branch 'kishan/feat/secondary-slot-block-production' of github.…
kishansagathiya Feb 15, 2022
1550205
make sure epochData.secondary gets filled
kishansagathiya Feb 15, 2022
a06c66b
Update lib/babe/verify_integration_test.go
kishansagathiya Feb 17, 2022
b27b37a
Update lib/babe/epoch_handler.go
kishansagathiya Feb 17, 2022
8b6a6d0
Update tests/stress/stress_test.go
kishansagathiya Feb 17, 2022
a9a9d11
addressed reviews
kishansagathiya Feb 17, 2022
f0aab84
more fixes
kishansagathiya Feb 17, 2022
255fdd7
more fixes
kishansagathiya Feb 17, 2022
c7f1730
Merge branch 'development' into kishan/feat/secondary-slot-block-prod…
kishansagathiya Feb 18, 2022
34f2605
feat(lib/babe): implement secondary vrf slot block production (#2307)
kishansagathiya Feb 25, 2022
c9b863a
Update lib/babe/epoch.go
kishansagathiya Feb 28, 2022
d1afc50
addressed reviews, modified tests
kishansagathiya Feb 28, 2022
988395c
Merge branch 'kishan/feat/secondary-slot-block-production' of github.…
kishansagathiya Feb 28, 2022
e9b24a9
fixing lint
kishansagathiya Feb 28, 2022
347a698
Addressed Eclesio's comments
kishansagathiya Mar 2, 2022
11b326b
Update tests/stress/stress_test.go
kishansagathiya Mar 2, 2022
4de8ed5
Using ToPreRuntimeDigest() method now
kishansagathiya Mar 3, 2022
678b2f8
more of quentin's comments
kishansagathiya Mar 3, 2022
c182a0d
Merge branch 'kishan/feat/secondary-slot-block-production' of github.…
kishansagathiya Mar 3, 2022
1291d1b
Merge branch 'development' into kishan/feat/secondary-slot-block-prod…
kishansagathiya Mar 3, 2022
983af6e
Update lib/babe/epoch.go
kishansagathiya Mar 3, 2022
0c8a7b0
Update lib/babe/epoch.go
kishansagathiya Mar 3, 2022
bc775c6
Update lib/babe/epoch.go
kishansagathiya Mar 3, 2022
9d6d62e
removed a comment
kishansagathiya Mar 4, 2022
e71b76d
Merge branch 'development' of github.com:ChainSafe/gossamer into kish…
kishansagathiya Mar 4, 2022
1a44de1
Merge branch 'kishan/feat/secondary-slot-block-production' of github.…
kishansagathiya Mar 4, 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
2 changes: 1 addition & 1 deletion dot/core/messages_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestService_HandleBlockProduced(t *testing.T) {

// simulate block sent from BABE session
digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
kishansagathiya marked this conversation as resolved.
Show resolved Hide resolved
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion dot/core/service_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestAnnounceBlock(t *testing.T) {

// simulate block sent from BABE session
digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down
12 changes: 6 additions & 6 deletions dot/rpc/modules/chain_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestChainGetHeader_Genesis(t *testing.T) {
require.NoError(t, err)

di := types.NewDigestItem()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = di.Set(*prd)
require.NoError(t, err)
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestChainGetHeader_Latest(t *testing.T) {
require.NoError(t, err)

di := types.NewDigestItem()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = di.Set(*prd)
require.NoError(t, err)
Expand Down Expand Up @@ -127,7 +127,7 @@ func TestChainGetBlock_Genesis(t *testing.T) {
require.NoError(t, err)

di := types.NewDigestItem()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = di.Set(*prd)
require.NoError(t, err)
Expand Down Expand Up @@ -171,7 +171,7 @@ func TestChainGetBlock_Latest(t *testing.T) {
require.NoError(t, err)

di := types.NewDigestItem()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = di.Set(*prd)
require.NoError(t, err)
Expand Down Expand Up @@ -315,7 +315,7 @@ func TestChainGetFinalizedHeadByRound(t *testing.T) {
require.Equal(t, common.BytesToHex(expected[:]), res)

digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down Expand Up @@ -388,7 +388,7 @@ func newTestStateService(t *testing.T) *state.Service {

func loadTestBlocks(t *testing.T, gh common.Hash, bs *state.BlockState, rt runtime.Instance) {
digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion dot/rpc/modules/childstate_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func setupChildStateStorage(t *testing.T) (*ChildStateModule, common.Hash) {
require.NoError(t, err)

digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion dot/rpc/modules/state_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ func setupStateModule(t *testing.T) (*StateModule, *common.Hash, *common.Hash) {
require.NoError(t, err)

digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion dot/rpc/modules/system_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func setupSystemModule(t *testing.T) *SystemModule {
require.NoError(t, err)

digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down
6 changes: 3 additions & 3 deletions dot/state/block_finalisation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestBlockState_SetFinalisedHash(t *testing.T) {
require.Equal(t, testGenesisHeader.Hash(), h)

digest := types.NewDigest()
di, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
di, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
require.NotNil(t, di)
err = digest.Add(*di)
Expand Down Expand Up @@ -101,13 +101,13 @@ func TestSetFinalisedHash_setFirstSlotOnFinalisation(t *testing.T) {
firstSlot := uint64(42069)

digest := types.NewDigest()
di, err := types.NewBabeSecondaryPlainPreDigest(0, firstSlot).ToPreRuntimeDigest()
di, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, firstSlot))
require.NoError(t, err)
require.NotNil(t, di)
err = digest.Add(*di)
require.NoError(t, err)
digest2 := types.NewDigest()
di, err = types.NewBabeSecondaryPlainPreDigest(0, firstSlot+100).ToPreRuntimeDigest()
di, err = types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, firstSlot+100))
require.NoError(t, err)
require.NotNil(t, di)
err = digest2.Add(*di)
Expand Down
4 changes: 2 additions & 2 deletions dot/state/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,13 @@ func TestNumberIsFinalised(t *testing.T) {
require.False(t, fin)

digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)

digest2 := types.NewDigest()
prd, err = types.NewBabeSecondaryPlainPreDigest(0, 100).ToPreRuntimeDigest()
prd, err = types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 100))
require.NoError(t, err)
err = digest2.Add(*prd)
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions dot/state/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func TestService_PruneStorage(t *testing.T) {
for i := 0; i < 3; i++ {
block, trieState := generateBlockWithRandomTrie(t, serv, nil, int64(i+1))
digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, uint64(i+1)).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(types.NewBabeSecondaryPlainPreDigest(0, uint64(i+1)))
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down Expand Up @@ -385,7 +385,7 @@ func TestService_Import(t *testing.T) {
}

digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 177).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 177))
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down
6 changes: 3 additions & 3 deletions dot/state/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func AddBlocksToState(t *testing.T, blockState *BlockState, depth int,
for i := startNum + 1; i <= depth+startNum; i++ {
d := types.NewBabePrimaryPreDigest(0, uint64(i), [32]byte{}, [64]byte{})
digest := types.NewDigest()
prd, err := d.ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*d)
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down Expand Up @@ -166,7 +166,7 @@ func AddBlocksToStateWithFixedBranches(t *testing.T, blockState *BlockState, dep
// create base tree
startNum := int(head.Number.Int64())
for i := startNum + 1; i <= depth; i++ {
d, err := types.NewBabePrimaryPreDigest(0, uint64(i), [32]byte{}, [64]byte{}).ToPreRuntimeDigest()
d, err := types.ToPreRuntimeDigest(*types.NewBabePrimaryPreDigest(0, uint64(i), [32]byte{}, [64]byte{}))
kishansagathiya marked this conversation as resolved.
Show resolved Hide resolved
require.NoError(t, err)
require.NotNil(t, d)
digest := types.NewDigest()
Expand Down Expand Up @@ -208,7 +208,7 @@ func AddBlocksToStateWithFixedBranches(t *testing.T, blockState *BlockState, dep
previousHash = branch.hash

for i := branch.depth; i < depth; i++ {
d, err := types.NewBabePrimaryPreDigest(0, uint64(i+j+99), [32]byte{}, [64]byte{}).ToPreRuntimeDigest()
d, err := types.ToPreRuntimeDigest(*types.NewBabePrimaryPreDigest(0, uint64(i+j+99), [32]byte{}, [64]byte{}))
kishansagathiya marked this conversation as resolved.
Show resolved Hide resolved
require.NoError(t, err)
require.NotNil(t, d)
digest := types.NewDigest()
Expand Down
13 changes: 10 additions & 3 deletions dot/sync/chain_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,22 @@ func (s *chainProcessor) processReadyBlocks() {
}

// processBlockData processes the BlockData from a BlockResponse and
// eturns the index of the last BlockData it handled on success,
// returns the index of the last BlockData it handled on success,
// or the index of the block data that errored on failure.
func (s *chainProcessor) processBlockData(bd *types.BlockData) error {
if bd == nil {
return ErrNilBlockData
}

hasHeader, _ := s.blockState.HasHeader(bd.Hash)
hasBody, _ := s.blockState.HasBlockBody(bd.Hash)
hasHeader, err := s.blockState.HasHeader(bd.Hash)
if err != nil {
return fmt.Errorf("failed to check if block state has header for hash %s: %w", bd.Hash, err)
}
hasBody, err := s.blockState.HasBlockBody(bd.Hash)
if err != nil {
return fmt.Errorf("failed to check block state has body for hash %s: %w", bd.Hash, err)
}

if hasHeader && hasBody {
// TODO: fix this; sometimes when the node shuts down the "best block" isn't stored properly,
// so when the node restarts it has blocks higher than what it thinks is the best, causing it not to sync
Expand Down
2 changes: 1 addition & 1 deletion dot/sync/chain_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func TestChainProcessor_ExecuteBlock(t *testing.T) {
func TestChainProcessor_HandleJustification(t *testing.T) {
syncer := newTestSyncer(t)

d, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
d, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
digest := types.NewDigest()
err = digest.Add(*d)
Expand Down
2 changes: 1 addition & 1 deletion dot/sync/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func addTestBlocksToState(t *testing.T, depth int, blockState BlockState) {
require.Nil(t, err)

digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion dot/sync/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
// BuildBlock ...
func BuildBlock(t *testing.T, instance runtime.Instance, parent *types.Header, ext types.Extrinsic) *types.Block {
digest := types.NewDigest()
prd, err := types.NewBabeSecondaryPlainPreDigest(0, 1).ToPreRuntimeDigest()
prd, err := types.ToPreRuntimeDigest(*types.NewBabeSecondaryPlainPreDigest(0, 1))
require.NoError(t, err)
err = digest.Add(*prd)
require.NoError(t, err)
Expand Down
13 changes: 13 additions & 0 deletions dot/types/babe.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ import (
// RandomnessLength is the length of the epoch randomness (32 bytes)
const RandomnessLength = 32

// AllowedSlots tells in what ways a slot can be claimed.
type AllowedSlots byte

// https://github.com/paritytech/substrate/blob/ded44948e2d5a398abcb4e342b0513cb690961bb/primitives/consensus/babe/src/lib.rs#L219-L226
const (
// PrimarySlots only allows primary slots.
PrimarySlots AllowedSlots = iota
// PrimaryAndSecondaryPlainSlots allow primary and secondary plain slots.
PrimaryAndSecondaryPlainSlots
// PrimaryAndSecondaryVRFSlots allows primary and secondary VRF slots.
PrimaryAndSecondaryVRFSlots
)

// BabeConfiguration contains the genesis data for BABE
//nolint:lll
// see: https://github.com/paritytech/substrate/blob/426c26b8bddfcdbaf8d29f45b128e0864b57de1c/core/consensus/babe/primitives/src/lib.rs#L132
Expand Down
45 changes: 17 additions & 28 deletions dot/types/babe_digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package types

import (
"errors"
"fmt"

"github.com/ChainSafe/gossamer/lib/crypto/sr25519"
"github.com/ChainSafe/gossamer/pkg/scale"
Expand Down Expand Up @@ -51,20 +52,6 @@ func NewBabePrimaryPreDigest(authorityIndex uint32,
}
}

// ToPreRuntimeDigest returns the BabePrimaryPreDigest as a PreRuntimeDigest
func (d *BabePrimaryPreDigest) ToPreRuntimeDigest() (*PreRuntimeDigest, error) {
digest := NewBabeDigest()
err := digest.Set(*d)
if err != nil {
return nil, err
}
enc, err := scale.Marshal(digest)
if err != nil {
return nil, err
}
return NewBABEPreRuntimeDigest(enc), nil
}
kishansagathiya marked this conversation as resolved.
Show resolved Hide resolved

// Index Returns VDT index
func (d BabePrimaryPreDigest) Index() uint { return 1 }

Expand All @@ -82,20 +69,6 @@ func NewBabeSecondaryPlainPreDigest(authorityIndex uint32, slotNumber uint64) *B
}
}

// ToPreRuntimeDigest returns the BabePrimaryPreDigest as a PreRuntimeDigest
func (d *BabeSecondaryPlainPreDigest) ToPreRuntimeDigest() (*PreRuntimeDigest, error) {
digest := NewBabeDigest()
err := digest.Set(*d)
if err != nil {
return nil, err
}
enc, err := scale.Marshal(digest)
if err != nil {
return nil, err
}
return NewBABEPreRuntimeDigest(enc), nil
}

// Index Returns VDT index
func (d BabeSecondaryPlainPreDigest) Index() uint { return 2 }

Expand All @@ -121,3 +94,19 @@ func NewBabeSecondaryVRFPreDigest(authorityIndex uint32,

// Index Returns VDT index
func (d BabeSecondaryVRFPreDigest) Index() uint { return 3 }

// ToPreRuntimeDigest returns the VaryingDataTypeValue as a PreRuntimeDigest
func ToPreRuntimeDigest(value scale.VaryingDataTypeValue) (*PreRuntimeDigest, error) {
digest := NewBabeDigest()
err := digest.Set(value)
if err != nil {
return nil, fmt.Errorf("cannot set varying data type value to babe digest: %w", err)
}

enc, err := scale.Marshal(digest)
if err != nil {
return nil, fmt.Errorf("cannot marshal babe digest: %w", err)
}

return NewBABEPreRuntimeDigest(enc), nil
}
8 changes: 6 additions & 2 deletions lib/babe/babe.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ func (b *Service) handleEpoch(epoch uint64) (next uint64, err error) {
// stop current epoch handler
cancel()
case err := <-errCh:
// TODO: errEpochPast is sent on this channel, but it doesnot get logged here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean here, the error is logged below no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen below part getting executed

logger.Warnf("attempted to start epoch that has passed: current slot=%d, start slot of epoch=%d",
currSlot, h.firstSlot,
)
errCh <- errEpochPast

Because errEpochPast is being sent on the channel here, I should see error from epochHandler in logs because of following code

gossamer/lib/babe/babe.go

Lines 388 to 390 in 67a9bbb

case err := <-errCh:
cleanup()
logger.Errorf("error from epochHandler: %s", err)

I did not see error from epochHandler in the logs when I was running gossamer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok, maybe a deadlock? It would be nice to investigate

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kishansagathiya can you open an issue for this?

cleanup()
logger.Errorf("error from epochHandler: %s", err)
}
Expand All @@ -400,7 +401,10 @@ func (b *Service) handleEpoch(epoch uint64) (next uint64, err error) {
return next, nil
}

func (b *Service) handleSlot(epoch, slotNum uint64, authorityIndex uint32, proof *VrfOutputAndProof) error {
func (b *Service) handleSlot(epoch, slotNum uint64,
authorityIndex uint32,
preRuntimeDigest *types.PreRuntimeDigest,
) error {
parentHeader, err := b.blockState.BestBlockHeader()
if err != nil {
return err
Expand Down Expand Up @@ -442,7 +446,7 @@ func (b *Service) handleSlot(epoch, slotNum uint64, authorityIndex uint32, proof

rt.SetContextStorage(ts)

block, err := b.buildBlock(parent, currentSlot, rt, authorityIndex, proof)
block, err := b.buildBlock(parent, currentSlot, rt, authorityIndex, preRuntimeDigest)
if err != nil {
return err
}
Expand Down
Loading