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

chore: Update light-poseidon to 0.2.0 #33923

Merged
merged 1 commit into from
Nov 10, 2023
Merged

chore: Update light-poseidon to 0.2.0 #33923

merged 1 commit into from
Nov 10, 2023

Conversation

vadorovsky
Copy link
Contributor

@vadorovsky vadorovsky commented Oct 29, 2023

That new release contains an important change which prevents a potential DDoS.

Invoking from_bytes_be function light-poseidon 0.1.1 inverts all the inputs before performing a check whether their length exceeds the modulus of the prime field. Therefore, it was prone to an attack, where a mailicious user could submit long byte slices just to DDoS the validator, being stuck on inverting large byte sequences.

The update and mentioned change fixes the same issue as #33363 aims to address.

The new release contains also few other less important changes like:

@mergify mergify bot added community Community contribution need:merge-assist labels Oct 29, 2023
@mergify mergify bot requested a review from a team October 29, 2023 17:43
@vadorovsky vadorovsky marked this pull request as draft October 29, 2023 21:36
@vadorovsky vadorovsky changed the title chore: Update light-poseidon to 0.1.2 chore: Update light-poseidon to 0.1.3 Nov 7, 2023
@vadorovsky vadorovsky marked this pull request as ready for review November 7, 2023 11:52
@vadorovsky
Copy link
Contributor Author

@samkim-crypto

@vovacodes
Copy link
Contributor

vovacodes commented Nov 7, 2023

Can we merge this plz. We see the compile errors fixed in this PR because our Cargo.lock already resolves light-poseidon to 0.1.3

error[E0004]: non-exhaustive patterns: `PoseidonError::BytesToPrimeFieldElement { .. }` and `PoseidonError::BytesToBigInt` not covered
   --> /Users/xxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-1.17.4/src/poseidon.rs:212:23
    |
