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

Contracts optimizations #42

Merged
merged 22 commits into from
Dec 13, 2023
Merged

Contracts optimizations #42

merged 22 commits into from
Dec 13, 2023

Conversation

nulltea
Copy link
Member

@nulltea nulltea commented Dec 11, 2023

Changes

Remove committee_poseidon from pub_input_commitment

  • Simplifies input conversion logic; poseidon commitment never needs to be used as bytes, not in contracts or circuits.
  • Reduced error area - no need to care about endianness (this was an issue when deploying Spectre)
  • More optimal both in terms of circuit constraints and contract gas usage:

Benchmarks:

Circuit

Before:

Gate Chip | Phase 0: 11198094 advice cells
Total 2062 fixed cells
Total range check advice cells to lookup per phase: [1109838, 0, 0]

Now:

Gate Chip | Phase 0: 11139416 advice cells
Total 2062 fixed cells
Total range check advice cells to lookup per phase: [1104230, 0, 0]

Reduction of 58k cells

Contracts

Before:

cumulative_gas_used: 29067

Now:

cumulative_gas_used: 28728

@nulltea nulltea requested review from ec2 and removed request for ec2 December 11, 2023 17:04
@nulltea nulltea force-pushed the timoftime/contracts_optimizations branch from 96663d8 to b3edbd5 Compare December 11, 2023 18:04
@nulltea nulltea changed the base branch from main to timoftime/circuit_optimizations December 11, 2023 18:04
Base automatically changed from timoftime/circuit_optimizations to main December 12, 2023 10:32
Copy link
Collaborator

@willemolding willemolding left a comment

Choose a reason for hiding this comment

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

Love your work ❤️

lightclient-circuits/src/sync_step_circuit.rs Outdated Show resolved Hide resolved
Co-authored-by: Willem Olding <[email protected]>
@nulltea nulltea merged commit 9cc6298 into main Dec 13, 2023
1 check failed
@nulltea nulltea deleted the timoftime/contracts_optimizations branch December 13, 2023 10:04
nulltea added a commit to sygmaprotocol/spectre-node that referenced this pull request Dec 13, 2023
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.

3 participants