Skip to content

Commit

Permalink
op-node: Fix span batch decode/encode logic error
Browse files Browse the repository at this point in the history
  • Loading branch information
pcw109550 committed Dec 5, 2023
1 parent 1e751d4 commit 53dcf4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions op-node/rollup/derive/span_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (bp *spanBatchPayload) decodeOriginBits(r *bytes.Reader) error {
originBits := new(big.Int)
for i := 0; i < int(bp.blockCount); i += 8 {
end := i + 8
if end < int(bp.blockCount) {
if end > int(bp.blockCount) {
end = int(bp.blockCount)
}
bits := originBitBuffer[i/8]
Expand Down Expand Up @@ -302,7 +302,7 @@ func (bp *spanBatchPayload) encodeOriginBits(w io.Writer) error {
originBitBuffer := make([]byte, originBitBufferLen)
for i := 0; i < int(bp.blockCount); i += 8 {
end := i + 8
if end < int(bp.blockCount) {
if end > int(bp.blockCount) {
end = int(bp.blockCount)
}
var bits uint = 0
Expand Down
8 changes: 4 additions & 4 deletions op-node/rollup/derive/span_batch_txs.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (btx *spanBatchTxs) encodeContractCreationBits(w io.Writer) error {
contractCreationBitBuffer := make([]byte, contractCreationBitBufferLen)
for i := 0; i < int(btx.totalBlockTxCount); i += 8 {
end := i + 8
if end < int(btx.totalBlockTxCount) {
if end > int(btx.totalBlockTxCount) {
end = int(btx.totalBlockTxCount)
}
var bits uint = 0
Expand Down Expand Up @@ -81,7 +81,7 @@ func (btx *spanBatchTxs) decodeContractCreationBits(r *bytes.Reader) error {
contractCreationBits := new(big.Int)
for i := 0; i < int(btx.totalBlockTxCount); i += 8 {
end := i + 8
if end < int(btx.totalBlockTxCount) {
if end > int(btx.totalBlockTxCount) {
end = int(btx.totalBlockTxCount)
}
bits := contractCreationBitBuffer[i/8]
Expand Down Expand Up @@ -173,7 +173,7 @@ func (btx *spanBatchTxs) encodeYParityBits(w io.Writer) error {
yParityBitBuffer := make([]byte, yParityBitBufferLen)
for i := 0; i < int(btx.totalBlockTxCount); i += 8 {
end := i + 8
if end < int(btx.totalBlockTxCount) {
if end > int(btx.totalBlockTxCount) {
end = int(btx.totalBlockTxCount)
}
var bits uint = 0
Expand Down Expand Up @@ -260,7 +260,7 @@ func (btx *spanBatchTxs) decodeYParityBits(r *bytes.Reader) error {
yParityBits := new(big.Int)
for i := 0; i < int(btx.totalBlockTxCount); i += 8 {
end := i + 8
if end < int(btx.totalBlockTxCount) {
if end > int(btx.totalBlockTxCount) {
end = int(btx.totalBlockTxCount)
}
bits := yParityBitBuffer[i/8]
Expand Down

0 comments on commit 53dcf4b

Please sign in to comment.