Conversation
Test Results 5 files ± 0 221 suites ±0 30m 53s ⏱️ - 1h 32m 32s Results for commit ddab23d. ± Comparison against base commit 928b3f6. This pull request removes 58 and adds 27 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
f50c0ea to
e3cd4c0
Compare
e3cd4c0 to
2ce5e81
Compare
34044ba to
a3d540b
Compare
a3d540b to
2f25caa
Compare
de7b283 to
26449d5
Compare
the Schnorr signing key can create the proof by signing a DST, prefix and its verification key the verification key can verify the proof given the prefix
It stores the stake, epoch and pool id and can convert them into a prefix used in the PoBP
26449d5 to
9328dfd
Compare
for the correctness of the PoBP for the correctness of the deduplication
9328dfd to
aa3aac4
Compare
hjeljeli32
left a comment
There was a problem hiding this comment.
LGTM 👍 Just left one comment.
| verification_key_signature_for_snark: signer | ||
| .verification_key_signature_for_snark | ||
| .map(|s| s.to_json_hex().unwrap()), | ||
| #[cfg(feature = "future_snark")] |
There was a problem hiding this comment.
Could we generate the proofs for each registration epoch here? generate_signer_data() currently creates them for epoch 0, but the load-test bootstrap registers these signers for epochs 3 and 4.
…snark values not just None
| pub fn compute_protocol_party_id(&self) -> Result<ProtocolPartyId, OpCertError> { | ||
| let mut hasher = Blake2b::<U28>::new(); | ||
| hasher.update(self.cold_vk.as_bytes()); | ||
| let mut pool_id = [0u8; 28]; | ||
| pool_id.copy_from_slice(hasher.finalize().as_bytes()); | ||
| encode_bech32("pool", &pool_id).map_err(|_| OpCertError::PoolAddressEncoding) | ||
| encode_bech32("pool", &self.compute_protocol_party_id_as_bytes()) | ||
| .map_err(|_| OpCertError::PoolAddressEncoding) | ||
| } | ||
|
|
||
| /// Compute protocol party id as hash | ||
| pub fn compute_protocol_party_id_as_hash(&self) -> String { | ||
| hex::encode(self.compute_protocol_party_id_as_bytes()) | ||
| } |
There was a problem hiding this comment.
issue(blocking): we should have some tests to make sure that we didn't introduce a breaking change here. I'd recommend to add golden tests first with the previous version of the code and then make sure they are still green with the modifications.
There was a problem hiding this comment.
I think that the test already present is acting as a golden test but I will add more specific golden tests for those two functions
There was a problem hiding this comment.
I added the new golden tests
| .configuration_for_aggregation | ||
| .protocol_parameters, | ||
| #[cfg(feature = "future_snark")] | ||
| data.epoch.offset_to_signer_retrieval_epoch_saturating(), |
There was a problem hiding this comment.
question(blocking): why did you choose to offset_to_signer_retrieval_epoch_saturating?
There was a problem hiding this comment.
I chose those values because they match what is done in the inform_epoch() function to get the signer_retrieval_epoch and next_signer_retrieval_epoch that are used to get current_signers_with_stake and next_signers_with_stake. The same offset function is used in update_next_signers_with_stake to get next_signers_with_stake before calling precompute_epoch_data. It is possible that this is wrong but it looks consistent
| .configuration_for_next_aggregation | ||
| .protocol_parameters, | ||
| #[cfg(feature = "future_snark")] | ||
| data.epoch.offset_to_next_signer_retrieval_epoch(), |
There was a problem hiding this comment.
question(blocking): why did you choose to offset_to_next_signer_retrieval_epoch?
There was a problem hiding this comment.
See the answer above
| if *entry < existing { | ||
| self.registered_keys_for_concatenation | ||
| .remove(&existing.get_verification_key_for_concatenation()); | ||
| self.registration_entries.remove(&existing); | ||
| } else { | ||
| return Ok(()); | ||
| } |
There was a problem hiding this comment.
issue(blocking): if there is a collision with an existing Schnorr verification key, we keep the one with lower stake, but the BLS verification key is also removed. This could create a split in the effective computation of the AVK by the different versions of the signers and aggregators, and thus stop the certification. Only the Schnorr part should be impacted and not the BLS part with an update of the existing entry instead of a replace. Can you add a test that verifies the expected behavior first, make sure that it breaks and then make it green?
There was a problem hiding this comment.
I update the registration to remove the snark key of entry when it is a duplicate with higher stake
…n for the proof of bound possession
…sion and added an epoch field to KeyRegWrapper
…hash, id and bytes)
Content
This PR includes the addition of a proof of bound possession for the Schnorr signing key. This proof is added in mithril-common under the
future_snarkfeature. It is computed by the Initializers and verified during the registration of the signers. This PR also includes a deduplication mechanism for the Schnorr verification key at the STM level.Summary
Adds Proof of Bound Possession (PoBP) for the Schnorr/SNARK signer verification key, entirely behind
future_snark.Changes
mithril-stm): Schnorr signing/verification keys gaincreate_pobp/verify_pobp;Initializer/StmInitializerWrappercreate and store the proof.KeyRegistration::registergains a deduplication of entries based on the Schnorr verification key.mithril-common): newProofOfBoundPossessionPrefix(stake || epoch || pool_id) feeding the Schnorr challenge; pool_id uses the raw fixed-length Blake2b-224 hash rather than the bech32 string, removing the need for a length-prefixed encoding.mithril-common,mithril-aggregator):KeyRegWrapper::registernow verifies the PoBP alongside the existing KES check;SignerRegistrationVerifier/leader/follower services thread the registrationepochthrough to that verification.Signer/SignerWithStakegainproof_of_bound_possession_for_snark; mirrored intoRegisterSignerMessage, message adapters, and DB persistence (new nullable column via migration) so it survives aggregator restarts and follower sync.SignerBuilder/fixture builders — since PoBP verification must use the exact epoch the proof was bound to.MithrilFixtureBuilder/fake_datagain epoch-aware builders (build_at_epoch,signers_with_stakes_at_epoch) to replace the implicit "always epoch 0" fixtures that broke once epoch-bound verification was enforced; extensive unit and integration test fixes acrossmithril-common/mithril-aggregator(including the aggregator's follower/leader integration suite) to build fixtures at the epoch they're actually registered/re-registered at, including cases where stake is updated mid-test.Notes
#[cfg(feature = "future_snark")]-gated; default builds are unaffected.Pre-submit checklist
Comments
Issue(s)
Closes #3537