Skip to content

Commit

Permalink
chore: fixup
Browse files Browse the repository at this point in the history
Signed-off-by: moul <[email protected]>
  • Loading branch information
moul committed Oct 5, 2024
1 parent b2f90b4 commit 8a444b4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
25 changes: 17 additions & 8 deletions contribs/gnodev/cmd/gnodev/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,20 @@ type devCfg struct {
webRemoteHelperAddr string

// Node Configuration
minimal bool
verbose bool
noWatch bool
noReplay bool
maxGas int64
chainId string
serverMode bool
unsafeAPI bool
minimal bool
verbose bool
noWatch bool
noReplay bool
maxGas int64
chainId string
chainDomain string
serverMode bool
unsafeAPI bool
}

var defaultDevOptions = &devCfg{
chainId: "dev",
chainDomain: "gno.land",
maxGas: 10_000_000_000,
webListenerAddr: "127.0.0.1:8888",
nodeRPCListenerAddr: "127.0.0.1:26657",
Expand Down Expand Up @@ -203,6 +205,13 @@ func (c *devCfg) RegisterFlags(fs *flag.FlagSet) {
"set node ChainID",
)

fs.StringVar(
&c.chainDomain,
"chain-domain",
defaultDevOptions.chainDomain,
"set node ChainDomain",
)

fs.BoolVar(
&c.noWatch,
"no-watch",
Expand Down
2 changes: 1 addition & 1 deletion contribs/gnodev/cmd/gnodev/setup_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func setupDevNodeConfig(
balances gnoland.Balances,
pkgspath []gnodev.PackagePath,
) *gnodev.NodeConfig {
config := gnodev.DefaultNodeConfig(cfg.root)
config := gnodev.DefaultNodeConfig(cfg.root, cfg.chainDomain)

config.Logger = logger
config.Emitter = emitter
Expand Down
6 changes: 4 additions & 2 deletions contribs/gnodev/pkg/dev/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ type NodeConfig struct {
NoReplay bool
MaxGasPerBlock int64
ChainID string
ChainDomain string
}

func DefaultNodeConfig(rootdir string) *NodeConfig {
func DefaultNodeConfig(rootdir, domain string) *NodeConfig {
tmc := gnoland.NewDefaultTMConfig(rootdir)
tmc.Consensus.SkipTimeoutCommit = false // avoid time drifting, see issue #1507
tmc.Consensus.WALDisabled = true
Expand All @@ -63,6 +64,7 @@ func DefaultNodeConfig(rootdir string) *NodeConfig {
DefaultDeployer: defaultDeployer,
BalancesList: balances,
ChainID: tmc.ChainID(),
ChainDomain: domain,
TMConfig: tmc,
SkipFailingGenesisTxs: true,
MaxGasPerBlock: 10_000_000_000,
Expand Down Expand Up @@ -468,7 +470,7 @@ func (n *Node) rebuildNode(ctx context.Context, genesis gnoland.GnoGenesisState)
}

// Setup node config
nodeConfig := newNodeConfig(n.config.TMConfig, n.config.ChainID, genesis)
nodeConfig := newNodeConfig(n.config.TMConfig, n.config.ChainID, n.config.ChainDomain, genesis)
nodeConfig.GenesisTxResultHandler = n.genesisTxResultHandler
// Speed up stdlib loading after first start (saves about 2-3 seconds on each reload).
nodeConfig.CacheStdlibLoad = true
Expand Down
6 changes: 3 additions & 3 deletions contribs/gnodev/pkg/dev/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestNewNode_NoPackages(t *testing.T) {
logger := log.NewTestingLogger(t)

// Call NewDevNode with no package should work
cfg := DefaultNodeConfig(gnoenv.RootDir())
cfg := DefaultNodeConfig(gnoenv.RootDir(), "gno.land")
cfg.Logger = logger
node, err := NewDevNode(ctx, cfg)
require.NoError(t, err)
Expand Down Expand Up @@ -62,7 +62,7 @@ func Render(_ string) string { return "foo" }
logger := log.NewTestingLogger(t)

// Call NewDevNode with no package should work
cfg := DefaultNodeConfig(gnoenv.RootDir())
cfg := DefaultNodeConfig(gnoenv.RootDir(), "gno.land")
cfg.PackagesPathList = []PackagePath{pkgpath}
cfg.Logger = logger
node, err := NewDevNode(ctx, cfg)
Expand Down Expand Up @@ -295,7 +295,7 @@ func newTestingDevNode(t *testing.T, pkgslist ...PackagePath) (*Node, *mock.Serv
emitter := &mock.ServerEmitter{}

// Call NewDevNode with no package should work
cfg := DefaultNodeConfig(gnoenv.RootDir())
cfg := DefaultNodeConfig(gnoenv.RootDir(), "gno.land")
cfg.PackagesPathList = pkgslist
cfg.Emitter = emitter
cfg.Logger = logger
Expand Down

0 comments on commit 8a444b4

Please sign in to comment.