Skip to content

Commit

Permalink
fix deltaTimeStamp for unsigned txs execution for specific block
Browse files Browse the repository at this point in the history
  • Loading branch information
tclemos committed Feb 17, 2024
1 parent eb77e04 commit d2cfa78
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion state/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,17 @@ func (s *State) internalProcessUnsignedTransactionV1(ctx context.Context, tx *ty
}
nonce := loadedNonce.Uint64()

var oldStateRoot common.Hash
previousL2BlockNumber := uint64(0)
if l2Block.NumberU64() > 0 {
previousL2BlockNumber = l2Block.NumberU64() - 1
}
previousL2Block, err := s.GetL2BlockByNumber(ctx, previousL2BlockNumber, dbTx)
if err != nil {
return nil, err
}
oldStateRoot = previousL2Block.Root()

batchL2Data, err := EncodeUnsignedTransaction(*tx, s.cfg.ChainID, &nonce, forkID)
if err != nil {
log.Errorf("error encoding unsigned transaction ", err)
Expand All @@ -382,7 +393,7 @@ func (s *State) internalProcessUnsignedTransactionV1(ctx context.Context, tx *ty
processBatchRequestV1 := &executor.ProcessBatchRequest{
From: senderAddress.String(),
OldBatchNum: batch.BatchNumber,
OldStateRoot: l2Block.Root().Bytes(),
OldStateRoot: oldStateRoot.Bytes(),
OldAccInputHash: batch.AccInputHash.Bytes(),
ForkId: forkID,
Coinbase: l2Block.Coinbase().String(),
Expand Down

0 comments on commit d2cfa78

Please sign in to comment.