Documentation
¶
Index ¶
- Variables
- func AddressToHash(a common.Address) common.Hash
- func FetchSigningPolicy(ctx context.Context, db *gorm.DB, relayAddress common.Address, ...) (*policy.SigningPolicy, error)
- func FetchSigningPolicyLog(ctx context.Context, db *gorm.DB, relayAddress common.Address, ...) (database.Log, bool, error)
- func InitializePolicyAction(ctx context.Context, db *gorm.DB, addresses config.Addresses, offset int, ...) (*types.Action, *policy.SigningPolicy, int, error)
- func UpdateFailureReason(err error) string
- func UpdatePolicyAction(ctx context.Context, db *gorm.DB, addresses config.Addresses, log database.Log, ...) (*types.Action, *policy.SigningPolicy, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrDeadlineExceeded = errors.New("deadline exceeded") ErrTooManyErrors = errors.New("too many errors") ErrThresholdNotReached = errors.New("threshold not reached") )
var ( // SigningPolicyInitializedEventSel is the topic[0] selector for the Relay's // SigningPolicyInitialized event; resolved at init from the contract ABI. SigningPolicyInitializedEventSel common.Hash )
Functions ¶
func AddressToHash ¶
AddressToHash zero prefixes address to 32 bytes.
func FetchSigningPolicy ¶
func FetchSigningPolicy(ctx context.Context, db *gorm.DB, relayAddress common.Address, signingPolicyID uint32) (*policy.SigningPolicy, error)
FetchSigningPolicy fetches and parses the SigningPolicyInitialized event for the given policy ID from the database.
func FetchSigningPolicyLog ¶ added in v0.0.19
func FetchSigningPolicyLog(ctx context.Context, db *gorm.DB, relayAddress common.Address, signingPolicyID uint32) (database.Log, bool, error)
FetchSigningPolicyLog fetches the SigningPolicyInitialized event log for the given policy ID from the database. found is false (with a nil error) when no such event exists yet — i.e. the reward epoch has not been initialized on chain.
func InitializePolicyAction ¶
func InitializePolicyAction( ctx context.Context, db *gorm.DB, addresses config.Addresses, offset int, chainID *big.Int, ) (*types.Action, *policy.SigningPolicy, int, error)
InitializePolicyAction prepares action for INITIALIZE_POLICY". SigningPolicyInitialized event that precedes the last emitted by offset is used. If such event is not found, the oldest found event is used.
The action, signing policy, and used offset are returned.
func UpdateFailureReason ¶ added in v0.0.20
UpdateFailureReason maps an UpdatePolicyAction error to a bounded metric reason (pubkey_mismatch/sig_deadline/indexer/not_consecutive/build_failed); "" for nil.
func UpdatePolicyAction ¶
func UpdatePolicyAction(ctx context.Context, db *gorm.DB, addresses config.Addresses, log database.Log, activePolicy *policy.SigningPolicy, chainID *big.Int) (*types.Action, *policy.SigningPolicy, error)
UpdatePolicyAction prepares an UPDATE_POLICY action from a SigningPolicyInitialized log event.
Types ¶
This section is empty.