types

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: Apache-2.0 Imports: 37 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ModuleName    = "lcp"
	ClientTypeLCP = "lcp-client-zkdcap"
	MrenclaveSize = 32
)
View Source
const (
	EventTypeRegisterEnclaveKey       = "register_enclave_key"
	EventTypeZKDCAPRegisterEnclaveKey = "zkdcap_register_enclave_key"
	AttributeKeyEnclaveKey            = "enclave_key"
	AttributeKeyExpiredAt             = "expired_at"
	AttributeKeyOperator              = "operator"

	EventTypeUpdateOperators         = "update_operators"
	AttributeKeyNonce                = "nonce"
	AttributeKeyNewOperators         = "new_operators"
	AttributeKeyThresholdNumerator   = "threshold_numerator"
	AttributeKeyThresholdDenominator = "threshold_denominator"

	EventTypeZKDCAPUpdateCurrentTCBEvaluationDataNumber = "zkdcap_update_current_tcb_evaluation_data_number"
	EventTypeZKDCAPUpdateNextTCBEvaluationDataNumber    = "zkdcap_update_next_tcb_evaluation_data_number"
	AttributeKeyTCBEvaluationDataNumber                 = "tcb_evaluation_data_number"
)
View Source
const (
	LCPMessageVersion          = 1
	LCPMessageTypeUpdateState  = 1
	LCPMessageTypeState        = 2
	LCPMessageTypeMisbehaviour = 3
)
View Source
const (
	LCPMessageContextTypeEmpty          = 0
	LCPMessageContextTypeTrustingPeriod = 1
)

Variables

View Source
var (
	ErrInvalidStateCommitment      = errorsmod.Register(ModuleName, 1, "invalid state commitment")
	ErrInvalidStateCommitmentProof = errorsmod.Register(ModuleName, 2, "invalid state commitment proof")
	ErrExpiredEnclaveKey           = errorsmod.Register(ModuleName, 3, "enclave key has expired")
	ErrProcessedTimeNotFound       = errorsmod.Register(ModuleName, 4, "processed time not found")
	ErrProcessedHeightNotFound     = errorsmod.Register(ModuleName, 5, "processed height not found")
	ErrDelayPeriodNotPassed        = errorsmod.Register(ModuleName, 6, "packet-specified delay period has not been reached")
	ErrInvalidMisbehaviour         = errorsmod.Register(ModuleName, 7, "invalid misbehaviour")
	ErrRetrieveClientID            = errorsmod.Register(ModuleName, 8, "failed to retrieve client id")
)
View Source
var (
	RegisterEnclaveKeyTypes = apitypes.Types{
		"EIP712Domain": []apitypes.Type{
			{Name: "name", Type: "string"},
			{Name: "version", Type: "string"},
			{Name: "chainId", Type: "uint256"},
			{Name: "verifyingContract", Type: "address"},
			{Name: "salt", Type: "bytes32"},
		},
		"RegisterEnclaveKey": []apitypes.Type{
			{Name: "avr", Type: "string"},
		},
	}

	ZKDCAPRegisterEnclaveKeyTypes = apitypes.Types{
		"EIP712Domain": []apitypes.Type{
			{Name: "name", Type: "string"},
			{Name: "version", Type: "string"},
			{Name: "chainId", Type: "uint256"},
			{Name: "verifyingContract", Type: "address"},
			{Name: "salt", Type: "bytes32"},
		},
		"ZKDCAPRegisterEnclaveKey": []apitypes.Type{
			{Name: "zkDCAPVerifierInfo", Type: "bytes"},
			{Name: "outputHash", Type: "bytes32"},
		},
	}

	UpdateOperatorsTypes = apitypes.Types{
		"EIP712Domain": []apitypes.Type{
			{Name: "name", Type: "string"},
			{Name: "version", Type: "string"},
			{Name: "chainId", Type: "uint256"},
			{Name: "verifyingContract", Type: "address"},
			{Name: "salt", Type: "bytes32"},
		},
		"UpdateOperators": []apitypes.Type{
			{Name: "clientId", Type: "string"},
			{Name: "nonce", Type: "uint64"},
			{Name: "newOperators", Type: "address[]"},
			{Name: "thresholdNumerator", Type: "uint64"},
			{Name: "thresholdDenominator", Type: "uint64"},
		},
	}
)
View Source
var (
	ErrInvalidLengthLcp        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowLcp          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupLcp = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// KeyProcessedTime is appended to consensus state key to store the processed time
	KeyProcessedTime = []byte("/processedTime")
	// KeyProcessedHeight is appended to consensus state key to store the processed height
	KeyProcessedHeight = []byte("/processedHeight")
)

Functions

func ComputeCosmosChainSalt added in v0.2.5

func ComputeCosmosChainSalt(chainID string, prefix []byte) common.Hash

func ComputeEIP712CosmosUpdateOperators added in v0.2.5

func ComputeEIP712CosmosUpdateOperators(
	chainID string,
	prefix []byte,
	clientID string,
	nonce uint64,
	newOperators []common.Address,
	newOperatorThresholdNumerator uint64,
	newOperatorThresholdDenominator uint64,
) ([]byte, error)

func ComputeEIP712RegisterEnclaveKey added in v0.2.6

func ComputeEIP712RegisterEnclaveKey(report string) ([]byte, error)

func ComputeEIP712RegisterEnclaveKeyHash added in v0.2.6

func ComputeEIP712RegisterEnclaveKeyHash(report string) (common.Hash, error)

func ComputeEIP712UpdateOperators added in v0.2.5

