Skip to content

Draft: Initial version for precommits & role-based validator timelock #1461

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

Draft
wants to merge 15 commits into
base: draft-v29
Choose a base branch
from

Conversation

StanislavBreadless
Copy link
Collaborator

What ❔

Why ❔

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.

@StanislavBreadless StanislavBreadless marked this pull request as draft May 8, 2025 14:47
@StanislavBreadless StanislavBreadless changed the base branch from draft-v28 to draft-v29 May 8, 2025 14:50

let currentCommitment := mload(TXS_STATUS_ROLLING_HASH_BEGIN_BYTE())

mstore(0, txHash)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it safe to write to this memory address?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, by this point in code, everything up to SCRATCH_SPACE_SLOTS + SCRATCH_SPACE_BEGIN_SLOT is safe to write to

Comment on lines 365 to 374
error InvalidBatchNumber(uint256 provided, uint256 expected);

error EmptyPrecommitData(uint256 batchNumber);

error PrecommitmentMismatch(uint256 batchNumber, bytes32 expected, bytes32 found);

error RoleAccessDenied(uint256 chainId, bytes32 role, address account);

error DefaultAdminTransferNotAllowed();

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error selectors missing here.

Copy link
Collaborator

@nikitastupin-matterlabs nikitastupin-matterlabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sharing a high-level review

@@ -174,4 +174,6 @@ struct ZKChainStorage {
/// @notice Bytecode hash of evm emulator.
/// @dev Used as an input to zkp-circuit.
bytes32 l2EvmEmulatorBytecodeHash;
/// todo
mapping (uint256 batchNumber => bytes32 precommitemnt) batchPrecommitments;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about other names? How about checkpoints?

I see that precommitments make sense because they go before the commit thus pre commitments. But the word commit might be misleading. A cryptographic commitment (commit-reveal) implies that it's not possible to change the value once committed. In our case that's not completely true as batches can be reverted.

This is more of an open discussion. I don't have a strong opinion in this particular case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO precommitments is a bit better as a universal long term name

Even "commitment" operation can be reverted, so the issue with naming is true even today

}

s.precommitmentForTheLatestBatch = currentPrecommitment;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we name it rollingTxsHash in this way we keep the meaning, but detach it from precommit operation

@@ -76,6 +76,8 @@ contract DiamondInit is ZKChainBase, IDiamondInit {
s.priorityTxMaxGasLimit = _initializeData.priorityTxMaxGasLimit;
s.feeParams = _initializeData.feeParams;
s.priorityTree.setup(s.priorityQueue.getTotalPriorityTxs());
// FIXME: include it in the upgrade.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be fixed after merging back draft-v29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants