Documentation
¶
Index ¶
- Constants
- func NewTransitChannel() chan TransitData
- type Alert
- type AlertDestination
- type AlertingPolicy
- type CUUID
- type ChainSubscription
- type ClientConfig
- type ComponentPID
- type ComponentType
- type CtxKey
- type DataRegister
- type EngineInputRelay
- type Env
- type FetchType
- type FilePath
- type InvSessionPID
- type InvSessionParams
- func (sp *InvSessionParams) Address() common.Address
- func (sp *InvSessionParams) Bytes() []byte
- func (sp *InvSessionParams) NestedArgs() []any
- func (sp *InvSessionParams) SetNestedArg(arg interface{})
- func (sp *InvSessionParams) SetValue(key string, val any)
- func (sp *InvSessionParams) Value(key string) (any, error)
- type Invalidation
- type InvariantInput
- type InvariantType
- type Network
- type PUUID
- type PipelineConfig
- type PipelinePID
- type PipelineType
- type RegisterDependencyPath
- type RegisterType
- type SUUID
- type SessionConfig
- type StateKey
- 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 ( AddressPrefix = iota + 1 NestedPrefix )
const (
UnknownType = "unknown"
)
Variables ¶
This section is empty.
Functions ¶
func NewTransitChannel ¶
func NewTransitChannel() chan TransitData
NewTransitChannel ... Builds new transit channel
Types ¶
type Alert ¶
type Alert struct {
Dest AlertDestination
PUUID PUUID
SUUID SUUID
Timestamp time.Time
Ptype PipelineType
Content string
}
Alert ... An alert
type AlertDestination ¶
type AlertDestination uint8
AlertDestination ... The destination for an alert
const ( Slack AlertDestination = iota + 1 ThirdParty // 2 )
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 AlertingPolicy ¶
type AlertingPolicy struct {
Destination AlertDestination
}
AlertingPolicy ... The alerting policy for an invariant session NOTE - This could be extended to support additional policy metadata like criticality, etc.
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 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 InvariantInput) *EngineInputRelay
NewEngineRelay ... Initializer
func (*EngineInputRelay) RelayTransitData ¶
func (eir *EngineInputRelay) RelayTransitData(td TransitData) error
RelayTransitData ... Creates invariant input from transit data to send to risk engine
type InvSessionPID ¶
type InvSessionPID [3]byte
InvSessionPID ... Invariant session Primary ID
func (InvSessionPID) InvType ¶
func (pid InvSessionPID) InvType() InvariantType
InvType ... Returns invariant type decoding from encoded pid byte
func (InvSessionPID) Network ¶
func (pid InvSessionPID) Network() Network
Network ... Returns network decoding from encoded pid byte
func (InvSessionPID) String ¶
func (pid InvSessionPID) String() string
String ... Returns string representation of an invariant session PID
type InvSessionParams ¶
type InvSessionParams struct {
// contains filtered or unexported fields
}
InvSessionParams ... Parameters used to initialize an invariant session
func NewSessionParams ¶
func NewSessionParams() *InvSessionParams
NewSessionParams ... Initializes invariant session params
func (*InvSessionParams) Address ¶
func (sp *InvSessionParams) Address() common.Address
Address ... Returns the address from the invariant session params
func (*InvSessionParams) Bytes ¶
func (sp *InvSessionParams) Bytes() []byte
Bytes ... Returns a marshalled byte array of the invariant session params
func (*InvSessionParams) NestedArgs ¶
func (sp *InvSessionParams) NestedArgs() []any
NestedArgs ... Returns the nested arguments from the invariant session params
func (*InvSessionParams) SetNestedArg ¶
func (sp *InvSessionParams) SetNestedArg(arg interface{})
SetNestedArg ... Sets a nested argument in the invariant session params unique nested key/value space
func (*InvSessionParams) SetValue ¶
func (sp *InvSessionParams) SetValue(key string, val any)
SetValue ... Sets a value in the invariant session params
type Invalidation ¶
Invalidation ... Represents an invalidation event
type InvariantInput ¶
type InvariantInput struct {
PUUID PUUID
Input TransitData
}
InvariantInput ... Standardized type used to supply the Risk Engine
type InvariantType ¶
type InvariantType uint8
InvariantType ... Represents the type of invariant
const ( BalanceEnforcement InvariantType = iota + 1 ContractEvent WithdrawalEnforcement FaultDetector )
func StringToInvariantType ¶
func StringToInvariantType(stringType string) InvariantType
StringToInvariantType ... Converts a string to an invariant type
func (InvariantType) String ¶
func (it InvariantType) String() string
String ... Converts an invariant 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 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 InvSessionPID
UUID UUID
}
Represents a non-deterministic ID that's assigned to every uniquely constructed invariant session
func MakeSUUID ¶
func MakeSUUID(n Network, pt PipelineType, invType InvariantType) SUUID
MakeSUUID ... Constructs an invariant PID sequence & random UUID
type SessionConfig ¶
type SessionConfig struct {
Network Network
PT PipelineType
AlertDest AlertDestination
Type InvariantType
Params *InvSessionParams
}
SessionConfig ... Configuration passed through to a session constructor
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 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