func ComputeEIP712UpdateOperators(
	chainId int64,
	verifyingContract common.Address,
	salt common.Hash,
	clientID string,
	nonce uint64,
	newOperators []common.Address,
	newOperatorThresholdNumerator uint64,
	newOperatorThresholdDenominator uint64,
) ([]byte, error)

func ComputeEIP712ZKDCAPRegisterEnclaveKey added in v0.2.16

func ComputeEIP712ZKDCAPRegisterEnclaveKey(zkDCAPVerifierInfo []byte, outputHash [32]byte) ([]byte, error)

func ComputeEIP712ZKDCAPRegisterEnclaveKeyHash added in v0.2.16

func ComputeEIP712ZKDCAPRegisterEnclaveKeyHash(zkDCAPVerifierInfo []byte, outputHash [32]byte) (common.Hash, error)

func EthABIEncodeCommitmentProofs added in v0.2.5

func EthABIEncodeCommitmentProofs(p *CommitmentProofs) ([]byte, error)

func GetProcessedHeight

func GetProcessedHeight(clientStore storetypes.KVStore, height exported.Height) (exported.Height, bool)

GetProcessedHeight gets the height at which this chain received and processed a tendermint header. This is used to validate that a received packet has passed the block delay period.

func GetProcessedTime

func GetProcessedTime(clientStore storetypes.KVStore, height exported.Height) (uint64, bool)

GetProcessedTime gets the time (in nanoseconds) at which this chain received and processed a tendermint header. This is used to validate that a received packet has passed the time delay period.

func GetRegisterEnclaveKeyTypedData added in v0.2.5

func GetRegisterEnclaveKeyTypedData(avr string) apitypes.TypedData

func GetUpdateOperatorsTypedData added in v0.2.5

func GetUpdateOperatorsTypedData(
	chainId int64,
	verifyingContract common.Address,
	salt common.Hash,
	clientID string,
	nonce uint64,
	newOperators []common.Address,
	newOperatorThresholdNumerator uint64,
	newOperatorThresholdDenominator uint64,
) apitypes.TypedData

func GetZKDCAPRegisterEnclaveKeyTypedData added in v0.2.16

func GetZKDCAPRegisterEnclaveKeyTypedData(zkDCAPVerifierInfo []byte, outputHash [32]byte) apitypes.TypedData

func LCPClientDomain added in v0.2.5

func LCPClientDomain(chainId int64, verifyingContract common.Address, salt common.Hash) apitypes.TypedDataDomain

func ProcessedHeightKey

func ProcessedHeightKey(height exported.Height) []byte

ProcessedHeightKey returns the key under which the processed height will be stored in the client store.

func ProcessedTimeKey

func ProcessedTimeKey(height exported.Height) []byte

ProcessedTimeKey returns the key under which the processed time will be stored in the client store.

func RecoverAddress added in v0.2.5

func RecoverAddress(commitment [32]byte, signature []byte) (common.Address, error)

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces register the ibc channel submodule interfaces to protobuf Any.

func SetProcessedHeight

func SetProcessedHeight(clientStore storetypes.KVStore, consHeight, processedHeight exported.Height)

SetProcessedHeight stores the height at which a header was processed and the corresponding consensus state was created. This is useful when validating whether a packet has reached the specified block delay period in the tendermint client's verification functions

func SetProcessedTime

func SetProcessedTime(clientStore storetypes.KVStore, height exported.Height, timeNs uint64)

SetProcessedTime stores the time at which a header was processed and the corresponding consensus state was created. This is useful when validating whether a packet has reached the time specified delay period in the tendermint client's verification functions

func ValidateClientID added in v0.2.5

func ValidateClientID(clientID string) error

ValidateClientID validates the client identifier by ensuring that it conforms to the 02-client identifier format and that it is a lcp clientID.

func VerifySignature

func VerifySignature(signBytes []byte, signature []byte) (common.Address, error)

Types

type ChainType added in v0.2.5

type ChainType uint16
const (
	ChainTypeEVM    ChainType = 1
	ChainTypeCosmos ChainType = 2
)

func (ChainType) String added in v0.2.5

func (t ChainType) String() string

func (ChainType) Uint16 added in v0.2.5

func (t ChainType) Uint16() uint16

type ClientState

