Skip to content

Commit

Permalink
Requested changes
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Navarro Perez <[email protected]>
  • Loading branch information
ajnavarro committed Jun 5, 2023
1 parent c8268bd commit 4c85bdf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
25 changes: 20 additions & 5 deletions gno.land/cmd/gnoland/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import (
"strings"
"time"

"github.com/peterbourgon/ff/v3"
"github.com/peterbourgon/ff/v3/fftoml"

"github.com/gnolang/gno/gno.land/pkg/gnoland"
gno "github.com/gnolang/gno/gnovm/pkg/gnolang"
"github.com/gnolang/gno/tm2/pkg/amino"
Expand All @@ -33,7 +36,8 @@ type gnolandCfg struct {
chainID string
genesisRemote string
rootDir string
maxCycles int64
genesisMaxVMCycles int64
config string
}

func main() {
Expand All @@ -43,6 +47,10 @@ func main() {
commands.Metadata{
ShortUsage: "[flags] [<arg>...]",
LongHelp: "Starts the gnoland blockchain node",
Options: []ff.Option{
ff.WithConfigFileFlag("config"),
ff.WithConfigFileParser(fftoml.Parser),
},
},
cfg,
func(_ context.Context, _ []string) error {
Expand Down Expand Up @@ -108,11 +116,18 @@ func (c *gnolandCfg) RegisterFlags(fs *flag.FlagSet) {
)

fs.Int64Var(
&c.maxCycles,
"max-vm-cycles",
10*1000*1000,
&c.genesisMaxVMCycles,
"genesis-max-vm-cycles",
10_000_000,
"set maximum allowed vm cycles per operation. Zero means no limit.",
)

fs.StringVar(
&c.config,
"config",
"",
"config file (optional)",
)
}

func exec(c *gnolandCfg) error {
Expand Down Expand Up @@ -143,7 +158,7 @@ func exec(c *gnolandCfg) error {
}

// create application and node.
gnoApp, err := gnoland.NewApp(rootDir, c.skipFailingGenesisTxs, logger, c.maxCycles)
gnoApp, err := gnoland.NewApp(rootDir, c.skipFailingGenesisTxs, logger, c.genesisMaxVMCycles)
if err != nil {
return fmt.Errorf("error in creating new app: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion tm2/pkg/sdk/vm/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func setupTestEnv() testEnv {
acck := authm.NewAccountKeeper(iavlCapKey, std.ProtoBaseAccount)
bank := bankm.NewBankKeeper(acck)
stdlibsDir := filepath.Join("..", "..", "..", "..", "gnovm", "stdlibs")
vmk := NewVMKeeper(baseCapKey, iavlCapKey, acck, bank, stdlibsDir, 10*1000*1000)
vmk := NewVMKeeper(baseCapKey, iavlCapKey, acck, bank, stdlibsDir, 10_000_000)

vmk.Initialize(ms.MultiCacheWrap())

Expand Down
1 change: 1 addition & 0 deletions tm2/pkg/sdk/vm/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func NewVMKeeper(
stdlibsDir string,
maxCycles int64,
) *VMKeeper {
// TODO: create an Options struct to avoid too many constructor parameters
vmk := &VMKeeper{
baseKey: baseKey,
iavlKey: iavlKey,
Expand Down

0 comments on commit 4c85bdf

Please sign in to comment.