Skip to content

Commit

Permalink
use IsL1MessageSkipped in da-codec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Oct 21, 2024
1 parent fa2e669 commit bbd7b73
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ require (
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7
github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7
github.com/rs/cors v1.7.0
github.com/scroll-tech/da-codec v0.1.1-0.20241020160143-e971fc973c48
github.com/scroll-tech/da-codec v0.1.1-0.20241021081245-8c5d2f0cd707
github.com/scroll-tech/zktrie v0.8.4
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/sourcegraph/conc v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/scroll-tech/da-codec v0.1.1-0.20241020160143-e971fc973c48 h1:R08Vpp1Zpv7gODO9lzl6gq2pf4BdYLxaz9DfIIOLNTI=
github.com/scroll-tech/da-codec v0.1.1-0.20241020160143-e971fc973c48/go.mod h1:odz1ck3umvYccCG03osaQBISAYGinZktZYbpk94fYRE=
github.com/scroll-tech/da-codec v0.1.1-0.20241021081245-8c5d2f0cd707 h1:uuBhIvpUK0+HuupF7TJAokdnRJc2FGrPQqplRY8jegw=
github.com/scroll-tech/da-codec v0.1.1-0.20241021081245-8c5d2f0cd707/go.mod h1:odz1ck3umvYccCG03osaQBISAYGinZktZYbpk94fYRE=
github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE=
github.com/scroll-tech/zktrie v0.8.4/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk=
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
Expand Down
12 changes: 1 addition & 11 deletions rollup/da_syncer/da/commitV0.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package da
import (
"encoding/binary"
"fmt"
"math/big"

"github.com/scroll-tech/da-codec/encoding"

Expand Down Expand Up @@ -147,19 +146,10 @@ func getL1Messages(db ethdb.Database, parentTotalL1MessagePopped uint64, skipped
return nil, fmt.Errorf("failed to decode skipped message bitmap: err: %w", err)
}

isL1MessageSkipped := func(skippedBitmap []*big.Int, index uint64) bool {
if index >= uint64(len(skippedBitmap))*256 {
return false
}
quo := index / 256
rem := index % 256
return skippedBitmap[quo].Bit(int(rem)) == 1
}

// get all necessary l1 messages without skipped
currentIndex := parentTotalL1MessagePopped
for index := 0; index < totalL1MessagePopped; index++ {
if isL1MessageSkipped(decodedSkippedBitmap, currentIndex-parentTotalL1MessagePopped) {
if encoding.IsL1MessageSkipped(decodedSkippedBitmap, currentIndex-parentTotalL1MessagePopped) {
currentIndex++
continue
}
Expand Down

0 comments on commit bbd7b73

Please sign in to comment.