diff --git a/consensus/consortium/common/contract.go b/consensus/consortium/common/contract.go index 7f6f5a56a..8f35e0687 100644 --- a/consensus/consortium/common/contract.go +++ b/consensus/consortium/common/contract.go @@ -208,6 +208,7 @@ func (c *ContractIntegrator) WrapUpEpoch(opts *ApplyTransactOpts) error { false, nil, nil, + nil, ) if err = ApplyTransaction(msg, opts); err != nil { @@ -249,6 +250,7 @@ func (c *ContractIntegrator) SubmitBlockReward(opts *ApplyTransactOpts) error { false, nil, nil, + nil, ) if err = ApplyTransaction(msg, opts); err != nil { @@ -282,6 +284,7 @@ func (c *ContractIntegrator) Slash(opts *ApplyTransactOpts, spoiledValidator com false, nil, nil, + nil, ) if err = ApplyTransaction(msg, opts); err != nil { @@ -313,6 +316,7 @@ func (c *ContractIntegrator) FinalityReward(opts *ApplyTransactOpts, votedValida false, nil, nil, + nil, ) if err = ApplyTransaction(msg, opts); err != nil { diff --git a/consensus/consortium/common/contract_test.go b/consensus/consortium/common/contract_test.go index 7ef297019..719dbad59 100644 --- a/consensus/consortium/common/contract_test.go +++ b/consensus/consortium/common/contract_test.go @@ -313,7 +313,7 @@ func TestApplyTransaction(t *testing.T) { t.Fatal(err) } msg := types.NewMessage(minerAddr, tx.To(), tx.Nonce(), tx.Value(), tx.Gas(), - tx.GasPrice(), tx.GasFeeCap(), tx.GasTipCap(), tx.Data(), nil, false, nil, nil) + tx.GasPrice(), tx.GasFeeCap(), tx.GasTipCap(), tx.Data(), nil, false, nil, nil, nil) state, err := state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase()), nil) if err != nil { diff --git a/core/types/transaction.go b/core/types/transaction.go index 21ef6ec0e..75c003233 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -627,6 +627,7 @@ func NewMessage( isFake bool, blobFeeCap *big.Int, blobHashes []common.Hash, + authList []Authorization, ) Message { return Message{ from: from, @@ -644,6 +645,7 @@ func NewMessage( expiredTime: 0, blobGasFeeCap: blobFeeCap, blobHashes: blobHashes, + authList: authList, } } diff --git a/eth/gasestimator/gasestimator.go b/eth/gasestimator/gasestimator.go index 886cc4c6e..97db9f814 100644 --- a/eth/gasestimator/gasestimator.go +++ b/eth/gasestimator/gasestimator.go @@ -211,6 +211,7 @@ func execute(ctx context.Context, call core.Message, opts *Options, gasLimit uin true, call.BlobGasFeeCap(), call.BlobHashes(), + nil, ) // Execute the call and separate execution faults caused by a lack of gas or diff --git a/eth/tracers/internal/tracetest/calltrace_test.go b/eth/tracers/internal/tracetest/calltrace_test.go index b570ce95b..48f9b66c3 100644 --- a/eth/tracers/internal/tracetest/calltrace_test.go +++ b/eth/tracers/internal/tracetest/calltrace_test.go @@ -359,7 +359,7 @@ func TestInternals(t *testing.T) { }, false, rawdb.HashScheme) defer triedb.Close() evm := vm.NewEVM(context, txContext, statedb, params.MainnetChainConfig, vm.Config{Tracer: tc.tracer}) - msg := types.NewMessage(origin, &to, 0, big.NewInt(0), 50000, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, false, nil, nil) + msg := types.NewMessage(origin, &to, 0, big.NewInt(0), 50000, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, false, nil, nil, nil) st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(msg.Gas())) if _, err := st.TransitionDb(); err != nil { t.Fatalf("test %v: failed to execute transaction: %v", tc.name, err) diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index ff36bdc39..bae02e669 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -66,6 +66,9 @@ type TransactionArgs struct { Commitments []kzg4844.Commitment `json:"commitments"` Proofs []kzg4844.Proof `json:"proofs"` + // For SetCodeTxType + AuthorizationList []types.Authorization `json:"authorizationList"` + // This configures whether blobs are allowed to be passed. blobSidecarAllowed bool } @@ -297,7 +300,7 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (t if args.BlobHashes != nil && args.BlobFeeCap == nil { args.BlobFeeCap = new(hexutil.Big) } - msg := types.NewMessage(addr, args.To, 0, value, gas, gasPrice, gasFeeCap, gasTipCap, data, accessList, true, (*big.Int)(args.BlobFeeCap), args.BlobHashes) + msg := types.NewMessage(addr, args.To, 0, value, gas, gasPrice, gasFeeCap, gasTipCap, data, accessList, true, (*big.Int)(args.BlobFeeCap), args.BlobHashes, args.AuthorizationList) return msg, nil } @@ -306,6 +309,23 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (t func (args *TransactionArgs) toTransaction() *types.Transaction { var data types.TxData switch { + case len(args.AuthorizationList) != 0: + al := types.AccessList{} + if args.AccessList != nil { + al = *args.AccessList + } + data = &types.SetCodeTx{ + To: *args.To, + ChainID: args.ChainID.ToInt().Uint64(), + Nonce: uint64(*args.Nonce), + Gas: uint64(*args.Gas), + GasFeeCap: uint256.MustFromBig((*big.Int)(args.MaxFeePerGas)), + GasTipCap: uint256.MustFromBig((*big.Int)(args.MaxPriorityFeePerGas)), + Value: uint256.MustFromBig((*big.Int)(args.Value)), + Data: args.data(), + AccessList: al, + AuthList: args.AuthorizationList, + } case len(args.BlobHashes) != 0: al := types.AccessList{} if args.AccessList != nil { diff --git a/les/odr_test.go b/les/odr_test.go index 9a4009100..50a66f5c5 100644 --- a/les/odr_test.go +++ b/les/odr_test.go @@ -136,7 +136,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, config *params.Chai from := statedb.GetOrNewStateObject(bankAddr) from.SetBalance(math.MaxBig256) - msg := callmsg{types.NewMessage(from.Address(), &testContractAddr, 0, new(big.Int), 100000, big.NewInt(params.InitialBaseFee), big.NewInt(params.InitialBaseFee), new(big.Int), data, nil, true, nil, nil)} + msg := callmsg{types.NewMessage(from.Address(), &testContractAddr, 0, new(big.Int), 100000, big.NewInt(params.InitialBaseFee), big.NewInt(params.InitialBaseFee), new(big.Int), data, nil, true, nil, nil, nil)} context := core.NewEVMBlockContext(header, bc, nil) txContext := core.NewEVMTxContext(msg) @@ -151,7 +151,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, config *params.Chai header := lc.GetHeaderByHash(bhash) state := light.NewState(ctx, header, lc.Odr()) state.SetBalance(bankAddr, math.MaxBig256) - msg := callmsg{types.NewMessage(bankAddr, &testContractAddr, 0, new(big.Int), 100000, big.NewInt(params.InitialBaseFee), big.NewInt(params.InitialBaseFee), new(big.Int), data, nil, true, nil, nil)} + msg := callmsg{types.NewMessage(bankAddr, &testContractAddr, 0, new(big.Int), 100000, big.NewInt(params.InitialBaseFee), big.NewInt(params.InitialBaseFee), new(big.Int), data, nil, true, nil, nil, nil)} context := core.NewEVMBlockContext(header, lc, nil) txContext := core.NewEVMTxContext(msg) vmenv := vm.NewEVM(context, txContext, state, config, vm.Config{NoBaseFee: true}) diff --git a/light/odr_test.go b/light/odr_test.go index 6929696cc..1eab1eb4a 100644 --- a/light/odr_test.go +++ b/light/odr_test.go @@ -194,7 +194,7 @@ func odrContractCall(ctx context.Context, db ethdb.Database, bc *core.BlockChain // Perform read-only call. st.SetBalance(testBankAddress, math.MaxBig256) - msg := callmsg{types.NewMessage(testBankAddress, &testContractAddr, 0, new(big.Int), 1000000, big.NewInt(params.InitialBaseFee), big.NewInt(params.InitialBaseFee), new(big.Int), data, nil, true, nil, nil)} + msg := callmsg{types.NewMessage(testBankAddress, &testContractAddr, 0, new(big.Int), 1000000, big.NewInt(params.InitialBaseFee), big.NewInt(params.InitialBaseFee), new(big.Int), data, nil, true, nil, nil, nil)} txContext := core.NewEVMTxContext(msg) context := core.NewEVMBlockContext(header, chain, nil) vmenv := vm.NewEVM(context, txContext, st, config, vm.Config{NoBaseFee: true}) diff --git a/tests/state_test_util.go b/tests/state_test_util.go index e3f576718..54681abee 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -368,8 +368,10 @@ func (tx *stTransaction) toMessage(ps stPostState, baseFee *big.Int) (core.Messa return nil, fmt.Errorf("no gas price provided") } + // TODO: pass authList as go-ethereum did, leave it to "tests" update tasks + // https://github.com/ethereum/go-ethereum/blob/aaaf01d71232d1b7da5ab2ae9258f7fb9f22b1bf/tests/state_test_util.go#L479 msg := types.NewMessage(from, to, tx.Nonce, value, gasLimit, gasPrice, - tx.MaxFeePerGas, tx.MaxPriorityFeePerGas, data, accessList, false, nil, nil) + tx.MaxFeePerGas, tx.MaxPriorityFeePerGas, data, accessList, false, nil, nil, nil) return msg, nil }