Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
cffls committed Jul 25, 2024
1 parent 269c9ec commit 314996b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion zk/erigon_db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ func (db ErigonDb) WriteHeader(
return nil, fmt.Errorf("failed to get parent header: %w", err)
}

h := core.MakeEmptyHeader(parentHeader, chainConfig, ts, &gasLimit)
h := &ethTypes.Header{}

if parentHeader != nil {
h = core.MakeEmptyHeader(parentHeader, chainConfig, ts, &gasLimit)
} else {
h.Number = blockNo
}

h.ParentHash = parentHash
h.Root = stateRoot
Expand Down
4 changes: 3 additions & 1 deletion zk/stages/stage_batches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/hex"
"testing"

"github.com/ledgerwatch/erigon-lib/chain"
"github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon-lib/kv/memdb"
Expand Down Expand Up @@ -72,7 +73,8 @@ func TestUnwindBatches(t *testing.T) {
require.NoError(t, err)

dsClient := NewTestDatastreamClient(fullL2Blocks, gerUpdates)
cfg := StageBatchesCfg(db1, dsClient, &ethconfig.Zk{}, nil)

cfg := StageBatchesCfg(db1, dsClient, &ethconfig.Zk{}, &chain.Config{}, nil)

s := &stagedsync.StageState{ID: stages.Batches, BlockNumber: 0}
u := &stagedsync.Sync{}
Expand Down

0 comments on commit 314996b

Please sign in to comment.