Skip to content

Commit 32ebb34

Browse files
Fixes to get tx gas to work correctly (ethereum#148)
1 parent 8debb8c commit 32ebb34

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

core/state_transition.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
247247
if msg.L1MessageSender() != nil {
248248
l1MessageSender = msg.L1MessageSender().Hex()
249249
}
250+
st.gas = msg.Gas()
250251
log.Debug("Applying transaction", "from", sender.Address().Hex(), "to", to, "nonce", msg.Nonce(), "l1MessageSender", l1MessageSender, "data", hexutil.Encode(msg.Data()))
251252
}
252253

core/state_transition_ovm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func toExecutionManagerRun(evm *vm.EVM, msg Message) (Message, error) {
3030
uint8(msg.QueueOrigin().Uint64()),
3131
*msg.L1MessageSender(),
3232
*msg.To(),
33-
big.NewInt(int64(msg.Gas())),
33+
big.NewInt(int64(evm.Context.GasLimit)),
3434
msg.Data(),
3535
}
3636

internal/ethapi/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash
903903
return 0, err
904904
}
905905
// For now always return the gas limit
906-
return hexutil.Uint64(block.GasLimit() - 1), nil
906+
return hexutil.Uint64(block.GasLimit() - 2000000), nil
907907
}
908908

909909
// EstimateGas returns an estimate of the amount of gas needed to execute the

0 commit comments

Comments
 (0)