Skip to content

Commit

Permalink
Provide gas to Call/Create in deposit transactions (ethereum#12)
Browse files Browse the repository at this point in the history
If the `st.gas` is not set, no gas is provided to the EVM resulting
in an immediate Out Of Gas error. While deposits do not affect the
gas pool, the EVM still expects to do gas metering.

Initial gas is still done for metering, but should be not used
for deposit transactions.
  • Loading branch information
trianglesphere authored and protolambda committed Sep 6, 2022
1 parent 80dd0c4 commit 9c45afd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ func (st *StateTransition) preCheck() error {
if st.msg.Nonce() == types.DepositsNonce {
// No fee fields to check, no nonce to check, and no need to check if EOA (L1 already verified it for us)
// Gas is free, but no refunds!
st.initialGas = st.msg.Gas()
st.gas += st.msg.Gas() // Add gas here in order to be able to execute calls.
return nil
}
// Only check transactions that are not fake
Expand Down Expand Up @@ -373,7 +375,7 @@ func (st *StateTransition) innerTransitionDb() (*ExecutionResult, error) {
// if deposit: skip refunds, skip tipping coinbase
if st.msg.Nonce() == types.DepositsNonce {
return &ExecutionResult{
UsedGas: st.gasUsed(),
UsedGas: 0, // Ignore actual used gas for deposits (until full deposit gas design is done)
Err: vmerr,
ReturnData: ret,
}, nil
Expand Down

0 comments on commit 9c45afd

Please sign in to comment.