Skip to content

Commit b2b258d

Browse files
authored
chore: Update poseidon version & remove unnecessary comptime globals (#20702)
Changes necessary for a breaking Noir change: noir-lang/noir#11627 requiring comptime globals to only be evaluated in comptime contexts. - Updates the `poseidon` version used to `0.2.4`. The previous version used a `comptime global` in runtime code which did not need to be comptime, so it was changed. - bigcurve and bignum versions also had to be updated since they also require poseidon internally - Makes the various VK tree constants no longer `comptime` - it was unnecessary and lead to errors with the above change. - There is a full copy of poseidon in `noir-projects/noir-protocol-circuits/crates/types/src/poseidon2.nr` which has a comment suggesting it should be removed now that there is a standalone poseidon. I did not remove it here but it should be considered.
2 parents bca9e52 + c8b17ef commit b2b258d

File tree

8 files changed

+34
-33
lines changed

8 files changed

+34
-33
lines changed

noir-projects/aztec-nr/aztec/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ type = "lib"
77
[dependencies]
88
protocol_types = { path = "../../noir-protocol-circuits/crates/types" }
99
sha256 = { tag = "v0.3.0", git = "https://github.com/noir-lang/sha256" }
10-
poseidon = { tag = "v0.2.3", git = "https://github.com/noir-lang/poseidon" }
10+
poseidon = { tag = "v0.2.6", git = "https://github.com/noir-lang/poseidon" }

noir-projects/noir-contracts/contracts/test/avm_gadgets_test_contract/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ type = "contract"
88
aztec = { path = "../../../../aztec-nr/aztec" }
99
keccak256 = { tag = "v0.1.3", git = "https://github.com/noir-lang/keccak256" }
1010
sha256 = { tag = "v0.3.0", git = "https://github.com/noir-lang/sha256" }
11-
poseidon = { tag= "v0.2.3", git = "https://github.com/noir-lang/poseidon" }
11+
poseidon = { tag= "v0.2.6", git = "https://github.com/noir-lang/poseidon" }

noir-projects/noir-contracts/contracts/test/avm_test_contract/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ aztec = { path = "../../../../aztec-nr/aztec" }
99
compressed_string = { path = "../../../../aztec-nr/compressed-string" }
1010
sha256 = { tag = "v0.3.0", git = "https://github.com/noir-lang/sha256" }
1111
keccak256 = { tag = "v0.1.3", git = "https://github.com/noir-lang/keccak256" }
12-
poseidon = { tag= "v0.2.3", git = "https://github.com/noir-lang/poseidon" }
12+
poseidon = { tag= "v0.2.6", git = "https://github.com/noir-lang/poseidon" }
1313
fee_juice = { path = "../../protocol_interface/fee_juice_interface" }
1414
auth_contract = { path = "../../protocol/auth_registry_contract" }
1515
instance_contract = { path = "../../protocol_interface/contract_instance_registry_interface" }

noir-projects/noir-protocol-circuits/crates/blob/Nargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ authors = [""]
55
compiler_version = ">=0.30.0"
66

77
[dependencies]
8-
bignum = { git = "https://github.com/noir-lang/noir-bignum", tag = "v0.9.0" }
9-
bigcurve = { git = "https://github.com/noir-lang/noir_bigcurve", tag = "v0.13.0" }
8+
bignum = { git = "https://github.com/noir-lang/noir-bignum", tag = "v0.9.2" }
9+
bigcurve = { git = "https://github.com/noir-lang/noir_bigcurve", tag = "v0.13.2" }
1010
types = { path = "../types" }

noir-projects/noir-protocol-circuits/crates/rollup-lib/Nargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = [""]
55
compiler_version = ">=0.18.0"
66

77
[dependencies]
8-
bignum = { git = "https://github.com/noir-lang/noir-bignum", tag = "v0.9.0" }
9-
bigcurve = { git = "https://github.com/noir-lang/noir_bigcurve", tag = "v0.13.0" }
8+
bignum = { git = "https://github.com/noir-lang/noir-bignum", tag = "v0.9.2" }
9+
bigcurve = { git = "https://github.com/noir-lang/noir_bigcurve", tag = "v0.13.2" }
1010
types = { path = "../types" }
1111
blob = { path = "../blob" }

noir-projects/noir-protocol-circuits/crates/types/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ compiler_version = ">=0.18.0"
66

77
[dependencies]
88
sha256 = { tag = "v0.3.0", git = "https://github.com/noir-lang/sha256" }
9-
poseidon = { tag = "v0.2.3", git = "https://github.com/noir-lang/poseidon" }
9+
poseidon = { tag = "v0.2.6", git = "https://github.com/noir-lang/poseidon" }
1010
serde = { path = "../serde" }

noir-projects/noir-protocol-circuits/crates/types/src/constants.nr

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -103,30 +103,30 @@ pub global MAX_KEY_VALIDATION_REQUESTS_PER_CALL: u32 = MAX_PRIVATE_LOGS_PER_CALL
103103
pub global NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP: u32 = 1 << L1_TO_L2_MSG_SUBTREE_HEIGHT;
104104

105105
// VK TREE CONSTANTS
106-
pub comptime global PRIVATE_KERNEL_INIT_VK_INDEX: u32 = 0;
107-
pub comptime global PRIVATE_KERNEL_INNER_VK_INDEX: u32 = 1;
108-
pub comptime global PRIVATE_KERNEL_TAIL_VK_INDEX: u32 = 2;
109-
pub comptime global PRIVATE_KERNEL_TAIL_TO_PUBLIC_VK_INDEX: u32 = 3;
110-
pub comptime global HIDING_KERNEL_TO_ROLLUP_VK_INDEX: u32 = 4;
111-
pub comptime global HIDING_KERNEL_TO_PUBLIC_VK_INDEX: u32 = 5;
112-
pub comptime global PUBLIC_CHONK_VERIFIER_VK_INDEX: u32 = 6;
113-
pub comptime global PRIVATE_TX_BASE_ROLLUP_VK_INDEX: u32 = 7;
114-
pub comptime global PUBLIC_TX_BASE_ROLLUP_VK_INDEX: u32 = 8;
115-
pub comptime global TX_MERGE_ROLLUP_VK_INDEX: u32 = 9;
116-
pub comptime global BLOCK_ROOT_FIRST_ROLLUP_VK_INDEX: u32 = 10;
117-
pub comptime global BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP_VK_INDEX: u32 = 11;
118-
pub comptime global BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP_VK_INDEX: u32 = 12;
119-
pub comptime global BLOCK_ROOT_ROLLUP_VK_INDEX: u32 = 13;
120-
pub comptime global BLOCK_ROOT_SINGLE_TX_ROLLUP_VK_INDEX: u32 = 14;
121-
pub comptime global BLOCK_MERGE_ROLLUP_VK_INDEX: u32 = 15;
122-
pub comptime global CHECKPOINT_ROOT_ROLLUP_VK_INDEX: u32 = 16;
123-
pub comptime global CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP_VK_INDEX: u32 = 17;
124-
pub comptime global CHECKPOINT_PADDING_ROLLUP_VK_INDEX: u32 = 18;
125-
pub comptime global CHECKPOINT_MERGE_ROLLUP_VK_INDEX: u32 = 19;
126-
pub comptime global ROOT_ROLLUP_VK_INDEX: u32 = 20;
127-
pub comptime global PARITY_BASE_VK_INDEX: u32 = 21;
128-
pub comptime global PARITY_ROOT_VK_INDEX: u32 = 22;
129-
pub comptime global PRIVATE_KERNEL_RESET_VK_INDEX: u32 = 23;
106+
pub global PRIVATE_KERNEL_INIT_VK_INDEX: u32 = 0;
107+
pub global PRIVATE_KERNEL_INNER_VK_INDEX: u32 = 1;
108+
pub global PRIVATE_KERNEL_TAIL_VK_INDEX: u32 = 2;
109+
pub global PRIVATE_KERNEL_TAIL_TO_PUBLIC_VK_INDEX: u32 = 3;
110+
pub global HIDING_KERNEL_TO_ROLLUP_VK_INDEX: u32 = 4;
111+
pub global HIDING_KERNEL_TO_PUBLIC_VK_INDEX: u32 = 5;
112+
pub global PUBLIC_CHONK_VERIFIER_VK_INDEX: u32 = 6;
113+
pub global PRIVATE_TX_BASE_ROLLUP_VK_INDEX: u32 = 7;
114+
pub global PUBLIC_TX_BASE_ROLLUP_VK_INDEX: u32 = 8;
115+
pub global TX_MERGE_ROLLUP_VK_INDEX: u32 = 9;
116+
pub global BLOCK_ROOT_FIRST_ROLLUP_VK_INDEX: u32 = 10;
117+
pub global BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP_VK_INDEX: u32 = 11;
118+
pub global BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP_VK_INDEX: u32 = 12;
119+
pub global BLOCK_ROOT_ROLLUP_VK_INDEX: u32 = 13;
120+
pub global BLOCK_ROOT_SINGLE_TX_ROLLUP_VK_INDEX: u32 = 14;
121+
pub global BLOCK_MERGE_ROLLUP_VK_INDEX: u32 = 15;
122+
pub global CHECKPOINT_ROOT_ROLLUP_VK_INDEX: u32 = 16;
123+
pub global CHECKPOINT_ROOT_SINGLE_BLOCK_ROLLUP_VK_INDEX: u32 = 17;
124+
pub global CHECKPOINT_PADDING_ROLLUP_VK_INDEX: u32 = 18;
125+
pub global CHECKPOINT_MERGE_ROLLUP_VK_INDEX: u32 = 19;
126+
pub global ROOT_ROLLUP_VK_INDEX: u32 = 20;
127+
pub global PARITY_BASE_VK_INDEX: u32 = 21;
128+
pub global PARITY_ROOT_VK_INDEX: u32 = 22;
129+
pub global PRIVATE_KERNEL_RESET_VK_INDEX: u32 = 23;
130130
// Important: Do not define indexes after the PRIVATE_KERNEL_RESET_VK_INDEX. They are allocated for the variants of private kernel reset.
131131

132132
// SIDE EFFECT RELATED CONSTANTS

noir-projects/noir-protocol-circuits/crates/types/src/poseidon2.nr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ use std::meta::derive;
55
// It exists as we sometimes need to perform custom absorption, but the stdlib version
66
// has a private absorb() method (it's also designed to just be a hasher)
77
// Can be removed when standalone noir poseidon lib exists: See noir#6679
8+
// TODO: Poseidon is stand-alone now
89

9-
comptime global RATE: u32 = 3;
10+
global RATE: u32 = 3;
1011

1112
#[derive(Deserialize, Eq, Serialize)]
1213
pub struct Poseidon2Sponge {

0 commit comments

Comments
 (0)