Skip to content

Commit 4e2f7bc

Browse files
committed
Respect config values for evm & vm bridge setup
1 parent cedec03 commit 4e2f7bc

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

server/server.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ func configureBlockchain(logger *zerolog.Logger, conf *Config, store storage.Sto
422422
emulator.WithTransactionFeesEnabled(conf.TransactionFeesEnabled),
423423
emulator.WithChainID(conf.ChainID),
424424
emulator.WithContractRemovalEnabled(conf.ContractRemovalEnabled),
425+
emulator.WithSetupEVMEnabled(conf.SetupEVMEnabled),
426+
emulator.WithSetupVMBridgeEnabled(conf.SetupVMBridgeEnabled),
425427
}
426428

427429
if conf.SkipTransactionValidation {
@@ -464,20 +466,6 @@ func configureBlockchain(logger *zerolog.Logger, conf *Config, store storage.Sto
464466
)
465467
}
466468

467-
if conf.SetupEVMEnabled {
468-
options = append(
469-
options,
470-
emulator.WithSetupEVMEnabled(true),
471-
)
472-
}
473-
474-
if conf.SetupVMBridgeEnabled {
475-
options = append(
476-
options,
477-
emulator.WithSetupVMBridgeEnabled(true),
478-
)
479-
}
480-
481469
emulatedBlockchain, err := emulator.New(options...)
482470
if err != nil {
483471
return nil, err

server/server_test.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestNoPersistence(t *testing.T) {
3636
os.RemoveAll(dbPath)
3737
defer os.RemoveAll(dbPath)
3838

39-
conf := &Config{DBPath: dbPath}
39+
conf := &Config{DBPath: dbPath, SetupEVMEnabled: true, SetupVMBridgeEnabled: true}
4040
server := NewEmulatorServer(&logger, conf)
4141
defer server.Stop()
4242

@@ -53,7 +53,7 @@ func TestPersistenceWithPersistFlag(t *testing.T) {
5353
os.RemoveAll(dbPath)
5454
defer os.RemoveAll(dbPath)
5555

56-
conf := &Config{Persist: true, DBPath: dbPath}
56+
conf := &Config{Persist: true, DBPath: dbPath, SetupEVMEnabled: true, SetupVMBridgeEnabled: true}
5757
server := NewEmulatorServer(&logger, conf)
5858
defer server.Stop()
5959

@@ -70,7 +70,7 @@ func TestPersistenceWithSnapshotFlag(t *testing.T) {
7070
os.RemoveAll(dbPath)
7171
defer os.RemoveAll(dbPath)
7272

73-
conf := &Config{Snapshot: true, DBPath: dbPath}
73+
conf := &Config{Snapshot: true, DBPath: dbPath, SetupEVMEnabled: true, SetupVMBridgeEnabled: true}
7474
server := NewEmulatorServer(&logger, conf)
7575
defer server.Stop()
7676

@@ -82,7 +82,7 @@ func TestPersistenceWithSnapshotFlag(t *testing.T) {
8282
func TestExecuteScript(t *testing.T) {
8383

8484
logger := zerolog.Nop()
85-
server := NewEmulatorServer(&logger, &Config{})
85+
server := NewEmulatorServer(&logger, &Config{SetupEVMEnabled: true, SetupVMBridgeEnabled: true})
8686
go server.Start()
8787
defer server.Stop()
8888

@@ -103,7 +103,9 @@ func TestExecuteScript(t *testing.T) {
103103

104104
func TestExecuteScriptImportingContracts(t *testing.T) {
105105
conf := &Config{
106-
WithContracts: true,
106+
WithContracts: true,
107+
SetupEVMEnabled: true,
108+
SetupVMBridgeEnabled: true,
107109
}
108110

109111
logger := zerolog.Nop()
@@ -133,8 +135,10 @@ func TestExecuteScriptImportingContracts(t *testing.T) {
133135
func TestCustomChainID(t *testing.T) {
134136

135137
conf := &Config{
136-
WithContracts: true,
137-
ChainID: "flow-sandboxnet",
138+
WithContracts: true,
139+
ChainID: "flow-sandboxnet",
140+
SetupEVMEnabled: true,
141+
SetupVMBridgeEnabled: true,
138142
}
139143
logger := zerolog.Nop()
140144
server := NewEmulatorServer(&logger, conf)

0 commit comments

Comments
 (0)