type ClientState struct {
	// This value strictly identifies the allowed enclave.
	Mrenclave []byte `protobuf:"bytes,1,opt,name=mrenclave,proto3" json:"mrenclave,omitempty"`
	// The `key_expiration` is used to determine the validity period of the EK.
	//
	// The logic for calculating EK validity periods slightly differs between IAS and DCAP:
	//
	// IAS:
	// - This value must be greater than 0.
	// - The EK validity ends at `ias_report.timestamp + key_expiration`.
	//
	// DCAP:
	// - If the value is 0, the EK validity ends at `output.validity.not_after`.
	// - If the value is greater than 0, the EK validity ends at:
	//   min(`qv_output.validity.not_before` + key_expiration, `output.validity.not_after`)
	//
	// Considerations:
	// - Operators should fetch the latest collateral from Intel Provisioning Certification Service (PCS) to ensure the EK validity starts close to the current time.
	// - When the EK expires and the TCB evaluation data number has been updated, operators might not be immediately ready
	//   to operate with the newly accepted TCB status, resulting in availability risks.
	//   To mitigate this risk, operators should set an appropriate `tcb_evaluation_data_number_update_grace_period`.
	KeyExpiration uint64 `protobuf:"varint,2,opt,name=key_expiration,json=keyExpiration,proto3" json:"key_expiration,omitempty"`
	// Indicates whether the client is frozen.
	Frozen bool `protobuf:"varint,3,opt,name=frozen,proto3" json:"frozen,omitempty"`
	// The height of the latest consensus state that the client has tracked
	LatestHeight types.Height `protobuf:"bytes,4,opt,name=latest_height,json=latestHeight,proto3" json:"latest_height"`
	// Determines which SGX enclave quote statuses are acceptable.
	//
	// Operators must configure this carefully based on their operational
	// security posture and environment-specific considerations.
	//
	// e.g. IAS: SW_HARDENING_NEEDED, CONFIGURATION_AND_SW_HARDENING_NEEDED
	//      DCAP: SWHardeningNeeded, ConfigurationAndSWHardeningNeeded
	AllowedQuoteStatuses []string `protobuf:"bytes,5,rep,name=allowed_quote_statuses,json=allowedQuoteStatuses,proto3" json:"allowed_quote_statuses,omitempty"`
	// Specifies Security Advisory IDs that operators explicitly allow.
	//
	// Operators must carefully consider the security implications of allowing specific advisories.
	//
	// e.g. INTEL-SA-00001, INTEL-SA-00002
	AllowedAdvisoryIds []string `protobuf:"bytes,6,rep,name=allowed_advisory_ids,json=allowedAdvisoryIds,proto3" json:"allowed_advisory_ids,omitempty"`
	// A list of LCP operator addresses (ethereum format) associated with this client.
	//
	// If this field is empty, operator signatures are not required, allowing any entity to act as an operator.
	//
	// Operational assumptions:
	// - At least one operator (including entities not listed in the `operators` field) is expected to promptly reference and report the latest TCB evaluation data number.
	//   - If no operator promptly reports the latest TCB number, the client continues accepting attestations based on outdated collateral for up to 12 months.
	// - Not all operators may immediately prepare an SGX environment compatible with the latest TCB level.
	//   - The `tcb_evaluation_data_number_update_grace_period` ensures that all operators have a guaranteed minimum period to update their SGX environments, maintaining overall availability.
	Operators [][]byte `protobuf:"bytes,7,rep,name=operators,proto3" json:"operators,omitempty"`
	// The current nonce used in operator updates.
	OperatorsNonce uint64 `protobuf:"varint,8,opt,name=operators_nonce,json=operatorsNonce,proto3" json:"operators_nonce,omitempty"`
	// The numerator of the signature threshold for operator updates.
	OperatorsThresholdNumerator uint64 `` /* 145-byte string literal not displayed */
	// The denominator of the signature threshold for operator updates.
	OperatorsThresholdDenominator uint64 `` /* 152-byte string literal not displayed */
	// The current TCB evaluation data number
	//
	// The client only accepts the zkDCAP output generated using collateral with a TCB evaluation data number equal to or greater than this number.
	CurrentTcbEvaluationDataNumber uint32 `` /* 159-byte string literal not displayed */
	// The grace period (in seconds) for operators to update their SGX environments to support a newly observed TCB evaluation data number.
	//
	// Notes:
	// - A shorter grace period could increase availability risk if operators are not given sufficient time
	//   to prepare the new SGX environment compatible with the updated TCB level.
	// - Conversely, a longer grace period could delay the adoption of the latest TCB level, potentially increasing security risks.
	// - Operators must carefully consider their operational preparation needs and security posture when configuring this value.
	//
	// When a new TCB evaluation data number greater than the current number is observed:
	//
	// - If the grace period is zero:
	//   - The current number is updated immediately.
	//
	// - If the grace period is non-zero:
	//   - The new number is reserved as `next_tcb_evaluation_data_number`.
	//   - `next_tcb_evaluation_data_number_update_time` is set to current timestamp plus the grace period.
	//
	// Edge cases:
	//
	//   - Edge case 1 (current < next < newly observed number):
	//     - Immediate activation of reserved next number, bypassing the remaining grace period.
	//     - Newly observed number is reserved as the next number.
	//
	//   - Edge case 2 (current < newly observed number < next):
	//     - Immediate activation of newly observed number, preserving the reserved next number.
	//
	// These edge cases can occur due to excessively long grace periods or frequent TCB Recovery Events occurring within shorter intervals than the typical 6-month update frequency.
	// Note that we assume operators can maintain an appropriate TCB status based on previous TCB collateral. Therefore, we expect that immediate updates in these edge cases do not cause operational issues.
	// Additionally, with a well-configured grace period aligned with typical TCB update intervals, the client will never skip the configured grace period for any TCB number update.
	TcbEvaluationDataNumberUpdateGracePeriod uint32 `` /* 193-byte string literal not displayed */
	// Next TCB evaluation data number scheduled to be updated
	//
	// Notes:
	// - Must be zero if and only if `next_tcb_evaluation_data_number_update_time` is zero.
	// - When `tcb_evaluation_data_number_update_grace_period` is zero, this field must always be zero.
	// - If this is non-zero, this number must be always greater than the `current_tcb_evaluation_data_number`.
	NextTcbEvaluationDataNumber uint32 `` /* 150-byte string literal not displayed */
	// Scheduled update time of the next TCB evaluation data number (UNIX time seconds)
	//
	// Notes:
	// - Must be zero if and only if `next_tcb_evaluation_data_number` is zero.
	// - When `tcb_evaluation_data_number_update_grace_period` is zero, this field must always be zero.
	NextTcbEvaluationDataNumberUpdateTime uint64 `` /* 184-byte string literal not displayed */
	// Contains verifier-specific information for zkDCAP proofs.
	//
	// Data format:
	// - First byte (0): zkVM type identifier.
	// - Remaining bytes (1–N): zkVM-specific data.
	//
	// Currently, only RISC Zero zkVM (type=1) is supported, with the following format:
	//
	// | Byte(s) | Description                 |
	// |---------|-----------------------------|
	// | 0       | zkVM type (fixed as 1)      |
	// | 1–31    | Reserved (set as zero)      |
	// | 32–63   | Image ID                    |
	ZkdcapVerifierInfos [][]byte `protobuf:"bytes,15,rep,name=zkdcap_verifier_infos,json=zkdcapVerifierInfos,proto3" json:"zkdcap_verifier_infos,omitempty"`
}

