review comments, pt. 1

This commit is contained in:
Sina Mahmoodi 2024-08-16 09:23:53 +02:00
parent e3cd999230
commit 33400fb152
4 changed files with 9 additions and 7 deletions

View file

@ -135,7 +135,7 @@ func ApplyTransactionWithEVM(msg *Message, config *params.ChainConfig, gp *GasPo
} }
*usedGas += result.UsedGas *usedGas += result.UsedGas
return MakeReceipt(evm, result, statedb, blockNumber, blockHash, tx, *usedGas, root), err return MakeReceipt(evm, result, statedb, blockNumber, blockHash, tx, *usedGas, root), nil
} }
// MakeReceipt generates the receipt object for a transaction given its execution result. // MakeReceipt generates the receipt object for a transaction given its execution result.

View file

@ -146,8 +146,9 @@ type Message struct {
// account nonce in state. // account nonce in state.
// This field will be set to true for operations like RPC eth_call. // This field will be set to true for operations like RPC eth_call.
SkipNonceChecks bool SkipNonceChecks bool
// When SkipFromEoACheck is true, the message sender is not checked to be an EOA.
SkipFromEoACheck bool // When SkipFromEOACheck is true, the message sender is not checked to be an EOA.
SkipFromEOACheck bool
} }
// TransactionToMessage converts a transaction into a Message. // TransactionToMessage converts a transaction into a Message.
@ -163,7 +164,7 @@ func TransactionToMessage(tx *types.Transaction, s types.Signer, baseFee *big.In
Data: tx.Data(), Data: tx.Data(),
AccessList: tx.AccessList(), AccessList: tx.AccessList(),
SkipNonceChecks: false, SkipNonceChecks: false,
SkipFromEoACheck: false, SkipFromEOACheck: false,
BlobHashes: tx.BlobHashes(), BlobHashes: tx.BlobHashes(),
BlobGasFeeCap: tx.BlobGasFeeCap(), BlobGasFeeCap: tx.BlobGasFeeCap(),
} }
@ -297,7 +298,7 @@ func (st *StateTransition) preCheck() error {
msg.From.Hex(), stNonce) msg.From.Hex(), stNonce)
} }
} }
if !msg.SkipFromEoACheck { if !msg.SkipFromEOACheck {
// Make sure the sender is an EOA // Make sure the sender is an EOA
codeHash := st.state.GetCodeHash(msg.From) codeHash := st.state.GetCodeHash(msg.From)
if codeHash != (common.Hash{}) && codeHash != types.EmptyCodeHash { if codeHash != (common.Hash{}) && codeHash != types.EmptyCodeHash {

View file

@ -172,7 +172,8 @@ func init() {
} }
} }
// Copy returns a copy of the precompiled contracts. // Copy returns a copy of the precompiled contracts. The precompiled
// contracts are shallow-copied. It should be safe as they are stateless/immutable.
func (p PrecompiledContracts) Copy() PrecompiledContracts { func (p PrecompiledContracts) Copy() PrecompiledContracts {
c := make(PrecompiledContracts) c := make(PrecompiledContracts)
for k, v := range p { for k, v := range p {

View file

@ -465,7 +465,7 @@ func (args *TransactionArgs) ToMessage(baseFee *big.Int, skipNonceCheck, skipEoA
BlobGasFeeCap: (*big.Int)(args.BlobFeeCap), BlobGasFeeCap: (*big.Int)(args.BlobFeeCap),
BlobHashes: args.BlobHashes, BlobHashes: args.BlobHashes,
SkipNonceChecks: skipNonceCheck, SkipNonceChecks: skipNonceCheck,
SkipFromEoACheck: skipEoACheck, SkipFromEOACheck: skipEoACheck,
} }
} }