Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
  • Loading branch information
joshua-kim committed Jul 17, 2024
1 parent b7d2f01 commit 67df567
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
8 changes: 7 additions & 1 deletion examples/morpheusvm/tests/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,13 @@ var _ = ginkgo.BeforeSuite(func() {
genesisBytes,
nil,
[]byte(
`{"parallelism":3, "testMode":true, "logLevel":"debug"}`,
`{
"config": {
"parallelism":3,
"testMode":true,
"logLevel":"debug"
}
}`,
),
toEngine,
nil,
Expand Down
9 changes: 8 additions & 1 deletion examples/tokenvm/tests/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,14 @@ var _ = ginkgo.BeforeSuite(func() {
genesisBytes,
nil,
[]byte(
`{"parallelism":3, "testMode":true, "logLevel":"debug", "trackedPairs":["*"]}`,
`{
"config": {
"parallelism":3,
"testMode":true,
"logLevel":"debug",
"trackedPairs":["*"]
}
}`,
),
toEngine,
nil,
Expand Down
2 changes: 1 addition & 1 deletion vm/dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type Config struct {
TargetGossipDuration time.Duration `json:"targetGossipDuration"`
BlockCompactionFrequency int `json:"blockCompactionFrequency"`
// Config is defined by the Controller
Config []byte `json:"config"`
Config map[string]any `json:"config"`
}

func NewConfig() Config {
Expand Down
7 changes: 6 additions & 1 deletion vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,19 @@ func (vm *VM) Initialize(
return fmt.Errorf("failed to unmarshal config: %w", err)
}

controllerConfigBytes, err := json.Marshal(vm.config.Config)
if err != nil {
return fmt.Errorf("failed to marshal controller config: %w", err)
}

// Always initialize implementation first
vm.genesis, vm.builder, vm.gossiper, vm.handlers, vm.actionRegistry, vm.authRegistry, vm.authEngine, err = vm.c.Initialize(
vm,
controllerContext,
controllerContext.Metrics,
genesisBytes,
upgradeBytes,
vm.config.Config,
controllerConfigBytes,
)
if err != nil {
return fmt.Errorf("implementation initialization failed: %w", err)
Expand Down

0 comments on commit 67df567

Please sign in to comment.