Skip to content

Commit

Permalink
fix im state root in stream (#3192)
Browse files Browse the repository at this point in the history
  • Loading branch information
ToniRamirezM committed Feb 5, 2024
1 parent fd78640 commit 4fc8671
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
1 change: 1 addition & 0 deletions sequencer/datastreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func (f *finalizer) DSSendL2Block(batchNumber uint64, blockResponse *state.Proce
IsValid: 1,
EncodedLength: uint32(len(binaryTxData)),
Encoded: binaryTxData,
StateRoot: txResponse.StateRoot,
}

l2Transactions = append(l2Transactions, l2Transaction)
Expand Down
9 changes: 0 additions & 9 deletions sequencer/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package sequencer
import (
"context"
"fmt"
"math/big"
"time"

"github.com/0xPolygonHermez/zkevm-data-streamer/datastreamer"
Expand Down Expand Up @@ -302,14 +301,6 @@ func (s *Sequencer) sendDataToStreamer(chainID uint64) {
}

for _, l2Transaction := range l2Block.Txs {
// Populate intermediate state root
position := state.GetSystemSCPosition(blockStart.L2BlockNumber)
imStateRoot, err := s.stateIntf.GetStorageAt(context.Background(), common.HexToAddress(state.SystemSC), big.NewInt(0).SetBytes(position), l2Block.StateRoot)
if err != nil {
log.Errorf("failed to get storage at for l2block %d, error: %v", l2Block.L2BlockNumber, err)
}
l2Transaction.StateRoot = common.BigToHash(imStateRoot)

_, err = s.streamServer.AddStreamEntry(state.EntryTypeL2Tx, l2Transaction.Encode())
if err != nil {
log.Errorf("failed to add l2tx stream entry for l2block %d, error: %v", l2Block.L2BlockNumber, err)
Expand Down

0 comments on commit 4fc8671

Please sign in to comment.