config

package
v0.0.0-...-cce48a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const SharedSecretSize = 16 // A 128-bit symmetric key

Variables

View Source
var File_offchain_config_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type OffchainConfig

type OffchainConfig struct {
	DeltaProgress                           uint64                        `protobuf:"varint,1,opt,name=delta_progress,json=deltaProgress,proto3" json:"delta_progress,omitempty"`
	DeltaResend                             uint64                        `protobuf:"varint,2,opt,name=delta_resend,json=deltaResend,proto3" json:"delta_resend,omitempty"`
	DeltaRound                              uint64                        `protobuf:"varint,3,opt,name=delta_round,json=deltaRound,proto3" json:"delta_round,omitempty"`
	DeltaGrace                              uint64                        `protobuf:"varint,4,opt,name=delta_grace,json=deltaGrace,proto3" json:"delta_grace,omitempty"`
	DeltaStage                              uint64                        `protobuf:"varint,5,opt,name=delta_stage,json=deltaStage,proto3" json:"delta_stage,omitempty"`
	RMax                                    uint32                        `protobuf:"varint,6,opt,name=r_max,json=rMax,proto3" json:"r_max,omitempty"`
	S                                       []uint32                      `protobuf:"varint,7,rep,packed,name=s,proto3" json:"s,omitempty"`
	OffchainPublicKeys                      [][]byte                      `protobuf:"bytes,8,rep,name=offchain_public_keys,json=offchainPublicKeys,proto3" json:"offchain_public_keys,omitempty"`
	PeerIds                                 []string                      `protobuf:"bytes,9,rep,name=peer_ids,json=peerIds,proto3" json:"peer_ids,omitempty"`
	ReportingPluginConfig                   []byte                        `` /* 127-byte string literal not displayed */
	MaxDurationQuery                        uint64                        `protobuf:"varint,11,opt,name=max_duration_query,json=maxDurationQuery,proto3" json:"max_duration_query,omitempty"`
	MaxDurationObservation                  uint64                        `` /* 131-byte string literal not displayed */
	MaxDurationReport                       uint64                        `protobuf:"varint,13,opt,name=max_duration_report,json=maxDurationReport,proto3" json:"max_duration_report,omitempty"`
	MaxDurationShouldAcceptFinalizedReport  uint64                        `` /* 185-byte string literal not displayed */
	MaxDurationShouldTransmitAcceptedReport uint64                        `` /* 188-byte string literal not displayed */
	SharedSecretEncryptions                 *SharedSecretEncryptionsProto `` /* 133-byte string literal not displayed */
	// contains filtered or unexported fields
}

func DecodeConfig

func DecodeConfig(b []byte) (*OffchainConfig, error)

func (*OffchainConfig) Descriptor deprecated

func (*OffchainConfig) Descriptor() ([]byte, []int)

Deprecated: Use OffchainConfig.ProtoReflect.Descriptor instead.

func (*OffchainConfig) Encode

func (c *OffchainConfig) Encode() ([]byte, error)

func (*OffchainConfig) GetDeltaGrace

func (x *OffchainConfig) GetDeltaGrace() uint64

func (*OffchainConfig) GetDeltaProgress

func (x *OffchainConfig) GetDeltaProgress() uint64

func (*OffchainConfig) GetDeltaResend

func (x *OffchainConfig) GetDeltaResend() uint64

func (*OffchainConfig) GetDeltaRound

func (x *OffchainConfig) GetDeltaRound() uint64

func (*OffchainConfig) GetDeltaStage

func (x *OffchainConfig) GetDeltaStage() uint64

func (*OffchainConfig) GetMaxDurationObservation

func (x *OffchainConfig) GetMaxDurationObservation() uint64

func (*OffchainConfig) GetMaxDurationQuery

func (x *OffchainConfig) GetMaxDurationQuery() uint64

func (*OffchainConfig) GetMaxDurationReport

func (x *OffchainConfig) GetMaxDurationReport() uint64

func (*OffchainConfig) GetMaxDurationShouldAcceptFinalizedReport

func (x *OffchainConfig) GetMaxDurationShouldAcceptFinalizedReport() uint64

func (*OffchainConfig) GetMaxDurationShouldTransmitAcceptedReport

func (x *OffchainConfig) GetMaxDurationShouldTransmitAcceptedReport() uint64

func (*OffchainConfig) GetOffchainPublicKeys

func (x *OffchainConfig) GetOffchainPublicKeys() [][]byte

func (*OffchainConfig) GetPeerIds

func (x *OffchainConfig) GetPeerIds() []string

func (*OffchainConfig) GetRMax

func (x *OffchainConfig) GetRMax() uint32

func (*OffchainConfig) GetReportingPluginConfig

