Skip to content

fix(dkg): align register key-length checks with the kernel encoding#844

Merged
0xHansLee merged 1 commit into
dkg/devfrom
fix/dkg-pubkey-length-32
Jun 12, 2026
Merged

fix(dkg): align register key-length checks with the kernel encoding#844
0xHansLee merged 1 commit into
dkg/devfrom
fix/dkg-pubkey-length-32

Conversation

@0xHansLee

Copy link
Copy Markdown
Contributor

Problem

DKG.sol::register pins dkgPubKey to 64 bytes and enclaveCommKey to 65 bytes, but the kernel produces — and the consensus client verifies — a 32-byte ed25519 dkgPubKey and a 64-byte secp256k1 commKey (uncompressed, 0x04 prefix stripped). Every register therefore reverts on the length check, so DKG cannot bootstrap on any chain running the current contracts.

The strict checks were added in #831 (previously the fields were only required to be non-empty), which is why this surfaced only after the up-to-date contracts were actually deployed.

Fix

Require dkgPubKey == 32 and enclaveCommKey == 64 to match what the kernel emits and the CL verifies. Both fields stay fixed-length, so the abi.encodePacked report-data preimage remains injective and calculateReportData still mirrors it.

issue: piplabs/story-kernel#73

register() pinned dkgPubKey to 64 bytes and enclaveCommKey to 65 bytes, but the
kernel produces (and the CL verifies) a 32-byte ed25519 dkgPubKey and a 64-byte
secp256k1 commKey, so every registration reverted on length. Require 32/64 to
match the kernel; both stay fixed-length, so the abi.encodePacked report-data
preimage stays injective.
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@0xHansLee
0xHansLee merged commit 65929f7 into dkg/dev Jun 12, 2026
11 of 12 checks passed
@0xHansLee
0xHansLee deleted the fix/dkg-pubkey-length-32 branch June 12, 2026 22:10
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.

2 participants