Documentation
¶
Index ¶
Constants ¶
const ( DefaultPrivateKeyVariable = "PRIVATE_KEY" DefaultDirectAPIKeyVariable = "DIRECT_API_KEY" )
Variables ¶
This section is empty.
Functions ¶
func PrivateKeyFromEnv ¶
func PrivateKeyFromEnv(variableName string) (*ecdsa.PrivateKey, error)
PrivateKeyFromEnv extracts ecdsa private key from env variable.
Private key should be 32 bytes long hex string, but it can be shorter. It can be 0x or 0X prefixed or not.
Types ¶
type Addresses ¶
type Addresses struct {
FlareSystemsManager common.Address `toml:"flare_systems_manager"`
Relay common.Address `toml:"relay"`
VoterRegistry common.Address `toml:"voter_registry"`
MachinePathManager common.Address `toml:"machine_path_manager"` // optional: when unset, the machine path list service is disabled.
}
Addresses of the smart contracts.
type Attestation ¶ added in v0.0.18
type Attestation struct {
Enable bool `toml:"enable"`
Audience string `toml:"audience"` // expected aud claim; empty skips the audience check
ExpectedCodeHashes []string `toml:"expected_code_hashes"` // 32-byte hex; accepts an optional 0x or sha256: prefix, but not both
ExpectedPlatforms []string `toml:"expected_platforms"` // hwmodel strings, e.g. "AMD_SEV_SNP_VM"
ExpectedDebugStatuses []string `toml:"expected_debug_statuses"` // dbgstat values, e.g. "disabled-since-boot"
MaxTokenAge time.Duration `toml:"max_token_age"`
RequireSecBoot bool `toml:"require_sec_boot"`
// AllowMagicPass accepts the tee-node sentinel; dev/test only.
AllowMagicPass bool `toml:"allow_magic_pass"`
}
Attestation controls bootstrap attestation verification. Empty allowlists / zero values skip the corresponding check.
func (Attestation) ParsedCodeHashes ¶ added in v0.0.18
func (a Attestation) ParsedCodeHashes() ([]common.Hash, error)
ParsedCodeHashes decodes ExpectedCodeHashes; safe after validate() passes.
type Direct ¶
type Direct struct {
Enable bool `toml:"enable"` // Enable registers the /direct endpoint on the external server.
APIKey string `toml:"api_key"` // APIKey for the /direct endpoint. Can also be set via env variable (see APIKeyVariable).
APIKeyVariable string `toml:"api_key_variable"` // APIKeyVariable is the name of environment variable that stores the /direct endpoint API key. Defaults to DIRECT_API_KEY.
APIKeyOptional bool `toml:"api_key_optional"` // APIKeyOptional disables the API key requirement for the /direct endpoint.
MaxBodySize int64 `toml:"max_body_size"` // MaxBodySize limits the body of the request on the /direct endpoint. If 0, the server applies its 10 MiB default.
}
Direct holds configuration for the /direct endpoint.
type GCS ¶ added in v0.0.20
type GCS struct {
Bucket string `toml:"bucket"` // Bucket holding the proxy's persistent data.
Prefix string `toml:"prefix"` // Optional object-name prefix namespacing this proxy's data within the bucket.
URL string `toml:"url"` // Endpoint override for emulators/tests. Empty means production Google Cloud Storage.
CredentialsFile string `toml:"credentials_file"` // Path to service account JSON key. Empty means Application Default Credentials.
}
GCS holds Google Cloud Storage connection configuration. Setting bucket enables GCS-backed persistent storage; empty means Redis-backed.
type Governance ¶ added in v0.0.20
type Governance struct {
Signers []common.Address `toml:"signers"`
Threshold uint64 `toml:"threshold"`
Safe common.Address `toml:"safe"`
TeeManager common.Address `toml:"tee_manager"`
}
Governance is the extension's TEE governance. It is required for Safe-backed governance and optional otherwise:
- Safe-backed governance: set all fields so the proxy can collect and pre-verify the approveMachinePathList Safe transactions that authorize a machine-path list. Without them the proxy cannot assemble Safe authorization and the node rejects every list update. Configuring it also cross-checks the governance hash against the node's attested hash at startup, refusing to run on a mismatch.
- direct-signature governance: leave it unset — the proxy recovers the on-chain governance signatures itself and forwards them for the node to verify. Setting Signers and Threshold alone (no Safe) is optional and only enables the startup governance-hash cross-check.
Signers and Threshold are the plain governance signer set / threshold, or — for Safe-backed governance — the Safe owners' snapshot and threshold. Safe and TeeManager are set together only for Safe-backed governance.
A set governance requires addresses.machine_path_manager: the block exists only for the machine-path service, so configuring one without the other is rejected at load time.
func (Governance) IsSet ¶ added in v0.0.20
func (g Governance) IsSet() bool
IsSet reports whether any governance field was configured.
func (Governance) SafeBacked ¶ added in v0.0.20
func (g Governance) SafeBacked() bool
SafeBacked reports whether the configured governance is Safe-backed.
type InfoTiming ¶
type InfoTiming struct {
Initial time.Duration `toml:"initial_timeout"` // Bound on the bootstrap fetch; 0 means no timeout.
CycleInternal time.Duration `toml:"cycle_internal"` // Period of the internal refresh cycle.
CycleQueueResponseWait time.Duration `toml:"cycle_queue_response_wait"` // Per-refresh wait for a response.
}
InfoTiming controls the bootstrap and steady-state cadence of TEE info refreshes.
type Metrics ¶ added in v0.0.19
type Metrics struct {
Enable bool `toml:"enable"` // Master switch. When false, the whole subsystem is inert.
HTTP *bool `toml:"http"` // Per-request count and latency middleware.
Storage *bool `toml:"storage"` // Generic Redis/GCS operation count and errors.
Queue *bool `toml:"queue"` // Action enqueue/dequeue counters and queue-depth gauge.
Voting *bool `toml:"voting"` // Instruction and votings-started counters, threshold-duration histogram.
ActiveVoters *bool `toml:"active_voters"` // Per-epoch participant gauges (data-provider voters and weight, initiators, top providers, voting threshold).
Result *bool `toml:"result"` // Result throughput, lost, discarded, rejected, and channel-dropped counters; rejected{reason=wrong_tee_id} is the TEE tamper/mis-route signal.
Wallet *bool `toml:"wallet"` // Wallet key/proof sync-cycle outcome counter and cached-key gauge.
Info *bool `toml:"info"` // TEE info per-stage refresh failures and end-to-end refresh-duration histogram.
Attestation *bool `toml:"attestation"` // Attestation verify outcomes.
Policy *bool `toml:"policy"` // Active signing-policy reward-epoch gauge.
Liveness *bool `toml:"liveness"` // Readiness gauge and info-staleness gauge.
Node *bool `toml:"node"` // TEE-node response-wait latency and outcomes (info, wallet, machinepath).
Runtime *bool `toml:"runtime"` // Go runtime/process collectors and build info.
}
Metrics controls the Prometheus metrics subsystem, off by default. Each group is a *bool: unset inherits Enable, an explicit false omits just that group.
type Proxy ¶
type Proxy struct {
DB database.Config `toml:"db"` // C-chain indexer database config.
RedisPort string `toml:"redis_port"` // Redis database port.
GCS GCS `toml:"gcs"` // Google Cloud Storage connection configuration.
ChainID uint64 `toml:"chain_id"` // EVM chain ID bound into TEE/FDC2 signed payloads. Must be a positive integer.
Addresses Addresses `toml:"addresses"` // Smart contract addresses.
Governance Governance `toml:"governance"` // TEE governance; required for Safe-backed governance (enables Safe machine-path-list approval pre-verification), optional otherwise.
Ports Ports `toml:"ports"` // Servers ports.
InfoTiming InfoTiming `toml:"info_timing"` // Timing configuration for TEE info updates (duration between periodic checks and response timeout)
Voting Voting `toml:"voting"` // Instruction voting configurations.
PrivateKeyVariable string `toml:"private_key_variable"` // Name of environment variable that stores proxy's private key. Defaults to PRIVATE_KEY.
InitialSigningPolicyOffset int `toml:"initial_signing_policy_offset"` // 0 for current signing policy, n for "current - n". If not set it defaults to 3.
SigningPolicyFetchInterval time.Duration `toml:"signing_policy_fetch_interval"` // Duration between periodic checks for a new signing policy.
MachinePathListFetchInterval time.Duration `toml:"machine_path_list_fetch_interval"` // Duration between periodic checks for a newly signed machine path list. Defaults to 10m.
DBSyncMaxSleepTime time.Duration `toml:"db_sync_max_sleep_time"` // Max sleep between DB sync retries on startup. Defaults to 10m.
Logging logger.Config `toml:"logging"` // Logging configurations. Default is "DEBUG" level in consol.
Direct Direct `toml:"direct"` // Direct endpoint configuration.
Storage Storage `toml:"storage"` // TTLs applied to Redis/GCS-backed persistent storage.
Attestation Attestation `toml:"attestation"` // Bootstrap attestation verification configuration.
Metrics Metrics `toml:"metrics"` // Prometheus metrics. Off by default; opt-in via [metrics] enable.
}
Proxy holds the full configuration for the TEE proxy service.
type Storage ¶ added in v0.0.18
type Storage struct {
ActionTTL time.Duration `toml:"action_ttl"` // Retention for queued action bodies. Defaults to 14 days.
ResultTTL time.Duration `toml:"result_ttl"` // Retention for Threshold/End results. Defaults to 14 days.
SubmitResultTTL time.Duration `toml:"submit_result_ttl"` // Retention for Submit results. Defaults to 30 minutes.
BackupTTL time.Duration `toml:"backup_ttl"` // Retention for backup bodies and index. Defaults to 8 days.
}
Storage holds TTLs for persistent stores (Redis/GCS).
func (*Storage) SetDefault ¶ added in v0.0.18
func (s *Storage) SetDefault()
type Voting ¶
type Voting struct {
ProposalExpiration time.Duration `toml:"proposal_expiration"` // Duration the voting for a proposal is open for. Default is 120s
MaxPendingRequests uint `toml:"max_pending_request"` // Maximal number of open (unfinalized) proposals per provider. It defaults to 100.
HistorySize int `toml:"history_size"` // Number of most recent signing policy rounds to keep in memory. Defaults to 3.
FinalizedBufferSize int `toml:"finalized_buffer_size"` // Buffer size for the finalized instructions channel. Defaults to 10.
MaxProviderVote float64 `toml:"max_provider_vote"` // Maximal possible fraction (0,1] of total weight a single provider can hold. Used to cap per-vote variable message size for restore operations. If unset, no cap is applied.
}
Voting holds tuning parameters for the instruction voting consensus.
func (*Voting) SetDefault ¶
SetDefault sets default values if applicable.