Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/testing/testing_buildBlockV1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
- name: Payload attributes
required: true
schema:
title: PayloadAttributesV3
title: PayloadAttributesV4
type: object
properties:
timestamp:
Expand All @@ -39,6 +39,10 @@
$ref: '#/components/schemas/Withdrawal'
parentBeaconBlockRoot:
$ref: '#/components/schemas/hash32'
slotNumber:
$ref: '#/components/schemas/uint'
targetGasLimit:
$ref: '#/components/schemas/uint'
- name: Transactions
required: true
description: |
Expand Down Expand Up @@ -106,6 +110,8 @@
suggestedFeeRecipient: '0x0000000000000000000000000000000000000000'
withdrawals: []
parentBeaconBlockRoot: '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884365149a42212e8822'
slotNumber: '0x0'
targetGasLimit: '0x1c9c380'
- name: Transactions
value: []
- name: Extra data
Expand Down
20 changes: 20 additions & 0 deletions tools/testgen/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -2732,6 +2732,11 @@ var TestingBuildBlockV1 = MethodTests{
payloadAttrs["parentBeaconBlockRoot"] = beaconRoot.Hex()
}

if t.chain.Config().IsAmsterdam(parentBlock.Number(), parentBlock.Time()) {
payloadAttrs["slotNumber"] = hexutil.Uint64(0)
payloadAttrs["targetGasLimit"] = hexutil.Uint64(parentBlock.GasLimit())
}

// Use sender index 2 so nonce matches geth state: index 0 (and 3) are used by
// eth_sendRawTransaction tests which call IncNonce, so they diverge from geth when run in full suite.
sender, nonce := t.chain.GetSender(2)
Expand Down Expand Up @@ -2821,6 +2826,11 @@ var TestingBuildBlockV1 = MethodTests{
payloadAttrs["parentBeaconBlockRoot"] = beaconRoot.Hex()
}

if t.chain.Config().IsAmsterdam(parentBlock.Number(), parentBlock.Time()) {
payloadAttrs["slotNumber"] = hexutil.Uint64(0)
payloadAttrs["targetGasLimit"] = hexutil.Uint64(parentBlock.GasLimit())
}

extraData := hexutil.Encode([]byte{})
var result map[string]interface{}
err := t.rpc.CallContext(ctx, &result, "testing_buildBlockV1",
Expand Down Expand Up @@ -2875,6 +2885,11 @@ var TestingBuildBlockV1 = MethodTests{
payloadAttrs["parentBeaconBlockRoot"] = beaconRoot.Hex()
}

if t.chain.Config().IsAmsterdam(parentBlock.Number(), parentBlock.Time()) {
payloadAttrs["slotNumber"] = hexutil.Uint64(0)
payloadAttrs["targetGasLimit"] = hexutil.Uint64(parentBlock.GasLimit())
}

// Add a transaction to the mempool first
sender, nonce := t.chain.GetSender(1)
basefee := parentBlock.BaseFee()
Expand Down Expand Up @@ -2957,6 +2972,11 @@ var TestingBuildBlockV1 = MethodTests{
payloadAttrs["parentBeaconBlockRoot"] = beaconRoot.Hex()
}

if t.chain.Config().IsAmsterdam(parentBlock.Number(), parentBlock.Time()) {
payloadAttrs["slotNumber"] = hexutil.Uint64(0)
payloadAttrs["targetGasLimit"] = hexutil.Uint64(parentBlock.GasLimit())
}

// Use an invalid nonce (e.g. 999) so the tx cannot be applied; client MUST fail.
sender, _ := t.chain.GetSender(2)
basefee := parentBlock.BaseFee()
Expand Down