-
Notifications
You must be signed in to change notification settings - Fork 606
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
wip: l1 block hashes poc #1016
base: develop
Are you sure you want to change the base?
wip: l1 block hashes poc #1016
Conversation
64f4cdd
to
24f9020
Compare
33b2481
to
49ecf53
Compare
…pliedL1BlockInBlock to return uint64 instead of uint256
b38c73b
to
7fafc28
Compare
|
||
import {L1Blocks} from "../../src/L2/L1Blocks.sol"; | ||
|
||
contract DeployL2L1BlocksContract is Script { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we need a hardfork to add this change, I think it's better to make it a predployed contract.
* @return hash_ The keccak hash of all blockhashes in the provided range. | ||
*/ | ||
function blockRangeHash(uint256 _from, uint256 _to) external view returns (bytes32 hash_) { | ||
require(_to >= _from, "Incorrect from/to range"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to use custom error here.
|
||
for (uint256 i = _from; i <= _to; i++) { | ||
bytes32 blockHash = blockhash(i); | ||
require(blockHash != 0, "Blockhash not available"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
// stack too deep | ||
struct ChunkResult { | ||
// _totalNumL1MessagesInChunk The total number of L1 messages popped in current chunk | ||
uint256 _totalNumL1MessagesInChunk; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the bai in the variable name.
BatchHeaderV0Codec.storeParentBatchHash(batchPtr, _parentBatchHash); | ||
BatchHeaderV0Codec.storeSkippedBitmap(batchPtr, _skippedL1MessageBitmap); | ||
BatchHeaderV0Codec.storeLastAppliedL1Block( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we change the structure of BatchHeader
, it is better to use another version.
@@ -165,13 +190,13 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain { | |||
uint8 _version, | |||
bytes calldata _parentBatchHeader, | |||
bytes[] memory _chunks, | |||
bytes calldata _skippedL1MessageBitmap | |||
bytes calldata _skippedL1MessageBitmap, | |||
uint64 _prevLastAppliedL1Block |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the first value of _prevLastAppliedL1Block
? And except the first one, all _prevLastAppliedL1Block
can be found in the _parentBatchHeader
, right?
uint64 lastAppliedL1Block_ = lastAppliedL1Block; | ||
|
||
/// @dev It handles the case where the block is in the future. | ||
require(_number <= lastAppliedL1Block_, "L1Blocks: hash number out of bounds"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, use custom error here.
2585426
to
ee021f7
Compare
ee021f7
to
72fe2d2
Compare
…pliedL1BlockNumber as previous
…and blockRangeHash
…lock hashes specific fields add missing chunk setters
This reverts commit 82ef045.
Purpose or design rationale of this PR
Describe your change. Make sure to answer these three questions: What does this PR do? Why does it do it? How does it do it?
Updating scroll monorepo to support l1 block hashes POC.
PR title
Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:
Deployment tag versioning
Has
tag
incommon/version.go
been updated or have you addedbump-version
label to this PR?Breaking change label
Does this PR have the
breaking-change
label?