Fid monad gas detection (#771)

This commit is contained in:
KirillPamPam
2026-01-15 13:15:59 +04:00
committed by GitHub
parent 7f9e350a9c
commit be77e4caeb
4 changed files with 53 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ class EthereumLowerBoundBlockDetector(
"method handler crashed", // sei
"Unexpected error", // hyperliquid
"invalid block height", // hyperliquid
"pruned history unavailable", // xlayer
)
}

View File

@@ -28,6 +28,7 @@ class EthereumLowerBoundReceiptsDetector(
"Unexpected error", // hyperliquid
"invalid block height", // hyperliquid
"header not found",
"pruned history unavailable", // xlayer
).plus(EthereumLowerBoundBlockDetector.NO_BLOCK_ERRORS)
}

View File

@@ -23,6 +23,7 @@ class EthereumLowerBoundTxDetector(
NO_TX_DATA,
"Unexpected error", // hyperliquid
"invalid block height", // hyperliquids
"pruned history unavailable", // xlayer blocks
).plus(EthereumLowerBoundBlockDetector.NO_BLOCK_ERRORS)
}

View File

@@ -89,6 +89,22 @@ class EthereumUpstreamSettingsDetector(
*
*/
private fun detectGasLabels(): Flux<Pair<String, String>> {
return if (chain == Chain.MONAD__MAINNET || chain == Chain.MONAD__TESTNET) {
basicGasLabels()
.collectList()
.flatMapMany { labels ->
if (labels.find { it.first == "extra_gas_limit" }?.second == "600000000") {
Flux.fromIterable(labels)
} else {
monadGasLabels()
}
}
} else {
basicGasLabels()
}
}
private fun basicGasLabels(): Flux<Pair<String, String>> {
return upstream.getIngressReader().read(
ChainRequest(
"eth_call",
@@ -123,6 +139,40 @@ class EthereumUpstreamSettingsDetector(
}
}
// the basic gas check doesn't work on monad nodes, let's check then by an error message
private fun monadGasLabels(): Flux<Pair<String, String>> {
return upstream.getIngressReader().read(
ChainRequest(
"eth_call",
ListParams(
mapOf(
"to" to "0x53Daa71B04d589429f6d3DF52db123913B818F22",
"data" to "0x51be4eaa",
"gas" to "0x232AAF80",
),
"latest",
mapOf(
"0x53Daa71B04d589429f6d3DF52db123913B818F22" to mapOf(
"code" to "0x6080604052348015600f57600080fd5b506004361060285760003560e01c806351be4eaa14602d575b600080fd5b60336047565b604051603e91906066565b60405180910390f35b60005a905090565b6000819050919050565b606081604f565b82525050565b6000602082019050607960008301846059565b9291505056fea26469706673582212201c0202887c1afe66974b06ee355dee07542bbc424cf4d1659c91f56c08c3dcc064736f6c63430008130033",
),
),
),
),
).flatMapMany {
Flux.fromIterable(emptyList<Pair<String, String>>())
}.onErrorResume {
if (it.message?.contains("gas limit too high") ?: false) {
val labels = mutableListOf(
Pair("gas-limit", 600_000_000.toString()),
Pair("extra_gas_limit", 600_000_000.toString()),
)
Flux.fromIterable(labels)
} else {
Flux.empty()
}
}
}
/*
Some clients on hyperliquid don't include system topup transactions, set either one of labels
*/