212 |                 match error {
    |                       ^^^^^ patterns `PoseidonError::BytesToPrimeFieldElement { .. }` and `PoseidonError::BytesToBigInt` not covered
    |
note: `PoseidonError` defined here
   --> /Users/xxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/light-poseidon-0.1.3/src/lib.rs:160:5
    |
145 | pub enum PoseidonError {
    | ----------------------
...
160 |     BytesToPrimeFieldElement { bytes: Vec<u8> },
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ not covered
...
168 |     BytesToBigInt,
    |     ^^^^^^^^^^^^^ not covered
    = note: the matched value is of type `PoseidonError`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
    |
231 ~                     } => PoseidonSyscallError::InvalidWidthCircom,
232 ~                     PoseidonError::BytesToPrimeFieldElement { .. } | PoseidonError::BytesToBigInt => todo!(),
    |


@vadorovsky btw guys could you please make sure to not ship breaking changes in a patch release. Adding new enum types is a breaking change. I understand that there was no bad intent, but if your lib becomes a dependency of the crate that a lot of people use every day, this kind of considerations have to be taken extremely seriously. Not trying to be rude here, just feedback

@vadorovsky
Copy link
Contributor Author

vadorovsky commented Nov 8, 2023

@vovacodes Apologies for that! I yanked the 0.1.3 version and I'm going to ship the breaking changes as 0.2.0, since we are breaking the API and adding new errors.

@samkim-crypto samkim-crypto added the CI Pull Request is ready to enter CI label Nov 8, 2023
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Nov 8, 2023
@samkim-crypto samkim-crypto self-assigned this Nov 8, 2023
@vadorovsky vadorovsky changed the title chore: Update light-poseidon to 0.1.3 chore: Update light-poseidon to 0.2.0 Nov 8, 2023
@samkim-crypto samkim-crypto added the CI Pull Request is ready to enter CI label Nov 8, 2023
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Nov 8, 2023
@samkim-crypto samkim-crypto removed their assignment Nov 8, 2023
@samkim-crypto samkim-crypto self-requested a review November 8, 2023 23:41
That new release contains an important change which prevents a
potential DDoS.

* Lightprotocol/light-poseidon#32

Invoking `from_bytes_be` function light-poseidon 0.1.1 inverts all
the inputs before performing a check whether their length exceeds
the modulus of the prime field. Therefore, it was prone to an
attack, where a mailicious user could submit long byte slices just
to DDoS the validator, being stuck on inverting large byte sequences.

The update and mentioned change fixes the same issue as #33363 aims
to address.

The new release contains also few other less important changes like:

* Lightprotocol/light-poseidon#37
* Lightprotocol/light-poseidon#38
* Lightprotocol/light-poseidon#39
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Merging #33923 (dbb00a9) into master (28e08ac) will increase coverage by 0.0%.
Report is 3 commits behind head on master.
The diff coverage is 0.0%.

@@           Coverage Diff           @@
##           master   #33923   +/-   ##
=======================================
  Coverage    81.9%    81.9%           
=======================================
  Files         811      811           
  Lines      219427   219433    +6     
=======================================
+ Hits       179769   179803   +34     
+ Misses      39658    39630   -28     

Copy link
Contributor

@samkim-crypto samkim-crypto left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@samkim-crypto samkim-crypto merged commit 67f8daf into solana-labs:master Nov 10, 2023
28 checks passed
@vadorovsky vadorovsky deleted the light-poseidon-0.1.2 branch November 10, 2023 09:27
@Lichtso Lichtso added the v1.17 PRs that should be backported to v1.17 label Nov 28, 2023
Copy link
Contributor

mergify bot commented Nov 28, 2023

Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis.

mergify bot pushed a commit that referenced this pull request Nov 28, 2023
That new release contains an important change which prevents a
potential DDoS.

* Lightprotocol/light-poseidon#32

Invoking `from_bytes_be` function light-poseidon 0.1.1 inverts all
the inputs before performing a check whether their length exceeds
the modulus of the prime field. Therefore, it was prone to an
attack, where a mailicious user could submit long byte slices just
to DDoS the validator, being stuck on inverting large byte sequences.

The update and mentioned change fixes the same issue as #33363 aims
to address.

The new release contains also few other less important changes like:

* Lightprotocol/light-poseidon#37
* Lightprotocol/light-poseidon#38
* Lightprotocol/light-poseidon#39

(cherry picked from commit 67f8daf)

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	programs/sbf/Cargo.lock
Lichtso pushed a commit that referenced this pull request Nov 28, 2023
That new release contains an important change which prevents a
potential DDoS.

* Lightprotocol/light-poseidon#32

Invoking `from_bytes_be` function light-poseidon 0.1.1 inverts all
the inputs before performing a check whether their length exceeds
the modulus of the prime field. Therefore, it was prone to an
attack, where a mailicious user could submit long byte slices just
to DDoS the validator, being stuck on inverting large byte sequences.

The update and mentioned change fixes the same issue as #33363 aims
to address.

The new release contains also few other less important changes like:

* Lightprotocol/light-poseidon#37
* Lightprotocol/light-poseidon#38
* Lightprotocol/light-poseidon#39

(cherry picked from commit 67f8daf)
samkim-crypto pushed a commit that referenced this pull request Dec 8, 2023
…4247)

chore: Update light-poseidon to 0.2.0 (#33923)

That new release contains an important change which prevents a
potential DDoS.

* Lightprotocol/light-poseidon#32

Invoking `from_bytes_be` function light-poseidon 0.1.1 inverts all
the inputs before performing a check whether their length exceeds
the modulus of the prime field. Therefore, it was prone to an
attack, where a mailicious user could submit long byte slices just
to DDoS the validator, being stuck on inverting large byte sequences.

The update and mentioned change fixes the same issue as #33363 aims
to address.

The new release contains also few other less important changes like:

* Lightprotocol/light-poseidon#37
* Lightprotocol/light-poseidon#38
* Lightprotocol/light-poseidon#39

(cherry picked from commit 67f8daf)

Co-authored-by: vadorovsky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution need:merge-assist v1.17 PRs that should be backported to v1.17
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants