Skip to content

Pqc falcon512#31

Merged
Federico2014 merged 3 commits into
Federico2014:pqc-falcon512from
Little-Peony:pqc-falcon512
May 21, 2026
Merged

Pqc falcon512#31
Federico2014 merged 3 commits into
Federico2014:pqc-falcon512from
Little-Peony:pqc-falcon512

Conversation

@Federico2014
Copy link
Copy Markdown
Owner

@Federico2014 Federico2014 commented May 20, 2026

What does this PR do?

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details


Summary by cubic

Enable post‑quantum signatures (Falcon‑512) across transaction validation, bandwidth accounting, and block production, with activation controlled by dynamic properties and a registry-driven scheme list. Simplifies miner config by using Param.Miner.pqScheme to select PQ signing and falling back to ECDSA when unset.

  • New Features
    • DynamicPropertiesStore.isAnyPqSchemeAllowed() now iterates PQSchemeRegistry.registeredSchemes() to detect activated schemes.
    • Validation counts PQ signatures toward limits only when PQ is enabled; otherwise PQ sigs are rejected with a clear error; consolidates to "miss sig or contract" when absent.
    • BandwidthProcessor always adds PQAuthSig bytes to signature overhead, regardless of whether PQ is enabled.
    • Block production: if any PQ scheme is allowed and the miner has pqScheme, sign with PQ keys; otherwise sign with ECDSA. Throws clear errors when the scheme is unregistered or not allowed.

Written for commit cc48428. Summary will update on new commits. Review in cubic

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eede973c-5c47-4777-8768-1e9180508ffc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

Re-trigger cubic

int signatureCount = trx.getInstance().getSignatureCount();
long sigOverhead = signatureCount * PER_SIGN_LENGTH;
if (trx.getInstance().getPqAuthSigCount() > 0) {
if (dynamicPropertiesStore.isAnyPqSchemeAllowed() && trx.getInstance().getPqAuthSigCount() > 0) {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

这里 dynamicPropertiesStore.isAnyPqSchemeAllowed() 应该去掉

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ok, here I agree

} else { //transfer from shielded address
if (this.transaction.getSignatureCount() > 0
|| this.transaction.getPqAuthSigCount() > 0) {
|| (dynamicPropertiesStore.isAnyPqSchemeAllowed() && this.transaction.getPqAuthSigCount() > 0)) {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

dynamicPropertiesStore.isAnyPqSchemeAllowed() 去掉

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ok

return true;
}
}
return false;
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

这里是否允许某个PQ 方案不应该是看提案是否开启了么

if (getDynamicPropertiesStore().isAnyPqSchemeAllowed() &&
miner.getType() != Param.MinerType.ECDSA) {
signBlockCapsuleWithPQ(blockCapsule, miner);
} else {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

这里也不应该用else, 若是 pq 方案不允许,minerType 为PQ, 走ecdsa 签名就有问题。

@Federico2014 Federico2014 merged commit 6084635 into Federico2014:pqc-falcon512 May 21, 2026
2 checks passed
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.

3 participants