fdc

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChainBoundRelayPrefixedHash added in v0.0.26

func ChainBoundRelayPrefixedHash(chainID uint64, messageHash common.Hash) common.Hash

ChainBoundRelayPrefixedHash returns keccak256(chainID || 0x010000000000 || messageHash) — the inner hash that both cosigner signatures (Fdc2ProofVerification.toCosignersMessageHash) and signing-policy data-provider signatures (Relay.relay() Mode 2, protocolId=1) are recovered against. eth_sign-wrap this value before signing or recovering.

The 70-byte preimage must stay byte-identical to keccak256(bytes.concat(bytes32(block.chainid), hex"010000000000", messageHash)). chainID is the Relay's sourceChainId; FDC2 only ships alongside a home Relay, where that equals block.chainid.

The TEE's own signature path (Verification._verifyTeeSignature) recovers against the bare messageHash, so do not use this helper there.

func DecodeRequest

func DecodeRequest(data []byte) (fdc2.IFdc2HubFdc2AttestationRequest, error)

DecodeRequest decodes bytes into an FDC2 attestation request.

func DecodeResponse

func DecodeResponse(data []byte) (fdc2.IFdc2HubFdc2ResponseHeader, error)

DecodeResponse decodes bytes into an FDC2 response header.

func EncodeRequest

EncodeRequest encodes an FDC2 attestation request to bytes.

func EncodeResponseHeader

func EncodeResponseHeader(header fdc2.IFdc2HubFdc2ResponseHeader) (hexutil.Bytes, error)

EncodeResponseHeader encodes an FDC2 response header to bytes.

func HashMessage

func HashMessage(
	chainID uint64,
	req fdc2.IFdc2HubFdc2AttestationRequest,
	responseBody []byte,
	cosigners []common.Address,
	cosignersThreshold uint64,
	timestamp uint64,
) (common.Hash, hexutil.Bytes, error)

HashMessage returns the SignedPayload preimage the on-chain Verification facet recovers FDC2 signatures against:

signing.Payload{signing.FDC2, chainID, keccak256(abi.encode(
    keccak256(abi.encode(header)),
    keccak256(abi.encode(requestBody)),
    keccak256(abi.encode(responseBody)),
))}.Hash()

The encoded header is returned alongside so callers can embed it verbatim in the proof response.

func RelayPrefixedHash added in v0.0.21

func RelayPrefixedHash(messageHash common.Hash) common.Hash

RelayPrefixedHash returns keccak256(0x010000000000 || messageHash) — the pre-cutover form of the digest, retired on chain by RLY-23 in favour of ChainBoundRelayPrefixedHash.

No tee-node or tee-proxy code path computes it any more. It stays exported for the relay client, which still signs this form for chains whose breaking reward epoch has not arrived, and which gates between the two itself. Delete it once that client no longer needs it.

Types

type ProveResponse

type ProveResponse struct {
	ResponseHeader         hexutil.Bytes   `json:"responseHeader"`
	RequestBody            hexutil.Bytes   `json:"requestBody"`
	ResponseBody           hexutil.Bytes   `json:"responseBody"`
	TEESignature           hexutil.Bytes   `json:"teeSignature"`
	CosignerSignatures     []hexutil.Bytes `json:"cosignerSignatures"`
	DataProviderSignatures hexutil.Bytes   `json:"dataProviderSignatures"`
}

ProveResponse represents the response structure for F_FDC2 PROVE opCommand.

Jump to

Keyboard shortcuts

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