Skip to content

perf: optimize CBLSSignature::VerifySecureAggregated in 2 times#110

Draft
knst wants to merge 3 commits into
dashpay:mainfrom
knst:perf-bls-verify-secure
Draft

perf: optimize CBLSSignature::VerifySecureAggregated in 2 times#110
knst wants to merge 3 commits into
dashpay:mainfrom
knst:perf-bls-verify-secure

Conversation

@knst

@knst knst commented May 26, 2025

Copy link
Copy Markdown

Current implementation of CoreMPL::VerifySecure does serialization and deserialization of G1 element.

Deserialization is very heavy because FromBytes() also validates that G1 is valid.
This validation is very expensive for computation power but useless because we already know that object is valid.
Much better to keep pointer to original object.

This PR to dashbls speeds up validation of quorum commitment in Dash Core in 2 times which make indexing and validating new blocks overall 11% faster.
The performance improvement is most noticeable on blocks that have rotation quorum commitment, because one block has 32 commitments.

Benchmarks has been done on 15000 last blocks.

Dash Core with this PR:
image

2025-05-26T07:35:21Z [bench]         - m_qblockman: 0.05ms [55.43s]
2025-05-26T07:35:21Z [bench]   - Connect total: 19.96ms [223.70s (14.40ms/blk)]
2025-05-26T07:35:21Z [bench] - Connect block: 20.46ms [230.66s (14.85ms/blk)]

Dash Core with current master:
image

2025-05-22T18:39:44Z [bench]         - m_qblockman: 0.03ms [96.90s]
2025-05-22T18:39:44Z [bench]   - Connect total: 9.31ms [252.80s (16.28ms/blk)]
2025-05-22T18:39:44Z [bench] - Connect block: 9.50ms [258.90s (16.67ms/blk)]

knst added 3 commits May 26, 2025 21:10
Deserialization is very heavy because FromBytes also validates if G1 / G2 elements are valid.
It is computation expensive. Much better to keep pointer to original object.

Also simplified using of helper HashPubKeys
@knst knst requested review from PastaPastaPasta, UdjinM6 and kwvg May 26, 2025 14:30
@knst knst marked this pull request as draft May 28, 2025 10:32
@knst

knst commented May 28, 2025

Copy link
Copy Markdown
Author

probably DNM as it is because missing validation of public key inside library.

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.

1 participant