Skip to content

Commit

Permalink
core: set sender to 0x00..00 when l1messagesender is not nil (#49)
Browse files Browse the repository at this point in the history
* core: set sender to 0x00..00 when l1messagesender is not nil

* core: l1message sender updates
  • Loading branch information
tynes authored Oct 6, 2020
1 parent 930c9f1 commit 31b5eb0
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package core

import (
"bytes"
"errors"
"fmt"
"math"
Expand All @@ -34,6 +35,7 @@ import (
var (
errInsufficientBalanceForGas = errors.New("insufficient balance to pay for gas")
executionManagerAbi abi.ABI
ZeroAddress = common.HexToAddress("0000000000000000000000000000000000000000")
)

func init() {
Expand Down Expand Up @@ -227,13 +229,6 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
vmerr error
)

to := "<nil>"
if msg.To() != nil {
to = msg.To().Hex()
}

log.Debug("Applying transaction", "from", sender.Address().Hex(), "to", to, "nonce", msg.Nonce(), "data", hexutil.Encode(msg.Data()))

executionMgrTime := st.evm.Time
if executionMgrTime.Cmp(big.NewInt(0)) == 0 {
executionMgrTime = big.NewInt(1)
Expand All @@ -243,10 +238,18 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
queueOrigin := big.NewInt(0)

l1MessageSender := msg.L1MessageSender()
if l1MessageSender == nil {
addr := common.HexToAddress("")
if l1MessageSender == nil || bytes.Equal(l1MessageSender.Bytes(), ZeroAddress.Bytes()) {
addr := common.HexToAddress("0000000000000000000000000000000000000000")
l1MessageSender = &addr
} else {
sender = vm.AccountRef(common.HexToAddress("0000000000000000000000000000000000000000"))
}

to := "<nil>"
if msg.To() != nil {
to = msg.To().Hex()
}
log.Debug("Applying transaction", "from", sender.Address().Hex(), "to", to, "nonce", msg.Nonce(), "l1MessageSender", l1MessageSender.Hex(), "data", hexutil.Encode(msg.Data()))

if contractCreation {
// Here we are going to call the EM directly
Expand Down

0 comments on commit 31b5eb0

Please sign in to comment.