Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bc26c83
new atomic pkg
ceyonur Dec 11, 2024
fe45c37
Merge branch 'master' into move-atomic-txs
ceyonur Dec 11, 2024
9c3e284
bump avago
ceyonur Dec 11, 2024
ddbbab7
bump versions
ceyonur Dec 11, 2024
0ecd789
move attomic gossip
ceyonur Dec 13, 2024
019bb04
lint
ceyonur Dec 14, 2024
aa50ce6
change newimport clk to time
ceyonur Dec 15, 2024
52081a9
move utils
ceyonur Dec 15, 2024
d93257b
remove extra heaps files
ceyonur Dec 15, 2024
0b10cc4
move database to own pkg
ceyonur Dec 15, 2024
8eb3056
move atomic trie/state/backend to separaet pkg
ceyonur Dec 18, 2024
397c535
Merge branch 'seperate-atomic-pkg-base' into move-atomic-txs
ceyonur Dec 23, 2024
2b13c8e
bump avago
ceyonur Dec 23, 2024
2798ad6
go mod tidy
ceyonur Dec 23, 2024
6bf2ff2
Merge branch 'move-atomic-txs' into move-atomic-gossip
ceyonur Dec 23, 2024
278e055
update releases md
ceyonur Dec 23, 2024
e5f2c27
use address methods from avago
ceyonur Dec 24, 2024
71babe6
bump avago
ceyonur Dec 24, 2024
aab47b6
bump e2e avago version
ceyonur Dec 24, 2024
b9b67bc
Merge branch 'move-atomic-txs' into move-atomic-gossip
ceyonur Dec 24, 2024
6f1adc8
Update plugin/evm/atomic/gossip_test.go
ceyonur Dec 24, 2024
876716f
Update plugin/evm/atomic/mempool.go
ceyonur Dec 24, 2024
682e4bc
Update plugin/evm/config/config.go
ceyonur Dec 24, 2024
38ad868
Update plugin/evm/atomic/tx_heap.go
ceyonur Dec 24, 2024
de328e9
Update plugin/evm/config/config.go
ceyonur Dec 24, 2024
55c0be9
fix reviews
ceyonur Dec 24, 2024
3ac1a1a
Merge branch 'move-atomic-gossip' of github.com:ava-labs/coreth into …
ceyonur Dec 24, 2024
9c148ff
Merge branch 'move-atomic-gossip' into move-atomic-state
ceyonur Dec 29, 2024
803e50a
fix linter
ceyonur Dec 29, 2024
0b40185
nits
ceyonur Dec 29, 2024
2f1dbc5
Update plugin/evm/vm_test.go
ceyonur Jan 3, 2025
936bb59
Update plugin/evm/syncervm_test.go
ceyonur Jan 3, 2025
4019a34
review fix
ceyonur Jan 3, 2025
266a55f
Merge branch 'move-atomic-state' of github.com:ava-labs/coreth into m…
ceyonur Jan 3, 2025
1958ee8
Merge branch 'seperate-atomic-pkg-base' into move-atomic-state
ceyonur Jan 6, 2025
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 plugin/evm/atomic/atomic_syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func testAtomicSyncer(t *testing.T, serverTrieDB *triedb.Database, targetHeight
if err != nil {
t.Fatal("could not initialize atomix tx repository", err)
}
atomicBackend, err := NewAtomicBackend(clientDB, utils.TestSharedMemory(), nil, repo, 0, common.Hash{}, commitInterval)
atomicBackend, err := NewAtomicBackend(clientDB, utils.TestSnowContext().SharedMemory, nil, repo, 0, common.Hash{}, commitInterval)
if err != nil {
t.Fatal("could not initialize atomic backend", err)
}
Expand Down
10 changes: 5 additions & 5 deletions plugin/evm/atomic/atomic_trie_iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
func TestIteratorCanIterate(t *testing.T) {
lastAcceptedHeight := uint64(1000)
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec
repo, err := NewAtomicTxRepository(db, codec, lastAcceptedHeight)
assert.NoError(t, err)

Expand All @@ -32,7 +32,7 @@ func TestIteratorCanIterate(t *testing.T) {

// create an atomic trie
// on create it will initialize all the transactions from the above atomic repository
atomicBackend, err := NewAtomicBackend(db, utils.TestSharedMemory(), nil, repo, lastAcceptedHeight, common.Hash{}, 100)
atomicBackend, err := NewAtomicBackend(db, utils.TestSnowContext().SharedMemory, nil, repo, lastAcceptedHeight, common.Hash{}, 100)
assert.NoError(t, err)
atomicTrie1 := atomicBackend.AtomicTrie()

Expand All @@ -45,7 +45,7 @@ func TestIteratorCanIterate(t *testing.T) {

// iterate on a new atomic trie to make sure there is no resident state affecting the data and the
// iterator
atomicBackend2, err := NewAtomicBackend(db, utils.TestSharedMemory(), nil, repo, lastAcceptedHeight, common.Hash{}, 100)
atomicBackend2, err := NewAtomicBackend(db, utils.TestSnowContext().SharedMemory, nil, repo, lastAcceptedHeight, common.Hash{}, 100)
assert.NoError(t, err)
atomicTrie2 := atomicBackend2.AtomicTrie()
lastCommittedHash2, lastCommittedHeight2 := atomicTrie2.LastCommitted()
Expand All @@ -60,7 +60,7 @@ func TestIteratorHandlesInvalidData(t *testing.T) {
require := require.New(t)
lastAcceptedHeight := uint64(1000)
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec
repo, err := NewAtomicTxRepository(db, codec, lastAcceptedHeight)
require.NoError(err)

Expand All @@ -73,7 +73,7 @@ func TestIteratorHandlesInvalidData(t *testing.T) {
// create an atomic trie
// on create it will initialize all the transactions from the above atomic repository
commitInterval := uint64(100)
atomicBackend, err := NewAtomicBackend(db, utils.TestSharedMemory(), nil, repo, lastAcceptedHeight, common.Hash{}, commitInterval)
atomicBackend, err := NewAtomicBackend(db, utils.TestSnowContext().SharedMemory, nil, repo, lastAcceptedHeight, common.Hash{}, commitInterval)
require.NoError(err)
atomicTrie := atomicBackend.AtomicTrie()

Expand Down
40 changes: 20 additions & 20 deletions plugin/evm/atomic/atomic_trie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestAtomicTrieInitialize(t *testing.T) {
} {
t.Run(name, func(t *testing.T) {
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec
repo, err := NewAtomicTxRepository(db, codec, test.lastAcceptedHeight)
if err != nil {
t.Fatal(err)
Expand All @@ -140,7 +140,7 @@ func TestAtomicTrieInitialize(t *testing.T) {
writeTxs(t, repo, 1, test.lastAcceptedHeight+1, test.numTxsPerBlock, nil, operationsMap)

// Construct the atomic trie for the first time
atomicBackend1, err := NewAtomicBackend(db, utils.TestSharedMemory(), nil, repo, test.lastAcceptedHeight, common.Hash{}, test.commitInterval)
atomicBackend1, err := NewAtomicBackend(db, utils.TestSnowContext().SharedMemory, nil, repo, test.lastAcceptedHeight, common.Hash{}, test.commitInterval)
if err != nil {
t.Fatal(err)
}
Expand All @@ -156,7 +156,7 @@ func TestAtomicTrieInitialize(t *testing.T) {
verifyOperations(t, atomicTrie1, codec, rootHash1, 1, test.expectedCommitHeight, operationsMap)

// Construct the atomic trie again (on the same database) and ensure the last accepted root is correct.
atomicBackend2, err := NewAtomicBackend(db, utils.TestSharedMemory(), nil, repo, test.lastAcceptedHeight, common.Hash{}, test.commitInterval)
atomicBackend2, err := NewAtomicBackend(db, utils.TestSnowContext().SharedMemory, nil, repo, test.lastAcceptedHeight, common.Hash{}, test.commitInterval)
if err != nil {
t.Fatal(err)
}
Expand All @@ -165,7 +165,7 @@ func TestAtomicTrieInitialize(t *testing.T) {

// Construct the atomic trie again (on an empty database) and ensure that it produces the same hash.
atomicBackend3, err := NewAtomicBackend(
versiondb.New(memdb.New()), utils.TestSharedMemory(), nil, repo, test.lastAcceptedHeight, common.Hash{}, test.commitInterval,
versiondb.New(memdb.New()), utils.TestSnowContext().SharedMemory, nil, repo, test.lastAcceptedHeight, common.Hash{}, test.commitInterval,
)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -203,7 +203,7 @@ func TestAtomicTrieInitialize(t *testing.T) {

// Generate a new atomic trie to compare the root against.
atomicBackend4, err := NewAtomicBackend(
versiondb.New(memdb.New()), utils.TestSharedMemory(), nil, repo, nextCommitHeight, common.Hash{}, test.commitInterval,
versiondb.New(memdb.New()), utils.TestSnowContext().SharedMemory, nil, repo, nextCommitHeight, common.Hash{}, test.commitInterval,
)
if err != nil {
t.Fatal(err)
Expand All @@ -220,14 +220,14 @@ func TestAtomicTrieInitialize(t *testing.T) {
func TestIndexerInitializesOnlyOnce(t *testing.T) {
lastAcceptedHeight := uint64(25)
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec
repo, err := NewAtomicTxRepository(db, codec, lastAcceptedHeight)
assert.NoError(t, err)
operationsMap := make(map[uint64]map[ids.ID]*avalancheatomic.Requests)
writeTxs(t, repo, 1, lastAcceptedHeight+1, constTxsPerHeight(2), nil, operationsMap)

// Initialize atomic repository
atomicBackend, err := NewAtomicBackend(db, utils.TestSharedMemory(), nil, repo, lastAcceptedHeight, common.Hash{}, 10 /* commitInterval*/)
atomicBackend, err := NewAtomicBackend(db, utils.TestSnowContext().SharedMemory, nil, repo, lastAcceptedHeight, common.Hash{}, 10 /* commitInterval*/)
assert.NoError(t, err)
atomicTrie := atomicBackend.AtomicTrie()

Expand All @@ -243,7 +243,7 @@ func TestIndexerInitializesOnlyOnce(t *testing.T) {
assert.NoError(t, err)

// Re-initialize the atomic trie
atomicBackend, err = NewAtomicBackend(db, utils.TestSharedMemory(), nil, repo, lastAcceptedHeight, common.Hash{}, 10 /* commitInterval */)
atomicBackend, err = NewAtomicBackend(db, utils.TestSnowContext().SharedMemory, nil, repo, lastAcceptedHeight, common.Hash{}, 10 /* commitInterval */)
assert.NoError(t, err)
atomicTrie = atomicBackend.AtomicTrie()

Expand All @@ -254,11 +254,11 @@ func TestIndexerInitializesOnlyOnce(t *testing.T) {

func newTestAtomicTrie(t *testing.T) AtomicTrie {
db := versiondb.New(memdb.New())
repo, err := NewAtomicTxRepository(db, TestTxCodec, 0)
repo, err := NewAtomicTxRepository(db, testTxCodec, 0)
if err != nil {
t.Fatal(err)
}
atomicBackend, err := NewAtomicBackend(db, utils.TestSharedMemory(), nil, repo, 0, common.Hash{}, testCommitInterval)
atomicBackend, err := NewAtomicBackend(db, utils.TestSnowContext().SharedMemory, nil, repo, 0, common.Hash{}, testCommitInterval)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -332,7 +332,7 @@ func TestAtomicTrieDoesNotSkipBonusBlocks(t *testing.T) {
commitInterval := uint64(10)
expectedCommitHeight := uint64(100)
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec
repo, err := NewAtomicTxRepository(db, codec, lastAcceptedHeight)
if err != nil {
t.Fatal(err)
Expand All @@ -346,7 +346,7 @@ func TestAtomicTrieDoesNotSkipBonusBlocks(t *testing.T) {
14: {},
}
// Construct the atomic trie for the first time
atomicBackend, err := NewAtomicBackend(db, utils.TestSharedMemory(), bonusBlocks, repo, lastAcceptedHeight, common.Hash{}, commitInterval)
atomicBackend, err := NewAtomicBackend(db, utils.TestSnowContext().SharedMemory, bonusBlocks, repo, lastAcceptedHeight, common.Hash{}, commitInterval)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -453,7 +453,7 @@ func TestApplyToSharedMemory(t *testing.T) {
} {
t.Run(name, func(t *testing.T) {
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec
repo, err := NewAtomicTxRepository(db, codec, test.lastAcceptedHeight)
assert.NoError(t, err)
operationsMap := make(map[uint64]map[ids.ID]*avalancheatomic.Requests)
Expand Down Expand Up @@ -519,7 +519,7 @@ func TestApplyToSharedMemory(t *testing.T) {

func BenchmarkAtomicTrieInit(b *testing.B) {
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec

operationsMap := make(map[uint64]map[ids.ID]*avalancheatomic.Requests)

Expand All @@ -537,7 +537,7 @@ func BenchmarkAtomicTrieInit(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
sharedMemory := utils.TestSharedMemory()
sharedMemory := utils.TestSnowContext().SharedMemory
atomicBackend, err := NewAtomicBackend(db, sharedMemory, nil, repo, lastAcceptedHeight, common.Hash{}, 5000)
assert.NoError(b, err)
atomicTrie = atomicBackend.AtomicTrie()
Expand All @@ -554,7 +554,7 @@ func BenchmarkAtomicTrieInit(b *testing.B) {

func BenchmarkAtomicTrieIterate(b *testing.B) {
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec

operationsMap := make(map[uint64]map[ids.ID]*avalancheatomic.Requests)

Expand All @@ -564,7 +564,7 @@ func BenchmarkAtomicTrieIterate(b *testing.B) {
assert.NoError(b, err)
writeTxs(b, repo, 1, lastAcceptedHeight, constTxsPerHeight(3), nil, operationsMap)

atomicBackend, err := NewAtomicBackend(db, utils.TestSharedMemory(), nil, repo, lastAcceptedHeight, common.Hash{}, 5000)
atomicBackend, err := NewAtomicBackend(db, utils.TestSnowContext().SharedMemory, nil, repo, lastAcceptedHeight, common.Hash{}, 5000)
assert.NoError(b, err)
atomicTrie := atomicBackend.AtomicTrie()

Expand Down Expand Up @@ -633,8 +633,8 @@ func BenchmarkApplyToSharedMemory(b *testing.B) {

func benchmarkApplyToSharedMemory(b *testing.B, disk database.Database, blocks uint64) {
db := versiondb.New(disk)
codec := TestTxCodec
sharedMemory := utils.TestSharedMemory()
codec := testTxCodec
sharedMemory := utils.TestSnowContext().SharedMemory

lastAcceptedHeight := blocks
repo, err := NewAtomicTxRepository(db, codec, lastAcceptedHeight)
Expand All @@ -659,7 +659,7 @@ func benchmarkApplyToSharedMemory(b *testing.B, disk database.Database, blocks u
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
backend.(*atomicBackend).sharedMemory = utils.TestSharedMemory()
backend.(*atomicBackend).sharedMemory = utils.TestSnowContext().SharedMemory
assert.NoError(b, backend.MarkApplyToSharedMemoryCursor(0))
assert.NoError(b, db.Commit())
assert.NoError(b, backend.ApplyToSharedMemory(lastAcceptedHeight))
Expand Down
10 changes: 5 additions & 5 deletions plugin/evm/atomic/atomic_tx_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func verifyOperations(t testing.TB, atomicTrie AtomicTrie, codec codec.Manager,

func TestAtomicRepositoryReadWriteSingleTx(t *testing.T) {
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec
repo, err := NewAtomicTxRepository(db, codec, 0)
if err != nil {
t.Fatal(err)
Expand All @@ -195,7 +195,7 @@ func TestAtomicRepositoryReadWriteSingleTx(t *testing.T) {

func TestAtomicRepositoryReadWriteMultipleTxs(t *testing.T) {
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec
repo, err := NewAtomicTxRepository(db, codec, 0)
if err != nil {
t.Fatal(err)
Expand All @@ -208,7 +208,7 @@ func TestAtomicRepositoryReadWriteMultipleTxs(t *testing.T) {

func TestAtomicRepositoryPreAP5Migration(t *testing.T) {
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec

acceptedAtomicTxDB := prefixdb.New(atomicTxIDDBPrefix, db)
txMap := make(map[uint64][]*Tx)
Expand All @@ -233,7 +233,7 @@ func TestAtomicRepositoryPreAP5Migration(t *testing.T) {

func TestAtomicRepositoryPostAP5Migration(t *testing.T) {
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec

acceptedAtomicTxDB := prefixdb.New(atomicTxIDDBPrefix, db)
txMap := make(map[uint64][]*Tx)
Expand All @@ -258,7 +258,7 @@ func TestAtomicRepositoryPostAP5Migration(t *testing.T) {

func benchAtomicRepositoryIndex10_000(b *testing.B, maxHeight uint64, txsPerHeight int) {
db := versiondb.New(memdb.New())
codec := TestTxCodec
codec := testTxCodec

acceptedAtomicTxDB := prefixdb.New(atomicTxIDDBPrefix, db)
txMap := make(map[uint64][]*Tx)
Expand Down
2 changes: 1 addition & 1 deletion plugin/evm/atomic/test_shared_memories.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (s *SharedMemories) assertOpsNotApplied(t *testing.T, ops map[ids.ID]*atomi
}
}

// TODO: once tetsts are moved to atomic package, unexport this function
// TODO: once tests are moved to atomic package, unexport this function
func NewSharedMemories(atomicMemory *atomic.Memory, thisChainID, peerChainID ids.ID) *SharedMemories {
return &SharedMemories{
thisChain: atomicMemory.NewSharedMemory(thisChainID),
Expand Down
6 changes: 3 additions & 3 deletions plugin/evm/atomic/test_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ import (
"github.com/ava-labs/coreth/params"
)

var TestTxCodec codec.Manager
var testTxCodec codec.Manager

func init() {
TestTxCodec = codec.NewDefaultManager()
testTxCodec = codec.NewDefaultManager()
c := linearcodec.NewDefault()

errs := wrappers.Errs{}
errs.Add(
c.RegisterType(&TestUnsignedTx{}),
TestTxCodec.RegisterCodec(atomic.CodecVersion, c),
testTxCodec.RegisterCodec(atomic.CodecVersion, c),
)

if errs.Errored() {
Expand Down
2 changes: 1 addition & 1 deletion plugin/evm/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (b *Block) Accept(context.Context) error {
return fmt.Errorf("chain could not accept %s: %w", b.ID(), err)
}

if err := vm.PutLastAcceptedID(b.id[:]); err != nil {
if err := vm.PutLastAcceptedID(b.id); err != nil {
return fmt.Errorf("failed to put %s as the last accepted block: %w", b.ID(), err)
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/evm/export_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ func TestExportTxVerify(t *testing.T) {
{
Address: testEthAddrs[0],
Amount: 0,
AssetID: utils.TestAvaxAssetID,
AssetID: ctx.AVAXAssetID,
Nonce: 0,
},
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/evm/import_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func TestImportTxVerify(t *testing.T) {
{
Address: testEthAddrs[0],
Amount: 0,
AssetID: utils.TestAvaxAssetID,
AssetID: ctx.AVAXAssetID,
},
}
return &tx
Expand Down
12 changes: 8 additions & 4 deletions plugin/evm/syncervm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/ethereum/go-ethereum/log"
)

// State sync fetches [StateSyncParentsToFetch] parents of the block it syncs to.
// StateSyncParentsToFetch is the number of the block parents the state syncs to.
// The last 256 block hashes are necessary to support the BLOCKHASH opcode.
const StateSyncParentsToFetch = 256

Expand All @@ -40,14 +40,14 @@ var (
)

type BlockAcceptor interface {
PutLastAcceptedID([]byte) error
PutLastAcceptedID(ids.ID) error
}

type EthBlockWrapper interface {
GetEthBlock() *types.Block
}

// StateSyncClientConfig defines the options and dependencies needed to construct a StateSyncerClient
// StateSyncClientConfig defines the options and dependencies needed to construct a StateSyncClient
type StateSyncClientConfig struct {
Enabled bool
SkipResume bool
Expand Down Expand Up @@ -407,7 +407,11 @@ func (client *stateSyncerClient) updateVMMarkers() error {
return err
}
client.AtomicBackend.SetLastAccepted(client.syncSummary.BlockHash)
if err := client.Acceptor.PutLastAcceptedID(client.syncSummary.BlockHash.Bytes()); err != nil {
id, err := ids.ToID(client.syncSummary.BlockHash.Bytes())
if err != nil {
return err
}
if err := client.Acceptor.PutLastAcceptedID(id); err != nil {
return err
}
if err := client.metadataDB.Delete(stateSyncSummaryKey); err != nil {
Expand Down
8 changes: 5 additions & 3 deletions plugin/evm/syncervm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ func createSyncServerAndClientVMs(t *testing.T, test syncTest, numBlocks int) *s
testShortIDAddrs[0]: importAmount,
}
)

// override serverAtomicTrie's commitInterval so the call to [serverAtomicTrie.Index]
// creates a commit at the height [syncableInterval]. This is necessary to support
// fetching a state summary.
config := fmt.Sprintf(`{"commit-interval": %d}`, test.syncableInterval)
_, serverVM, _, serverAtomicMemory, serverAppSender := GenesisVMWithUTXOs(
t, true, "", config, "", alloc,
Expand Down Expand Up @@ -330,9 +334,6 @@ func createSyncServerAndClientVMs(t *testing.T, test syncTest, numBlocks int) *s
}
}, nil)

// override serverAtomicTrie's commitInterval so the call to [serverAtomicTrie.Index]
// creates a commit at the height [syncableInterval]. This is necessary to support
// fetching a state summary.
serverAtomicTrie := serverVM.atomicTrie
require.True(serverAtomicTrie.AcceptTrie(test.syncableInterval, serverAtomicTrie.LastAcceptedRoot()))
require.NoError(serverVM.db.Commit())
Expand Down Expand Up @@ -364,6 +365,7 @@ func createSyncServerAndClientVMs(t *testing.T, test syncTest, numBlocks int) *s
serverVM.StateSyncServer.(*stateSyncServer).syncableInterval = test.syncableInterval

// initialise [syncerVM] with blank genesis state
// we also override [syncerVM]'s commit interval so the atomic trie works correctly.
stateSyncEnabledJSON := fmt.Sprintf(`{"state-sync-enabled":true, "state-sync-min-blocks": %d, "tx-lookup-limit": %d, "commit-interval": %d}`, test.stateSyncMinBlocks, 4, test.syncableInterval)
syncerEngineChan, syncerVM, syncerDB, syncerAtomicMemory, syncerAppSender := GenesisVMWithUTXOs(
t, false, "", stateSyncEnabledJSON, "", alloc,
Expand Down
4 changes: 2 additions & 2 deletions plugin/evm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,6 @@ func (vm *VM) newExportTx(
return tx, nil
}

func (vm *VM) PutLastAcceptedID(ID []byte) error {
return vm.acceptedBlockDB.Put(lastAcceptedKey, ID)
func (vm *VM) PutLastAcceptedID(ID ids.ID) error {
return vm.acceptedBlockDB.Put(lastAcceptedKey, ID[:])
}
Loading
Loading