Skip to content

Commit 78dee23

Browse files
committed
wip: new usage of eth_simulateV1
1 parent 4ab961f commit 78dee23

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

testing/simulated/execution/simulation_client.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929

3030
"github.com/berachain/beacon-kit/execution/client"
3131
gethprimitives "github.com/berachain/beacon-kit/geth-primitives"
32+
"github.com/berachain/beacon-kit/primitives/crypto"
3233
"github.com/berachain/beacon-kit/primitives/encoding/json"
3334
"github.com/ethereum/go-ethereum/common"
3435
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -66,16 +67,17 @@ type TransactionArgs struct {
6667

6768
// BlockOverrides holds optional block-level overrides for simulation.
6869
type BlockOverrides struct {
69-
Number *hexutil.Big `json:"number,omitempty"`
70-
Difficulty *hexutil.Big `json:"difficulty,omitempty"`
71-
Time *hexutil.Uint64 `json:"time,omitempty"`
72-
GasLimit *hexutil.Uint64 `json:"gasLimit,omitempty"`
73-
FeeRecipient *common.Address `json:"feeRecipient,omitempty"`
74-
PrevRandao *common.Hash `json:"prevRandao,omitempty"`
75-
BaseFeePerGas *hexutil.Big `json:"baseFeePerGas,omitempty"`
76-
BlobBaseFee *hexutil.Big `json:"blobBaseFee,omitempty"`
77-
BeaconRoot *common.Hash `json:"beaconRoot,omitempty"`
78-
Withdrawals gethprimitives.Withdrawals
70+
Number *hexutil.Big `json:"number,omitempty"`
71+
Difficulty *hexutil.Big `json:"difficulty,omitempty"`
72+
Time *hexutil.Uint64 `json:"time,omitempty"`
73+
GasLimit *hexutil.Uint64 `json:"gasLimit,omitempty"`
74+
FeeRecipient *common.Address `json:"feeRecipient,omitempty"`
75+
PrevRandao *common.Hash `json:"prevRandao,omitempty"`
76+
BaseFeePerGas *hexutil.Big `json:"baseFeePerGas,omitempty"`
77+
BlobBaseFee *hexutil.Big `json:"blobBaseFee,omitempty"`
78+
BeaconRoot *common.Hash `json:"beaconRoot,omitempty"`
79+
Withdrawals *gethprimitives.Withdrawals
80+
ProposerPubkey *crypto.BLSPubkey
7981
}
8082

8183
// SimBlock is a block containing calls and optional overrides for simulation.

testing/simulated/utils.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func DefaultSimulationInput(
208208
overrideBaseFeePerGas := origBlock.GetBody().GetExecutionPayload().GetBaseFeePerGas().ToBig()
209209
overrideBeaconRoot := gethcommon.HexToHash(origBlock.GetParentBlockRoot().Hex())
210210
origWithdrawls := origBlock.GetBody().GetExecutionPayload().GetWithdrawals()
211-
overrideWithdrawals := *(*gethtypes.Withdrawals)(unsafe.Pointer(&origWithdrawls))
211+
overrideWithdrawals := (*gethtypes.Withdrawals)(unsafe.Pointer(&origWithdrawls))
212212

213213
calls, err := execution.TxsToTransactionArgs(chainSpec.DepositEth1ChainID(), txs)
214214
require.NoError(t, err)
@@ -224,6 +224,7 @@ func DefaultSimulationInput(
224224
BaseFeePerGas: (*hexutil.Big)(overrideBaseFeePerGas),
225225
BeaconRoot: &overrideBeaconRoot,
226226
Withdrawals: overrideWithdrawals,
227+
// TODO: Get the override proposer pubkey from beacon state.
227228
// TODO: Do we need to override blob base fee?
228229
},
229230
},

0 commit comments

Comments
 (0)