Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion keystore/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/lib/pq v1.10.9
github.com/mr-tron/base58 v1.2.0
github.com/smartcontractkit/chainlink-common v0.11.2-0.20260422075950-29f37fa83c8a
github.com/smartcontractkit/libocr v0.0.0-20251027221354-bdc84e1ed858
github.com/smartcontractkit/libocr v0.0.0-20260529134643-c101335a64cd
github.com/smartcontractkit/smdkg v0.0.0-20251029093710-c38905e58aeb
github.com/smartcontractkit/wsrpc v0.8.5-0.20250502134807-c57d3d995945
github.com/spf13/cobra v1.9.1
Expand Down
4 changes: 2 additions & 2 deletions keystore/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions keystore/ocr3util/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package ocr3util
Comment thread
pavel-raykov marked this conversation as resolved.

import (
"github.com/smartcontractkit/libocr/offchainreporting2/types"
"github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types"
ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types"
)

// OnchainKeyring2 is a genericless counterpart of ocr3types.OnchainKeyring2. If generic RI does not matter,
// then it is more convenient to implement this interface and then use AsOCR3OnchainKeyring2 to use it as
// ocr3types.OnchainKeyring2.
type OnchainKeyring2 interface {
Sign(configDigest ocrtypes.ConfigDigest, seqNr uint64, report types.Report) (signature []byte, err error)
Verify(publicKey ocrtypes.OnchainPublicKey, configDigest ocrtypes.ConfigDigest, seqNr uint64, report types.Report, signature []byte) bool
Has(publicKey ocrtypes.OnchainPublicKey) bool
MaxSignatureLength() int
DebugIdentifier() string
}

var _ ocr3types.OnchainKeyring2[struct{}] = &onchainKeyring2[struct{}]{}

type onchainKeyring2[RI any] struct {
k OnchainKeyring2
}

func (o *onchainKeyring2[RI]) Sign(c ocrtypes.ConfigDigest, seqNr uint64, r ocr3types.ReportWithInfo[RI]) (signature []byte, err error) {
return o.k.Sign(c, seqNr, r.Report)
}

func (o *onchainKeyring2[RI]) Verify(pk ocrtypes.OnchainPublicKey, c ocrtypes.ConfigDigest, seqNr uint64, r ocr3types.ReportWithInfo[RI], signature []byte) bool {
return o.k.Verify(pk, c, seqNr, r.Report, signature)
}

func (o *onchainKeyring2[RI]) Has(key ocrtypes.OnchainPublicKey) bool {
return o.k.Has(key)
}

func (o *onchainKeyring2[RI]) MaxSignatureLength() int {
return o.k.MaxSignatureLength()
}

func (o *onchainKeyring2[RI]) DebugIdentifier() string {
return o.k.DebugIdentifier()
}

func AsOCR3OnchainKeyring2[RI any](k OnchainKeyring2) ocr3types.OnchainKeyring2[RI] {
return &onchainKeyring2[RI]{k}
}
Loading