mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-20 13:44:31 +00:00
This commit is contained in:
parent
835579e304
commit
3fd03e0814
8 changed files with 38 additions and 38 deletions
|
|
@ -119,18 +119,18 @@ func toWordSize(size uint64) uint64 {
|
|||
// A Message contains the data derived from a single transaction that is relevant to state
|
||||
// processing.
|
||||
type Message struct {
|
||||
To *common.Address
|
||||
From common.Address
|
||||
Nonce uint64
|
||||
Value *big.Int
|
||||
GasLimit uint64
|
||||
GasPrice *big.Int
|
||||
GasFeeCap *big.Int
|
||||
GasTipCap *big.Int
|
||||
BalanceTokenFee *big.Int
|
||||
Data []byte
|
||||
AccessList types.AccessList
|
||||
AuthList []types.SetCodeAuthorization
|
||||
To *common.Address
|
||||
From common.Address
|
||||
Nonce uint64
|
||||
Value *big.Int
|
||||
GasLimit uint64
|
||||
GasPrice *big.Int
|
||||
GasFeeCap *big.Int
|
||||
GasTipCap *big.Int
|
||||
BalanceTokenFee *big.Int
|
||||
Data []byte
|
||||
AccessList types.AccessList
|
||||
SetCodeAuthorizations []types.SetCodeAuthorization
|
||||
|
||||
// When SkipNonceChecks is true, the message nonce is not checked against the
|
||||
// account nonce in state.
|
||||
|
|
@ -144,19 +144,19 @@ type Message struct {
|
|||
// TransactionToMessage converts a transaction into a Message.
|
||||
func TransactionToMessage(tx *types.Transaction, s types.Signer, balanceFee, blockNumber, baseFee *big.Int) (*Message, error) {
|
||||
msg := &Message{
|
||||
Nonce: tx.Nonce(),
|
||||
GasLimit: tx.Gas(),
|
||||
GasPrice: new(big.Int).Set(tx.GasPrice()),
|
||||
GasFeeCap: new(big.Int).Set(tx.GasFeeCap()),
|
||||
GasTipCap: new(big.Int).Set(tx.GasTipCap()),
|
||||
To: tx.To(),
|
||||
Value: tx.Value(),
|
||||
Data: tx.Data(),
|
||||
AccessList: tx.AccessList(),
|
||||
AuthList: tx.AuthList(),
|
||||
SkipNonceChecks: false,
|
||||
SkipFromEOACheck: false,
|
||||
BalanceTokenFee: balanceFee,
|
||||
Nonce: tx.Nonce(),
|
||||
GasLimit: tx.Gas(),
|
||||
GasPrice: new(big.Int).Set(tx.GasPrice()),
|
||||
GasFeeCap: new(big.Int).Set(tx.GasFeeCap()),
|
||||
GasTipCap: new(big.Int).Set(tx.GasTipCap()),
|
||||
To: tx.To(),
|
||||
Value: tx.Value(),
|
||||
Data: tx.Data(),
|
||||
AccessList: tx.AccessList(),
|
||||
SetCodeAuthorizations: tx.SetCodeAuthorizations(),
|
||||
SkipNonceChecks: false,
|
||||
SkipFromEOACheck: false,
|
||||
BalanceTokenFee: balanceFee,
|
||||
}
|
||||
|
||||
if balanceFee != nil {
|
||||
|
|
@ -339,11 +339,11 @@ func (st *StateTransition) preCheck() error {
|
|||
}
|
||||
}
|
||||
// Check that EIP-7702 authorization list signatures are well formed.
|
||||
if msg.AuthList != nil {
|
||||
if msg.SetCodeAuthorizations != nil {
|
||||
if msg.To == nil {
|
||||
return fmt.Errorf("%w (sender %v)", ErrSetCodeTxCreate, msg.From)
|
||||
}
|
||||
if len(msg.AuthList) == 0 {
|
||||
if len(msg.SetCodeAuthorizations) == 0 {
|
||||
return fmt.Errorf("%w (sender %v)", ErrEmptyAuthList, msg.From)
|
||||
}
|
||||
}
|
||||
|
|
@ -387,7 +387,7 @@ func (st *StateTransition) TransitionDb(owner common.Address) (*ExecutionResult,
|
|||
)
|
||||
|
||||
// Check clauses 4-5, subtract intrinsic gas if everything is correct
|
||||
gas, err := IntrinsicGas(msg.Data, msg.AccessList, msg.AuthList, contractCreation, rules.IsHomestead, rules.IsEIP1559)
|
||||
gas, err := IntrinsicGas(msg.Data, msg.AccessList, msg.SetCodeAuthorizations, contractCreation, rules.IsHomestead, rules.IsEIP1559)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -429,8 +429,8 @@ func (st *StateTransition) TransitionDb(owner common.Address) (*ExecutionResult,
|
|||
st.state.SetNonce(msg.From, st.state.GetNonce(msg.From)+1)
|
||||
|
||||
// Apply EIP-7702 authorizations.
|
||||
if msg.AuthList != nil {
|
||||
for _, auth := range msg.AuthList {
|
||||
if msg.SetCodeAuthorizations != nil {
|
||||
for _, auth := range msg.SetCodeAuthorizations {
|
||||
// Note errors are ignored, we simply skip invalid authorizations here.
|
||||
st.applyAuthorization(msg, &auth)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -686,7 +686,7 @@ func (pool *TxPool) validateTxBasics(tx *types.Transaction, local bool) error {
|
|||
return nil
|
||||
}
|
||||
// Ensure the transaction has more gas than the basic tx fee.
|
||||
intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.AuthList(), tx.To() == nil, true, pool.eip1559.Load())
|
||||
intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, true, pool.eip1559.Load())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -392,8 +392,8 @@ func (tx *Transaction) EffectiveGasTipIntCmp(other *big.Int, baseFee *big.Int) i
|
|||
return tx.EffectiveGasTipValue(baseFee).Cmp(other)
|
||||
}
|
||||
|
||||
// AuthList returns the authorizations list of the transaction.
|
||||
func (tx *Transaction) AuthList() []SetCodeAuthorization {
|
||||
// SetCodeAuthorizations returns the authorizations list of the transaction.
|
||||
func (tx *Transaction) SetCodeAuthorizations() []SetCodeAuthorization {
|
||||
setcodetx, ok := tx.inner.(*SetCodeTx)
|
||||
if !ok {
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ func (s pragueSigner) Hash(tx *Transaction) common.Hash {
|
|||
tx.Value(),
|
||||
tx.Data(),
|
||||
tx.AccessList(),
|
||||
tx.AuthList(),
|
||||
tx.SetCodeAuthorizations(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ func (t *prestateTracer) OnTxStart(env *tracing.VMContext, tx *types.Transaction
|
|||
t.lookupAccount(env.Coinbase)
|
||||
|
||||
// Add accounts with authorizations to the prestate before they get applied.
|
||||
for _, auth := range tx.AuthList() {
|
||||
for _, auth := range tx.SetCodeAuthorizations() {
|
||||
addr, err := auth.Authority()
|
||||
if err != nil {
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -1746,7 +1746,7 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
|
|||
} else {
|
||||
result.GasPrice = (*hexutil.Big)(tx.GasFeeCap())
|
||||
}
|
||||
result.AuthorizationList = tx.AuthList()
|
||||
result.AuthorizationList = tx.SetCodeAuthorizations()
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ func (args *TransactionArgs) ToMessage(b AccountBackend, baseFee *big.Int, skipN
|
|||
GasTipCap: gasTipCap,
|
||||
Data: args.data(),
|
||||
AccessList: accessList,
|
||||
AuthList: args.AuthorizationList,
|
||||
SetCodeAuthorizations: args.AuthorizationList,
|
||||
SkipNonceChecks: skipNonceCheck,
|
||||
SkipFromEOACheck: skipEoACheck,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ func (tx *stTransaction) toMessage(ps stPostState, baseFee *big.Int) (*core.Mess
|
|||
GasTipCap: tx.MaxPriorityFeePerGas,
|
||||
Data: data,
|
||||
AccessList: accessList,
|
||||
AuthList: authList,
|
||||
SetCodeAuthorizations: authList,
|
||||
SkipNonceChecks: false,
|
||||
SkipFromEOACheck: false,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue