Skip to content

Commit

Permalink
Rewrite extra gas label
Browse files Browse the repository at this point in the history
  • Loading branch information
Кирилл committed Jan 7, 2025
1 parent c6955af commit 7311e2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ class EthereumUpstreamSettingsDetector(
it.requireResult()
}.flatMapMany {
val gaslimit = String(it).drop(3).dropLast(1).toBigInteger(16) + (21182).toBigInteger()
val labels = mutableListOf(Pair("gas-limit", gaslimit.toString(10)))
val nodeGasLimit = gaslimit.toString(10)
val labels = mutableListOf(Pair("gas-limit", nodeGasLimit))
if (gaslimit.toLong() > 590_000_000L) {
labels.add(Pair("extra_gas_limit", 600_000_000.toString()))
} else {
labels.add(Pair("extra_gas_limit", nodeGasLimit))
}
Flux.fromIterable(labels)
}.onErrorResume {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class EthereumUpstreamSettingsDetectorSpec extends Specification {
result.expectComplete().verify(Duration.ofSeconds(1))
where:
response | gas | gasv | extragas | clientType | version
"Nethermind/v1.19.3+e8ac1da4/linux-x64/dotnet7.0.8" | "0x2fa9dc2" | "50000000" | null | "nethermind" | "v1.19.3+e8ac1da4"
"Geth/v1.12.0-stable-e501b3b0/linux-amd64/go1.20.3" | "0x2fa9dc2" | "50000000" | null | "geth" | "v1.12.0-stable-e501b3b0"
"Erigon/v1.12.0-stable-e501b3b0/linux-amd64/go1.20.3" | "0x2fa9dc2" | "50000000" | null | "erigon" | "v1.12.0-stable-e501b3b0"
"Nethermind/v1.19.3+e8ac1da4/linux-x64/dotnet7.0.8" | "0x2fa9dc2" | "50000000" | "50000000" | "nethermind" | "v1.19.3+e8ac1da4"
"Geth/v1.12.0-stable-e501b3b0/linux-amd64/go1.20.3" | "0x2fa9dc2" | "50000000" | "50000000" | "geth" | "v1.12.0-stable-e501b3b0"
"Erigon/v1.12.0-stable-e501b3b0/linux-amd64/go1.20.3" | "0x2fa9dc2" | "50000000" | "50000000" | "erigon" | "v1.12.0-stable-e501b3b0"
"Bor/v0.4.0/linux-amd64/go1.19.10" | "0x23c2f342"| "600000000" | "600000000" | "bor" | "v0.4.0"
}

Expand Down

0 comments on commit 7311e2d

Please sign in to comment.