Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit 5bb90dc

Browse files
committed
chore: update Firewood (#1333)
1 parent 0eda2e8 commit 5bb90dc

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

core/blockchain_ext_test.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ package core
66
import (
77
"fmt"
88
"math/big"
9+
"os"
10+
"path/filepath"
911
"testing"
1012

1113
"github.com/ava-labs/libevm/common"
@@ -138,6 +140,30 @@ func copyMemDB(db ethdb.Database) (ethdb.Database, error) {
138140
return newDB, nil
139141
}
140142

143+
// This copies all files from a flat directory [src] to a new temporary directory and returns
144+
// the path to the new directory.
145+
func copyFlatDir(t *testing.T, src string) string {
146+
t.Helper()
147+
if src == "" {
148+
return ""
149+
}
150+
151+
dst := t.TempDir()
152+
ents, err := os.ReadDir(src)
153+
require.NoError(t, err)
154+
155+
for _, e := range ents {
156+
require.False(t, e.IsDir(), "expected flat directory")
157+
name := e.Name()
158+
data, err := os.ReadFile(filepath.Join(src, name))
159+
require.NoError(t, err)
160+
info, err := e.Info()
161+
require.NoError(t, err)
162+
require.NoError(t, os.WriteFile(filepath.Join(dst, name), data, info.Mode().Perm()))
163+
}
164+
return dst
165+
}
166+
141167
// checkBlockChainState creates a new BlockChain instance and checks that exporting each block from
142168
// genesis to last accepted from the original instance yields the same last accepted block and state
143169
// root.
@@ -204,7 +230,8 @@ func checkBlockChainState(
204230
if err != nil {
205231
t.Fatal(err)
206232
}
207-
restartedChain, err := create(originalDB, gspec, lastAcceptedBlock.Hash(), oldChainDataDir)
233+
newChainDataDir := copyFlatDir(t, oldChainDataDir)
234+
restartedChain, err := create(originalDB, gspec, lastAcceptedBlock.Hash(), newChainDataDir)
208235
if err != nil {
209236
t.Fatal(err)
210237
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/VictoriaMetrics/fastcache v1.12.1
77
github.com/antithesishq/antithesis-sdk-go v0.3.8
88
github.com/ava-labs/avalanchego v1.13.6-0.20251007213349-63cc1a166a56
9-
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.12
9+
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.13
1010
github.com/ava-labs/libevm v1.13.15-0.20251002164226-35926db4d661
1111
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
1212
github.com/deckarep/golang-set/v2 v2.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ github.com/ava-labs/avalanchego v1.13.6-0.20251007213349-63cc1a166a56 h1:Q4lnXtj
3232
github.com/ava-labs/avalanchego v1.13.6-0.20251007213349-63cc1a166a56/go.mod h1:EL0MGbL2liE9jp4QtCHR2thkNl8hCkD26DJ+7cmcaqs=
3333
github.com/ava-labs/coreth v0.15.4-rc.3.0.20251002221438-a857a64c28ea h1:vrHUSx6hlQgdVufhtT9LT9i7eHZcWmBEjH9cBozDLuc=
3434
github.com/ava-labs/coreth v0.15.4-rc.3.0.20251002221438-a857a64c28ea/go.mod h1:y/14LplmA0lLwIDlKiGAZ8OlxQ7OxhaU2dfkYcviLPM=
35-
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.12 h1:aMcrLbpJ/dyu2kZDf/Di/4JIWsUcYPyTDKymiHpejt0=
36-
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.12/go.mod h1:cq89ua3iiZ5wPBALTEQS5eG8DIZcs7ov6OiL4YR1BVY=
35+
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.13 h1:obPwnVCkF5+B2f8WbTepHj0ZgiW21vKUgFCtATuAYNY=
36+
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.13/go.mod h1:gsGr1ICjokI9CyPaaRHMqDoDCaT1VguC/IyOTx6rJ14=
3737
github.com/ava-labs/libevm v1.13.15-0.20251002164226-35926db4d661 h1:lt4yQE1HMvxWrdD5RFj+h9kWUsZK2rmNohvkeQsbG9M=
3838
github.com/ava-labs/libevm v1.13.15-0.20251002164226-35926db4d661/go.mod h1:ivRC/KojP8sai7j8WnpXIReQpcRklL2bIzoysnjpARQ=
3939
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=

0 commit comments

Comments
 (0)