-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging palla/split-protocol-contracts into ad/ci2.5+blobs+/palla/spl…
…it-protocol-contracts
- Loading branch information
Showing
193 changed files
with
1,729 additions
and
1,379 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
e88deaf4890a3c6d6af8b0760e952d10573c004d | ||
f337992de96ef656681ebfc96a30c2c9c9b82a70 |
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
3 changes: 1 addition & 2 deletions
3
...s/noir-protocol-circuits/crates/rollup-lib/src/abis/base_or_merge_rollup_public_inputs.nr
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
1 change: 0 additions & 1 deletion
1
noir-projects/noir-protocol-circuits/crates/rollup-lib/src/abis/mod.nr
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
5 changes: 3 additions & 2 deletions
5
noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/components/constants.nr
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
28 changes: 28 additions & 0 deletions
28
...ir-protocol-circuits/crates/rollup-lib/src/base/components/private_tube_data_validator.nr
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use super::validate_tube_data::validate_max_fees_per_gas; | ||
use dep::types::abis::{constant_rollup_data::ConstantRollupData, tube::PrivateTubeData}; | ||
|
||
pub struct PrivateTubeDataValidator { | ||
pub data: PrivateTubeData, | ||
} | ||
|
||
// TODO: Move relevant verifications here. | ||
impl PrivateTubeDataValidator { | ||
pub fn new(data: PrivateTubeData) -> Self { | ||
PrivateTubeDataValidator { data } | ||
} | ||
|
||
pub fn verify_proof<let N: u32>(self, _allowed_previous_circuits: [u32; N]) { | ||
if !dep::std::runtime::is_unconstrained() { | ||
self.data.verify(); | ||
// TODO(#7410) | ||
// self.data.vk_data.validate_in_vk_tree(self.data.public_inputs.constants.vk_tree_root, allowed_previous_circuits); | ||
} | ||
} | ||
|
||
pub fn validate_with_rollup_data(self, constants: ConstantRollupData) { | ||
validate_max_fees_per_gas( | ||
self.data.public_inputs.constants.tx_context.gas_settings.max_fees_per_gas, | ||
constants.global_variables.gas_fees, | ||
); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...oir-protocol-circuits/crates/rollup-lib/src/base/components/public_tube_data_validator.nr
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use super::validate_tube_data::validate_max_fees_per_gas; | ||
use dep::types::abis::{constant_rollup_data::ConstantRollupData, tube::PublicTubeData}; | ||
|
||
pub struct PublicTubeDataValidator { | ||
pub data: PublicTubeData, | ||
} | ||
|
||
// TODO: Move relevant verifications here. | ||
impl PublicTubeDataValidator { | ||
pub fn new(data: PublicTubeData) -> Self { | ||
PublicTubeDataValidator { data } | ||
} | ||
|
||
pub fn verify_proof(self) { | ||
if !dep::std::runtime::is_unconstrained() { | ||
self.data.verify(); | ||
// TODO(#7410) | ||
// self.tube_data.vk_data.validate_in_vk_tree(self.tube_data.public_inputs.constants.vk_tree_root, ALLOWED_PREVIOUS_CIRCUITS); | ||
} | ||
} | ||
|
||
pub fn validate_with_rollup_data(self, constants: ConstantRollupData) { | ||
validate_max_fees_per_gas( | ||
self.data.public_inputs.constants.tx_context.gas_settings.max_fees_per_gas, | ||
constants.global_variables.gas_fees, | ||
); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ojects/noir-protocol-circuits/crates/rollup-lib/src/base/components/validate_tube_data.nr
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use dep::types::abis::gas_fees::GasFees; | ||
|
||
pub fn validate_max_fees_per_gas(max_fees_per_gas: GasFees, gas_fees: GasFees) { | ||
assert( | ||
!max_fees_per_gas.fee_per_da_gas.lt(gas_fees.fee_per_da_gas), | ||
"da gas is higher than the maximum specified by the tx", | ||
); | ||
assert( | ||
!max_fees_per_gas.fee_per_l2_gas.lt(gas_fees.fee_per_l2_gas), | ||
"l2 gas is higher than the maximum specified by the tx", | ||
); | ||
} |
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
1 change: 1 addition & 0 deletions
1
noir-projects/noir-protocol-circuits/crates/rollup-lib/src/base/tests/mod.nr
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
mod private_tube_data_validator_builder; |
24 changes: 24 additions & 0 deletions
24
...ocol-circuits/crates/rollup-lib/src/base/tests/private_tube_data_validator_builder/mod.nr
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
mod validate_with_rollup_data; | ||
|
||
use crate::base::components::PrivateTubeDataValidator; | ||
use dep::types::tests::fixture_builder::FixtureBuilder; | ||
|
||
pub struct PrivateTubeDataValidatorBuilder { | ||
pub tube_data: FixtureBuilder, | ||
pub rollup_data: FixtureBuilder, | ||
} | ||
|
||
impl PrivateTubeDataValidatorBuilder { | ||
pub fn new() -> Self { | ||
PrivateTubeDataValidatorBuilder { | ||
tube_data: FixtureBuilder::new(), | ||
rollup_data: FixtureBuilder::new(), | ||
} | ||
} | ||
|
||
pub fn validate_with_rollup_data(self) { | ||
let tube_data = self.tube_data.to_private_tube_data(); | ||
let rollup_data = self.rollup_data.to_constant_rollup_data(); | ||
PrivateTubeDataValidator::new(tube_data).validate_with_rollup_data(rollup_data); | ||
} | ||
} |
Oops, something went wrong.