Skip to content

Commit

Permalink
feature(op-geth): add opbnb gasless solution
Browse files Browse the repository at this point in the history
  • Loading branch information
redhdx committed Jul 18, 2024
1 parent 887404f commit 04d0f76
Show file tree
Hide file tree
Showing 21 changed files with 1,497 additions and 16 deletions.
3 changes: 3 additions & 0 deletions consensus/misc/eip1559/eip1559.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ func VerifyEIP1559Header(config *params.ChainConfig, parent, header *types.Heade
// CalcBaseFee calculates the basefee of the header.
// The time belongs to the new block to check if Canyon is activted or not
func CalcBaseFee(config *params.ChainConfig, parent *types.Header, time uint64) *big.Int {
if config.IsWright(time) {
return new(big.Int).SetUint64(params.OpBNBBaseFeeForGasLess)
}
// If the current block is the first EIP-1559 block, return the InitialBaseFee.
if !config.IsLondon(parent.Number) {
return new(big.Int).SetUint64(params.InitialBaseFee)
Expand Down
5 changes: 5 additions & 0 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ func (st *StateTransition) buyGas() error {
mgval = mgval.Mul(mgval, st.msg.GasPrice)
var l1Cost *big.Int
if st.evm.Context.L1CostFunc != nil && !st.msg.SkipAccountChecks {
if st.msg.GasPrice.Cmp(big.NewInt(0)) == 0 {
l1Cost = big.NewInt(0)
} else {
l1Cost = st.evm.Context.L1CostFunc(st.msg.RollupCostData, st.evm.Context.Time)
}
l1Cost = st.evm.Context.L1CostFunc(st.msg.RollupCostData, st.evm.Context.Time)
if l1Cost != nil {
mgval = mgval.Add(mgval, l1Cost)
Expand Down
Loading

0 comments on commit 04d0f76

Please sign in to comment.