From de63da8a78aca6b40d6c071f58b4fb308e34d170 Mon Sep 17 00:00:00 2001 From: Luke <129730838+luketheart@users.noreply.github.com> Date: Wed, 17 Jan 2024 16:44:27 +0800 Subject: [PATCH] fix: config of applyPool & queryPool (#84) --- app/app.go | 2 +- ethereum/server/config/config.go | 20 ++++++++++++++------ ethereum/server/config/toml.go | 3 ++- ethereum/server/flags/flags.go | 3 ++- ethereum/server/start.go | 3 ++- init.sh | 2 -- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/app.go b/app/app.go index 8068599d..1076e5bf 100644 --- a/app/app.go +++ b/app/app.go @@ -351,7 +351,7 @@ func NewArtela( ) // set the runner cache capacity of aspect-runtime - aspecttypes.InitRuntimePool(cast.ToInt32(appOpts.Get(srvflags.AspectPoolSize))) + aspecttypes.InitRuntimePool(cast.ToInt32(appOpts.Get(srvflags.ApplyPoolSize)), cast.ToInt32(appOpts.Get(srvflags.QueryPoolSize))) // grant capabilities for the ibc and ibc-transfer modules scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) diff --git a/ethereum/server/config/config.go b/ethereum/server/config/config.go index 3579184c..6516aff0 100644 --- a/ethereum/server/config/config.go +++ b/ethereum/server/config/config.go @@ -98,8 +98,10 @@ type EVMConfig struct { // AspectConfig defines the application configuration values for Aspect. type AspectConfig struct { - // PoolSize defines capacity of aspect runtime instance pool - PoolSize int32 + // ApplyPoolSize defines capacity of aspect runtime instance pool for applying txs + ApplyPoolSize int32 + // QueryPoolSize defines capacity of aspect runtime instance pool for querying txs + QueryPoolSize int32 } // JSONRPCConfig defines configuration for the EVM RPC server. @@ -291,14 +293,19 @@ func (c EVMConfig) Validate() error { // DefaultAspectConfig returns the default Aspect configuration func DefaultAspectConfig() *AspectConfig { return &AspectConfig{ - PoolSize: aspecttypes.DefaultAspectPoolSize, + ApplyPoolSize: aspecttypes.DefaultAspectPoolSize, + QueryPoolSize: aspecttypes.DefaultAspectPoolSize, } } // Validate returns an error if the tracer type is invalid. func (a AspectConfig) Validate() error { - if a.PoolSize < 0 { - return errors.New("Aspect pool-size cannot be negative") + if a.ApplyPoolSize < 0 { + return errors.New("Aspect apply-pool-size cannot be negative") + } + + if a.QueryPoolSize < 0 { + return errors.New("Aspect query-pool-size cannot be negative") } return nil @@ -452,7 +459,8 @@ func GetConfig(v *viper.Viper) (Config, error) { KeyPath: v.GetString("tls.key-path"), }, Aspect: AspectConfig{ - PoolSize: v.GetInt32("aspect.pool-size"), + ApplyPoolSize: v.GetInt32("aspect.apply-pool-size"), + QueryPoolSize: v.GetInt32("aspect.query-pool-size"), }, }, nil } diff --git a/ethereum/server/config/toml.go b/ethereum/server/config/toml.go index 37b72d3c..c64be474 100644 --- a/ethereum/server/config/toml.go +++ b/ethereum/server/config/toml.go @@ -96,5 +96,6 @@ key-path = "{{ .TLS.KeyPath }}" ### Aspect Configuration ### ############################################################################### [aspect] -pool-size = {{ .Aspect.PoolSize }} +apply-pool-size = {{ .Aspect.ApplyPoolSize }} +query-pool-size = {{ .Aspect.QueryPoolSize }} ` diff --git a/ethereum/server/flags/flags.go b/ethereum/server/flags/flags.go index 9dd4d790..ecf121f8 100644 --- a/ethereum/server/flags/flags.go +++ b/ethereum/server/flags/flags.go @@ -65,7 +65,8 @@ const ( // Aspect flags const ( - AspectPoolSize = "aspect.pool-size" + ApplyPoolSize = "aspect.apply-pool-size" + QueryPoolSize = "aspect.query-pool-size" ) // TLS flags diff --git a/ethereum/server/start.go b/ethereum/server/start.go index c2b42c3e..b86599f6 100644 --- a/ethereum/server/start.go +++ b/ethereum/server/start.go @@ -231,7 +231,8 @@ is performed. Note, when enabled, gRPC will also be automatically enabled. cmd.Flags().String(artelaflag.TLSCertPath, "", "the cert.pem file path for the server TLS configuration") cmd.Flags().String(artelaflag.TLSKeyPath, "", "the key.pem file path for the server TLS configuration") - cmd.Flags().Uint64(artelaflag.AspectPoolSize, aspecttypes.DefaultAspectPoolSize, "the cache pool size for runtime instances of the aspect") + cmd.Flags().Uint64(artelaflag.ApplyPoolSize, aspecttypes.DefaultAspectPoolSize, "the cache pool size for runtime instances for applying message") + cmd.Flags().Uint64(artelaflag.QueryPoolSize, aspecttypes.DefaultAspectPoolSize, "the cache pool size for runtime instances for querying message") // add support for all Tendermint-specific command line options tcmd.AddNodeFlags(cmd) diff --git a/init.sh b/init.sh index e441f340..837d4e4b 100755 --- a/init.sh +++ b/init.sh @@ -80,7 +80,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then sed -i '' 's/enabled = false/enabled = true/g' $HOME/.artelad/config/app.toml sed -i '' 's/127.0.0.1:8545/0.0.0.0:8545/g' $HOME/.artelad/config/app.toml sed -i '' 's/allow-unprotected-txs = false/allow-unprotected-txs = true/g' $HOME/.artelad/config/app.toml - sed -i '' 's/pool-size = 0/pool-size = 10/g' $HOME/.artelad/config/app.toml # set prunning options sed -i '' 's/pruning = "default"/pruning = "custom"/g' $HOME/.artelad/config/app.toml @@ -96,7 +95,6 @@ else sed -i 's/enabled = false/enabled = true/g' $HOME/.artelad/config/app.toml sed -i 's/127.0.0.1:8545/0.0.0.0:8545/g' $HOME/.artelad/config/app.toml sed -i 's/allow-unprotected-txs = false/allow-unprotected-txs = true/g' $HOME/.artelad/config/app.toml - sed -i 's/pool-size = 0/pool-size = 10/g' $HOME/.artelad/config/app.toml # set prunning options sed -i 's/pruning = "default"/pruning = "custom"/g' $HOME/.artelad/config/app.toml