func (ClientState) CheckAndUpdateTcbEvaluationDataNumber added in v0.2.16

func (cs ClientState) CheckAndUpdateTcbEvaluationDataNumber(blockTimestamp time.Time, outputTcbEvaluationDataNumber uint32) (ClientState, bool, bool)

CheckAndUpdateTcbEvaluationDataNumber checks if the current or next TCB evaluation data number update is required.

func (ClientState) CheckForMisbehaviour

func (cs ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, msg exported.ClientMessage) bool

func (ClientState) CheckSubstituteAndUpdateState

func (cs ClientState) CheckSubstituteAndUpdateState(
	ctx sdk.Context, cdc codec.BinaryCodec, subjectClientStore,
	substituteClientStore storetypes.KVStore, substituteClient exported.ClientState,
) error

func (ClientState) ClientType

func (cs ClientState) ClientType() string

func (ClientState) Contains

func (cs ClientState) Contains(clientStore storetypes.KVStore, ek common.Address) bool

func (*ClientState) Descriptor

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

func (ClientState) ExportMetadata

func (cs ClientState) ExportMetadata(_ storetypes.KVStore) []exported.GenesisMetadata

Genesis function

func (ClientState) GetDCAPKeyExpiredAt added in v0.2.16

func (cs ClientState) GetDCAPKeyExpiredAt(validity dcap.ValidityIntersection) time.Time

func (ClientState) GetEKInfo added in v0.2.5

func (cs ClientState) GetEKInfo(clientStore storetypes.KVStore, ek common.Address) (*EKInfo, error)

func (ClientState) GetLatestHeight

func (cs ClientState) GetLatestHeight() exported.Height

func (ClientState) GetOperators added in v0.2.5

func (cs ClientState) GetOperators() []common.Address

func (ClientState) GetTimestampAtHeight

func (cs ClientState) GetTimestampAtHeight(
	ctx sdk.Context,
	clientStore storetypes.KVStore,
	cdc codec.BinaryCodec,
	height exported.Height,
) (uint64, error)

func (ClientState) GetZKDCAPVerifierInfos added in v0.2.16

func (cs ClientState) GetZKDCAPVerifierInfos() ([]*dcap.ZKDCAPVerifierInfo, error)

func (ClientState) Initialize

func (cs ClientState) Initialize(_ sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, consensusState exported.ConsensusState) error

Initialization function Clients must validate the initial consensus state, and may store any client-specific metadata necessary for correct light client operation

func (ClientState) IsZKDCAPEnabled added in v0.2.16

func (cs ClientState) IsZKDCAPEnabled() bool

func (*ClientState) Marshal

func (m *ClientState) Marshal() (dAtA []byte, err error)

func (*ClientState) MarshalTo

func (m *ClientState) MarshalTo(dAtA []byte) (int, error)

func (*ClientState) MarshalToSizedBuffer

func (m *ClientState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ClientState) ProtoMessage

func (*ClientState) ProtoMessage()

func (*ClientState) Reset

func (m *ClientState) Reset()

func (ClientState) SetEKInfo added in v0.2.5

func (cs ClientState) SetEKInfo(clientStore storetypes.KVStore, ek, operator common.Address, expiredAt time.Time) error

func (*ClientState) Size

func (m *ClientState) Size() (n int)

func (ClientState) Status

func (cs ClientState) Status(ctx sdk.Context, clientStore storetypes.KVStore, cdc codec.BinaryCodec) exported.Status

Status function Clients must return their status. Only Active clients are allowed to process packets.

func (*ClientState) String

func (m *ClientState) String() string

func (*ClientState) Unmarshal

func (m *ClientState) Unmarshal(dAtA []byte) error

func (ClientState) UpdateState

func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) []exported.Height

func (ClientState) UpdateStateOnMisbehaviour

func (cs ClientState) UpdateStateOnMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, msg exported.ClientMessage)

func (ClientState) Validate

func (cs ClientState) Validate() error

func (ClientState) ValidateRisc0DCAPVerifierOutput added in v0.2.16

func (cs ClientState) ValidateRisc0DCAPVerifierOutput(blockTimestamp time.Time, output *dcap.QuoteVerificationOutput) error

func (ClientState) VerifyClientMessage

func (cs ClientState) VerifyClientMessage(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) error

func (ClientState) VerifyMembership

func (cs ClientState) VerifyMembership(
	ctx sdk.Context,
	clientStore storetypes.KVStore,
	cdc codec.BinaryCodec,
	height exported.Height,
	delayTimePeriod uint64,
	delayBlockPeriod uint64,
	proof []byte,
	path exported.Path,
	value []byte,
) error

func (ClientState) VerifyNonMembership

