forked from matter-labs/era-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Validium mode #6
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
df48ddf
Use test verifying key
ilitteri 4c5314e
Use solpp for `VALIDIUM_MODE`in the Executor
ilitteri 63d5fea
Add ValidiumExecutor facet
ilitteri 0845a34
Adapt scripts for Validium mode
ilitteri 4fe58ca
Rename contracts/ to era-lambda-contracts/
ilitteri 1ede21e
Update scheduler key
ilitteri dd8031c
Fix path
ilitteri 7455c0f
zk fmt
ilitteri 7fe7979
Update validium mode env
ilitteri 34b4124
Change pubdata constants to 0 (#7)
toni-calvin 6f40ca2
Revert zk fmt (#8)
ilitteri 92fa800
Merge branch 'main' of github.com:lambdaclass/era-contracts into vali…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
pragma solidity 0.8.20; | ||
|
||
// #def ETH_SENDER_SENDER_VALIDIUM_MODE true | ||
|
||
import {Base} from "./Base.sol"; | ||
import {COMMIT_TIMESTAMP_NOT_OLDER, COMMIT_TIMESTAMP_APPROXIMATION_DELTA, EMPTY_STRING_KECCAK, L2_TO_L1_LOG_SERIALIZE_SIZE, MAX_INITIAL_STORAGE_CHANGES_COMMITMENT_BYTES, MAX_REPEATED_STORAGE_CHANGES_COMMITMENT_BYTES, MAX_L2_TO_L1_LOGS_COMMITMENT_BYTES, PACKED_L2_BLOCK_TIMESTAMP_MASK, PUBLIC_INPUT_SHIFT} from "../Config.sol"; | ||
import {IExecutor, L2_LOG_ADDRESS_OFFSET, L2_LOG_KEY_OFFSET, L2_LOG_VALUE_OFFSET, SystemLogKey} from "../interfaces/IExecutor.sol"; | ||
|
@@ -119,7 +121,9 @@ contract ExecutorFacet is Base, IExecutor { | |
// See SystemLogKey enum in Constants.sol for ordering. | ||
uint256 processedLogs; | ||
|
||
// #if ETH_SENDER_SENDER_VALIDIUM_MODE == false | ||
bytes32 providedL2ToL1PubdataHash = keccak256(_newBatch.totalL2ToL1Pubdata); | ||
// #endif | ||
|
||
// linear traversal of the logs | ||
for (uint256 i = 0; i < emittedL2Logs.length; i = i.uncheckedAdd(L2_TO_L1_LOG_SERIALIZE_SIZE)) { | ||
|
@@ -137,8 +141,10 @@ contract ExecutorFacet is Base, IExecutor { | |
require(logSender == L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, "lm"); | ||
l2LogsTreeRoot = logValue; | ||
} else if (logKey == uint256(SystemLogKey.TOTAL_L2_TO_L1_PUBDATA_KEY)) { | ||
// #if ETH_SENDER_SENDER_VALIDIUM_MODE == false | ||
require(logSender == L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, "ln"); | ||
require(providedL2ToL1PubdataHash == logValue, "wp"); | ||
// #endif | ||
} else if (logKey == uint256(SystemLogKey.STATE_DIFF_HASH_KEY)) { | ||
require(logSender == L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, "lb"); | ||
stateDiffHash = logValue; | ||
|
@@ -364,7 +370,7 @@ contract ExecutorFacet is Base, IExecutor { | |
|
||
function _verifyProof(uint256[] memory proofPublicInput, ProofInput calldata _proof) internal view { | ||
// We can only process 1 batch proof at a time. | ||
require(proofPublicInput.length == 1, "t4"); | ||
require(_proof.serializedProof.length == 1, "t4"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can change it and check that the results are still the same |
||
|
||
bool successVerifyProof = s.verifier.verify( | ||
proofPublicInput, | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not sure it's correct, because we still store some data.
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.
This was set to 0 because of the 0 division, what should we set it to? Can you elaborate more on what data are we still storing?