Skip to content

Commit

Permalink
Merge pull request #263 from bnb-chain/develop
Browse files Browse the repository at this point in the history
chore: prepare for v0.5.2
  • Loading branch information
joeylichang authored Feb 19, 2025
2 parents 4748aa3 + f3ff1bc commit cd221b5
Show file tree
Hide file tree
Showing 36 changed files with 462 additions and 58 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
working-directory: op-node
version: latest
args: -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is"
version: v1.63.4
args: -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 15m -e "errors.As" -e "errors.Is"

op-batcher-lint:
runs-on: ubuntu-latest
Expand All @@ -42,8 +42,8 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
working-directory: op-batcher
version: latest
args: -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is"
version: v1.63.4
args: -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 15m -e "errors.As" -e "errors.Is"

op-proposer-lint:
runs-on: ubuntu-latest
Expand All @@ -61,8 +61,8 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
working-directory: op-proposer
version: latest
args: -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is"
version: v1.63.4
args: -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 15m -e "errors.As" -e "errors.Is"

op-service-lint:
runs-on: ubuntu-latest
Expand All @@ -80,8 +80,8 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
working-directory: op-service
version: latest
args: -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 5m -e "errors.As" -e "errors.Is"
version: v1.63.4
args: -E goimports,sqlclosecheck,bodyclose,asciicheck,misspell,errorlint --timeout 15m -e "errors.As" -e "errors.Is"

op-node-test:
runs-on: ubuntu-latest
Expand Down
29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## v0.5.2

This is a minor release and must upgrade to this release before the Pascal & Prague hardforks time of BSC, supports EIP-7702.

- Testnet: Feb-25-2025 06:00 AM +UTC
- Mainnet: Late March.

This release adds a new bootnode in the US region for testnet, improves sequencer recovery functionality, introduces a new engine_opSealPayload API, and updates documentation links.

This release supports EIP-7702, op-node is compatible with type 7702 transactions from L1.

### What's Changed

* chore: add bootnode in us region(testnet) by @krish-nr in https://github.com/bnb-chain/opbnb/pull/249
* feat: handle sequencer recover related logic by @krish-nr in https://github.com/bnb-chain/opbnb/pull/250
* feat: add new engine_opSealPayload API by @bnoieh in https://github.com/bnb-chain/opbnb/pull/248
* doc: update outdated links in readme by @owen-reorg in https://github.com/bnb-chain/opbnb/pull/253
* feat: EIP-7702 adaption by @krish-nr in https://github.com/bnb-chain/opbnb/pull/261

### Docker Images

- ghcr.io/bnb-chain/op-node:v0.5.2
- ghcr.io/bnb-chain/op-batcher:v0.5.2
- ghcr.io/bnb-chain/op-proposer:v0.5.2

**Full Changelog**: https://github.com/bnb-chain/opbnb/compare/v0.5.1...v0.5.2

## v0.5.1

This is a minor release and upgrading is optional.
Expand Down Expand Up @@ -262,7 +289,7 @@ https://github.com/bnb-chain/opbnb/compare/v0.3.0...v0.3.1

## v0.3.0

This is a recommended release for op-node. This release brings in upstream updates, see https://github.com/bnb-chain/opbnb/pull/121 for the contents. This is also a ready release for the next planed fork, which will bring in canyon fork from upstream as well.
This is a recommended release for op-node. This release brings in upstream updates, see https://github.com/bnb-chain/opbnb/pull/121 for the contents. This is also a ready release for the next planned fork, which will bring in canyon fork from upstream as well.

### User Facing Changes

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# opBNB - High-performance layer 2 solution

