Documentation ¶
Index ¶
- Constants
- func NewTransitChannel() chan TransitData
- type Activation
- type Alert
- type AlertClientCfg
- type AlertDestination
- type AlertPolicy
- type AlertRoutingParams
- type AlertStatus
- type CUUID
- type ChainSubscription
- type ClientConfig
- type ComponentPID
- type ComponentType
- type Config
- type CtxKey
- type DataRegister
- type EngineInputRelay
- type Env
- type FetchType
- type FilePath
- type HeuristicInput
- type HeuristicType
- type Network
- type PUUID
- type PagerDutySeverity
- type PipelineConfig
- type PipelinePID
- type PipelineType
- type RegisterDependencyPath
- type RegisterType
- type SUUID
- type SessionConfig
- type SessionPID
- type SessionParams
- type Severity
- type SeverityMap
- type StateKey
- type StringFromEnv
- type Subsystem
- type Timeouts
- type TransitData
- type TransitOption
- type UUID
Constants ¶
const ( AddressKey = "address" NestedArgs = "args" )
const ( L1Portal = "l1_portal_address" //#nosec G101: False positive, this isn't a credential L2ToL1MessagePasser = "l2_to_l1_address" //#nosec G101: False positive, this isn't a credential L2OutputOracle = "l2_output_address" //#nosec G101: False positive, this isn't a credential )
const (
UnknownType = "unknown"
)
Variables ¶
This section is empty.
Functions ¶
func NewTransitChannel ¶
func NewTransitChannel() chan TransitData
NewTransitChannel ... Builds new transit channel
Types ¶
type Activation ¶ added in v1.0.0
Activation ... Represents an activation event
type Alert ¶
type Alert struct { Criticality Severity PUUID PUUID SUUID SUUID Timestamp time.Time Ptype PipelineType Content string }
Alert ... An alert
type AlertClientCfg ¶ added in v1.0.0
type AlertClientCfg struct { Slack map[string]*Config `yaml:"slack"` PagerDuty map[string]*Config `yaml:"pagerduty"` }
AlertClientCfg ... The alert client config
type AlertDestination ¶
type AlertDestination uint8
AlertDestination ... The destination for an alert
const ( Slack AlertDestination = iota + 1 PagerDuty ThirdParty )
func StringToAlertingDestType ¶
func StringToAlertingDestType(stringType string) AlertDestination
StringToAlertingDestType ... Converts a string to an alerting destination type
func (AlertDestination) String ¶
func (ad AlertDestination) String() string
String ... Converts an alerting destination type to a string
type AlertPolicy ¶ added in v1.0.0
type AlertPolicy struct { Sev string `json:"severity"` Dest string `json:"destination"` Msg string `json:"message"` CoolDown int `json:"cooldown_time"` }
AlertPolicy ... The alerting policy for a heuristic session
func (*AlertPolicy) CoolDownTime ¶ added in v1.0.0
func (ap *AlertPolicy) CoolDownTime() time.Time
CoolDownTime ... Returns the cool down time for an alert
func (*AlertPolicy) Destination ¶ added in v1.0.0
func (ap *AlertPolicy) Destination() AlertDestination
Destination ... Returns the destination for an alert
func (*AlertPolicy) HasCoolDown ¶ added in v1.0.0
func (ap *AlertPolicy) HasCoolDown() bool
HasCoolDown ... Checks if the alert policy has a cool down
func (*AlertPolicy) Message ¶ added in v1.0.0
func (ap *AlertPolicy) Message() string
Message ... Returns the message for an alert policy
func (*AlertPolicy) Severity ¶ added in v1.0.0
func (ap *AlertPolicy) Severity() Severity
Severity ... Returns the severity of an alert policy
type AlertRoutingParams ¶ added in v1.0.0
type AlertRoutingParams struct {
AlertRoutes *SeverityMap `yaml:"alertRoutes"`
}
AlertRoutingParams ... The routing parameters for alerts
type AlertStatus ¶ added in v1.0.0
type AlertStatus string
AlertStatus ... A standardized response status for alert clients
const ( SuccessStatus AlertStatus = "success" FailureStatus AlertStatus = "failure" )
type CUUID ¶
type CUUID struct { PID ComponentPID UUID UUID }
Represents a non-deterministic ID that's assigned to every uniquely constructed ETL component
func MakeCUUID ¶
func MakeCUUID(pt PipelineType, ct ComponentType, rt RegisterType, n Network) CUUID
MakeCUUID ... Constructs a component PID sequence & random UUID
func NilCUUID ¶
func NilCUUID() CUUID
NOTE - This is useful for error handling with functions that also return a ComponentID NilCUUID ... Returns a zero'd out or empty component UUID
func (CUUID) Type ¶
func (uuid CUUID) Type() ComponentType
Type ... Returns component type byte value from component UUID
type ChainSubscription ¶
type ChainSubscription uint8
const ( OnlyLayer1 ChainSubscription = iota + 1 OnlyLayer2 BothNetworks )
type ClientConfig ¶
type ClientConfig struct { Network Network PollInterval time.Duration NumOfRetries int StartHeight *big.Int EndHeight *big.Int }
ClientConfig ... Configuration passed through to an oracle component constructor
func (*ClientConfig) Backfill ¶
func (oc *ClientConfig) Backfill() bool
Backfill ... Returns true if the oracle is configured to backfill
func (*ClientConfig) Backtest ¶
func (oc *ClientConfig) Backtest() bool
Backtest ... Returns true if the oracle is configured to backtest
type ComponentPID ¶
type ComponentPID [4]byte
ComponentPID ... Component Primary ID
func (ComponentPID) String ¶
func (pid ComponentPID) String() string
String ... Returns string representation of a component PID
type ComponentType ¶
type ComponentType uint8
ComponentType ... Denotes the ETL component type
const ( Oracle ComponentType = iota + 1 Pipe Aggregator )
func (ComponentType) String ¶
func (ct ComponentType) String() string
String ... Converts the component type to a string
type Config ¶ added in v1.0.0
type Config struct { URL StringFromEnv `yaml:"url"` Channel StringFromEnv `yaml:"channel"` IntegrationKey StringFromEnv `yaml:"integration_key"` }
Config ... The config for an alert client
type DataRegister ¶
type DataRegister struct { Addressing bool Sk *StateKey DataType RegisterType ComponentType ComponentType ComponentConstructor interface{} Dependencies []RegisterType }
DataRegister ... Represents an ETL subsytem data type that can be produced and consumed by heterogenous components
func (*DataRegister) StateKey ¶
func (dr *DataRegister) StateKey() *StateKey
StateKey ... Returns a cloned state key for a data register
func (*DataRegister) Stateful ¶
func (dr *DataRegister) Stateful() bool
Stateful ... Indicates whether the data register has statefulness
type EngineInputRelay ¶
type EngineInputRelay struct {
// contains filtered or unexported fields
}
EngineInputRelay ... Represents a inter-subsystem relay used to bind final ETL pipeline outputs to risk engine inputs
func NewEngineRelay ¶
func NewEngineRelay(pUUID PUUID, outChan chan HeuristicInput) *EngineInputRelay
NewEngineRelay ... Initializer
func (*EngineInputRelay) RelayTransitData ¶
func (eir *EngineInputRelay) RelayTransitData(td TransitData) error
RelayTransitData ... Creates heuristic input from transit data to send to risk engine
type HeuristicInput ¶ added in v1.0.0
type HeuristicInput struct { PUUID PUUID Input TransitData }
HeuristicInput ... Standardized type used to supply the Risk Engine
type HeuristicType ¶ added in v1.0.0
type HeuristicType uint8
HeuristicType ... Represents the type of heuristic
const ( BalanceEnforcement HeuristicType = iota + 1 ContractEvent WithdrawalEnforcement FaultDetector )
func StringToHeuristicType ¶ added in v1.0.0
func StringToHeuristicType(stringType string) HeuristicType
StringToHeuristicType ... Converts a string to a heuristic type
func (HeuristicType) String ¶ added in v1.0.0
func (it HeuristicType) String() string
String ... Converts a heuristic type to a string
type Network ¶
type Network uint8
Network ... Represents the network for which a pipeline's oracle is subscribed to.
func StringToNetwork ¶
StringToNetwork ... Converts a string to a network
type PUUID ¶
type PUUID struct { PID PipelinePID UUID UUID }
Represents a non-deterministic ID that's assigned to every uniquely constructed ETL pipeline
func MakePUUID ¶
func MakePUUID(pt PipelineType, firstCID, lastCID CUUID) PUUID
MakePUUID ... Constructs a pipeline PID sequence & random UUID
func (PUUID) NetworkType ¶
func (PUUID) PipelineType ¶
func (uuid PUUID) PipelineType() PipelineType
PipelineType ... Returns pipeline type decoding from encoded pid byte
type PagerDutySeverity ¶ added in v1.0.0
type PagerDutySeverity string
PagerDutySeverity represents the severity of an event
const ( Critical PagerDutySeverity = "critical" Error PagerDutySeverity = "error" Warning PagerDutySeverity = "warning" Info PagerDutySeverity = "info" )
type PipelineConfig ¶
type PipelineConfig struct { Network Network DataType RegisterType PipelineType PipelineType ClientConfig *ClientConfig }
PipelineConfig ... Configuration passed through to a pipeline constructor
type PipelinePID ¶
type PipelinePID [9]byte
Used for local lookups to look for active collisions
func (PipelinePID) String ¶
func (pid PipelinePID) String() string
String ... Returns string representation of a pipeline PID
type PipelineType ¶
type PipelineType uint8
PipelineType ...
const ( Backtest PipelineType = iota + 1 Live MockTest )
func StringToPipelineType ¶
func StringToPipelineType(stringType string) PipelineType
StringToPipelineType ... Converts a string to a pipeline type
func (PipelineType) String ¶
func (pt PipelineType) String() string
String ... Converts the pipeline type to a string
type RegisterDependencyPath ¶
type RegisterDependencyPath struct {
Path []*DataRegister
}
RegisterDependencyPath ... Represents an inclusive acyclic sequential path of data register dependencies
func (RegisterDependencyPath) GeneratePUUID ¶
func (rdp RegisterDependencyPath) GeneratePUUID(pt PipelineType, n Network) PUUID
GeneratePUUID ... Generates a PUUID for an existing dependency path provided an enumerated pipeline and network type
type RegisterType ¶
type RegisterType uint8
RegisterType ... One byte register type enum
const ( AccountBalance RegisterType = iota + 1 GethBlock EventLog )
func (RegisterType) String ¶
func (rt RegisterType) String() string
String ... Returns string representation of a register enum
type SUUID ¶
type SUUID struct { PID SessionPID UUID UUID }
Represents a non-deterministic ID that's assigned to every uniquely constructed heuristic session
func MakeSUUID ¶
func MakeSUUID(n Network, pt PipelineType, ht HeuristicType) SUUID
MakeSUUID ... Constructs a heuristic PID sequence & random UUID
type SessionConfig ¶
type SessionConfig struct { Network Network PT PipelineType AlertPolicy *AlertPolicy Type HeuristicType Params *SessionParams }
SessionConfig ... Configuration passed through to a session constructor
type SessionPID ¶ added in v1.0.0
type SessionPID [3]byte
SessionPID ... Heuristic session Primary ID
func (SessionPID) HeuristicType ¶ added in v1.0.0
func (pid SessionPID) HeuristicType() HeuristicType
HeuristicType ... Returns heuristic type decoding from encoded pid byte
func (SessionPID) Network ¶ added in v1.0.0
func (pid SessionPID) Network() Network
Network ... Returns network decoding from encoded pid byte
func (SessionPID) String ¶ added in v1.0.0
func (pid SessionPID) String() string
String ... Returns string representation of a heuristic session PID
type SessionParams ¶ added in v1.0.0
type SessionParams struct {
// contains filtered or unexported fields
}
SessionParams ... Parameters used to initialize a heuristic session
func NewSessionParams ¶
func NewSessionParams() *SessionParams
NewSessionParams ... Initializes heuristic session params
func (*SessionParams) Address ¶ added in v1.0.0
func (sp *SessionParams) Address() common.Address
Address ... Returns the address from the heuristic session params
func (*SessionParams) Bytes ¶ added in v1.0.0
func (sp *SessionParams) Bytes() []byte
Bytes ... Returns a marshalled byte array of the heuristic session params
func (*SessionParams) NestedArgs ¶ added in v1.0.0
func (sp *SessionParams) NestedArgs() []any
NestedArgs ... Returns the nested arguments from the heuristic session params
func (*SessionParams) SetNestedArg ¶ added in v1.0.0
func (sp *SessionParams) SetNestedArg(arg interface{})
SetNestedArg ... Sets a nested argument in the heuristic session params unique nested key/value space
func (*SessionParams) SetValue ¶ added in v1.0.0
func (sp *SessionParams) SetValue(key string, val any)
SetValue ... Sets a value in the heuristic session params
type Severity ¶ added in v1.0.0
type Severity uint8
Severity ... The severity of an alert
func StringToSev ¶ added in v1.0.0
StringToSev ... Converts a string to a severity
func (Severity) ToPagerDutySev ¶ added in v1.0.0
func (s Severity) ToPagerDutySev() PagerDutySeverity
ToPagerDutySev ... Converts a severity to a pagerduty severity. See docs/alert-routing.md for more on this
type SeverityMap ¶ added in v1.0.0
type SeverityMap struct { Low *AlertClientCfg `yaml:"low"` Medium *AlertClientCfg `yaml:"medium"` High *AlertClientCfg `yaml:"high"` }
SeverityMap ... A map of severity to alert client config
type StateKey ¶
type StateKey struct { Nesting bool Prefix RegisterType ID string PUUID *PUUID }
StateKey ... Represents a key in the state store
func MakeStateKey ¶
func MakeStateKey(pre RegisterType, id string, nest bool) *StateKey
MakeStateKey ... Builds a minimal state key using a prefix and key
func (*StateKey) IsNested ¶
IsNested ... Indicates whether the state key is nested NOTE - This is used to determine if the state key maps to a value slice of state keys in the state store (ie. nested)
type StringFromEnv ¶ added in v1.0.0
type StringFromEnv string
func (*StringFromEnv) String ¶ added in v1.0.0
func (e *StringFromEnv) String() string
String returns the string value, implementing the flag.Value interface.
func (*StringFromEnv) UnmarshalYAML ¶ added in v1.0.0
func (e *StringFromEnv) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements the yaml.Unmarshaler interface to allow parsing strings from env vars.
type TransitData ¶
type TransitData struct { OriginTS time.Time Timestamp time.Time Network Network Type RegisterType Address common.Address Value any }
TransitData ... Standardized type used for data inter-communication between all ETL components and Risk Engine
func NewTransitData ¶
func NewTransitData(rt RegisterType, val any, opts ...TransitOption) TransitData
NewTransitData ... Initializes transit data with supplied options NOTE - transit data is used as a standard data representation for communication between all ETL components and the risk engine
func (*TransitData) Addressed ¶
func (td *TransitData) Addressed() bool
Addressed ... Indicates whether the transit data has an associated address field
type TransitOption ¶
type TransitOption = func(*TransitData)
TransitOption ... Option used to initialize transit data
func WithAddress ¶
func WithAddress(address common.Address) TransitOption
WithAddress ... Injects address to transit data
func WithOriginTS ¶
func WithOriginTS(t time.Time) TransitOption
WithOriginTS ... Injects origin timestamp to transit data
type UUID ¶
UUID ... third-party wrapper struct for https://pkg.go.dev/github.com/google/UUID
func (UUID) ShortString ¶
ShortString ... Short string representation for easier debugging and ensuring conformance with pessimism specific abstractions https://pkg.go.dev/github.com/google/UUID#UUID.String