policy

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDeadlineExceeded    = errors.New("deadline exceeded")
	ErrTooManyErrors       = errors.New("too many errors")
	ErrThresholdNotReached = errors.New("threshold not reached")
)
View Source
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

func AddressToHash(a common.Address) common.Hash

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

func UpdateFailureReason(err error) string

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.

Jump to

Keyboard shortcuts

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