Skip to content
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

[HackerOne-2300725] Limit the number of allowed constraints for deployments #2271

Merged
merged 40 commits into from
Feb 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
88364b0
Limit the number of allowed constraints for deployments
vicsn Dec 29, 2023
5e0e2f6
Increase allowed number of deployment constraints for existing test s…
vicsn Dec 29, 2023
f429701
Correct test expectations. The RNG depends on FinalizeState
vicsn Jan 2, 2024
696d332
Add test for too many constraints
vicsn Jan 2, 2024
d872a42
Actually limit at max_constraints
vicsn Jan 10, 2024
0be9950
Use Self::set_constraint_maximum
vicsn Jan 10, 2024
06ab667
Comment nit
vicsn Jan 10, 2024
6b6fc40
Convert type early
vicsn Jan 10, 2024
726a614
Check that the number of functions matches the number of verifying keys
vicsn Jan 10, 2024
4573348
Clean up deployment_cost function
vicsn Jan 10, 2024
5d3c2b7
Nit: fix comment
vicsn Jan 10, 2024
61edab1
Merge branch 'testnet3' into limit_deployment_num_constraints
howardwu Jan 11, 2024
d696985
Merge mainnet
raychu86 Jan 19, 2024
6b4b78b
Rewrite expectations
raychu86 Jan 19, 2024
54495e7
Merge branch 'mainnet' into limit_deployment_num_constraints
howardwu Jan 21, 2024
722b6d0
Fix terminology, fix vulnerability
howardwu Jan 21, 2024
2284e88
Merge branch 'limit_deployment_num_constraints' of https://github.com…
howardwu Jan 21, 2024
a22ab6d
Fix the deployment limit usage
howardwu Jan 21, 2024
dc8fb72
Write like an adult
howardwu Jan 21, 2024
e919f7b
nit: comments
howardwu Jan 21, 2024
d2e52b0
Update comments
howardwu Jan 21, 2024
1568ce0
Adds a getter for the constraint limit from the circuit
howardwu Jan 21, 2024
e39f9d2
Fix names, set limit to 1<<20
howardwu Jan 21, 2024
4383518
Missing period (.)
howardwu Jan 21, 2024
3841a3e
Include the synthesis cost in the return for the deployment cost
howardwu Jan 21, 2024
5d0c2da
Add enforcement that the number of synthesized constraints matches th…
howardwu Jan 21, 2024
01b95d2
WIP: scaffolding for testing vk manipulation
vicsn Jan 22, 2024
cc87b98
Remove redundant check
evan-schott Jan 31, 2024
1b02d5c
Revise tests
evan-schott Jan 31, 2024
1ae6626
Modify constraint limit to account for the constraint added after syn…
evan-schott Feb 1, 2024
32053f9
Add back synthesis check to catch overreports
evan-schott Feb 1, 2024
ff10297
tx id changes bc deploy fee increased w/ this PR
evan-schott Feb 1, 2024
32d3ca4
revise new tests
evan-schott Feb 1, 2024
7d443bc
clippy
evan-schott Feb 1, 2024
763d5fe
fixes
evan-schott Feb 2, 2024
6adc557
fixes
evan-schott Feb 2, 2024
b746a19
Correct underreport test program name
vicsn Feb 8, 2024
ed6cfa7
Merge remote-tracking branch 'origin/mainnet' into limit_deployment_n…
vicsn Feb 8, 2024
58e6c39
Correct test expectations
vicsn Feb 8, 2024
411218b
nit: use let-else syntax
howardwu Feb 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion synthesizer/process/src/stack/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,20 @@ impl<N: Network> Stack<N> {
lap!(timer, "Compute the request for {}", function.name());
// Initialize the assignments.
let assignments = Assignments::<N>::default();
// Initialize the constraint limit. Account for the constraint added after synthesis that randomizes vars.
let constraint_limit = match verifying_key.circuit_info.num_constraints.checked_sub(1) {
// Since a deployment must always pay non-zero fee, it must always have at least one constraint.
None => {
bail!("The constraint limit of 0 for function '{}' is invalid", function.name());
}
Some(limit) => limit,
};
// Initialize the call stack.
let call_stack = CallStack::CheckDeployment(
vec![request],
burner_private_key,
assignments.clone(),
Some(verifying_key.circuit_info.num_constraints as u64),
Some(constraint_limit as u64),
);
// Append the function name, callstack, and assignments.
call_stacks.push((function.name(), call_stack, assignments));
Expand Down