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

Commit e38b660

Browse files
authored
chore: update Firewood (#1333)
1 parent bdbeea0 commit e38b660

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

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
"slices"
1012
"testing"
1113

@@ -164,6 +166,30 @@ func copyMemDB(db ethdb.Database) (ethdb.Database, error) {
164166
return newDB, nil
165167
}
166168

169+
// This copies all files from a flat directory [src] to a new temporary directory and returns
170+
// the path to the new directory.
171+
func copyFlatDir(t *testing.T, src string) string {
172+
t.Helper()
173+
if src == "" {
174+
return ""
175+
}
176+
177+
dst := t.TempDir()
178+
ents, err := os.ReadDir(src)
179+
require.NoError(t, err)
180+
181+
for _, e := range ents {
182+
require.False(t, e.IsDir(), "expected flat directory")
183+
name := e.Name()
184+
data, err := os.ReadFile(filepath.Join(src, name))
185+
require.NoError(t, err)
186+
info, err := e.Info()
187+
require.NoError(t, err)
188+
require.NoError(t, os.WriteFile(filepath.Join(dst, name), data, info.Mode().Perm()))
189+
}
190+
return dst
191+
}
192+
167193
// checkBlockChainState creates a new BlockChain instance and checks that exporting each block from
168194
// genesis to last accepted from the original instance yields the same last accepted block and state
169195
// root.
@@ -211,7 +237,8 @@ func checkBlockChainState(
211237
// Copy the database over to prevent any issues when re-using [originalDB] after this call.
212238
originalDB, err = copyMemDB(originalDB)
213239
require.NoError(err)
214-
restartedChain, err := create(originalDB, gspec, lastAcceptedBlock.Hash(), oldChainDataDir)
240+
newChainDataDir := copyFlatDir(t, oldChainDataDir)
241+
restartedChain, err := create(originalDB, gspec, lastAcceptedBlock.Hash(), newChainDataDir)
215242
require.NoError(err)
216243
defer restartedChain.Stop()
217244
currentBlock := restartedChain.CurrentBlock()

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ go 1.24.8
1717
require (
1818
github.com/VictoriaMetrics/fastcache v1.12.1
1919
github.com/ava-labs/avalanchego v1.13.6-0.20251007213349-63cc1a166a56
20-
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.12
20+
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.13
2121
github.com/ava-labs/libevm v1.13.15-0.20251002164226-35926db4d661
2222
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
2323
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
@@ -28,8 +28,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
2828
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
2929
github.com/ava-labs/avalanchego v1.13.6-0.20251007213349-63cc1a166a56 h1:Q4lnXtjMwsIheyRUkuOU7EZZ9WFf28vMWG4lPCmqhaE=
3030
github.com/ava-labs/avalanchego v1.13.6-0.20251007213349-63cc1a166a56/go.mod h1:EL0MGbL2liE9jp4QtCHR2thkNl8hCkD26DJ+7cmcaqs=
31-
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.12 h1:aMcrLbpJ/dyu2kZDf/Di/4JIWsUcYPyTDKymiHpejt0=
32-
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.12/go.mod h1:cq89ua3iiZ5wPBALTEQS5eG8DIZcs7ov6OiL4YR1BVY=
31+
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.13 h1:obPwnVCkF5+B2f8WbTepHj0ZgiW21vKUgFCtATuAYNY=
32+
github.com/ava-labs/firewood-go-ethhash/ffi v0.0.13/go.mod h1:gsGr1ICjokI9CyPaaRHMqDoDCaT1VguC/IyOTx6rJ14=
3333
github.com/ava-labs/libevm v1.13.15-0.20251002164226-35926db4d661 h1:lt4yQE1HMvxWrdD5RFj+h9kWUsZK2rmNohvkeQsbG9M=
3434
github.com/ava-labs/libevm v1.13.15-0.20251002164226-35926db4d661/go.mod h1:ivRC/KojP8sai7j8WnpXIReQpcRklL2bIzoysnjpARQ=
3535
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=

0 commit comments

Comments
 (0)