diff --git a/cmd/harmony/config_migrations.go b/cmd/harmony/config_migrations.go index b3da9ec2b..84607c2d0 100644 --- a/cmd/harmony/config_migrations.go +++ b/cmd/harmony/config_migrations.go @@ -8,7 +8,7 @@ import ( "strings" goversion "github.com/hashicorp/go-version" - "github.com/pelletier/go-toml" + "github.com/pelletier/go-toml" // TODO support go-toml/v2 "github.com/harmony-one/harmony/api/service/legacysync" harmonyconfig "github.com/harmony-one/harmony/internal/configs/harmony" @@ -357,6 +357,27 @@ func init() { return confTree } + migrations["2.5.13"] = func(confTree *toml.Tree) *toml.Tree { + if confTree.Get("TxPool.AccountQueue") == nil { + confTree.Set("TxPool.AccountQueue", defaultConfig.TxPool.AccountQueue) + } + if confTree.Get("TxPool.GlobalQueue") == nil { + confTree.Set("TxPool.GlobalQueue", defaultConfig.TxPool.GlobalQueue) + } + if confTree.Get("TxPool.Lifetime") == nil { + confTree.Set("TxPool.Lifetime", defaultConfig.TxPool.Lifetime.String()) + } + if confTree.Get("TxPool.PriceLimit") == nil { + confTree.Set("TxPool.PriceLimit", defaultConfig.TxPool.PriceLimit) + } + if confTree.Get("TxPool.PriceBump") == nil { + confTree.Set("TxPool.PriceBump", defaultConfig.TxPool.PriceBump) + } + + confTree.Set("Version", "2.5.14") + return confTree + } + // check that the latest version here is the same as in default.go largestKey := getNextVersion(migrations) if largestKey != tomlConfigVersion { diff --git a/cmd/harmony/config_migrations_test.go b/cmd/harmony/config_migrations_test.go index 72db5d790..e52c7347b 100644 --- a/cmd/harmony/config_migrations_test.go +++ b/cmd/harmony/config_migrations_test.go @@ -1,10 +1,10 @@ package main import ( - "reflect" "testing" harmonyconfig "github.com/harmony-one/harmony/internal/configs/harmony" + "github.com/stretchr/testify/require" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" ) @@ -72,6 +72,11 @@ Version = "1.0.2" [TxPool] BlacklistFile = "./.hmy/blacklist.txt" LocalAccountsFile = "./.hmy/locals.txt" + AccountQueue = 64 + GlobalQueue = 5120 + Lifetime = "30m" + PriceBump = 1 + PriceLimit = 100e9 [WS] Enabled = true @@ -142,6 +147,11 @@ Version = "1.0.3" [TxPool] BlacklistFile = "./.hmy/blacklist.txt" LocalAccountsFile = "./.hmy/locals.txt" + AccountQueue = 64 + GlobalQueue = 5120 + Lifetime = "30m" + PriceBump = 1 + PriceLimit = 100e9 [WS] Enabled = true @@ -224,6 +234,11 @@ Version = "1.0.4" [TxPool] BlacklistFile = "./.hmy/blacklist.txt" LocalAccountsFile = "./.hmy/locals.txt" + AccountQueue = 64 + GlobalQueue = 5120 + Lifetime = "30m" + PriceBump = 1 + PriceLimit = 100e9 [WS] Enabled = true @@ -314,6 +329,11 @@ Version = "1.0.4" BlacklistFile = "./.hmy/blacklist.txt" LocalAccountsFile = "./.hmy/locals.txt" AllowedTxsFile = "./.hmy/allowedtxs.txt" + AccountQueue = 64 + GlobalQueue = 5120 + Lifetime = "30m" + PriceBump = 1 + PriceLimit = 100e9 [WS] Enabled = true @@ -389,9 +409,7 @@ func Test_migrateConf(t *testing.T) { t.Errorf("migrateConf() error = %v, wantErr %v", err, tt.wantErr) return } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("migrateConf() = %+v, want %+v", got, tt.want) - } + require.Equal(t, tt.want, got) }) } } diff --git a/cmd/harmony/config_test.go b/cmd/harmony/config_test.go index 0d5879700..d19f5d985 100644 --- a/cmd/harmony/config_test.go +++ b/cmd/harmony/config_test.go @@ -9,6 +9,7 @@ import ( "testing" harmonyconfig "github.com/harmony-one/harmony/internal/configs/harmony" + "github.com/stretchr/testify/require" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" ) @@ -86,6 +87,11 @@ Version = "1.0.4" BlacklistFile = "./.hmy/blacklist.txt" LocalAccountsFile = "./.hmy/locals.txt" AllowedTxsFile = "./.hmy/allowedtxs.txt" + AccountQueue = 64 + GlobalQueue = 5120 + Lifetime = "30m" + PriceBump = 1 + PriceLimit = 100e9 [Sync] Downloader = false @@ -136,9 +142,7 @@ Version = "1.0.4" t.Errorf("Expected config version: 1.0.4, not %v", config.Version) } config.Version = defConf.Version // Shortcut for testing, value checked above - if !reflect.DeepEqual(config, defConf) { - t.Errorf("Unexpected config \n\t%+v \n\t%+v", config, defaultConfig) - } + require.Equal(t, config, defConf) } func TestPersistConfig(t *testing.T) { diff --git a/cmd/harmony/default.go b/cmd/harmony/default.go index 95e05b29c..2c15e123f 100644 --- a/cmd/harmony/default.go +++ b/cmd/harmony/default.go @@ -1,11 +1,12 @@ package main import ( + "github.com/harmony-one/harmony/core" harmonyconfig "github.com/harmony-one/harmony/internal/configs/harmony" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" ) -const tomlConfigVersion = "2.5.13" +const tomlConfigVersion = "2.5.14" const ( defNetworkType = nodeconfig.Mainnet @@ -81,9 +82,14 @@ var defaultConfig = harmonyconfig.HarmonyConfig{ BlacklistFile: "./.hmy/blacklist.txt", AllowedTxsFile: "./.hmy/allowedtxs.txt", RosettaFixFile: "", - AccountSlots: 16, + AccountSlots: core.DefaultTxPoolConfig.AccountSlots, LocalAccountsFile: "./.hmy/locals.txt", - GlobalSlots: 5120, + GlobalSlots: core.DefaultTxPoolConfig.GlobalSlots, + AccountQueue: core.DefaultTxPoolConfig.AccountQueue, + GlobalQueue: core.DefaultTxPoolConfig.GlobalQueue, + Lifetime: core.DefaultTxPoolConfig.Lifetime, + PriceLimit: harmonyconfig.PriceLimit(core.DefaultTxPoolConfig.PriceLimit), + PriceBump: core.DefaultTxPoolConfig.PriceBump, }, Sync: getDefaultSyncConfig(defNetworkType), Pprof: harmonyconfig.PprofConfig{ diff --git a/cmd/harmony/flags.go b/cmd/harmony/flags.go index 8a2799ce2..9760652e0 100644 --- a/cmd/harmony/flags.go +++ b/cmd/harmony/flags.go @@ -4,6 +4,7 @@ import ( "fmt" "strconv" "strings" + "time" harmonyconfig "github.com/harmony-one/harmony/internal/configs/harmony" @@ -139,12 +140,17 @@ var ( txPoolFlags = []cli.Flag{ tpAccountSlotsFlag, + tpGlobalSlotsFlag, + tpAccountQueueFlag, + tpGlobalQueueFlag, + tpLifetimeFlag, rosettaFixFileFlag, tpBlacklistFileFlag, legacyTPBlacklistFileFlag, localAccountsFileFlag, allowedTxsFileFlag, - tpGlobalSlotsFlag, + tpPriceLimitFlag, + tpPriceBumpFlag, } pprofFlags = []cli.Flag{ @@ -1186,6 +1192,31 @@ var ( Usage: "maximum global number of non-executable transactions in the pool", DefValue: int(defaultConfig.TxPool.GlobalSlots), } + tpAccountQueueFlag = cli.IntFlag{ + Name: "txpool.accountqueue", + Usage: "capacity of queued transactions for account in the pool", + DefValue: int(defaultConfig.TxPool.AccountQueue), + } + tpGlobalQueueFlag = cli.IntFlag{ + Name: "txpool.globalqueue", + Usage: "global capacity for queued transactions in the pool", + DefValue: int(defaultConfig.TxPool.GlobalQueue), + } + tpLifetimeFlag = cli.StringFlag{ + Name: "txpool.lifetime", + Usage: "maximum lifetime of transactions in the pool as a golang duration string", + DefValue: defaultConfig.TxPool.Lifetime.String(), + } + tpPriceLimitFlag = cli.IntFlag{ + Name: "txpool.pricelimit", + Usage: "minimum gas price to enforce for acceptance into the pool", + DefValue: int(defaultConfig.TxPool.PriceLimit), + } + tpPriceBumpFlag = cli.IntFlag{ + Name: "txpool.pricebump", + Usage: "minimum price bump to replace an already existing transaction (nonce)", + DefValue: int(defaultConfig.TxPool.PriceLimit), + } ) func applyTxPoolFlags(cmd *cobra.Command, config *harmonyconfig.HarmonyConfig) { @@ -1206,6 +1237,20 @@ func applyTxPoolFlags(cmd *cobra.Command, config *harmonyconfig.HarmonyConfig) { } config.TxPool.GlobalSlots = uint64(value) } + if cli.IsFlagChanged(cmd, tpAccountQueueFlag) { + value := cli.GetIntFlagValue(cmd, tpAccountQueueFlag) + if value <= 0 { + panic("Must provide positive value for txpool.accountqueue") + } + config.TxPool.AccountQueue = uint64(value) + } + if cli.IsFlagChanged(cmd, tpGlobalQueueFlag) { + value := cli.GetIntFlagValue(cmd, tpGlobalQueueFlag) + if value <= 0 { + panic("Must provide positive value for txpool.globalqueue") + } + config.TxPool.GlobalQueue = uint64(value) + } if cli.IsFlagChanged(cmd, tpBlacklistFileFlag) { config.TxPool.BlacklistFile = cli.GetStringFlagValue(cmd, tpBlacklistFileFlag) } else if cli.IsFlagChanged(cmd, legacyTPBlacklistFileFlag) { @@ -1217,6 +1262,27 @@ func applyTxPoolFlags(cmd *cobra.Command, config *harmonyconfig.HarmonyConfig) { if cli.IsFlagChanged(cmd, allowedTxsFileFlag) { config.TxPool.AllowedTxsFile = cli.GetStringFlagValue(cmd, allowedTxsFileFlag) } + if cli.IsFlagChanged(cmd, tpLifetimeFlag) { + value, err := time.ParseDuration(cli.GetStringFlagValue(cmd, tpLifetimeFlag)) + if err != nil { + panic(fmt.Sprintf("Invalid value for txpool.lifetime: %v", err)) + } + config.TxPool.Lifetime = value + } + if cli.IsFlagChanged(cmd, tpPriceLimitFlag) { + value := cli.GetIntFlagValue(cmd, tpPriceLimitFlag) + if value <= 0 { + panic("Must provide positive value for txpool.pricelimit") + } + config.TxPool.PriceLimit = harmonyconfig.PriceLimit(value) + } + if cli.IsFlagChanged(cmd, tpPriceBumpFlag) { + value := cli.GetIntFlagValue(cmd, tpPriceBumpFlag) + if value <= 0 { + panic("Must provide positive value for txpool.pricebump") + } + config.TxPool.PriceBump = uint64(value) + } } // pprof flags diff --git a/cmd/harmony/flags_test.go b/cmd/harmony/flags_test.go index 2015188ed..5338b9f71 100644 --- a/cmd/harmony/flags_test.go +++ b/cmd/harmony/flags_test.go @@ -5,6 +5,7 @@ import ( "reflect" "strings" "testing" + "time" harmonyconfig "github.com/harmony-one/harmony/internal/configs/harmony" @@ -118,8 +119,13 @@ func TestHarmonyFlags(t *testing.T) { AllowedTxsFile: "./.hmy/allowedtxs.txt", RosettaFixFile: "", AccountSlots: 16, - GlobalSlots: 5120, + GlobalSlots: 4096, LocalAccountsFile: "./.hmy/locals.txt", + AccountQueue: 64, + GlobalQueue: 5120, + Lifetime: 30 * time.Minute, + PriceLimit: 100e9, + PriceBump: 1, }, Pprof: harmonyconfig.PprofConfig{ Enabled: false, @@ -1005,6 +1011,11 @@ func TestTxPoolFlags(t *testing.T) { AccountSlots: defaultConfig.TxPool.AccountSlots, LocalAccountsFile: defaultConfig.TxPool.LocalAccountsFile, GlobalSlots: defaultConfig.TxPool.GlobalSlots, + AccountQueue: defaultConfig.TxPool.AccountQueue, + GlobalQueue: defaultConfig.TxPool.GlobalQueue, + Lifetime: defaultConfig.TxPool.Lifetime, + PriceLimit: 100e9, + PriceBump: 1, }, }, { @@ -1015,7 +1026,12 @@ func TestTxPoolFlags(t *testing.T) { RosettaFixFile: "rosettafix.file", AccountSlots: defaultConfig.TxPool.AccountSlots, GlobalSlots: defaultConfig.TxPool.GlobalSlots, + AccountQueue: defaultConfig.TxPool.AccountQueue, + GlobalQueue: defaultConfig.TxPool.GlobalQueue, + Lifetime: defaultConfig.TxPool.Lifetime, LocalAccountsFile: defaultConfig.TxPool.LocalAccountsFile, + PriceLimit: 100e9, + PriceBump: 1, }, }, { @@ -1026,7 +1042,12 @@ func TestTxPoolFlags(t *testing.T) { AllowedTxsFile: defaultConfig.TxPool.AllowedTxsFile, AccountSlots: defaultConfig.TxPool.AccountSlots, GlobalSlots: defaultConfig.TxPool.GlobalSlots, + AccountQueue: defaultConfig.TxPool.AccountQueue, + GlobalQueue: defaultConfig.TxPool.GlobalQueue, + Lifetime: defaultConfig.TxPool.Lifetime, LocalAccountsFile: defaultConfig.TxPool.LocalAccountsFile, + PriceLimit: 100e9, + PriceBump: 1, }, }, { @@ -1038,6 +1059,11 @@ func TestTxPoolFlags(t *testing.T) { RosettaFixFile: "rosettafix.file", LocalAccountsFile: defaultConfig.TxPool.LocalAccountsFile, GlobalSlots: defaultConfig.TxPool.GlobalSlots, + AccountQueue: defaultConfig.TxPool.AccountQueue, + GlobalQueue: defaultConfig.TxPool.GlobalQueue, + Lifetime: defaultConfig.TxPool.Lifetime, + PriceLimit: 100e9, + PriceBump: 1, }, }, { @@ -1049,6 +1075,11 @@ func TestTxPoolFlags(t *testing.T) { AccountSlots: defaultConfig.TxPool.AccountSlots, LocalAccountsFile: "locals.txt", GlobalSlots: defaultConfig.TxPool.GlobalSlots, + AccountQueue: defaultConfig.TxPool.AccountQueue, + GlobalQueue: defaultConfig.TxPool.GlobalQueue, + Lifetime: defaultConfig.TxPool.Lifetime, + PriceLimit: 100e9, + PriceBump: 1, }, }, { @@ -1060,6 +1091,27 @@ func TestTxPoolFlags(t *testing.T) { AccountSlots: defaultConfig.TxPool.AccountSlots, LocalAccountsFile: defaultConfig.TxPool.LocalAccountsFile, GlobalSlots: 10240, + AccountQueue: defaultConfig.TxPool.AccountQueue, + GlobalQueue: defaultConfig.TxPool.GlobalQueue, + Lifetime: defaultConfig.TxPool.Lifetime, + PriceLimit: 100e9, + PriceBump: 1, + }, + }, + { + args: []string{"--txpool.accountqueue", "128", "--txpool.globalqueue", "10240", "--txpool.lifetime", "15m", "--txpool.pricelimit", "100", "--txpool.pricebump", "2"}, + expConfig: harmonyconfig.TxPoolConfig{ + BlacklistFile: defaultConfig.TxPool.BlacklistFile, + AllowedTxsFile: defaultConfig.TxPool.AllowedTxsFile, + RosettaFixFile: defaultConfig.TxPool.RosettaFixFile, + AccountSlots: defaultConfig.TxPool.AccountSlots, + LocalAccountsFile: defaultConfig.TxPool.LocalAccountsFile, + GlobalSlots: defaultConfig.TxPool.GlobalSlots, + AccountQueue: 128, + GlobalQueue: 10240, + Lifetime: 15 * time.Minute, + PriceLimit: 100, + PriceBump: 2, }, }, } diff --git a/core/tx_pool.go b/core/tx_pool.go index 2efaf3be0..bd062b6f4 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -185,12 +185,12 @@ var DefaultTxPoolConfig = TxPoolConfig{ PriceLimit: 100e9, // 100 Gwei/Nano PriceBump: 1, // PriceBump is percent, 1% is enough - AccountSlots: 16, - GlobalSlots: 4096, - AccountQueue: 64, - GlobalQueue: 1024, + AccountSlots: 16, // --txpool.accountslots + GlobalSlots: 4096, // --txpool.globalslots + AccountQueue: 64, // --txpool.accountqueue + GlobalQueue: 5120, // --txpool.globalqueue - Lifetime: 30 * time.Minute, + Lifetime: 30 * time.Minute, // --txpool.lifetime Blacklist: map[common.Address]struct{}{}, AllowedTxs: map[common.Address]AllowedTxData{}, @@ -243,6 +243,27 @@ func (config *TxPoolConfig) sanitize() TxPoolConfig { Msg("Sanitizing invalid txpool global slots") conf.GlobalSlots = DefaultTxPoolConfig.GlobalSlots } + if conf.AccountQueue == 0 { + utils.Logger().Warn(). + Uint64("provided", conf.AccountQueue). + Uint64("updated", DefaultTxPoolConfig.AccountQueue). + Msg("Sanitizing invalid txpool account queue") + conf.AccountQueue = DefaultTxPoolConfig.AccountQueue + } + if conf.GlobalQueue == 0 { + utils.Logger().Warn(). + Uint64("provided", conf.GlobalQueue). + Uint64("updated", DefaultTxPoolConfig.GlobalQueue). + Msg("Sanitizing invalid txpool account queue") + conf.GlobalQueue = DefaultTxPoolConfig.GlobalQueue + } + if conf.Lifetime == 0 { + utils.Logger().Warn(). + Dur("provided", conf.Lifetime). + Dur("updated", DefaultTxPoolConfig.Lifetime). + Msg("Sanitizing invalid txpool lifetime") + conf.Lifetime = DefaultTxPoolConfig.Lifetime + } return conf } diff --git a/go.sum b/go.sum index 2ebb5e94a..46f3d441b 100644 --- a/go.sum +++ b/go.sum @@ -774,6 +774,8 @@ github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtP github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= diff --git a/internal/configs/harmony/harmony.go b/internal/configs/harmony/harmony.go index d4e8df4b0..32161d1de 100644 --- a/internal/configs/harmony/harmony.go +++ b/internal/configs/harmony/harmony.go @@ -1,6 +1,7 @@ package harmony import ( + "fmt" "reflect" "strings" "time" @@ -181,8 +182,13 @@ type TxPoolConfig struct { AllowedTxsFile string RosettaFixFile string AccountSlots uint64 + AccountQueue uint64 + GlobalQueue uint64 LocalAccountsFile string GlobalSlots uint64 + Lifetime time.Duration + PriceLimit PriceLimit + PriceBump uint64 } type PprofConfig struct { @@ -318,3 +324,26 @@ type StagedSyncConfig struct { UseMemDB bool // it uses memory by default. set it to false to use disk LogProgress bool // log the full sync progress in console } + +type PriceLimit int64 + +func (s *PriceLimit) UnmarshalTOML(data interface{}) error { + switch v := data.(type) { + case float64: + *s = PriceLimit(v) + case int64: + *s = PriceLimit(v) + case PriceLimit: + *s = v + default: + return fmt.Errorf("PriceLimit.UnmarshalTOML: %T", data) + } + return nil +} + +func (s PriceLimit) MarshalTOML() ([]byte, error) { + if s > 1_000_000_000 { + return []byte(fmt.Sprintf("%de9", s/1_000_000_000)), nil + } + return []byte(fmt.Sprintf("%d", s)), nil +} diff --git a/internal/configs/harmony/harmony_test.go b/internal/configs/harmony/harmony_test.go index fef7cac9d..f51e2ef2f 100644 --- a/internal/configs/harmony/harmony_test.go +++ b/internal/configs/harmony/harmony_test.go @@ -6,7 +6,9 @@ import ( "time" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" + "github.com/pelletier/go-toml" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestToRPCServerConfig(t *testing.T) { @@ -79,3 +81,38 @@ func TestToRPCServerConfig(t *testing.T) { }) } } + +var data = `big = 100e9 +small = 100 +zero = 0 +` + +func TestPriceLimit_UnmarshalTOML(t *testing.T) { + type V struct { + Big PriceLimit `toml:"big"` + Small PriceLimit `toml:"small"` + Zero PriceLimit `toml:"zero"` + } + var v V + require.NoError(t, toml.Unmarshal([]byte(data), &v)) + + require.Equal(t, PriceLimit(100e9), v.Big) + require.Equal(t, PriceLimit(100), v.Small) + require.Equal(t, PriceLimit(0), v.Zero) +} + +func TestPriceLimit_MarshalTOML(t *testing.T) { + type V struct { + Big PriceLimit `toml:"big"` + Small PriceLimit `toml:"small"` + Zero PriceLimit `toml:"zero"` + } + v := V{ + Big: PriceLimit(100e9), + Small: PriceLimit(100), + Zero: PriceLimit(0), + } + e, err := toml.Marshal(v) + require.NoError(t, err) + require.Equal(t, data, string(e)) +} diff --git a/node/node.go b/node/node.go index 13988e2ad..b41163ac4 100644 --- a/node/node.go +++ b/node/node.go @@ -1084,15 +1084,20 @@ func New( node.BeaconBlockChannel = make(chan *types.Block) txPoolConfig := core.DefaultTxPoolConfig - // Temporarily not updating other networks to make the rpc tests pass - if node.NodeConfig.GetNetworkType() != nodeconfig.Mainnet && node.NodeConfig.GetNetworkType() != nodeconfig.Testnet { - txPoolConfig.PriceLimit = 1e9 - txPoolConfig.PriceBump = 10 - } if harmonyconfig != nil { txPoolConfig.AccountSlots = harmonyconfig.TxPool.AccountSlots txPoolConfig.GlobalSlots = harmonyconfig.TxPool.GlobalSlots txPoolConfig.Locals = append(txPoolConfig.Locals, localAccounts...) + txPoolConfig.AccountQueue = harmonyconfig.TxPool.AccountQueue + txPoolConfig.GlobalQueue = harmonyconfig.TxPool.GlobalQueue + txPoolConfig.Lifetime = harmonyconfig.TxPool.Lifetime + txPoolConfig.PriceLimit = uint64(harmonyconfig.TxPool.PriceLimit) + txPoolConfig.PriceBump = harmonyconfig.TxPool.PriceBump + } + // Temporarily not updating other networks to make the rpc tests pass + if node.NodeConfig.GetNetworkType() != nodeconfig.Mainnet && node.NodeConfig.GetNetworkType() != nodeconfig.Testnet { + txPoolConfig.PriceLimit = 1e9 + txPoolConfig.PriceBump = 10 } txPoolConfig.Blacklist = blacklist diff --git a/rosetta/infra/harmony-mainnet.conf b/rosetta/infra/harmony-mainnet.conf index 8d51609cb..6deea2294 100644 --- a/rosetta/infra/harmony-mainnet.conf +++ b/rosetta/infra/harmony-mainnet.conf @@ -133,6 +133,12 @@ Version = "2.5.13" GlobalSlots = 5120 LocalAccountsFile = "./.hmy/locals.txt" RosettaFixFile = "./rosetta_local_fix.csv" + GlobalSlots = 4096 + GlobalQueue = 5120 + AccountQueue = 64 + Lifetime = "30m" + PriceBump = 1 + PriceLimit = 100e9 [WS] AuthPort = 9801 diff --git a/rosetta/infra/harmony-pstn.conf b/rosetta/infra/harmony-pstn.conf index 1bb865c1a..49dbe01c1 100644 --- a/rosetta/infra/harmony-pstn.conf +++ b/rosetta/infra/harmony-pstn.conf @@ -133,6 +133,12 @@ Version = "2.5.13" GlobalSlots = 5120 LocalAccountsFile = "./.hmy/locals.txt" RosettaFixFile = "" + GlobalSlots = 4096 + GlobalQueue = 5120 + AccountQueue = 64 + Lifetime = "30m" + PriceBump = 1 + PriceLimit = 100e9 [WS] AuthPort = 9801