func (cs ClientState) VerifyNonMembership(
	ctx sdk.Context,
	clientStore storetypes.KVStore,
	cdc codec.BinaryCodec,
	height exported.Height,
	delayTimePeriod uint64,
	delayBlockPeriod uint64,
	proof []byte,
	path exported.Path,
) error

VerifyNonMembership is a generic proof verification method which verifies the absence of a given CommitmentPath at a specified height. The caller is expected to construct the full CommitmentPath from a CommitmentPrefix and a standardized path (as defined in ICS 24).

func (ClientState) VerifyRisc0ZKDCAPProof added in v0.2.16

func (cs ClientState) VerifyRisc0ZKDCAPProof(verifierInfo *dcap.ZKDCAPVerifierInfo, commit *dcap.QuoteVerificationOutput, proof []byte, mockProofAllowed bool) error

func (ClientState) VerifySignatures added in v0.2.5

func (cs ClientState) VerifySignatures(ctx sdk.Context, clientStore storetypes.KVStore, commitment [32]byte, signatures [][]byte) error

func (ClientState) VerifyUpgradeAndUpdateState

func (cs ClientState) VerifyUpgradeAndUpdateState(
	ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore,
	upgradedClient exported.ClientState, upgradedConsState exported.ConsensusState,
	proofUpgradeClient, proofUpgradeConsState []byte,
) error

func (*ClientState) XXX_DiscardUnknown

func (m *ClientState) XXX_DiscardUnknown()

func (*ClientState) XXX_Marshal

func (m *ClientState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClientState) XXX_Merge

func (m *ClientState) XXX_Merge(src proto.Message)

func (*ClientState) XXX_Size

func (m *ClientState) XXX_Size() int

func (*ClientState) XXX_Unmarshal

func (m *ClientState) XXX_Unmarshal(b []byte) error

func (ClientState) ZeroCustomFields

func (cs ClientState) ZeroCustomFields() exported.ClientState

Utility function that zeroes out any client customizable fields in client state Ledger enforced fields are maintained while all custom fields are zero values Used to verify upgrades

type CommitmentProofs added in v0.2.5

type CommitmentProofs struct {
	Message    []byte
	Signatures [][]byte
}

func EthABIDecodeCommitmentProofs added in v0.2.5

func EthABIDecodeCommitmentProofs(bz []byte) (*CommitmentProofs, error)

func (CommitmentProofs) GetMessage added in v0.2.5

func (p CommitmentProofs) GetMessage() (*HeaderedProxyMessage, error)

type ConsensusState

type ConsensusState struct {
	// An identifier that uniquely indicates the ELC state at a specific height
	//
	// Please check the state ID details: <https://docs.lcp.network/protocol/elc#state-id>
	StateId []byte `protobuf:"bytes,1,opt,name=state_id,json=stateId,proto3" json:"state_id,omitempty"`
	// The timestamp of the target chain's block corresponding to the consensus height,
	// expressed in UNIX time (seconds).
	Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
}

func GetConsensusState

func GetConsensusState(store storetypes.KVStore, cdc codec.BinaryCodec, height exported.Height) (*ConsensusState, error)

GetConsensusState retrieves the consensus state from the client prefixed store. An error is returned if the consensus state does not exist.

func (ConsensusState) ClientType

func (cs ConsensusState) ClientType() string

func (*ConsensusState) Descriptor

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

func (ConsensusState) GetTimestamp

func (cs ConsensusState) GetTimestamp() uint64

GetTimestamp returns the timestamp (in nanoseconds) of the consensus state

func (*ConsensusState) Marshal

func (m *ConsensusState) Marshal() (dAtA []byte, err error)

func (*ConsensusState) MarshalTo

func (m *ConsensusState) MarshalTo(dAtA []byte) (int, error)

func (*ConsensusState) MarshalToSizedBuffer

func (m *ConsensusState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ConsensusState) ProtoMessage

func (*ConsensusState) ProtoMessage()

func (*ConsensusState) Reset

func (m *ConsensusState) Reset()

func (*ConsensusState) Size

func (m *ConsensusState) Size() (n int)

func (*ConsensusState) String

func (m *ConsensusState) String() string

func (*ConsensusState) Unmarshal

func (m *ConsensusState) Unmarshal(dAtA []byte) error

func (ConsensusState) ValidateBasic

func (cs ConsensusState) ValidateBasic() error

func (*ConsensusState) XXX_DiscardUnknown

func (m *ConsensusState) XXX_DiscardUnknown()

func (*ConsensusState) XXX_Marshal

func (m *ConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ConsensusState) XXX_Merge

func (m *ConsensusState) XXX_Merge(src proto.Message)

func (*ConsensusState) XXX_Size

func (m *ConsensusState) XXX_Size() int

func (*ConsensusState) XXX_Unmarshal

func (m *ConsensusState) XXX_Unmarshal(b []byte) error

type EKInfo added in v0.2.5

type EKInfo struct {
	ExpiredAt uint64
	Operator  common.Address
}

func (EKInfo) IsExpired added in v0.2.5

func (ei EKInfo) IsExpired(blockTime time.Time) bool

func (EKInfo) IsMatchOperator added in v0.2.5

func (ei EKInfo) IsMatchOperator(operator common.Address) bool

type ELCVerifyMembershipMessage added in v0.1.11

type ELCVerifyMembershipMessage struct {
	Prefix  []byte
	Path    []byte
	Value   [32]byte
	Height  clienttypes.Height
	StateID StateID
}

func EthABIDecodeVerifyMembershipProxyMessage added in v0.1.14

func EthABIDecodeVerifyMembershipProxyMessage(bz []byte) (*ELCVerifyMembershipMessage, error)

