Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 0 additions & 10 deletions server/fork_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ func TestForkingAgainstTestnet(t *testing.T) {
t.Fatalf("expected ChainID to be Testnet after fork detection, got %q", cfg.ChainID)
}

// Create an initial local block so we have a valid reference block ID in the forked store
if _, _, err := srv.Emulator().ExecuteAndCommitBlock(); err != nil {
t.Fatalf("prime local block: %v", err)
}

// Submit a minimal transaction against the forked emulator to ensure tx processing works
latest, err := srv.Emulator().GetLatestBlock()
if err != nil {
Expand Down Expand Up @@ -205,11 +200,6 @@ func TestForkingAgainstMainnet(t *testing.T) {
t.Fatalf("expected ChainID to be Mainnet after fork detection, got %q", cfg.ChainID)
}

// Create an initial local block so we have a valid reference block ID in the forked store
if _, _, err := srv.Emulator().ExecuteAndCommitBlock(); err != nil {
t.Fatalf("prime local block: %v", err)
}

// Test account key retrieval for a known mainnet account with multiple keys
// This tests the account key deduplication shim by executing a script that accesses
// keys and ensures no errors occur (successful execution proves the shim works)
Expand Down
13 changes: 13 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,19 @@ func NewEmulatorServer(logger *zerolog.Logger, conf *Config) *EmulatorServer {
return nil
}

// In fork mode, commit an initial reference block so transactions can be submitted immediately
if conf.ForkHost != "" {
block, _, err := emulatedBlockchain.ExecuteAndCommitBlock()
if err != nil {
logger.Error().Err(err).Msg("❗ Failed to commit initial reference block for fork mode")
return nil
}
logger.Info().
Uint64("blockHeight", block.Height).
Str("blockID", block.ID().String()).
Msg("📦 Committed initial reference block for fork mode")
}

chain := emulatedBlockchain.GetChain()

sc := systemcontracts.SystemContractsForChain(chain.ChainID())
Expand Down
Loading