Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deltaTimeStamp and TimestampLimit for eth_call #3529

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions state/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,7 @@ func (s *State) internalProcessUnsignedTransactionV2(ctx context.Context, tx *ty
}
nonce := loadedNonce.Uint64()

deltaTimestamp := uint32(uint64(time.Now().Unix()) - l2Block.Time())
transactions := s.BuildChangeL2Block(deltaTimestamp, uint32(0))
transactions := s.BuildChangeL2Block(uint32(0), uint32(0))

batchL2Data, err := EncodeUnsignedTransaction(*tx, s.cfg.ChainID, &nonce, forkID)
if err != nil {
Expand All @@ -535,22 +534,23 @@ func (s *State) internalProcessUnsignedTransactionV2(ctx context.Context, tx *ty

// v2 fields
L1InfoRoot: l2Block.BlockInfoRoot().Bytes(),
TimestampLimit: uint64(time.Now().Unix()),
TimestampLimit: l2Block.Time(),
SkipFirstChangeL2Block: cFalse,
SkipWriteBlockInfoRoot: cTrue,
}
if noZKEVMCounters {
processBatchRequestV2.NoCounters = cTrue
}

log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.From]: %v", processBatchRequestV2.From)
log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.OldBatchNum]: %v", processBatchRequestV2.OldBatchNum)
log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.OldStateRoot]: %v", hex.EncodeToHex(processBatchRequestV2.OldStateRoot))
log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.OldAccInputHash]: %v", hex.EncodeToHex(processBatchRequestV2.OldAccInputHash))

log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.Coinbase]: %v", processBatchRequestV2.Coinbase)
log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.ForkId]: %v", processBatchRequestV2.ForkId)
log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.ChainId]: %v", processBatchRequestV2.ChainId)
log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.UpdateMerkleTree]: %v", processBatchRequestV2.UpdateMerkleTree)
log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.ChainId]: %v", processBatchRequestV2.ChainId)
log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.ForkId]: %v", processBatchRequestV2.ForkId)
log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.From]: %v", processBatchRequestV2.From)
log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.ContextId]: %v", processBatchRequestV2.ContextId)

log.Debugf("internalProcessUnsignedTransactionV2[processBatchRequestV2.L1InfoRoot]: %v", hex.EncodeToHex(processBatchRequestV2.L1InfoRoot))
Expand Down
15 changes: 15 additions & 0 deletions test/contracts/auto/CounterAndBlock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

contract CounterAndBlock {
uint public count;

function increment() external {
count += 1;
}

function getCount() public view returns (uint, uint) {
return (count, block.timestamp);
}
}
287 changes: 287 additions & 0 deletions test/contracts/bin/CounterAndBlock/CounterAndBlock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading