-
Notifications
You must be signed in to change notification settings - Fork 251
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
Bls v0.10.1 #780
Merged
Merged
Bls v0.10.1 #780
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8ef4d39
Update vendor/nim-blscurve
mratsim 1ed7a10
Update to BLS v0.10.1
mratsim 831c0e2
update blscurve with privtopub, serialize and exportRaw primitives
mratsim f892bfd
init for mainchain_monitor
mratsim 0e5fe46
Try to solve the stack smashing / discriminant changes object branch
mratsim 80bd9a9
"init" should handle fake/invalid pubkeys and signatures
mratsim 5628080
Update validator keygen
mratsim d1d3f97
Fix mock signatures/validator keys and stack smashing
mratsim d935c9e
Fix ambiguous call newKeyPair
mratsim 344fac6
Skip tests:
mratsim 16794bc
Disable compilation of bench_bls_sig_agggregation
mratsim b2faac7
Fix serialization of deposits
mratsim 8a2aaf9
Fix second stack-smashing (https://github.com/status-im/nim-blscurve/…
mratsim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,9 +73,11 @@ proc process_deposit*( | |
|
||
if index == -1: | ||
# Verify the deposit signature (proof of possession) | ||
if skipBlsValidation notin flags and not bls_verify( | ||
pubkey, hash_tree_root(deposit.getDepositMessage).data, | ||
deposit.data.signature, compute_domain(DOMAIN_DEPOSIT)): | ||
let domain = compute_domain(DOMAIN_DEPOSIT) | ||
let signing_root = compute_signing_root(deposit.getDepositMessage, domain) | ||
if skipBLSValidation notin flags and not bls_verify( | ||
pubkey, signing_root.data, | ||
deposit.data.signature): | ||
return false | ||
|
||
# Add validator and balance entries | ||
|
@@ -214,7 +216,7 @@ func initialize_beacon_state_from_eth1*( | |
latest_block_header: | ||
BeaconBlockHeader( | ||
body_root: hash_tree_root(BeaconBlockBody( | ||
randao_reveal: BlsValue[Signature](kind: OpaqueBlob) | ||
randao_reveal: ValidatorSig(kind: OpaqueBlob) | ||
)) | ||
) | ||
) | ||
|
@@ -263,7 +265,7 @@ func get_initial_beacon_block*(state: BeaconState): SignedBeaconBlock = | |
state_root: hash_tree_root(state), | ||
body: BeaconBlockBody( | ||
# TODO: This shouldn't be necessary if OpaqueBlob is the default | ||
randao_reveal: BlsValue[Signature](kind: OpaqueBlob)))) | ||
randao_reveal: ValidatorSig(kind: OpaqueBlob)))) | ||
# parent_root, randao_reveal, eth1_data, signature, and body automatically | ||
# initialized to default values. | ||
|
||
|
@@ -381,13 +383,13 @@ proc is_valid_indexed_attestation*( | |
return false | ||
|
||
# Verify aggregate signature | ||
if skipBlsValidation notin flags and not bls_verify( | ||
bls_aggregate_pubkeys(mapIt(indices, state.validators[it.int].pubkey)), | ||
hash_tree_root(indexed_attestation.data).data, | ||
indexed_attestation.signature, | ||
get_domain( | ||
state, DOMAIN_BEACON_ATTESTER, indexed_attestation.data.target.epoch) | ||
): | ||
let pubkeys = mapIt(indices, state.validators[it.int].pubkey) # TODO: fuse loops with blsFastAggregateVerify | ||
let domain = state.get_domain(DOMAIN_BEACON_ATTESTER, indexed_attestation.data.target.epoch) | ||
let signing_root = compute_signing_root(indexed_attestation.data, domain) | ||
if skipBLSValidation notin flags and | ||
not blsFastAggregateVerify( | ||
pubkeys, signing_root.data, indexed_attestation.signature | ||
): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the possible apparent cause of a couple of EF test vector failures. Hopefully, it improves things. |
||
notice "indexed attestation: signature verification failure" | ||
return false | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is related to the local private key storage, this might be an instance of what @zah discussed as excessive specialization on a design which should be regardless decoupled. If so, maybe note as such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was when we were hesitating between using the raw private keys and being able to handle fake blobs, especially due to testing faking the BLS stuff.