The opBNB network is the Layer 2 scaling solution for the BNB Smart Chain(BSC) powered by [bedrock version](https://community.optimism.io/docs/developers/bedrock/) of Optimism OP Stack.
The opBNB network is the Layer 2 scaling solution for the BNB Smart Chain(BSC) powered by bedrock version of [Optimism OP Stack](https://docs.optimism.io/stack/getting-started).

It works by offloading transaction processing and resource usage from the BNB Smart Chain, while still posting data to the underlying network. Users interact with the opBNB network by depositing funds from BSC and using applications and contracts on opBNB. At its core, opBNB allows users to deposit and withdraw funds, use smart contracts, and view network data with high throughput and low fees. By leveraging Layer 2, opBNB is able to scale beyond the constraints of the BNB Smart Chain and provide an improved experience for users.

## Comparison

Besides the [differentiators of bedrock](https://community.optimism.io/docs/developers/bedrock/differences/), opBNB is the solution that we aim to provide the best optimistic rollup solution on the BSC.
Besides the [differentiators of OP Stack](https://docs.optimism.io/stack/differences), opBNB is the solution that we aim to provide the best optimistic rollup solution on the BSC.

- Capacity can reach to 100m gas per second, which is much higher than other layer 2 solutions on the Ethereum.
- Gas fee of transfer can reach as low as $0.005 on average.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ require (
rsc.io/tmplfunc v0.0.3 // indirect
)

replace github.com/ethereum/go-ethereum v1.13.15 => github.com/bnb-chain/op-geth v1.101315.2-0.0.20240823030609-c0f12a4e1b05
replace github.com/ethereum/go-ethereum v1.13.15 => github.com/bnb-chain/op-geth v1.101315.2-0.0.20250213114253-fbecb252643d

replace github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v1.0.0

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ github.com/bnb-chain/fastssz v0.1.2 h1:vTcXw5SwCtRYnl/BEclujiml7GXiVOZ74tub4GHpv
github.com/bnb-chain/fastssz v0.1.2/go.mod h1:KcabV+OEw2QwgyY8Fc88ZG79CKYkFdu0kKWyfA3dI6o=
github.com/bnb-chain/greenfield-cometbft v1.0.0 h1:0r6hOJWD/+es0gxP/exKuN/krgXAr3LCn5/XlcgDWr8=
github.com/bnb-chain/greenfield-cometbft v1.0.0/go.mod h1:f35mk/r5ab6yvzlqEWZt68LfUje68sYgMpVlt2CUYMk=
github.com/bnb-chain/op-geth v1.101315.2-0.0.20240823030609-c0f12a4e1b05 h1:Tyov2UCjIxxHt6ZX46T09CiKpKDY72AtjHzUQFK3SBA=
github.com/bnb-chain/op-geth v1.101315.2-0.0.20240823030609-c0f12a4e1b05/go.mod h1:hyHrrcHkUe3lRwfJs+JGrbOHp+pRdheRk+ren4TPhF8=
github.com/bnb-chain/op-geth v1.101315.2-0.0.20250213114253-fbecb252643d h1:zYSisO6VUWaQzieOnP7NcEXfwbcYa86CipNS+sXHb7Q=
github.com/bnb-chain/op-geth v1.101315.2-0.0.20250213114253-fbecb252643d/go.mod h1:hyHrrcHkUe3lRwfJs+JGrbOHp+pRdheRk+ren4TPhF8=
github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
Expand Down
38 changes: 31 additions & 7 deletions op-batcher/batcher/driver.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package batcher

import (
"bytes"
"context"
"errors"
"fmt"
Expand All @@ -12,6 +13,14 @@ import (
"sync/atomic"
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"

"github.com/ethereum-optimism/optimism/op-batcher/flags"
"github.com/ethereum-optimism/optimism/op-batcher/metrics"
"github.com/ethereum-optimism/optimism/op-node/rollup"
Expand All @@ -20,12 +29,6 @@ import (
"github.com/ethereum-optimism/optimism/op-service/dial"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
)

const LimitLoadBlocksOneTime uint64 = 30
Expand Down Expand Up @@ -678,10 +681,31 @@ func (l *BatchSubmitter) sendTransaction(ctx context.Context, txdata txData, que
candidate = l.calldataTxCandidate(data)
}

intrinsicGas, err := core.IntrinsicGas(candidate.TxData, nil, false, true, true, false)
intrinsicGas, err := core.IntrinsicGas(candidate.TxData, nil, nil, true, true, false, false)
if err != nil {
// we log instead of return an error here because txmgr can do its own gas estimation
l.Log.Error("Failed to calculate intrinsic gas", "err", err)
} else if candidate.Blobs == nil {
minimumGasRequired, err := func(data []byte) (uint64, error) {
var (
z = uint64(bytes.Count(data, []byte{0}))
nz = uint64(len(data)) - z
tokens = nz*params.TxTokenPerNonZeroByte + z
)
if (math.MaxUint64-params.TxGas)/params.TxCostFloorPerToken < tokens {
return 0, errors.New("intrinsic gas too low")
}
return params.TxGas + tokens*params.TxCostFloorPerToken, nil
}(candidate.TxData)

if err != nil {
return err
}
//
baseGas := intrinsicGas - params.TxGas
finalGasLimit := max(baseGas, minimumGasRequired) + params.TxGas

candidate.GasLimit = finalGasLimit
} else {
candidate.GasLimit = intrinsicGas
}
Expand Down
6 changes: 3 additions & 3 deletions op-chain-ops/cmd/check-derivation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func getRandomSignedTransaction(ctx context.Context, ethClient *ethclient.Client
var txData types.TxData
switch txType {
case types.LegacyTxType:
gasLimit, err := core.IntrinsicGas(data, nil, false, true, true, false)
gasLimit, err := core.IntrinsicGas(data, nil, nil, false, true, false, false)
if err != nil {
return nil, fmt.Errorf("failed to get intrinsicGas: %w", err)
}
Expand All @@ -242,7 +242,7 @@ func getRandomSignedTransaction(ctx context.Context, ethClient *ethclient.Client
Address: randomAddress,
StorageKeys: []common.Hash{common.HexToHash("0x1234")},
}}
gasLimit, err := core.IntrinsicGas(data, accessList, false, true, true, false)
gasLimit, err := core.IntrinsicGas(data, accessList, nil, false, true, false, false)
if err != nil {
return nil, fmt.Errorf("failed to get intrinsicGas: %w", err)
}
Expand All @@ -257,7 +257,7 @@ func getRandomSignedTransaction(ctx context.Context, ethClient *ethclient.Client
Data: data,
}
case types.DynamicFeeTxType:
gasLimit, err := core.IntrinsicGas(data, nil, false, true, true, false)
gasLimit, err := core.IntrinsicGas(data, nil, nil, false, true, false, false)
if err != nil {
return nil, fmt.Errorf("failed to get intrinsicGas: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions op-e2e/actions/l2_batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (s *L2Batcher) ActL2BatchSubmit(t Testing, txOpts ...func(tx *types.Dynamic
opt(rawTx)
}

gas, err := core.IntrinsicGas(rawTx.Data, nil, false, true, true, false)
gas, err := core.IntrinsicGas(rawTx.Data, nil, nil, false, true, false, false)
require.NoError(t, err, "need to compute intrinsic gas")
rawTx.Gas = gas
txData = rawTx
Expand Down Expand Up @@ -468,7 +468,7 @@ func (s *L2Batcher) ActL2BatchSubmitGarbage(t Testing, kind GarbageKind) {
GasFeeCap: gasFeeCap,
Data: outputFrame,
}
gas, err := core.IntrinsicGas(rawTx.Data, nil, false, true, true, false)
gas, err := core.IntrinsicGas(rawTx.Data, nil, nil, false, true, false, false)
require.NoError(t, err, "need to compute intrinsic gas")
rawTx.Gas = gas

Expand Down
2 changes: 1 addition & 1 deletion op-e2e/actions/l2_batcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ func BigL2Txs(gt *testing.T, deltaTimeOffset *hexutil.Uint64) {
data := make([]byte, 120_000) // very large L2 txs, as large as the tx-pool will accept
_, err := rng.Read(data[:]) // fill with random bytes, to make compression ineffective
require.NoError(t, err)
gas, err := core.IntrinsicGas(data, nil, false, true, true, false)
gas, err := core.IntrinsicGas(data, nil, nil, false, true, true, false)
require.NoError(t, err)
if gas > engine.engineApi.RemainingBlockGas() {
break
Expand Down
2 changes: 1 addition & 1 deletion op-e2e/actions/l2_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type safeDB interface {

func NewL2Verifier(t Testing, log log.Logger, l1 derive.L1Fetcher, blobsSrc derive.L1BlobsFetcher, plasmaSrc driver.PlasmaIface, eng L2API, cfg *rollup.Config, syncCfg *sync.Config, safeHeadListener safeDB) *L2Verifier {
metrics := &testutils.TestDerivationMetrics{}
engine := derive.NewEngineController(eng, log, metrics, cfg, syncCfg)
engine := derive.NewEngineController(eng, log, metrics, cfg, syncCfg, false)

clSync := clsync.NewCLSync(log, cfg, metrics, engine)

Expand Down
4 changes: 2 additions & 2 deletions op-e2e/actions/span_batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ func TestSpanBatchLowThroughputChain(gt *testing.T) {
data := make([]byte, rand.Intn(100))
_, err := crand.Read(data[:]) // fill with random bytes
require.NoError(t, err)
gas, err := core.IntrinsicGas(data, nil, false, true, true, false)
gas, err := core.IntrinsicGas(data, nil, nil, false, true, false, false)
require.NoError(t, err)
baseFee := seqEngine.l2Chain.CurrentBlock().BaseFee
nonce, err := cl.PendingNonceAt(t.Ctx(), addrs[userIdx])
Expand Down Expand Up @@ -663,7 +663,7 @@ func TestBatchEquivalence(gt *testing.T) {
data := make([]byte, rand.Intn(100))
_, err := crand.Read(data[:]) // fill with random bytes
require.NoError(t, err)
gas, err := core.IntrinsicGas(data, nil, false, true, true, false)
gas, err := core.IntrinsicGas(data, nil, nil, false, true, false, false)
require.NoError(t, err)
baseFee := seqEngine.l2Chain.CurrentBlock().BaseFee
nonce, err := seqEngCl.PendingNonceAt(t.Ctx(), addrs[userIdx])
Expand Down
2 changes: 1 addition & 1 deletion op-e2e/actions/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ func TestInvalidPayloadInSpanBatch(gt *testing.T) {
aliceNonce, err := seqEng.EthClient().PendingNonceAt(t.Ctx(), dp.Addresses.Alice)
require.NoError(t, err)
data := make([]byte, rand.Intn(100))
gas, err := core.IntrinsicGas(data, nil, false, true, true, false)
gas, err := core.IntrinsicGas(data, nil, nil, false, true, false, false)
require.NoError(t, err)
baseFee := seqEng.l2Chain.CurrentBlock().BaseFee
tx := types.MustSignNewTx(dp.Secrets.Alice, signer, &types.DynamicFeeTx{
Expand Down
2 changes: 1 addition & 1 deletion op-e2e/brotli_batcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestBrotliBatcherFjord(t *testing.T) {
opts.Value = big.NewInt(1_000_000_000)
opts.Nonce = 1 // Already have deposit
opts.ToAddr = &common.Address{0xff, 0xff}
opts.Gas, err = core.IntrinsicGas(opts.Data, nil, false, true, true, false)
opts.Gas, err = core.IntrinsicGas(opts.Data, nil, nil, false, true, false, false)
require.NoError(t, err)
opts.VerifyOnClients(l2Verif)
})
Expand Down
2 changes: 1 addition & 1 deletion op-e2e/eip4844_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func testSystem4844E2E(t *testing.T, multiBlob bool) {
opts.ToAddr = &common.Address{0xff, 0xff}
// put some random data in the tx to make it fill up 6 blobs (multi-blob case)
opts.Data = testutils.RandomData(rand.New(rand.NewSource(420)), 400)
opts.Gas, err = core.IntrinsicGas(opts.Data, nil, false, true, true, false)
opts.Gas, err = core.IntrinsicGas(opts.Data, nil, nil, false, true, false, false)
require.NoError(t, err)
opts.VerifyOnClients(l2Verif)
})
Expand Down
7 changes: 7 additions & 0 deletions op-node/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ var (
EnvVars: prefixEnvVars("SEQUENCER_PRIORITY"),
Category: SequencerCategory,
}
SequencerCombinedEngineFlag = &cli.BoolFlag{
Name: "sequencer.combined-engine",
Usage: "Enable sequencer select combined engine api when sealing payload.",
EnvVars: prefixEnvVars("SEQUENCER_COMBINED_ENGINE"),
Category: SequencerCategory,
}
SequencerL1Confs = &cli.Uint64Flag{
Name: "sequencer.l1-confs",
Usage: "Number of L1 blocks to keep distance from the L1 head as a sequencer for picking an L1 origin.",
Expand Down Expand Up @@ -437,6 +443,7 @@ var optionalFlags = []cli.Flag{
SequencerStoppedFlag,
SequencerMaxSafeLagFlag,
SequencerPriorityFlag,
SequencerCombinedEngineFlag,
SequencerL1Confs,
L1EpochPollIntervalFlag,
RuntimeConfigReloadIntervalFlag,
Expand Down
1 change: 1 addition & 0 deletions op-node/p2p/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var OpBNBTestnetBootnodes = []string{
// op-node
"enr:-J24QGQBeMsXOaCCaLWtNFSfb2Gv50DjGOKToH2HUTAIn9yXImowlRoMDNuPNhSBZNQGCCE8eAl5O3dsONuuQp5Qix2GAYjB7KHSgmlkgnY0gmlwhDREiqaHb3BzdGFja4PrKwCJc2VjcDI1NmsxoQL4I9wpEVDcUb8bLWu6V8iPoN5w8E8q-GrS5WUCygYUQ4N0Y3CCIyuDdWRwgiMr",
"enr:-J24QJKXHEkIhy0tmIk2EscMZ2aRrivNsZf_YhgIU51g4ZKHWY0BxW6VedRJ1jxmneW9v7JjldPOPpLkaNSo6cXGFxqGAYpK96oCgmlkgnY0gmlwhANzx96Hb3BzdGFja4PrKwCJc2VjcDI1NmsxoQMOCzUFffz04eyDrmkbaSCrMEvLvn5O4RZaZ5k1GV4wa4N0Y3CCIyuDdWRwgiMr",
"enr:-J24QJefH6RDbHDnNbL9ZNXS-eTEwX_OnpuQOjIpqKFGU6YLGpj5MAAPZ9ChvOhMfqAMaBhTkpMCFK-r6LZJ0WZqUBeGAZIOsduvgmlkgnY0gmlwhAPlGvCHb3BzdGFja4PrKwCJc2VjcDI1NmsxoQLCihReuE6ZRbGMotobGXEiNQ-GWFZ0R7VZWHitpi03sYN0Y3CCIyuDdWRwgiMs",
}

type HostMetrics interface {
Expand Down
4 changes: 4 additions & 0 deletions op-node/rollup/attributes/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io"
"strings"
"time"

"github.com/ethereum/go-ethereum"
Expand Down Expand Up @@ -153,6 +154,9 @@ func (eq *AttributesHandler) forceNextSafeAttributes(ctx context.Context, attrib
_ = eq.ec.CancelPayload(ctx, true)
return derive.NewResetError(fmt.Errorf("need reset to resolve pre-state problem: %w", err))
case derive.BlockInsertPayloadErr:
if strings.Contains(err.Error(), "INCONSISTENT") {
return derive.NewTemporaryError(fmt.Errorf("temporarily cannot insert new safe block: %w", err))
}
_ = eq.ec.CancelPayload(ctx, true)
eq.log.Warn("could not process payload derived from L1 data, dropping batch", "err", err)
// Count the number of deposits to see if the tx list is deposit only.
Expand Down
Loading

0 comments on commit cd221b5

Please sign in to comment.