From d628c3340e4aae39023b8d2b2459c35c4f04723c Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 29 Oct 2024 16:21:26 +0300 Subject: [PATCH] rm ZkSyncCallLimitValidator (#584) * rm ZkSyncCallLimitValidator * Revert "rm ZkSyncCallLimitValidator" This reverts commit 08ebf2cb97fb691cdb93591518169adc0c5689b7. * rm ZkSyncCallLimitValidator --- foundation/src/main/resources/public | 2 +- .../ethereum/EthereumChainSpecific.kt | 4 +-- .../ethereum/EthereumUpstreamValidator.kt | 31 ------------------- 3 files changed, 2 insertions(+), 35 deletions(-) diff --git a/foundation/src/main/resources/public b/foundation/src/main/resources/public index 41bf2959d..522e263ab 160000 --- a/foundation/src/main/resources/public +++ b/foundation/src/main/resources/public @@ -1 +1 @@ -Subproject commit 41bf2959d0893513cb2cdb4b001b63f491ecb093 +Subproject commit 522e263ab98a09b74281c6ffe0805a79ee1745c7 diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumChainSpecific.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumChainSpecific.kt index fd547c812..d0badf349 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumChainSpecific.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumChainSpecific.kt @@ -153,19 +153,17 @@ object EthereumChainSpecific : AbstractPollChainSpecific() { options: Options, config: ChainConfig, ): List> { - val limitValidator = callLimitValidatorFactory(upstream, options, config, chain) - val validators = mutableListOf( ChainIdValidator(upstream, chain), OldBlockValidator(upstream), ) + val limitValidator = EthCallLimitValidator(upstream, options, config) if (limitValidator.isEnabled()) { validators.add(limitValidator) } if (options.validateGasPrice) { validators.add(GasPriceValidator(upstream, config)) } - return validators } diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstreamValidator.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstreamValidator.kt index eede8bfe6..d09e87536 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstreamValidator.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumUpstreamValidator.kt @@ -113,37 +113,6 @@ class EthCallLimitValidator( err.message != null && err.message!!.contains("rpc.returndata.limit") } -class ZkSyncCallLimitValidator( - private val upstream: Upstream, - private val options: ChainOptions.Options, -) : AbstractCallLimitValidator(upstream, options) { - private val method = "debug_traceBlockByNumber" - - override fun isEnabled() = - options.validateCallLimit && upstream.getMethods().getSupportedMethods().contains(method) - - override fun createRequest() = ChainRequest( - method, - ListParams("0x1b73b2b", mapOf("tracer" to "callTracer")), - ) - - override fun isLimitError(err: Throwable): Boolean = - err.message != null && err.message!!.contains("response size should not greater than") -} - -fun callLimitValidatorFactory( - upstream: Upstream, - options: ChainOptions.Options, - config: ChainConfig, - chain: Chain, -): CallLimitValidator { - return if (listOf(Chain.ZKSYNC__MAINNET).contains(chain)) { - ZkSyncCallLimitValidator(upstream, options) - } else { - EthCallLimitValidator(upstream, options, config) - } -} - class ChainIdValidator( private val upstream: Upstream, private val chain: Chain,