func (x *OffchainConfig) GetReportingPluginConfig() []byte

func (*OffchainConfig) GetS

func (x *OffchainConfig) GetS() []uint32

func (*OffchainConfig) GetSharedSecretEncryptions

func (x *OffchainConfig) GetSharedSecretEncryptions() *SharedSecretEncryptionsProto

func (*OffchainConfig) ProtoMessage

func (*OffchainConfig) ProtoMessage()

func (*OffchainConfig) ProtoReflect

func (x *OffchainConfig) ProtoReflect() protoreflect.Message

func (*OffchainConfig) Reset

func (x *OffchainConfig) Reset()

func (*OffchainConfig) String

func (x *OffchainConfig) String() string

type SharedSecretEncryptions

type SharedSecretEncryptions struct {
	// (secret key chosen by dealer) * g, X25519 point
	DiffieHellmanPoint [curve25519.PointSize]byte

	// keccak256 of plaintext sharedSecret.
	//
	// Since SharedSecretEncryptions are shared through a smart contract, each
	// oracle will see the same SharedSecretHash. After decryption, oracles can
	// check their sharedSecret against SharedSecretHash to prevent the dealer
	// from equivocating
	SharedSecretHash common.Hash

	// Encryptions of the shared secret with one entry for each oracle. The
	// i-th oracle can recover the key as follows:
	//
	// 1. key := Keccak256(DH(DiffieHellmanPoint, process' secret key))[:16]
	// 2. sharedSecret := AES128DecryptBlock(key, Encryptions[i])
	//
	// See Decrypt for details.
	Encryptions []encryptedSharedSecret
}

SharedSecretEncryptions is the encryptions of SharedConfig.SharedSecret, using each oracle's SharedSecretEncryptionPublicKey.

We use a custom encryption scheme to be more space-efficient (compared to standard AEAD schemes, nacl crypto_box, etc...), which saves gas in transmission to the OCR2Aggregator.

func EncryptSharedSecret

func EncryptSharedSecret(
	keys []ocrtypes.SharedSecretEncryptionPublicKey,
	sharedSecret *[SharedSecretSize]byte,
	rand io.Reader,
) SharedSecretEncryptions

EncryptSharedSecret constructs a SharedSecretEncryptions from a set of SharedSecretEncryptionPublicKeys, the sharedSecret, and a cryptographic randomness source

func EncryptSharedSecretInternal

func EncryptSharedSecretInternal(
	publicKeys []ocrtypes.SharedSecretEncryptionPublicKey,
	sharedSecret *[SharedSecretSize]byte,
	sk *[32]byte,
) SharedSecretEncryptions

EncryptSharedSecretInternal constructs a SharedSecretEncryptions from a set of SharedSecretEncryptionPublicKeys, the sharedSecret, and an ephemeral secret key sk

func (SharedSecretEncryptions) Decrypt

Decrypt returns the sharedSecret

func (SharedSecretEncryptions) Equal

func (SharedSecretEncryptions) Proto

type SharedSecretEncryptionsProto

type SharedSecretEncryptionsProto struct {
	DiffieHellmanPoint []byte   `protobuf:"bytes,1,opt,name=diffieHellmanPoint,proto3" json:"diffieHellmanPoint,omitempty"`
	SharedSecretHash   []byte   `protobuf:"bytes,2,opt,name=sharedSecretHash,proto3" json:"sharedSecretHash,omitempty"`
	Encryptions        [][]byte `protobuf:"bytes,3,rep,name=encryptions,proto3" json:"encryptions,omitempty"`
	// contains filtered or unexported fields
}

func (*SharedSecretEncryptionsProto) Descriptor deprecated

func (*SharedSecretEncryptionsProto) Descriptor() ([]byte, []int)

Deprecated: Use SharedSecretEncryptionsProto.ProtoReflect.Descriptor instead.

func (*SharedSecretEncryptionsProto) GetDiffieHellmanPoint

func (x *SharedSecretEncryptionsProto) GetDiffieHellmanPoint() []byte

func (*SharedSecretEncryptionsProto) GetEncryptions

func (x *SharedSecretEncryptionsProto) GetEncryptions() [][]byte

func (*SharedSecretEncryptionsProto) GetSharedSecretHash

func (x *SharedSecretEncryptionsProto) GetSharedSecretHash() []byte

func (*SharedSecretEncryptionsProto) ProtoMessage

func (*SharedSecretEncryptionsProto) ProtoMessage()

func (*SharedSecretEncryptionsProto) ProtoReflect

func (*SharedSecretEncryptionsProto) Reset

func (x *SharedSecretEncryptionsProto) Reset()

func (*SharedSecretEncryptionsProto) String

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL