Skip to content

Commit

Permalink
Revert regression with zero address msg sender (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
karlfloersch committed Oct 6, 2020
1 parent 31b5eb0 commit ac9a47f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package core

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

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

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

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

l1MessageSender := msg.L1MessageSender()
if l1MessageSender == nil || bytes.Equal(l1MessageSender.Bytes(), ZeroAddress.Bytes()) {
addr := common.HexToAddress("0000000000000000000000000000000000000000")
if l1MessageSender == nil {
addr := common.HexToAddress("")
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 {
Expand Down

0 comments on commit ac9a47f

Please sign in to comment.