From a578d7e090f223c52a5b1417d82139761e158133 Mon Sep 17 00:00:00 2001 From: Valentin Staykov Date: Fri, 4 Oct 2024 09:11:20 +0000 Subject: [PATCH 1/2] refactor: remove unused flag --- README.md | 4 ---- cmd/cdk-erigon/main.go | 10 ++++++++-- cmd/utils/flags.go | 5 ----- hermezconfig-bali.yaml.example | 1 - hermezconfig-cardona.yaml.example | 1 - hermezconfig-dev.yaml.example | 1 - hermezconfig-estest-syncer.yaml.example | 1 - hermezconfig-mainnet-shadowfork.yaml.example | 1 - hermezconfig-mainnet.yaml.example | 1 - turbo/cli/default_flags.go | 1 - turbo/cli/flags_zkevm.go | 5 ++--- xlayerconfig-mainnet.yaml.example | 1 - xlayerconfig-testnet.yaml.example | 1 - zk/tests/nightly-l1-recovery/network5-config.yaml | 1 - zk/tests/nightly-l1-recovery/network5-sync-config.yaml | 1 - zk/tests/nightly-l1-recovery/network8-config.yaml | 1 - zk/tests/nightly-l1-recovery/network8-sync-config.yaml | 1 - zk/tests/unwinds/config/dynamic-integration8.yaml | 1 - 18 files changed, 10 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 55b567116ab..1e593d467ed 100644 --- a/README.md +++ b/README.md @@ -132,9 +132,6 @@ Initial SMT build performance can be increased if machine has enough RAM: ## Configuration Files Config files are the easiest way to configure cdk-erigon, there are examples in the repository for each network e.g. `hermezconfig-mainnet.yaml.example`. - -Depending on the RPC provider you are using, you may wish to alter `zkevm.rpc-ratelimit`. - *** ## Running CDK-Erigon @@ -193,7 +190,6 @@ For a full explanation of the config options, see below: - `zkevm.address-zkevm`: The address for the zkevm contract - `zkevm.address-rollup`: The address for the rollup contract - `zkevm.address-ger-manager`: The address for the GER manager contract -- `zkevm.rpc-ratelimit`: Rate limit for RPC calls. - `zkevm.data-stream-port`: Port for the data stream. This needs to be set to enable the datastream server - `zkevm.data-stream-host`: The host for the data stream i.e. `localhost`. This must be set to enable the datastream server - `zkevm.datastream-version:` Version of the data stream protocol. diff --git a/cmd/cdk-erigon/main.go b/cmd/cdk-erigon/main.go index 6598464dea1..d8422b8faef 100644 --- a/cmd/cdk-erigon/main.go +++ b/cmd/cdk-erigon/main.go @@ -111,14 +111,20 @@ func setFlagsFromConfigFile(ctx *cli.Context, filePath string) error { } if err := ctx.Set(key, strings.Join(s, ",")); err != nil { if deprecatedFlag, found := erigoncli.DeprecatedFlags[key]; found { - return fmt.Errorf("failed setting %s flag Flag is deprecated, use %s instead", key, deprecatedFlag) + if deprecatedFlag == "" { + return fmt.Errorf("failed setting %s flag it is deprecated, remove it", key) + } + return fmt.Errorf("failed setting %s flag it is deprecated, use %s instead", key, deprecatedFlag) } return fmt.Errorf("failed setting %s flag with values=%s error=%s", key, s, err) } } else { if err := ctx.Set(key, fmt.Sprintf("%v", value)); err != nil { if deprecatedFlag, found := erigoncli.DeprecatedFlags[key]; found { - return fmt.Errorf("failed setting %s flag Flag is deprecated, use %s instead", key, deprecatedFlag) + if deprecatedFlag == "" { + return fmt.Errorf("failed setting %s flag it is deprecated, remove it", key) + } + return fmt.Errorf("failed setting %s flag it is deprecated, use %s instead", key, deprecatedFlag) } return fmt.Errorf("failed setting %s flag with value=%v error=%s", key, value, err) } diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 021553ec9fa..4a8250147b7 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -552,11 +552,6 @@ var ( Usage: "The maximum number of concurrent requests to the executor", Value: 1, } - RpcRateLimitsFlag = cli.IntFlag{ - Name: "zkevm.rpc-ratelimit", - Usage: "RPC rate limit in requests per second.", - Value: 0, - } RpcGetBatchWitnessConcurrencyLimitFlag = cli.IntFlag{ Name: "zkevm.rpc-get-batch-witness-concurrency-limit", Usage: "The maximum number of concurrent requests to the executor for getBatchWitness.", diff --git a/hermezconfig-bali.yaml.example b/hermezconfig-bali.yaml.example index 84ecf06d856..2324247b7e4 100644 --- a/hermezconfig-bali.yaml.example +++ b/hermezconfig-bali.yaml.example @@ -19,7 +19,6 @@ zkevm.gas-price-factor: 0.12 zkevm.l1-rollup-id: 1 zkevm.l1-first-block: 4794475 -zkevm.rpc-ratelimit: 250 txpool.disable: true torrent.port: 42070 zkevm.datastream-version: 2 diff --git a/hermezconfig-cardona.yaml.example b/hermezconfig-cardona.yaml.example index 4840fe005b1..b25311f2fbb 100644 --- a/hermezconfig-cardona.yaml.example +++ b/hermezconfig-cardona.yaml.example @@ -21,7 +21,6 @@ zkevm.l1-rollup-id: 1 zkevm.l1-block-range: 20000 zkevm.l1-query-delay: 6000 zkevm.l1-first-block: 4789190 -zkevm.rpc-ratelimit: 250 txpool.disable: true torrent.port: 42070 zkevm.datastream-version: 2 diff --git a/hermezconfig-dev.yaml.example b/hermezconfig-dev.yaml.example index d41f711ba82..76b02a7608b 100644 --- a/hermezconfig-dev.yaml.example +++ b/hermezconfig-dev.yaml.example @@ -16,7 +16,6 @@ zkevm.address-ger-manager: "0x76216E45Bdd20022eEcC07999e50228d7829534B" zkevm.l1-block-range: 20000 zkevm.l1-query-delay: 6000 zkevm.l1-first-block: 5192000 -zkevm.rpc-ratelimit: 250 zkevm.data-stream-port: 6900 zkevm.datastream-version: 2 zkevm.data-stream-host: localhost diff --git a/hermezconfig-estest-syncer.yaml.example b/hermezconfig-estest-syncer.yaml.example index eda029d1d12..1458b566a94 100644 --- a/hermezconfig-estest-syncer.yaml.example +++ b/hermezconfig-estest-syncer.yaml.example @@ -16,7 +16,6 @@ zkevm.address-ger-manager: "0x0FE6A2FcF455b9B8004fd625909857933d3c7494" zkevm.l1-block-range: 20000 zkevm.l1-query-delay: 6000 zkevm.l1-first-block: 5192000 -zkevm.rpc-ratelimit: 250 zkevm.data-stream-port: 6900 zkevm.datastream-version: 2 zkevm.data-stream-host: "127.0.0.1" diff --git a/hermezconfig-mainnet-shadowfork.yaml.example b/hermezconfig-mainnet-shadowfork.yaml.example index f50e69102ec..285b570b7a4 100644 --- a/hermezconfig-mainnet-shadowfork.yaml.example +++ b/hermezconfig-mainnet-shadowfork.yaml.example @@ -16,7 +16,6 @@ zkevm.address-ger-manager: "0x76216E45Bdd20022eEcC07999e50228d7829534B" zkevm.l1-block-range: 20000 zkevm.l1-query-delay: 6000 zkevm.l1-first-block: 5192000 -zkevm.rpc-ratelimit: 250 zkevm.data-stream-port: 6900 zkevm.datastream-version: 2 zkevm.data-stream-host: localhost diff --git a/hermezconfig-mainnet.yaml.example b/hermezconfig-mainnet.yaml.example index f5ec1540a45..8cbf02145c9 100644 --- a/hermezconfig-mainnet.yaml.example +++ b/hermezconfig-mainnet.yaml.example @@ -21,7 +21,6 @@ zkevm.l1-rollup-id: 1 zkevm.l1-block-range: 20000 zkevm.l1-query-delay: 6000 zkevm.l1-first-block: 16896700 -zkevm.rpc-ratelimit: 250 zkevm.datastream-version: 2 # debug.timers: true # Uncomment to enable timers diff --git a/turbo/cli/default_flags.go b/turbo/cli/default_flags.go index 6f8fabc694b..7fcf6503450 100644 --- a/turbo/cli/default_flags.go +++ b/turbo/cli/default_flags.go @@ -191,7 +191,6 @@ var DefaultFlags = []cli.Flag{ &utils.L1FirstBlockFlag, &utils.L1FinalizedBlockRequirementFlag, &utils.L1ContractAddressCheckFlag, - &utils.RpcRateLimitsFlag, &utils.RpcGetBatchWitnessConcurrencyLimitFlag, &utils.DatastreamVersionFlag, &utils.RebuildTreeAfterFlag, diff --git a/turbo/cli/flags_zkevm.go b/turbo/cli/flags_zkevm.go index 1014e76abc5..4d979d04d7e 100644 --- a/turbo/cli/flags_zkevm.go +++ b/turbo/cli/flags_zkevm.go @@ -17,7 +17,8 @@ import ( ) var DeprecatedFlags = map[string]string{ - "zkevm.gasless": "zkevm.allow-free-transactions", + "zkevm.gasless": "zkevm.allow-free-transactions", + "zkevm.rpc-ratelimit": "", } func ApplyFlagsForZkConfig(ctx *cli.Context, cfg *ethconfig.Config) { @@ -135,7 +136,6 @@ func ApplyFlagsForZkConfig(ctx *cli.Context, cfg *ethconfig.Config) { L1FirstBlock: ctx.Uint64(utils.L1FirstBlockFlag.Name), L1FinalizedBlockRequirement: ctx.Uint64(utils.L1FinalizedBlockRequirementFlag.Name), L1ContractAddressCheck: ctx.Bool(utils.L1ContractAddressCheckFlag.Name), - RpcRateLimits: ctx.Int(utils.RpcRateLimitsFlag.Name), RpcGetBatchWitnessConcurrencyLimit: ctx.Int(utils.RpcGetBatchWitnessConcurrencyLimitFlag.Name), DatastreamVersion: ctx.Int(utils.DatastreamVersionFlag.Name), RebuildTreeAfter: ctx.Uint64(utils.RebuildTreeAfterFlag.Name), @@ -224,7 +224,6 @@ func ApplyFlagsForZkConfig(ctx *cli.Context, cfg *ethconfig.Config) { checkFlag(utils.L1RpcUrlFlag.Name, cfg.L1RpcUrl) checkFlag(utils.L1MaticContractAddressFlag.Name, cfg.L1MaticContractAddress.Hex()) checkFlag(utils.L1FirstBlockFlag.Name, cfg.L1FirstBlock) - checkFlag(utils.RpcRateLimitsFlag.Name, cfg.RpcRateLimits) checkFlag(utils.RpcGetBatchWitnessConcurrencyLimitFlag.Name, cfg.RpcGetBatchWitnessConcurrencyLimit) checkFlag(utils.RebuildTreeAfterFlag.Name, cfg.RebuildTreeAfter) checkFlag(utils.L1BlockRangeFlag.Name, cfg.L1BlockRange) diff --git a/xlayerconfig-mainnet.yaml.example b/xlayerconfig-mainnet.yaml.example index 9d92556b800..6bb2c269066 100644 --- a/xlayerconfig-mainnet.yaml.example +++ b/xlayerconfig-mainnet.yaml.example @@ -17,7 +17,6 @@ zkevm.l1-rollup-id: 3 zkevm.l1-first-block: 19218658 zkevm.l1-block-range: 2000 zkevm.l1-query-delay: 1000 -zkevm.rpc-ratelimit: 250 zkevm.datastream-version: 3 externalcl: true diff --git a/xlayerconfig-testnet.yaml.example b/xlayerconfig-testnet.yaml.example index cb9a07a510e..706c8009901 100644 --- a/xlayerconfig-testnet.yaml.example +++ b/xlayerconfig-testnet.yaml.example @@ -17,7 +17,6 @@ zkevm.l1-rollup-id: 1 zkevm.l1-first-block: 4648290 zkevm.l1-block-range: 2000 zkevm.l1-query-delay: 1000 -zkevm.rpc-ratelimit: 250 zkevm.datastream-version: 3 externalcl: true diff --git a/zk/tests/nightly-l1-recovery/network5-config.yaml b/zk/tests/nightly-l1-recovery/network5-config.yaml index 82cf74f727e..b274cc3b290 100644 --- a/zk/tests/nightly-l1-recovery/network5-config.yaml +++ b/zk/tests/nightly-l1-recovery/network5-config.yaml @@ -18,7 +18,6 @@ zkevm.l1-matic-contract-address: "0x0f25eE4CA85Db4362a9749782872c558873566e4" zkevm.l1-block-range: 20000 zkevm.l1-query-delay: 6000 zkevm.l1-first-block: 6032365 -zkevm.rpc-ratelimit: 250 zkevm.data-stream-port: 6900 zkevm.datastream-version: 2 zkevm.data-stream-host: "127.0.0.1" diff --git a/zk/tests/nightly-l1-recovery/network5-sync-config.yaml b/zk/tests/nightly-l1-recovery/network5-sync-config.yaml index 648303c2b50..5a09921c6af 100644 --- a/zk/tests/nightly-l1-recovery/network5-sync-config.yaml +++ b/zk/tests/nightly-l1-recovery/network5-sync-config.yaml @@ -17,7 +17,6 @@ zkevm.l1-matic-contract-address: "0x0f25eE4CA85Db4362a9749782872c558873566e4" zkevm.l1-block-range: 20000 zkevm.l1-query-delay: 6000 zkevm.l1-first-block: 6032365 -zkevm.rpc-ratelimit: 250 zkevm.executor-strict: false # zkevm.executor-urls: "zkevm2-stateless-executor:50071" zkevm.witness-full: false diff --git a/zk/tests/nightly-l1-recovery/network8-config.yaml b/zk/tests/nightly-l1-recovery/network8-config.yaml index b38c7a3b45f..4c414cdc9c0 100644 --- a/zk/tests/nightly-l1-recovery/network8-config.yaml +++ b/zk/tests/nightly-l1-recovery/network8-config.yaml @@ -17,7 +17,6 @@ zkevm.l1-matic-contract-address: "0xdC66C280f5E8bBbd2F2d92FaD1489863c8F55915" zkevm.l1-block-range: 20000 zkevm.l1-query-delay: 6000 zkevm.l1-first-block: 6411787 -zkevm.rpc-ratelimit: 250 zkevm.data-stream-port: 6900 zkevm.datastream-version: 2 zkevm.data-stream-host: "127.0.0.1" diff --git a/zk/tests/nightly-l1-recovery/network8-sync-config.yaml b/zk/tests/nightly-l1-recovery/network8-sync-config.yaml index 98a80e3747d..f51c251ea81 100644 --- a/zk/tests/nightly-l1-recovery/network8-sync-config.yaml +++ b/zk/tests/nightly-l1-recovery/network8-sync-config.yaml @@ -17,7 +17,6 @@ zkevm.l1-matic-contract-address: "0xdC66C280f5E8bBbd2F2d92FaD1489863c8F55915" zkevm.l1-block-range: 20000 zkevm.l1-query-delay: 6000 zkevm.l1-first-block: 6411787 -zkevm.rpc-ratelimit: 250 #zkevm.data-stream-port: 6900 zkevm.datastream-version: 2 #zkevm.data-stream-host: "127.0.0.1" diff --git a/zk/tests/unwinds/config/dynamic-integration8.yaml b/zk/tests/unwinds/config/dynamic-integration8.yaml index afba2cd46a8..2590341925d 100644 --- a/zk/tests/unwinds/config/dynamic-integration8.yaml +++ b/zk/tests/unwinds/config/dynamic-integration8.yaml @@ -17,7 +17,6 @@ zkevm.l1-matic-contract-address: "0xdC66C280f5E8bBbd2F2d92FaD1489863c8F55915" zkevm.l1-block-range: 20000 zkevm.l1-query-delay: 6000 zkevm.l1-first-block: 6411787 -zkevm.rpc-ratelimit: 250 # zkevm.data-stream-port: 6900 zkevm.datastream-version: 2 # zkevm.data-stream-host: "127.0.0.1" From 2b885ee1f3b481db314f2bcb60ecd8630df9d26f Mon Sep 17 00:00:00 2001 From: Valentin Staykov Date: Fri, 4 Oct 2024 10:01:40 +0000 Subject: [PATCH 2/2] fix: kurtosis tests --- cmd/utils/flags.go | 5 +++++ turbo/cli/default_flags.go | 1 + 2 files changed, 6 insertions(+) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 4a8250147b7..021553ec9fa 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -552,6 +552,11 @@ var ( Usage: "The maximum number of concurrent requests to the executor", Value: 1, } + RpcRateLimitsFlag = cli.IntFlag{ + Name: "zkevm.rpc-ratelimit", + Usage: "RPC rate limit in requests per second.", + Value: 0, + } RpcGetBatchWitnessConcurrencyLimitFlag = cli.IntFlag{ Name: "zkevm.rpc-get-batch-witness-concurrency-limit", Usage: "The maximum number of concurrent requests to the executor for getBatchWitness.", diff --git a/turbo/cli/default_flags.go b/turbo/cli/default_flags.go index 7fcf6503450..6f8fabc694b 100644 --- a/turbo/cli/default_flags.go +++ b/turbo/cli/default_flags.go @@ -191,6 +191,7 @@ var DefaultFlags = []cli.Flag{ &utils.L1FirstBlockFlag, &utils.L1FinalizedBlockRequirementFlag, &utils.L1ContractAddressCheckFlag, + &utils.RpcRateLimitsFlag, &utils.RpcGetBatchWitnessConcurrencyLimitFlag, &utils.DatastreamVersionFlag, &utils.RebuildTreeAfterFlag,