Skip to content

Commit

Permalink
Add OriginWasRemapped to TxContext
Browse files Browse the repository at this point in the history
  • Loading branch information
edfelten committed Nov 3, 2021
1 parent eab9acc commit f81705d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ type callMsg struct {
ethereum.CallMsg
}

func (m callMsg) UnderlyingTransaction() *types.Transaction { return nil }
func (m callMsg) From() common.Address { return m.CallMsg.From }
func (m callMsg) Nonce() uint64 { return 0 }
func (m callMsg) IsFake() bool { return true }
Expand Down
12 changes: 5 additions & 7 deletions core/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,12 @@ func NewEVMBlockContext(header *types.Header, chain ChainContext, author *common

// NewEVMTxContext creates a new transaction context for a single transaction.
func NewEVMTxContext(msg Message) vm.TxContext {
return vm.TxContext{
Origin: msg.From(),
GasPrice: new(big.Int).Set(msg.GasPrice()),
originWasRemapped := false
tx := msg.UnderlyingTransaction()
if tx != nil {
txType := tx.Type()
originWasRemapped = txType == types.ArbitrumUnsignedTxType || txType == types.ArbitrumContractTxType
}
}

// NewEVMTxContextWithRemapInfo creates a new transaction context for a single transaction.
func NewEVMTxContextWithRemapInfo(msg Message, originWasRemapped bool) vm.TxContext {
return vm.TxContext{
Origin: msg.From(),
GasPrice: new(big.Int).Set(msg.GasPrice()),
Expand Down
1 change: 1 addition & 0 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ type StateTransition struct {

// Message represents a message sent to a contract.
type Message interface {
UnderlyingTransaction() *types.Transaction
From() common.Address
To() *common.Address

Expand Down

0 comments on commit f81705d

Please sign in to comment.