diff --git a/rollup/go.mod b/rollup/go.mod index 141cbfd466..9c7bbd6f9b 100644 --- a/rollup/go.mod +++ b/rollup/go.mod @@ -11,7 +11,7 @@ require ( github.com/holiman/uint256 v1.2.4 github.com/mitchellh/mapstructure v1.5.0 github.com/prometheus/client_golang v1.16.0 - github.com/scroll-tech/da-codec v0.1.1-0.20241007172557-669b454fad33 + github.com/scroll-tech/da-codec v0.1.1-0.20241011074604-986850d727f5 github.com/scroll-tech/go-ethereum v1.10.14-0.20241004182217-88bdce77a6e7 github.com/smartystreets/goconvey v1.8.0 github.com/spf13/viper v1.19.0 diff --git a/rollup/go.sum b/rollup/go.sum index 88c8025403..bfe880eeee 100644 --- a/rollup/go.sum +++ b/rollup/go.sum @@ -250,8 +250,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/scroll-tech/da-codec v0.1.1-0.20241007172557-669b454fad33 h1:e7ZFclDH2hX9JE/+5I5MpXrVe4mB5a3EpDUtc2QI+I0= -github.com/scroll-tech/da-codec v0.1.1-0.20241007172557-669b454fad33/go.mod h1:6jxEQvNc7GQKMSUi25PthAUY3WnZL8CN0yWivBgAXi0= +github.com/scroll-tech/da-codec v0.1.1-0.20241011074604-986850d727f5 h1:Ewhl6QVEPlGMpGOldAUytMeIyKmHFCiHKoEMg/b05+Y= +github.com/scroll-tech/da-codec v0.1.1-0.20241011074604-986850d727f5/go.mod h1:6jxEQvNc7GQKMSUi25PthAUY3WnZL8CN0yWivBgAXi0= github.com/scroll-tech/go-ethereum v1.10.14-0.20241004182217-88bdce77a6e7 h1:uj6kHOscSmho2oQsIFdTL5yWN/84mdd+LTQkdfBSH/s= github.com/scroll-tech/go-ethereum v1.10.14-0.20241004182217-88bdce77a6e7/go.mod h1:DWGorBlnlr6aLwN9IX4LLuHcgbMeYUUEvLjn186CNAY= github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE= diff --git a/rollup/internal/controller/watcher/batch_proposer.go b/rollup/internal/controller/watcher/batch_proposer.go index 319f84c817..4d2ba8b58b 100644 --- a/rollup/internal/controller/watcher/batch_proposer.go +++ b/rollup/internal/controller/watcher/batch_proposer.go @@ -3,6 +3,7 @@ package watcher import ( "context" "fmt" + "math/big" "time" "github.com/prometheus/client_golang/prometheus" @@ -247,7 +248,8 @@ func (p *BatchProposer) proposeBatch() error { return err } - maxChunksThisBatch := encoding.GetMaxChunksPerBatch(p.chainCfg, firstUnbatchedChunk.StartBlockNumber, firstUnbatchedChunk.StartBlockTime) + codec := encoding.CodecFromConfig(p.chainCfg, new(big.Int).SetUint64(firstUnbatchedChunk.StartBlockNumber), firstUnbatchedChunk.StartBlockTime) + maxChunksThisBatch := codec.MaxNumChunksPerBatch() // select at most maxChunkNumPerBatch chunks dbChunks, err := p.chunkOrm.GetChunksGEIndex(p.ctx, firstUnbatchedChunkIndex, int(maxChunksThisBatch))