Merge branch 'master' into patch-1
This commit is contained in:
commit
55677115cd
|
@ -64,7 +64,7 @@ suite "Execution types tests":
|
|||
shouldOverrideBuilder: Opt.some(false),
|
||||
)
|
||||
|
||||
deposit = DepositReceiptV1(
|
||||
deposit = DepositRequestV1(
|
||||
pubkey: FixedBytes[48].conv(1),
|
||||
withdrawalCredentials: FixedBytes[32].conv(3),
|
||||
amount: 5.Quantity,
|
||||
|
@ -72,9 +72,15 @@ suite "Execution types tests":
|
|||
index: 9.Quantity
|
||||
)
|
||||
|
||||
exit = WithdrawalRequestV1(
|
||||
withdrawal = WithdrawalRequestV1(
|
||||
sourceAddress: address(7),
|
||||
validatorPublicKey: FixedBytes[48].conv(9)
|
||||
validatorPubkey: FixedBytes[48].conv(9)
|
||||
)
|
||||
|
||||
consolidation = ConsolidationRequestV1(
|
||||
sourceAddress: address(8),
|
||||
sourcePubkey: FixedBytes[48].conv(10),
|
||||
targetPubkey: FixedBytes[48].conv(11)
|
||||
)
|
||||
|
||||
test "payload version":
|
||||
|
@ -167,25 +173,37 @@ suite "Execution types tests":
|
|||
|
||||
test "payload version 4":
|
||||
var v4 = payload
|
||||
v4.depositReceipts = Opt.some(@[deposit])
|
||||
v4.exits = Opt.some(@[exit])
|
||||
v4.depositRequests = Opt.some(@[deposit])
|
||||
v4.withdrawalRequests = Opt.some(@[withdrawal])
|
||||
v4.consolidationRequests = Opt.some(@[consolidation])
|
||||
check v4.version == Version.V4
|
||||
|
||||
var bad41 = v4
|
||||
bad41.depositReceipts = Opt.none(seq[DepositReceiptV1])
|
||||
bad41.depositRequests = Opt.none(seq[DepositRequestV1])
|
||||
check bad41.version == Version.V4
|
||||
|
||||
var bad42 = v4
|
||||
bad42.exits = Opt.none(seq[WithdrawalRequestV1])
|
||||
bad42.withdrawalRequests = Opt.none(seq[WithdrawalRequestV1])
|
||||
check bad42.version == Version.V4
|
||||
|
||||
var bad43 = v4
|
||||
bad43.consolidationRequests = Opt.none(seq[ConsolidationRequestV1])
|
||||
check bad43.version == Version.V4
|
||||
|
||||
let v41 = bad41.V4
|
||||
check v41.depositRequests == newSeq[DepositReceiptV1]()
|
||||
check v41.withdrawalRequests == v4.exits.get
|
||||
check v41.depositRequests == newSeq[DepositRequestV1]()
|
||||
check v41.withdrawalRequests == v4.withdrawalRequests.get
|
||||
check v41.consolidationRequests == v4.consolidationRequests.get
|
||||
|
||||
let v42 = bad42.V4
|
||||
check v42.depositRequests == v4.depositReceipts.get
|
||||
check v42.depositRequests == v4.depositRequests.get
|
||||
check v42.withdrawalRequests == newSeq[WithdrawalRequestV1]()
|
||||
check v41.consolidationRequests == v4.consolidationRequests.get
|
||||
|
||||
let v43 = bad43.V4
|
||||
check v43.depositRequests == v4.depositRequests.get
|
||||
check v43.withdrawalRequests == v4.withdrawalRequests.get
|
||||
check v43.consolidationRequests == newSeq[ConsolidationRequestV1]()
|
||||
|
||||
# roundtrip
|
||||
let v4p = v4.V4
|
||||
|
|
|
@ -172,6 +172,7 @@ suite "JSON-RPC Quantity":
|
|||
checkRandomObject(ProofResponse)
|
||||
checkRandomObject(FilterOptions)
|
||||
checkRandomObject(TransactionArgs)
|
||||
checkRandomObject(AuthorizationObject)
|
||||
|
||||
checkRandomObject(BlockHeader)
|
||||
checkRandomObject(BlockObject)
|
||||
|
|
|
@ -42,6 +42,10 @@ ProofResponse.useDefaultSerializationIn JrpcConv
|
|||
FilterOptions.useDefaultSerializationIn JrpcConv
|
||||
TransactionArgs.useDefaultSerializationIn JrpcConv
|
||||
FeeHistoryResult.useDefaultSerializationIn JrpcConv
|
||||
AuthorizationObject.useDefaultSerializationIn JrpcConv
|
||||
DepositRequestObject.useDefaultSerializationIn JrpcConv
|
||||
WithdrawalRequestObject.useDefaultSerializationIn JrpcConv
|
||||
ConsolidationRequestObject.useDefaultSerializationIn JrpcConv
|
||||
|
||||
derefType(BlockHeader).useDefaultSerializationIn JrpcConv
|
||||
derefType(BlockObject).useDefaultSerializationIn JrpcConv
|
||||
|
@ -53,7 +57,7 @@ derefType(ReceiptObject).useDefaultSerializationIn JrpcConv
|
|||
#------------------------------------------------------------------------------
|
||||
|
||||
WithdrawalV1.useDefaultSerializationIn JrpcConv
|
||||
DepositReceiptV1.useDefaultSerializationIn JrpcConv
|
||||
DepositRequestV1.useDefaultSerializationIn JrpcConv
|
||||
WithdrawalRequestV1.useDefaultSerializationIn JrpcConv
|
||||
ExecutionPayloadV1.useDefaultSerializationIn JrpcConv
|
||||
ExecutionPayloadV2.useDefaultSerializationIn JrpcConv
|
||||
|
@ -75,6 +79,7 @@ GetPayloadV2ResponseExact.useDefaultSerializationIn JrpcConv
|
|||
GetPayloadV3Response.useDefaultSerializationIn JrpcConv
|
||||
GetPayloadV4Response.useDefaultSerializationIn JrpcConv
|
||||
ClientVersionV1.useDefaultSerializationIn JrpcConv
|
||||
ConsolidationRequestV1.useDefaultSerializationIn JrpcConv
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# execution_types
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
# This file may not be copied, modified, or distributed except according to
|
||||
# those terms.
|
||||
|
||||
{.push raises: [].}
|
||||
|
||||
import
|
||||
std/typetraits,
|
||||
stint,
|
||||
|
@ -19,7 +21,7 @@ export
|
|||
type
|
||||
TypedTransaction* = distinct seq[byte]
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/shanghai.md#withdrawalv1
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#withdrawalv1
|
||||
WithdrawalV1* = object
|
||||
index*: Quantity
|
||||
validatorIndex*: Quantity
|
||||
|
@ -27,20 +29,26 @@ type
|
|||
amount*: Quantity
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/prague.md#depositrequestv1
|
||||
DepositReceiptV1* = object
|
||||
DepositRequestV1* = object
|
||||
pubkey*: FixedBytes[48]
|
||||
withdrawalCredentials*: FixedBytes[32]
|
||||
amount*: Quantity
|
||||
signature*: FixedBytes[96]
|
||||
index*: Quantity
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/prague.md#withdrawalrequestv1
|
||||
# https://github.com/nflaig/execution-apis/blob/update-withdrawal-request/src/engine/prague.md#withdrawalrequestv1
|
||||
WithdrawalRequestV1* = object
|
||||
sourceAddress*: Address
|
||||
validatorPublicKey*: FixedBytes[48]
|
||||
validatorPubkey*: FixedBytes[48]
|
||||
amount*: Quantity
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/paris.md#executionpayloadv1
|
||||
# https://github.com/ethereum/execution-apis/blob/3ae3d29fc9900e5c48924c238dff7643fdc3680e/src/engine/prague.md#consolidationrequestv1
|
||||
ConsolidationRequestV1* = object
|
||||
sourceAddress*: Address
|
||||
sourcePubkey*: FixedBytes[48]
|
||||
targetPubkey*: FixedBytes[48]
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/paris.md#executionpayloadv1
|
||||
ExecutionPayloadV1* = object
|
||||
parentHash*: Hash256
|
||||
feeRecipient*: Address
|
||||
|
@ -57,7 +65,7 @@ type
|
|||
blockHash*: Hash256
|
||||
transactions*: seq[TypedTransaction]
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/shanghai.md#executionpayloadv2
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#executionpayloadv2
|
||||
ExecutionPayloadV2* = object
|
||||
parentHash*: Hash256
|
||||
feeRecipient*: Address
|
||||
|
@ -87,7 +95,7 @@ type
|
|||
# please fix this. (Maybe the RPC library does handle sum types?
|
||||
# Or maybe we can enhance it to do so?) --Adam
|
||||
#
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/shanghai.md
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md
|
||||
ExecutionPayloadV1OrV2* = object
|
||||
parentHash*: BlockHash
|
||||
feeRecipient*: Address
|
||||
|
@ -105,7 +113,7 @@ type
|
|||
transactions*: seq[TypedTransaction]
|
||||
withdrawals*: Opt[seq[WithdrawalV1]]
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/fe8e13c288c592ec154ce25c534e26cb7ce0530d/src/engine/cancun.md#executionpayloadv3
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/cancun.md#executionpayloadv3
|
||||
ExecutionPayloadV3* = object
|
||||
parentHash*: Hash256
|
||||
feeRecipient*: Address
|
||||
|
@ -125,7 +133,7 @@ type
|
|||
blobGasUsed*: Quantity
|
||||
excessBlobGas*: Quantity
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/prague.md#executionpayloadv4
|
||||
# https://github.com/ethereum/execution-apis/blob/3ae3d29fc9900e5c48924c238dff7643fdc3680e/src/engine/prague.md#executionpayloadv4
|
||||
ExecutionPayloadV4* = object
|
||||
parentHash*: Hash256
|
||||
feeRecipient*: Address
|
||||
|
@ -144,13 +152,9 @@ type
|
|||
withdrawals*: seq[WithdrawalV1]
|
||||
blobGasUsed*: Quantity
|
||||
excessBlobGas*: Quantity
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/pull/3757
|
||||
# https://github.com/ethereum/execution-apis/pull/544
|
||||
# mainly for devnet-0
|
||||
depositRequests*: seq[DepositReceiptV1]
|
||||
|
||||
depositRequests*: seq[DepositRequestV1]
|
||||
withdrawalRequests*: seq[WithdrawalRequestV1]
|
||||
consolidationRequests*: seq[ConsolidationRequestV1]
|
||||
|
||||
SomeExecutionPayload* =
|
||||
ExecutionPayloadV1 |
|
||||
|
@ -158,34 +162,35 @@ type
|
|||
ExecutionPayloadV3 |
|
||||
ExecutionPayloadV4
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/ee3df5bc38f28ef35385cefc9d9ca18d5e502778/src/engine/cancun.md#blobsbundlev1
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/cancun.md#blobsbundlev1
|
||||
BlobsBundleV1* = object
|
||||
commitments*: seq[KZGCommitment]
|
||||
proofs*: seq[KZGProof]
|
||||
blobs*: seq[Blob]
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/d03c193dc317538e2a1a098030c21bacc2fd1333/src/engine/shanghai.md#executionpayloadbodyv1
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#executionpayloadbodyv1
|
||||
# For optional withdrawals field, see:
|
||||
# https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#engine_getpayloadbodiesbyhashv1
|
||||
# https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#engine_getpayloadbodiesbyrangev1
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#engine_getpayloadbodiesbyhashv1
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#engine_getpayloadbodiesbyrangev1
|
||||
# "Client software MUST set withdrawals field to null for bodies of pre-Shanghai blocks."
|
||||
ExecutionPayloadBodyV1* = object
|
||||
transactions*: seq[TypedTransaction]
|
||||
withdrawals*: Opt[seq[WithdrawalV1]]
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/paris.md#payloadattributesv1
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/paris.md#payloadattributesv1
|
||||
PayloadAttributesV1* = object
|
||||
timestamp*: Quantity
|
||||
prevRandao*: FixedBytes[32]
|
||||
suggestedFeeRecipient*: Address
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/shanghai.md#payloadattributesv2
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#payloadattributesv2
|
||||
PayloadAttributesV2* = object
|
||||
timestamp*: Quantity
|
||||
prevRandao*: FixedBytes[32]
|
||||
suggestedFeeRecipient*: Address
|
||||
withdrawals*: seq[WithdrawalV1]
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/ee3df5bc38f28ef35385cefc9d9ca18d5e502778/src/engine/cancun.md#payloadattributesv3
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/cancun.md#payloadattributesv3
|
||||
PayloadAttributesV3* = object
|
||||
timestamp*: Quantity
|
||||
prevRandao*: FixedBytes[32]
|
||||
|
@ -205,7 +210,7 @@ type
|
|||
PayloadAttributesV2 |
|
||||
PayloadAttributesV3
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/paris.md#payloadstatusv1
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/paris.md#payloadstatusv1
|
||||
PayloadExecutionStatus* {.pure.} = enum
|
||||
syncing = "SYNCING"
|
||||
valid = "VALID"
|
||||
|
@ -218,26 +223,26 @@ type
|
|||
latestValidHash*: Opt[BlockHash]
|
||||
validationError*: Opt[string]
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/paris.md#forkchoicestatev1
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/paris.md#forkchoicestatev1
|
||||
ForkchoiceStateV1* = object
|
||||
headBlockHash*: BlockHash
|
||||
safeBlockHash*: BlockHash
|
||||
finalizedBlockHash*: BlockHash
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/paris.md#response-1
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/paris.md#request-2
|
||||
PayloadID* = FixedBytes[8]
|
||||
|
||||
ForkchoiceUpdatedResponse* = object
|
||||
payloadStatus*: PayloadStatusV1
|
||||
payloadId*: Opt[PayloadID]
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/paris.md#transitionconfigurationv1
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/paris.md#transitionconfigurationv1
|
||||
TransitionConfigurationV1* = object
|
||||
terminalTotalDifficulty*: UInt256
|
||||
terminalBlockHash*: BlockHash
|
||||
terminalBlockNumber*: Quantity
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/shanghai.md#response-2
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/shanghai.md#response-2
|
||||
GetPayloadV2Response* = object
|
||||
executionPayload*: ExecutionPayloadV1OrV2
|
||||
blockValue*: UInt256
|
||||
|
@ -246,7 +251,7 @@ type
|
|||
executionPayload*: ExecutionPayloadV2
|
||||
blockValue*: UInt256
|
||||
|
||||
# https://github.com/ethereum/execution-apis/blob/584905270d8ad665718058060267061ecfd79ca5/src/engine/cancun.md#response-2
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/cancun.md#response-2
|
||||
GetPayloadV3Response* = object
|
||||
executionPayload*: ExecutionPayloadV3
|
||||
blockValue*: UInt256
|
||||
|
@ -274,7 +279,7 @@ type
|
|||
commit*: FixedBytes[4]
|
||||
|
||||
const
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.3/src/engine/common.md#errors
|
||||
# https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.4/src/engine/common.md#errors
|
||||
engineApiParseError* = -32700
|
||||
engineApiInvalidRequest* = -32600
|
||||
engineApiMethodNotFound* = -32601
|
||||
|
@ -287,7 +292,5 @@ const
|
|||
engineApiTooLargeRequest* = -38004
|
||||
engineApiUnsupportedFork* = -38005
|
||||
|
||||
{.push raises: [].}
|
||||
|
||||
template `==`*(a, b: TypedTransaction): bool =
|
||||
distinctBase(a) == distinctBase(b)
|
|
@ -60,6 +60,9 @@ type
|
|||
commitments*: Opt[seq[KZGCommitment]]
|
||||
proofs*: Opt[seq[KZGProof]]
|
||||
|
||||
# EIP-7702
|
||||
authorizationList*: Opt[seq[AuthorizationObject]]
|
||||
|
||||
## A block header object
|
||||
BlockHeader* = ref object
|
||||
number*: Quantity
|
||||
|
@ -83,6 +86,7 @@ type
|
|||
blobGasUsed*: Opt[Quantity] # EIP-4844
|
||||
excessBlobGas*: Opt[Quantity] # EIP-4844
|
||||
parentBeaconBlockRoot*: Opt[Hash256] # EIP-4788
|
||||
requestsRoot*: Opt[Hash256] # EIP-7685
|
||||
|
||||
WithdrawalObject* = object
|
||||
index*: Quantity
|
||||
|
@ -90,34 +94,55 @@ type
|
|||
address*: Address
|
||||
amount*: Quantity
|
||||
|
||||
DepositRequestObject* = object # EIP-6110
|
||||
pubkey* : FixedBytes[48]
|
||||
withdrawalCredentials*: FixedBytes[32]
|
||||
amount* : Quantity
|
||||
signature* : FixedBytes[96]
|
||||
index* : Quantity
|
||||
|
||||
WithdrawalRequestObject* = object # EIP-7002
|
||||
sourceAddress* : FixedBytes[20]
|
||||
validatorPubkey*: FixedBytes[48]
|
||||
amount* : Quantity
|
||||
|
||||
ConsolidationRequestObject* = object # EIP-7251
|
||||
sourceAddress*: FixedBytes[20]
|
||||
sourcePubkey* : FixedBytes[48]
|
||||
targetPubkey* : FixedBytes[48]
|
||||
|
||||
## A block object, or null when no block was found
|
||||
BlockObject* = ref object
|
||||
number*: BlockNumber # the block number. null when its pending block.
|
||||
hash*: Hash256 # hash of the block. null when its pending block.
|
||||
parentHash*: Hash256 # hash of the parent block.
|
||||
sha3Uncles*: Hash256 # SHA3 of the uncles data in the block.
|
||||
logsBloom*: FixedBytes[256] # the bloom filter for the logs of the block. null when its pending block.
|
||||
transactionsRoot*: Hash256 # the root of the transaction trie of the block.
|
||||
stateRoot*: Hash256 # the root of the final state trie of the block.
|
||||
receiptsRoot*: Hash256 # the root of the receipts trie of the block.
|
||||
miner*: Address # the address of the beneficiary to whom the mining rewards were given.
|
||||
difficulty*: UInt256 # integer of the difficulty for this block.
|
||||
extraData*: HistoricExtraData # the "extra data" field of this block.
|
||||
gasLimit*: Quantity # the maximum gas allowed in this block.
|
||||
gasUsed*: Quantity # the total used gas by all transactions in this block.
|
||||
timestamp*: Quantity # the unix timestamp for when the block was collated.
|
||||
nonce*: Opt[FixedBytes[8]] # hash of the generated proof-of-work. null when its pending block.
|
||||
mixHash*: Hash256
|
||||
size*: Quantity # integer the size of this block in bytes.
|
||||
totalDifficulty*: UInt256 # integer of the total difficulty of the chain until this block.
|
||||
transactions*: seq[TxOrHash] # list of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
|
||||
uncles*: seq[Hash256] # list of uncle hashes.
|
||||
number*: BlockNumber # the block number. null when its pending block.
|
||||
hash*: Hash256 # hash of the block. null when its pending block.
|
||||
parentHash*: Hash256 # hash of the parent block.
|
||||
sha3Uncles*: Hash256 # SHA3 of the uncles data in the block.
|
||||
logsBloom*: FixedBytes[256] # the bloom filter for the logs of the block. null when its pending block.
|
||||
transactionsRoot*: Hash256 # the root of the transaction trie of the block.
|
||||
stateRoot*: Hash256 # the root of the final state trie of the block.
|
||||
receiptsRoot*: Hash256 # the root of the receipts trie of the block.
|
||||
miner*: Address # the address of the beneficiary to whom the mining rewards were given.
|
||||
difficulty*: UInt256 # integer of the difficulty for this block.
|
||||
extraData*: HistoricExtraData # the "extra data" field of this block.
|
||||
gasLimit*: Quantity # the maximum gas allowed in this block.
|
||||
gasUsed*: Quantity # the total used gas by all transactions in this block.
|
||||
timestamp*: Quantity # the unix timestamp for when the block was collated.
|
||||
nonce*: Opt[FixedBytes[8]]
|
||||
mixHash*: Hash256 # hash of the generated proof-of-work. null when its pending block.
|
||||
size*: Quantity # integer the size of this block in bytes.
|
||||
totalDifficulty*: UInt256 # integer of the total difficulty of the chain until this block.
|
||||
transactions*: seq[TxOrHash] # list of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
|
||||
uncles*: seq[Hash256] # list of uncle hashes.
|
||||
baseFeePerGas*: Opt[UInt256] # EIP-1559
|
||||
withdrawals*: Opt[seq[WithdrawalObject]] # EIP-4895
|
||||
withdrawalsRoot*: Opt[Hash256] # EIP-4895
|
||||
blobGasUsed*: Opt[Quantity] # EIP-4844
|
||||
excessBlobGas*: Opt[Quantity] # EIP-4844
|
||||
parentBeaconBlockRoot*: Opt[Hash256] # EIP-4788
|
||||
depositRequests*: Opt[seq[DepositRequestObject]] # EIP-6110
|
||||
withdrawalRequests*: Opt[seq[WithdrawalRequestObject]] # EIP-7002
|
||||
consolidationRequests*: Opt[seq[ConsolidationRequestObject]] # EIP-7251
|
||||
requestsRoot*: Opt[Hash256] # EIP-7685
|
||||
|
||||
TxOrHashKind* = enum
|
||||
tohHash
|
||||
|
@ -139,21 +164,29 @@ type
|
|||
error*: Opt[string]
|
||||
gasUsed*: Quantity
|
||||
|
||||
TransactionObject* = ref object # A transaction object, or null when no transaction was found:
|
||||
hash*: TxHash # hash of the transaction.
|
||||
nonce*: Quantity # TODO: Is int? the number of transactions made by the sender prior to this one.
|
||||
AuthorizationObject* = object
|
||||
chainId*: Quantity
|
||||
address*: Address
|
||||
nonce*: Quantity
|
||||
yParity*: Quantity
|
||||
R*: UInt256
|
||||
S*: UInt256
|
||||
|
||||
TransactionObject* = ref object # A transaction object, or null when no transaction was found:
|
||||
hash*: TxHash # hash of the transaction.
|
||||
nonce*: Quantity # TODO: Is int? the number of transactions made by the sender prior to this one.
|
||||
blockHash*: Opt[BlockHash] # hash of the block where this transaction was in. null when its pending.
|
||||
blockNumber*: Opt[BlockNumber] # block number where this transaction was in. null when its pending.
|
||||
transactionIndex*: Opt[Quantity] # integer of the transactions index position in the block. null when its pending.
|
||||
`from`*: Address # address of the sender.
|
||||
`from`*: Address # address of the sender.
|
||||
to*: Opt[Address] # address of the receiver. null when its a contract creation transaction.
|
||||
value*: UInt256 # value transferred in Wei.
|
||||
gasPrice*: Quantity # gas price provided by the sender in Wei.
|
||||
gas*: Quantity # gas provided by the sender.
|
||||
input*: seq[byte] # the data send along with the transaction.
|
||||
v*: Quantity # ECDSA recovery id
|
||||
r*: UInt256 # ECDSA signature r
|
||||
s*: UInt256 # ECDSA signature s
|
||||
value*: UInt256 # value transferred in Wei.
|
||||
gasPrice*: Quantity # gas price provided by the sender in Wei.
|
||||
gas*: Quantity # gas provided by the sender.
|
||||
input*: seq[byte] # the data send along with the transaction.
|
||||
v*: Quantity # ECDSA recovery id
|
||||
r*: UInt256 # ECDSA signature r
|
||||
s*: UInt256 # ECDSA signature s
|
||||
yParity*: Opt[Quantity] # ECDSA y parity, none for Legacy, same as v for >= Tx2930
|
||||
`type`*: Opt[Quantity] # EIP-2718, with 0x0 for Legacy
|
||||
chainId*: Opt[Quantity] # EIP-159
|
||||
|
@ -162,20 +195,21 @@ type
|
|||
maxPriorityFeePerGas*: Opt[Quantity] # EIP-1559
|
||||
maxFeePerBlobGas*: Opt[UInt256] # EIP-4844
|
||||
blobVersionedHashes*: Opt[seq[VersionedHash]] # EIP-4844
|
||||
authorizationList*: Opt[seq[AuthorizationObject]] # EIP-7702
|
||||
|
||||
ReceiptObject* = ref object # A transaction receipt object, or null when no receipt was found:
|
||||
transactionHash*: TxHash # hash of the transaction.
|
||||
transactionIndex*: Quantity # integer of the transactions index position in the block.
|
||||
blockHash*: BlockHash # hash of the block where this transaction was in.
|
||||
blockNumber*: BlockNumber # block number where this transaction was in.
|
||||
`from`*: Address # address of the sender.
|
||||
ReceiptObject* = ref object # A transaction receipt object, or null when no receipt was found:
|
||||
transactionHash*: TxHash # hash of the transaction.
|
||||
transactionIndex*: Quantity # integer of the transactions index position in the block.
|
||||
blockHash*: BlockHash # hash of the block where this transaction was in.
|
||||
blockNumber*: BlockNumber # block number where this transaction was in.
|
||||
`from`*: Address # address of the sender.
|
||||
to*: Opt[Address] # address of the receiver. null when its a contract creation transaction.
|
||||
cumulativeGasUsed*: Quantity # the total amount of gas used when this transaction was executed in the block.
|
||||
effectiveGasPrice*: Quantity # The sum of the base fee and tip paid per unit of gas.
|
||||
gasUsed*: Quantity # the amount of gas used by this specific transaction alone.
|
||||
cumulativeGasUsed*: Quantity # the total amount of gas used when this transaction was executed in the block.
|
||||
effectiveGasPrice*: Quantity # The sum of the base fee and tip paid per unit of gas.
|
||||
gasUsed*: Quantity # the amount of gas used by this specific transaction alone.
|
||||
contractAddress*: Opt[Address] # the contract address created, if the transaction was a contract creation, otherwise null.
|
||||
logs*: seq[LogObject] # TODO: See Wiki for details. list of log objects, which this transaction generated.
|
||||
logsBloom*: FixedBytes[256] # bloom filter for light clients to quickly retrieve related logs.
|
||||
logs*: seq[LogObject] # TODO: See Wiki for details. list of log objects, which this transaction generated.
|
||||
logsBloom*: FixedBytes[256] # bloom filter for light clients to quickly retrieve related logs.
|
||||
`type`*: Opt[Quantity] # integer of the transaction type, 0x0 for legacy transactions, 0x1 for access list types, 0x2 for dynamic fees.
|
||||
root*: Opt[Hash256] # 32 bytes of post-transaction stateroot (pre Byzantium)
|
||||
status*: Opt[Quantity] # either 1 (success) or 0 (failure)
|
||||
|
@ -201,23 +235,22 @@ type
|
|||
FilterOptions* = object
|
||||
fromBlock*: Opt[RtBlockIdentifier] # (optional, default: "latest") integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.
|
||||
toBlock*: Opt[RtBlockIdentifier] # (optional, default: "latest") integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.
|
||||
# TODO: address as optional list of address or optional address
|
||||
address*: AddressOrList # (optional) contract address or a list of addresses from which logs should originate.
|
||||
topics*: seq[TopicOrList] # (optional) list of DATA topics. Topics are order-dependent. Each topic can also be a list of DATA with "or" options.
|
||||
blockHash*: Opt[BlockHash] # (optional) hash of the block. If its present, fromBlock and toBlock, should be none. Introduced in EIP234
|
||||
address*: AddressOrList # (optional) contract address or a list of addresses from which logs should originate.
|
||||
topics*: seq[TopicOrList] # (optional) list of DATA topics. Topics are order-dependent. Each topic can also be a list of DATA with "or" options.
|
||||
blockHash*: Opt[BlockHash] # (optional) hash of the block. If its present, fromBlock and toBlock, should be none. Introduced in EIP234
|
||||
|
||||
LogObject* = object
|
||||
removed*: bool # true when the log was removed, due to a chain reorganization. false if its a valid log.
|
||||
removed*: bool # true when the log was removed, due to a chain reorganization. false if its a valid log.
|
||||
logIndex*: Opt[Quantity] # integer of the log index position in the block. null when its pending log.
|
||||
transactionIndex*: Opt[Quantity] # integer of the transactions index position log was created from. null when its pending log.
|
||||
transactionHash*: Opt[TxHash] # hash of the transactions this log was created from. null when its pending log.
|
||||
blockHash*: Opt[BlockHash] # hash of the block where this log was in. null when its pending. null when its pending log.
|
||||
blockNumber*: Opt[BlockNumber] # the block number where this log was in. null when its pending. null when its pending log.
|
||||
address*: Address # address from which this log originated.
|
||||
data*: seq[byte] # contains one or more 32 Bytes non-indexed arguments of the log.
|
||||
topics*: seq[Topic] # array of 0 to 4 32 Bytes DATA of indexed log arguments.
|
||||
# (In solidity: The first topic is the hash of the signature of the event.
|
||||
# (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
|
||||
address*: Address # address from which this log originated.
|
||||
data*: seq[byte] # contains one or more 32 Bytes non-indexed arguments of the log.
|
||||
topics*: seq[Topic] # array of 0 to 4 32 Bytes DATA of indexed log arguments.
|
||||
# (In solidity: The first topic is the hash of the signature of the event.
|
||||
# (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
|
||||
|
||||
RlpEncodedBytes* = distinct seq[byte]
|
||||
|
||||
|
|
|
@ -34,8 +34,9 @@ type
|
|||
withdrawals*: Opt[seq[WithdrawalV1]]
|
||||
blobGasUsed*: Opt[Quantity]
|
||||
excessBlobGas*: Opt[Quantity]
|
||||
depositReceipts*: Opt[seq[DepositReceiptV1]]
|
||||
exits*: Opt[seq[WithdrawalRequestV1]]
|
||||
depositRequests*: Opt[seq[DepositRequestV1]]
|
||||
withdrawalRequests*: Opt[seq[WithdrawalRequestV1]]
|
||||
consolidationRequests*:Opt[seq[ConsolidationRequestV1]]
|
||||
|
||||
PayloadAttributes* = object
|
||||
timestamp*: Quantity
|
||||
|
@ -64,7 +65,9 @@ type
|
|||
{.push raises: [].}
|
||||
|
||||
func version*(payload: ExecutionPayload): Version =
|
||||
if payload.depositReceipts.isSome or payload.exits.isSome:
|
||||
if payload.depositRequests.isSome or
|
||||
payload.withdrawalRequests.isSome or
|
||||
payload.consolidationRequests.isSome:
|
||||
Version.V4
|
||||
elif payload.blobGasUsed.isSome or payload.excessBlobGas.isSome:
|
||||
Version.V3
|
||||
|
@ -272,8 +275,9 @@ func V4*(p: ExecutionPayload): ExecutionPayloadV4 =
|
|||
withdrawals: p.withdrawals.get,
|
||||
blobGasUsed: p.blobGasUsed.get(0.Quantity),
|
||||
excessBlobGas: p.excessBlobGas.get(0.Quantity),
|
||||
depositRequests: p.depositReceipts.get(newSeq[DepositReceiptV1]()),
|
||||
withdrawalRequests: p.exits.get(newSeq[WithdrawalRequestV1]())
|
||||
depositRequests: p.depositRequests.get(newSeq[DepositRequestV1]()),
|
||||
withdrawalRequests: p.withdrawalRequests.get(newSeq[WithdrawalRequestV1]()),
|
||||
consolidationRequests: p.consolidationRequests.get(newSeq[ConsolidationRequestV1]()),
|
||||
)
|
||||
|
||||
func V1*(p: ExecutionPayloadV1OrV2): ExecutionPayloadV1 =
|
||||
|
@ -390,8 +394,9 @@ func executionPayload*(p: ExecutionPayloadV4): ExecutionPayload =
|
|||
withdrawals: Opt.some(p.withdrawals),
|
||||
blobGasUsed: Opt.some(p.blobGasUsed),
|
||||
excessBlobGas: Opt.some(p.excessBlobGas),
|
||||
depositReceipts: Opt.some(p.depositRequests),
|
||||
exits: Opt.some(p.withdrawalRequests)
|
||||
depositRequests: Opt.some(p.depositRequests),
|
||||
withdrawalRequests: Opt.some(p.withdrawalRequests),
|
||||
consolidationRequests: Opt.some(p.consolidationRequests),
|
||||
)
|
||||
|
||||
func executionPayload*(p: ExecutionPayloadV1OrV2): ExecutionPayload =
|
||||
|
|
Loading…
Reference in New Issue