From 78dee2386c51d28eaaa46b00440cf353bfa30210 Mon Sep 17 00:00:00 2001 From: Cal Bera Date: Mon, 14 Jul 2025 16:19:19 -0700 Subject: [PATCH] wip: new usage of eth_simulateV1 --- .../simulated/execution/simulation_client.go | 22 ++++++++++--------- testing/simulated/utils.go | 3 ++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/testing/simulated/execution/simulation_client.go b/testing/simulated/execution/simulation_client.go index c196ba51aa..a029eca0ad 100644 --- a/testing/simulated/execution/simulation_client.go +++ b/testing/simulated/execution/simulation_client.go @@ -29,6 +29,7 @@ import ( "github.com/berachain/beacon-kit/execution/client" gethprimitives "github.com/berachain/beacon-kit/geth-primitives" + "github.com/berachain/beacon-kit/primitives/crypto" "github.com/berachain/beacon-kit/primitives/encoding/json" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -66,16 +67,17 @@ type TransactionArgs struct { // BlockOverrides holds optional block-level overrides for simulation. type BlockOverrides struct { - Number *hexutil.Big `json:"number,omitempty"` - Difficulty *hexutil.Big `json:"difficulty,omitempty"` - Time *hexutil.Uint64 `json:"time,omitempty"` - GasLimit *hexutil.Uint64 `json:"gasLimit,omitempty"` - FeeRecipient *common.Address `json:"feeRecipient,omitempty"` - PrevRandao *common.Hash `json:"prevRandao,omitempty"` - BaseFeePerGas *hexutil.Big `json:"baseFeePerGas,omitempty"` - BlobBaseFee *hexutil.Big `json:"blobBaseFee,omitempty"` - BeaconRoot *common.Hash `json:"beaconRoot,omitempty"` - Withdrawals gethprimitives.Withdrawals + Number *hexutil.Big `json:"number,omitempty"` + Difficulty *hexutil.Big `json:"difficulty,omitempty"` + Time *hexutil.Uint64 `json:"time,omitempty"` + GasLimit *hexutil.Uint64 `json:"gasLimit,omitempty"` + FeeRecipient *common.Address `json:"feeRecipient,omitempty"` + PrevRandao *common.Hash `json:"prevRandao,omitempty"` + BaseFeePerGas *hexutil.Big `json:"baseFeePerGas,omitempty"` + BlobBaseFee *hexutil.Big `json:"blobBaseFee,omitempty"` + BeaconRoot *common.Hash `json:"beaconRoot,omitempty"` + Withdrawals *gethprimitives.Withdrawals + ProposerPubkey *crypto.BLSPubkey } // SimBlock is a block containing calls and optional overrides for simulation. diff --git a/testing/simulated/utils.go b/testing/simulated/utils.go index 59c2a11cec..bca6c77039 100644 --- a/testing/simulated/utils.go +++ b/testing/simulated/utils.go @@ -208,7 +208,7 @@ func DefaultSimulationInput( overrideBaseFeePerGas := origBlock.GetBody().GetExecutionPayload().GetBaseFeePerGas().ToBig() overrideBeaconRoot := gethcommon.HexToHash(origBlock.GetParentBlockRoot().Hex()) origWithdrawls := origBlock.GetBody().GetExecutionPayload().GetWithdrawals() - overrideWithdrawals := *(*gethtypes.Withdrawals)(unsafe.Pointer(&origWithdrawls)) + overrideWithdrawals := (*gethtypes.Withdrawals)(unsafe.Pointer(&origWithdrawls)) calls, err := execution.TxsToTransactionArgs(chainSpec.DepositEth1ChainID(), txs) require.NoError(t, err) @@ -224,6 +224,7 @@ func DefaultSimulationInput( BaseFeePerGas: (*hexutil.Big)(overrideBaseFeePerGas), BeaconRoot: &overrideBeaconRoot, Withdrawals: overrideWithdrawals, + // TODO: Get the override proposer pubkey from beacon state. // TODO: Do we need to override blob base fee? }, },