diff --git a/cmd/rpcdaemon/commands/eth_block.go b/cmd/rpcdaemon/commands/eth_block.go index 8257bbd4abd..b31e3674d88 100644 --- a/cmd/rpcdaemon/commands/eth_block.go +++ b/cmd/rpcdaemon/commands/eth_block.go @@ -93,7 +93,7 @@ func (api *APIImpl) CallBundle(ctx context.Context, txHashes []common.Hash, stat } ibs := state.New(stateReader) - parent := rawdb.ReadHeader(tx, hash, stateBlockNumber) + parent, _ := api.headerByRPCNumber(rpc.BlockNumber(stateBlockNumber), tx) if parent == nil { return nil, fmt.Errorf("block %d(%x) not found", stateBlockNumber, hash) } diff --git a/go.mod b/go.mod index 36a1285ca5a..d033500505c 100644 --- a/go.mod +++ b/go.mod @@ -302,6 +302,6 @@ replace ( github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-tendermint v0.0.0-20230417032003-4cda1f296fb2 github.com/grpc-ecosystem/grpc-gateway/v2 => github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20210702154020-550e1cd83ec1 github.com/ledgerwatch/erigon-lib => github.com/node-real/bsc-erigon-lib v1.0.2-0.20230724023158-8adca9da31b4 - github.com/ledgerwatch/erigon-snapshot => github.com/node-real/bsc-erigon-snapshot v1.0.1-0.20230920065254-96e73b3e4c1e + github.com/ledgerwatch/erigon-snapshot => github.com/node-real/bsc-erigon-snapshot v1.0.1-0.20231021015030-17ba1845df17 github.com/tendermint/tendermint => github.com/bnb-chain/tendermint v0.31.15 ) diff --git a/go.sum b/go.sum index a666bd6494e..d2c83e0b548 100644 --- a/go.sum +++ b/go.sum @@ -1221,8 +1221,8 @@ github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/node-real/bsc-erigon-lib v1.0.2-0.20230724023158-8adca9da31b4 h1:jbF1TMYLiYs2Mkgb/5aj8buz+28JivDVw0u1dqcD+gY= github.com/node-real/bsc-erigon-lib v1.0.2-0.20230724023158-8adca9da31b4/go.mod h1:VfsdM52udAY3ghsNxdJcIVQJDEqE5eVBkFfYQkNHnO4= -github.com/node-real/bsc-erigon-snapshot v1.0.1-0.20230920065254-96e73b3e4c1e h1:79/htDi94BTlgoomyhDMAU7Uh6GEPL1F9m49/DqduoI= -github.com/node-real/bsc-erigon-snapshot v1.0.1-0.20230920065254-96e73b3e4c1e/go.mod h1:3AuPxZc85jkehh/HA9h8gabv5MSi3kb/ddtzBsTVJFo= +github.com/node-real/bsc-erigon-snapshot v1.0.1-0.20231021015030-17ba1845df17 h1:zFAkTm6tkDYTc7A6LqLg1OMz2GTIQgGKr3JylF7vVAg= +github.com/node-real/bsc-erigon-snapshot v1.0.1-0.20231021015030-17ba1845df17/go.mod h1:3AuPxZc85jkehh/HA9h8gabv5MSi3kb/ddtzBsTVJFo= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.9-0.20211216163028-4472660a31a6 h1:iZ5rEHU561k2tdi/atkIsrP5/3AX3BjyhYtC96nJ260= diff --git a/turbo/snapshotsync/block_snapshots.go b/turbo/snapshotsync/block_snapshots.go index 5370d3e1ac6..36843b9908f 100644 --- a/turbo/snapshotsync/block_snapshots.go +++ b/turbo/snapshotsync/block_snapshots.go @@ -1325,6 +1325,7 @@ func DumpTxs(ctx context.Context, db kv.RoDB, segmentFile, tmpDir string, blockF } defer f.Close() + var prevTxID uint64 numBuf := make([]byte, binary.MaxVarintLen64) parseCtx := types2.NewTxParseContext(*chainID) parseCtx.WithSender(false) @@ -1415,8 +1416,18 @@ func DumpTxs(ctx context.Context, db kv.RoDB, segmentFile, tmpDir string, blockF if err := addSystemTx(tx, body.BaseTxId); err != nil { return false, err } + if prevTxID > 0 { + prevTxID++ + } else { + prevTxID = body.BaseTxId + } binary.BigEndian.PutUint64(numBuf, body.BaseTxId+1) - if err := tx.ForAmount(kv.EthTx, numBuf, body.TxAmount-2, func(_, tv []byte) error { + if err := tx.ForAmount(kv.EthTx, numBuf[:8], body.TxAmount-2, func(tk, tv []byte) error { + id := binary.BigEndian.Uint64(tk) + if prevTxID != 0 && id != prevTxID+1 { + panic(fmt.Sprintf("no gaps in tx ids are allowed: block %d does jump from %d to %d", blockNum, prevTxID, id)) + } + prevTxID = id parseCtx.WithSender(len(senders) == 0) valueBuf, err = parse(tv, valueBuf, senders, j) if err != nil { @@ -1436,7 +1447,7 @@ func DumpTxs(ctx context.Context, db kv.RoDB, segmentFile, tmpDir string, blockF if err := addSystemTx(tx, body.BaseTxId+uint64(body.TxAmount)-1); err != nil { return false, err } - + prevTxID++ select { case <-ctx.Done(): return false, ctx.Err()