rm payload transaction value calculation for Bellatrix engine API (#6173)

This commit is contained in:
tersec 2024-04-04 04:33:08 +00:00 committed by GitHub
parent 0b6f75b88b
commit 08d6dc347e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 11 deletions

View File

@ -8,22 +8,24 @@
{.push raises: [].} {.push raises: [].}
import import
std/[strformat, strutils, sequtils, typetraits, uri, json], std/[strformat, typetraits, json],
# Nimble packages: # Nimble packages:
chronos, metrics, chronicles/timings, chronos, metrics, chronicles/timings,
json_rpc/[client, errors], json_rpc/[client, errors],
web3, web3/[engine_api, primitives, conversions], web3, web3/[engine_api, primitives, conversions],
eth/common/[eth_types, transaction], eth/common/eth_types,
eth/async_utils, results, eth/async_utils, results,
stew/[assign2, byteutils, objects], stew/[assign2, byteutils, objects],
# Local modules: # Local modules:
../spec/[eth2_merkleization, forks, helpers], ../spec/[eth2_merkleization, forks],
../networking/network_metadata, ../networking/network_metadata,
".."/[beacon_node_status, future_combinators], ".."/[beacon_node_status, future_combinators],
"."/[eth1_chain, el_conf] "."/[eth1_chain, el_conf]
from std/sequtils import anyIt, mapIt
from std/times import getTime, inSeconds, initTime, `-` from std/times import getTime, inSeconds, initTime, `-`
from ../spec/engine_authentication import getSignedIatToken from ../spec/engine_authentication import getSignedIatToken
from ../spec/helpers import bytes_to_uint64
from ../spec/state_transition_block import kzg_commitment_to_versioned_hash from ../spec/state_transition_block import kzg_commitment_to_versioned_hash
export export
@ -753,12 +755,6 @@ proc forkchoiceUpdated(rpcClient: RpcClient,
else: else:
static: doAssert false static: doAssert false
func computeBlockValue(blk: ExecutionPayloadV1): UInt256 {.raises: [RlpError].} =
for transactionBytes in blk.transactions:
var rlp = rlpFromBytes distinctBase(transactionBytes)
let transaction = rlp.read(eth_types.Transaction)
result += distinctBase(effectiveGasTip(transaction, blk.baseFeePerGas)).u256
proc getPayloadFromSingleEL( proc getPayloadFromSingleEL(
connection: ELConnection, connection: ELConnection,
GetPayloadResponseType: type, GetPayloadResponseType: type,
@ -831,8 +827,7 @@ proc getPayloadFromSingleEL(
let payload = let payload =
await engine_api.getPayload(rpcClient, ExecutionPayloadV1, payloadId) await engine_api.getPayload(rpcClient, ExecutionPayloadV1, payloadId)
return BellatrixExecutionPayloadWithValue( return BellatrixExecutionPayloadWithValue(
executionPayload: payload, executionPayload: payload, blockValue: Wei.zero)
blockValue: computeBlockValue payload)
elif GetPayloadResponseType is engine_api.GetPayloadV4Response: elif GetPayloadResponseType is engine_api.GetPayloadV4Response:
debugRaiseAssert "foo" debugRaiseAssert "foo"
return default(engine_api.GetPayloadV4Response) return default(engine_api.GetPayloadV4Response)