type EmittedState added in v0.1.11

type EmittedState struct {
	Height clienttypes.Height
	State  codectypes.Any
}

func (EmittedState) MarshalJSON added in v0.2.2

func (es EmittedState) MarshalJSON() ([]byte, error)

type EmptyValidationContext added in v0.1.11

type EmptyValidationContext struct{}

EmptyValidationContext is the validation context for a commitment that does not require any validation.

func (EmptyValidationContext) Validate added in v0.1.11

type HeaderedProxyMessage added in v0.1.14

type HeaderedProxyMessage struct {
	Version uint16
	Type    uint16
	Message []byte
}

func EthABIDecodeHeaderedProxyMessage added in v0.1.14

func EthABIDecodeHeaderedProxyMessage(bz []byte) (*HeaderedProxyMessage, error)

func (HeaderedProxyMessage) GetMisbehaviourProxyMessage added in v0.1.14

func (c HeaderedProxyMessage) GetMisbehaviourProxyMessage() (*MisbehaviourProxyMessage, error)

func (HeaderedProxyMessage) GetUpdateStateProxyMessage added in v0.1.14

func (c HeaderedProxyMessage) GetUpdateStateProxyMessage() (*UpdateStateProxyMessage, error)

func (HeaderedProxyMessage) GetVerifyMembershipProxyMessage added in v0.1.14

func (c HeaderedProxyMessage) GetVerifyMembershipProxyMessage() (*ELCVerifyMembershipMessage, error)

type MisbehaviourProxyMessage added in v0.1.14

type MisbehaviourProxyMessage struct {
	PrevStates []struct {
		Height  clienttypes.Height
		StateID StateID
	}
	Context       ValidationContext
	ClientMessage []byte
}

func EthABIDecodeMisbehaviourProxyMessage added in v0.1.14

func EthABIDecodeMisbehaviourProxyMessage(bz []byte) (*MisbehaviourProxyMessage, error)

type ProxyMessage added in v0.1.14

type ProxyMessage interface{}

type RegisterEnclaveKeyMessage

type RegisterEnclaveKeyMessage struct {
	// IAS report
	Report []byte `protobuf:"bytes,1,opt,name=report,proto3" json:"report,omitempty"`
	// A signature of the IAS report by the IAS signing key
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	// A certificate of the IAS signing key
	SigningCert []byte `protobuf:"bytes,3,opt,name=signing_cert,json=signingCert,proto3" json:"signing_cert,omitempty"`
	// An operator's signature of the EIP-712 message `RegisterEnclaveKey`
	OperatorSignature []byte `protobuf:"bytes,4,opt,name=operator_signature,json=operatorSignature,proto3" json:"operator_signature,omitempty"`
}

A message to verify IAS report and signature for the enclave key registration

func (RegisterEnclaveKeyMessage) ClientType

func (RegisterEnclaveKeyMessage) ClientType() string

func (*RegisterEnclaveKeyMessage) Descriptor

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

func (*RegisterEnclaveKeyMessage) Marshal

func (m *RegisterEnclaveKeyMessage) Marshal() (dAtA []byte, err error)

func (*RegisterEnclaveKeyMessage) MarshalTo

func (m *RegisterEnclaveKeyMessage) MarshalTo(dAtA []byte) (int, error)

func (*RegisterEnclaveKeyMessage) MarshalToSizedBuffer

func (m *RegisterEnclaveKeyMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RegisterEnclaveKeyMessage) ProtoMessage

func (*RegisterEnclaveKeyMessage) ProtoMessage()

func (*RegisterEnclaveKeyMessage) Reset

func (m *RegisterEnclaveKeyMessage) Reset()

func (*RegisterEnclaveKeyMessage) Size

func (m *RegisterEnclaveKeyMessage) Size() (n int)

func (*RegisterEnclaveKeyMessage) String

func (m *RegisterEnclaveKeyMessage) String() string

func (*RegisterEnclaveKeyMessage) Unmarshal

func (m *RegisterEnclaveKeyMessage) Unmarshal(dAtA []byte) error

func (RegisterEnclaveKeyMessage) ValidateBasic

func (RegisterEnclaveKeyMessage) ValidateBasic() error

func (*RegisterEnclaveKeyMessage) XXX_DiscardUnknown

func (m *RegisterEnclaveKeyMessage) XXX_DiscardUnknown()

func (*RegisterEnclaveKeyMessage) XXX_Marshal

func (m *RegisterEnclaveKeyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RegisterEnclaveKeyMessage) XXX_Merge

func (m *RegisterEnclaveKeyMessage) XXX_Merge(src proto.Message)

func (*RegisterEnclaveKeyMessage) XXX_Size

func (m *RegisterEnclaveKeyMessage) XXX_Size() int

func (*RegisterEnclaveKeyMessage) XXX_Unmarshal

func (m *RegisterEnclaveKeyMessage) XXX_Unmarshal(b []byte) error

type StateID

type StateID [32]byte

func (StateID) EqualBytes

func (id StateID) EqualBytes(bz []byte) bool

func (StateID) MarshalJSON added in v0.2.2

func (id StateID) MarshalJSON() ([]byte, error)

func (StateID) String added in v0.2.2

func (id StateID) String() string

type TrustingPeriodValidationContext added in v0.1.11

type TrustingPeriodValidationContext struct {
	UntrustedHeaderTimestamp time.Time `json:"untrusted_header_timestamp"`
	TrustedStateTimestamp    time.Time `json:"trusted_state_timestamp"`
	TrustingPeriod           big.Int   `json:"trusting_period"`
	ClockDrift               big.Int   `json:"clock_drift"`
}

