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

[Crypto] Pairing edge case #3977

Merged
merged 13 commits into from
Mar 4, 2023
Merged

[Crypto] Pairing edge case #3977

merged 13 commits into from
Mar 4, 2023

Conversation

tarakby
Copy link
Contributor

@tarakby tarakby commented Mar 1, 2023

  • Relic multi-pairing computation has a bug in a specific edge case, that can be triggered by BLS private keys equal to 1 or -1 during signature verification. This PR introduces a temporary fix in Flow crypto while Relic gets fixed.
  • add tests in the crypto lib to check the edge case.

@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2023

Codecov Report

Merging #3977 (656ed2f) into master (1c4bb73) will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #3977   +/-   ##
=======================================
  Coverage   53.26%   53.26%           
=======================================
  Files         820      820           
  Lines       76631    76631           
=======================================
+ Hits        40815    40816    +1     
+ Misses      32513    32512    -1     
  Partials     3303     3303           
Flag Coverage Δ
unittests 53.26% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...sus/hotstuff/timeoutcollector/timeout_processor.go 85.62% <0.00%> (-1.80%) ⬇️
ledger/complete/wal/checkpointer.go 67.45% <0.00%> (-0.45%) ⬇️
engine/collection/synchronization/engine.go 69.23% <0.00%> (ø)
network/p2p/dns/resolver.go 96.36% <0.00%> (+2.42%) ⬆️
...s/hotstuff/votecollector/staking_vote_processor.go 82.35% <0.00%> (+2.94%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -153,6 +153,10 @@ func testKeyGenSeed(t *testing.T, salg SigningAlgorithm, minLen int, maxLen int)
})
}

var BLS12381Order = []byte{0x73, 0xED, 0xA7, 0x53, 0x29, 0x9D, 0x7D, 0x48, 0x33, 0x39,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var BLS12381Order = []byte{0x73, 0xED, 0xA7, 0x53, 0x29, 0x9D, 0x7D, 0x48, 0x33, 0x39,
const BLS12381Order = []byte{0x73, 0xED, 0xA7, 0x53, 0x29, 0x9D, 0x7D, 0x48, 0x33, 0x39,

Copy link
Contributor Author

@tarakby tarakby Mar 3, 2023

Choose a reason for hiding this comment

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

I don't think it's possible to declare an array as a constant, an array in Go cannot be immutable.

Copy link
Member

@durkmurder durkmurder left a comment

Choose a reason for hiding this comment

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

LGTM

crypto/bls_test.go Outdated Show resolved Hide resolved
crypto/bls_test.go Show resolved Hide resolved
@tarakby
Copy link
Contributor Author

tarakby commented Mar 3, 2023

bors merge

bors bot added a commit that referenced this pull request Mar 3, 2023
3977: [Crypto] Pairing edge case r=tarakby a=tarakby

- Relic multi-pairing computation has a bug in a specific edge case, that can be triggered by BLS private keys equal to 1 or -1 during signature verification. This PR introduces a temporary fix in Flow crypto while Relic gets fixed.
- add tests in the crypto lib to check the edge case.


Co-authored-by: Tarak Ben Youssef <tarak.benyoussef@dapperlabs.com>
Co-authored-by: Tarak Ben Youssef <50252200+tarakby@users.noreply.github.com>
@bors
Copy link
Contributor

bors bot commented Mar 3, 2023

Canceled.

@tarakby
Copy link
Contributor Author

tarakby commented Mar 3, 2023

bors merge

@bors bors bot merged commit acc7f70 into master Mar 4, 2023
@bors bors bot deleted the tarak/pairing-edge-case branch March 4, 2023 00:23
bors bot added a commit that referenced this pull request Apr 21, 2023
4113: [Crypto] update Relic Version r=tarakby a=tarakby

- update Relic to a version that fixes a pairing computation bug
- remove the temporary fix in BLS verification (introduced in #3977)
- integrate Relic's cmake and minor header changes 

Co-authored-by: Tarak Ben Youssef <tarak.benyoussef@dapperlabs.com>
Co-authored-by: Tarak Ben Youssef <50252200+tarakby@users.noreply.github.com>
This pull request was closed.
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.

4 participants