Skip to content

Commit

Permalink
rm ZkSyncCallLimitValidator (#584)
Browse files Browse the repository at this point in the history
* rm ZkSyncCallLimitValidator

* Revert "rm ZkSyncCallLimitValidator"

This reverts commit 08ebf2c.

* rm ZkSyncCallLimitValidator
  • Loading branch information
tonatoz authored Oct 29, 2024
1 parent cc5531b commit d628c33
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,17 @@ object EthereumChainSpecific : AbstractPollChainSpecific() {
options: Options,
config: ChainConfig,
): List<SingleValidator<ValidateUpstreamSettingsResult>> {
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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d628c33

Please sign in to comment.