TrustingPeriodValidationContext is the commitment context for a commitment that requires the current time to be within the trusting period.

func DecodeTrustingPeriodValidationContext added in v0.1.11

func DecodeTrustingPeriodValidationContext(timestamps, params [32]byte) *TrustingPeriodValidationContext

func EthABIDecodeTrustingPeriodValidationContext added in v0.1.11

func EthABIDecodeTrustingPeriodValidationContext(bz []byte) (*TrustingPeriodValidationContext, error)

func (TrustingPeriodValidationContext) MarshalJSON added in v0.2.2

func (c TrustingPeriodValidationContext) MarshalJSON() ([]byte, error)

func (TrustingPeriodValidationContext) Validate added in v0.1.11

type UpdateClientMessage

type UpdateClientMessage struct {
	// A proxy message generated by the LCP node running on the target platform
	ProxyMessage []byte `protobuf:"bytes,1,opt,name=proxy_message,json=proxyMessage,proto3" json:"proxy_message,omitempty"`
	// Signatures of the proxy message by the LCP node
	Signatures [][]byte `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"`
}

A message containing information required to update the client.

func (UpdateClientMessage) ClientType

func (UpdateClientMessage) ClientType() string

func (*UpdateClientMessage) Descriptor

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

func (UpdateClientMessage) GetHeight

func (ucm UpdateClientMessage) GetHeight() exported.Height

func (UpdateClientMessage) GetProxyMessage added in v0.1.14

func (ucm UpdateClientMessage) GetProxyMessage() (ProxyMessage, error)

func (*UpdateClientMessage) Marshal

func (m *UpdateClientMessage) Marshal() (dAtA []byte, err error)

func (*UpdateClientMessage) MarshalTo

func (m *UpdateClientMessage) MarshalTo(dAtA []byte) (int, error)

func (*UpdateClientMessage) MarshalToSizedBuffer

func (m *UpdateClientMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*UpdateClientMessage) ProtoMessage

func (*UpdateClientMessage) ProtoMessage()

func (*UpdateClientMessage) Reset

func (m *UpdateClientMessage) Reset()

func (*UpdateClientMessage) Size

func (m *UpdateClientMessage) Size() (n int)

func (*UpdateClientMessage) String

func (m *UpdateClientMessage) String() string

func (*UpdateClientMessage) Unmarshal

func (m *UpdateClientMessage) Unmarshal(dAtA []byte) error

func (UpdateClientMessage) ValidateBasic

func (ucm UpdateClientMessage) ValidateBasic() error

func (*UpdateClientMessage) XXX_DiscardUnknown

func (m *UpdateClientMessage) XXX_DiscardUnknown()

func (*UpdateClientMessage) XXX_Marshal

func (m *UpdateClientMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UpdateClientMessage) XXX_Merge

func (m *UpdateClientMessage) XXX_Merge(src proto.Message)

func (*UpdateClientMessage) XXX_Size

func (m *UpdateClientMessage) XXX_Size() int

func (*UpdateClientMessage) XXX_Unmarshal

func (m *UpdateClientMessage) XXX_Unmarshal(b []byte) error

type UpdateOperatorsMessage added in v0.2.5

type UpdateOperatorsMessage struct {
	// A nonce for this operators update
	Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"`
	// A list of new operators
	NewOperators [][]byte `protobuf:"bytes,2,rep,name=new_operators,json=newOperators,proto3" json:"new_operators,omitempty"`
	// A numerator of the threshold of signatures required for new operators
	NewOperatorsThresholdNumerator uint64 `` /* 156-byte string literal not displayed */
	// A denominator of the threshold of signatures required for new operators
	NewOperatorsThresholdDenominator uint64 `` /* 162-byte string literal not displayed */
	// Signatures of the EIP-712 message `UpdateOperators` by the current operators
	Signatures [][]byte `protobuf:"bytes,5,rep,name=signatures,proto3" json:"signatures,omitempty"`
}

func (UpdateOperatorsMessage) ClientType added in v0.2.5

func (UpdateOperatorsMessage) ClientType() string

func (*UpdateOperatorsMessage) Descriptor added in v0.2.5

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

func (UpdateOperatorsMessage) GetNewOperators added in v0.2.5

func (m UpdateOperatorsMessage) GetNewOperators() ([]common.Address, error)

func (*UpdateOperatorsMessage) Marshal added in v0.2.5

func (m *UpdateOperatorsMessage) Marshal() (dAtA []byte, err error)

func (*UpdateOperatorsMessage) MarshalTo added in v0.2.5

func (m *UpdateOperatorsMessage) MarshalTo(dAtA []byte) (int, error)

func (*UpdateOperatorsMessage) MarshalToSizedBuffer added in v0.2.5

func (m *UpdateOperatorsMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*UpdateOperatorsMessage) ProtoMessage added in v0.2.5

func (*UpdateOperatorsMessage) ProtoMessage()

func (*UpdateOperatorsMessage) Reset added in v0.2.5

func (m *UpdateOperatorsMessage) Reset()

func (*UpdateOperatorsMessage) Size added in v0.2.5

func (m *UpdateOperatorsMessage) Size() (n int)

func (*UpdateOperatorsMessage) String added in v0.2.5

func (m *UpdateOperatorsMessage) String() string

func (*UpdateOperatorsMessage) Unmarshal added in v0.2.5

func (m *UpdateOperatorsMessage) Unmarshal(dAtA []byte) error

