Skip to content

Commit

Permalink
Minor fix for getting nonces to bump (ethereum#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcontracts authored Nov 11, 2020
1 parent 178367c commit cf49df7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
istanbul := st.evm.ChainConfig().IsIstanbul(st.evm.BlockNumber)
contractCreation := msg.To() == nil

// OVM_ADDITION
initialNonce := st.state.GetNonce(msg.From())

// TODO(mark): pay intrinsic gas function needs to be updated
gas, err := IntrinsicGas(st.data, contractCreation, homestead, istanbul)
if err != nil {
Expand Down Expand Up @@ -246,12 +249,22 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
// OVM_DISABLED
st.state.SetNonce(msg.From(), st.state.GetNonce(msg.From())+1)
} else {
// OVM_ENABLED
if msg.From() == GodAddress {
st.state.SetNonce(msg.From(), st.state.GetNonce(msg.From())+1)
}
}

ret, st.gas, vmerr = st.evm.Call(sender, st.to(), st.data, st.gas, st.value)

// OVM_NOTE: We have to set our account nonce if it wasn't changed or we'll
// get an annoying infinite loop in geth.
if vm.UsingOVM {
// OVM_ENABLED
if st.state.GetNonce(msg.From()) != initialNonce+1 {
st.state.SetNonce(msg.From(), initialNonce+1)
}
}
}

if vmerr != nil {
Expand Down

0 comments on commit cf49df7

Please sign in to comment.