Skip to content

feat(ocr2key): expose raw EVM onchain signing public key#2087

Merged
jmank88 merged 8 commits into
mainfrom
sish/get-rawpubkey
May 28, 2026
Merged

feat(ocr2key): expose raw EVM onchain signing public key#2087
jmank88 merged 8 commits into
mainfrom
sish/get-rawpubkey

Conversation

@stackman27
Copy link
Copy Markdown
Contributor

@stackman27 stackman27 commented May 25, 2026

Expose the full uncompressed EVM OCR2 onchain signing public key (65 bytes, hex-encoded) via a new RawOnChainPublicKey() method on KeyBundle.

Today, evmKeyring.PublicKey() returns the 20-byte address, not the full secp256k1 pubkey. Job Distributor needs the raw pubkey to avoid manually exec’ing into pods and exporting/decrypting OCR2 keys.

noecrecoverin Daml so we have to verify(r,s)against preconfigured pubkeys

Requires

Supports

smartcontractkit/chainlink#22673

Copilot AI review requested due to automatic review settings May 25, 2026 06:41
@stackman27 stackman27 requested review from a team as code owners May 25, 2026 06:41
@stackman27 stackman27 changed the title get raw pubKey feat(ocr2key): expose raw EVM onchain signing public key May 25, 2026
@github-actions
Copy link
Copy Markdown

👋 stackman27, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 25, 2026

✅ API Diff Results - github.com/smartcontractkit/chainlink-common/keystore

✅ Compatible Changes (1)

corekeys/ocr2key (1)
  • RawEVMOnChainPublicKey — ➕ Added

📄 View full apidiff report

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR exposes the full uncompressed ECDSA/secp256k1 on-chain signing public key (65 bytes, hex-encoded) for OCR2 EVM key bundles via a new RawOnChainPublicKey() method on ocr2key.KeyBundle, enabling external consumers (e.g., Job Distributor) to obtain the raw pubkey without manual key export/decryption steps.

Changes:

  • Extends the KeyBundle interface with RawOnChainPublicKey() string.
  • Implements RawOnChainPublicKey() in the generic key bundle and adds an EVM keyring helper that returns the uncompressed pubkey.
  • Documents the new behavior via interface/method comments.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
keystore/corekeys/ocr2key/key_bundle.go Adds the new RawOnChainPublicKey() API to the KeyBundle interface and documents intended behavior.
keystore/corekeys/ocr2key/generic_key_bundle.go Implements RawOnChainPublicKey() on the generic key bundle, delegating to the EVM keyring for supported chains.
keystore/corekeys/ocr2key/evm_keyring.go Adds RawOnChainPublicKey() to return the hex-encoded uncompressed secp256k1 public key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread keystore/corekeys/ocr2key/key_bundle.go Outdated
Comment on lines +38 to +40
// RawOnChainPublicKey returns the full uncompressed secp256k1 public key for EVM (65 bytes, hex-encoded).
// Returns empty string for other chain types.
RawOnChainPublicKey() string
Comment on lines +38 to +42
// RawOnChainPublicKey returns the full uncompressed public key (65 bytes for EVM)
// while PublicKey returns the address (20 bytes for EVM)
func (ekr *evmKeyring) RawOnChainPublicKey() string {
return hex.EncodeToString(crypto.FromECDSAPub(&ekr.privateKey().PublicKey))
}
Comment on lines +120 to +131
// RawOnChainPublicKey returns the full uncompressed secp256k1 public key for EVM.
// Returns empty string for other chain types.
func (kb *keyBundle[K]) RawOnChainPublicKey() string {
if kb.chainType != corekeys.EVM {
return ""
}
evmKr, ok := any(kb.keyring).(*evmKeyring)
if !ok {
return ""
}
return evmKr.RawOnChainPublicKey()
}

// RawOnChainPublicKey returns the full uncompressed secp256k1 public key for EVM.
// Returns empty string for other chain types.
func (kb *keyBundle[K]) RawOnChainPublicKey() string {
stackman27 and others added 5 commits May 25, 2026 14:42
Define RawEVMOnChainPublicKey via a type assertion on *keyBundle[*evmKeyring]
so the keystore module compiles under Go generics.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@stackman27 stackman27 requested a review from pavel-raykov May 28, 2026 04:26
@pavel-raykov
Copy link
Copy Markdown
Contributor

Today, evmKeyring.PublicKey() returns the 20-byte address, not the full secp256k1 pubkey. Job Distributor needs the raw pubkey to avoid manually exec’ing into pods and exporting/decrypting OCR2 keys.

Could you probably mention Catana here (and the absence of noecrecoverin in Daml)

@jmank88 jmank88 added this pull request to the merge queue May 28, 2026
Merged via the queue into main with commit cf893cd May 28, 2026
32 of 33 checks passed
@jmank88 jmank88 deleted the sish/get-rawpubkey branch May 28, 2026 21:57
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.

5 participants