func (UpdateOperatorsMessage) ValidateBasic added in v0.2.5

func (m UpdateOperatorsMessage) ValidateBasic() error

func (*UpdateOperatorsMessage) XXX_DiscardUnknown added in v0.2.5

func (m *UpdateOperatorsMessage) XXX_DiscardUnknown()

func (*UpdateOperatorsMessage) XXX_Marshal added in v0.2.5

func (m *UpdateOperatorsMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UpdateOperatorsMessage) XXX_Merge added in v0.2.5

func (m *UpdateOperatorsMessage) XXX_Merge(src proto.Message)

func (*UpdateOperatorsMessage) XXX_Size added in v0.2.5

func (m *UpdateOperatorsMessage) XXX_Size() int

func (*UpdateOperatorsMessage) XXX_Unmarshal added in v0.2.5

func (m *UpdateOperatorsMessage) XXX_Unmarshal(b []byte) error

type UpdateStateProxyMessage added in v0.1.14

type UpdateStateProxyMessage struct {
	PrevHeight    *clienttypes.Height `json:"prev_height"`
	PrevStateID   *StateID            `json:"prev_state_id"`
	PostHeight    clienttypes.Height  `json:"post_height"`
	PostStateID   StateID             `json:"post_state_id"`
	Timestamp     *big.Int            `json:"timestamp"`
	Context       ValidationContext   `json:"context"`
	EmittedStates []EmittedState      `json:"emitted_states"`
}

func EthABIDecodeUpdateStateProxyMessage added in v0.1.14

func EthABIDecodeUpdateStateProxyMessage(bz []byte) (*UpdateStateProxyMessage, error)

type ValidationContext added in v0.1.11

type ValidationContext interface {
	Validate(time.Time) error
}

ValidationContext is the interface of validation context.

func EthABIDecodeValidationContext added in v0.1.11

func EthABIDecodeValidationContext(bz []byte) (ValidationContext, error)

type ZKDCAPRegisterEnclaveKeyMessage added in v0.2.16

type ZKDCAPRegisterEnclaveKeyMessage struct {
	// A type of zkVM generated the `quote_verification_output` and `proof`
	ZkvmType uint32 `protobuf:"varint,1,opt,name=zkvm_type,json=zkvmType,proto3" json:"zkvm_type,omitempty"`
	// An output of the zkDCAP program that verifies the quote
	QuoteVerificationOutput []byte `` /* 132-byte string literal not displayed */
	// A proof of the zkVM generated the `quote_verification_output`
	Proof []byte `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"`
	// An operator's signature of the EIP-712 message `ZKDCAPRegisterEnclaveKey`
	OperatorSignature []byte `protobuf:"bytes,4,opt,name=operator_signature,json=operatorSignature,proto3" json:"operator_signature,omitempty"`
}

A message to verify zkDCAP's output and proof for the enclave key registration

func (ZKDCAPRegisterEnclaveKeyMessage) ClientType added in v0.2.16

func (*ZKDCAPRegisterEnclaveKeyMessage) Descriptor added in v0.2.16

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

func (*ZKDCAPRegisterEnclaveKeyMessage) Marshal added in v0.2.16

func (m *ZKDCAPRegisterEnclaveKeyMessage) Marshal() (dAtA []byte, err error)

func (*ZKDCAPRegisterEnclaveKeyMessage) MarshalTo added in v0.2.16

func (m *ZKDCAPRegisterEnclaveKeyMessage) MarshalTo(dAtA []byte) (int, error)

func (*ZKDCAPRegisterEnclaveKeyMessage) MarshalToSizedBuffer added in v0.2.16

func (m *ZKDCAPRegisterEnclaveKeyMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ZKDCAPRegisterEnclaveKeyMessage) ProtoMessage added in v0.2.16

func (*ZKDCAPRegisterEnclaveKeyMessage) ProtoMessage()

func (*ZKDCAPRegisterEnclaveKeyMessage) Reset added in v0.2.16

func (*ZKDCAPRegisterEnclaveKeyMessage) Size added in v0.2.16

func (m *ZKDCAPRegisterEnclaveKeyMessage) Size() (n int)

func (*ZKDCAPRegisterEnclaveKeyMessage) String added in v0.2.16

func (*ZKDCAPRegisterEnclaveKeyMessage) Unmarshal added in v0.2.16

func (m *ZKDCAPRegisterEnclaveKeyMessage) Unmarshal(dAtA []byte) error

func (ZKDCAPRegisterEnclaveKeyMessage) ValidateBasic added in v0.2.16

func (ZKDCAPRegisterEnclaveKeyMessage) ValidateBasic() error

func (*ZKDCAPRegisterEnclaveKeyMessage) XXX_DiscardUnknown added in v0.2.16

func (m *ZKDCAPRegisterEnclaveKeyMessage) XXX_DiscardUnknown()

func (*ZKDCAPRegisterEnclaveKeyMessage) XXX_Marshal added in v0.2.16

func (m *ZKDCAPRegisterEnclaveKeyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ZKDCAPRegisterEnclaveKeyMessage) XXX_Merge added in v0.2.16

func (m *ZKDCAPRegisterEnclaveKeyMessage) XXX_Merge(src proto.Message)

func (*ZKDCAPRegisterEnclaveKeyMessage) XXX_Size added in v0.2.16

func (m *ZKDCAPRegisterEnclaveKeyMessage) XXX_Size() int

func (*ZKDCAPRegisterEnclaveKeyMessage) XXX_Unmarshal added in v0.2.16

func (m *ZKDCAPRegisterEnclaveKeyMessage) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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