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 Nov 4, 2022
1 parent 6afc95b commit 687b14e
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 @@ -225,6 +225,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 @@ -375,7 +377,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 687b14e

Please sign in to comment.