Documentation
¶
Overview ¶
Package keeper prepares recipes and owns their process-local execution lifecycle.
Index ¶
- func ValidatePlanComposition(calldata []byte, providers []Provider, outputs [][]provider.Output) error
- func ValidateRecipeComposition(recipe recipes.Recipe, tree *recipes.Tree, requirements []RecipeRequirements) error
- type Backend
- type Config
- type ExecutionPlan
- type Keeper
- type PermissionSource
- type Plan
- type PlanMember
- type Planner
- func (p *Planner) ConfirmedSnapshot(ctx context.Context, original provider.Snapshot) (provider.Snapshot, error)
- func (p *Planner) Prepare(ctx context.Context, strategy Strategy) (Plan, error)
- func (p *Planner) PrepareExecution(ctx context.Context, strategies []Strategy) (ExecutionPlan, error)
- func (p *Planner) VerifyConfirmedSnapshot(ctx context.Context, snapshot provider.Snapshot) error
- type Planning
- type Provider
- type RecipeRequirements
- type Sender
- type Strategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidatePlanComposition ¶
func ValidatePlanComposition(calldata []byte, providers []Provider, outputs [][]provider.Output) error
ValidatePlanComposition checks receipt attribution against immutable call data.
func ValidateRecipeComposition ¶
func ValidateRecipeComposition(recipe recipes.Recipe, tree *recipes.Tree, requirements []RecipeRequirements) error
ValidateRecipeComposition checks pure authenticated target ownership before any provider resolution or HTTP. Immutable calldata is checked again later.
Types ¶
type Backend ¶
type Backend interface {
CallContract(context.Context, ethereum.CallMsg, *big.Int) ([]byte, error)
HeaderByNumber(context.Context, *big.Int) (*types.Header, error)
HeaderByHash(context.Context, common.Hash) (*types.Header, error)
FilterLogs(context.Context, ethereum.FilterQuery) ([]types.Log, error)
}
type Config ¶
Config identifies one committed executor and its scheduling policy. Name must be nonempty and unique within a Keeper.
type ExecutionPlan ¶
type ExecutionPlan struct {
To common.Address `json:"to"`
Sender common.Address `json:"sender,omitempty"`
Members []PlanMember `json:"members"`
Failures map[string]error `json:"-"`
}
func (ExecutionPlan) Transaction ¶
func (b ExecutionPlan) Transaction() (common.Address, []byte, error)
Transaction encodes a direct, AccessManager-forwarded or delegated call.
type Keeper ¶
type Keeper struct {
Sender Sender
Planner Planning
Strategies []Strategy
Mode string
OperationTimeout time.Duration
Log logr.Logger
Observe func(strategy, outcome string)
// contains filtered or unexported fields
}
Keeper is driven explicitly by the host. It never writes state or starts workers. Configuration is fixed for its lifetime; use one Keeper per sender.
type PermissionSource ¶
type PermissionSource interface {
PermissionTree(context.Context, *big.Int, recipes.Snapshot) ([]byte, error)
}
PermissionSource supplies encoded artifacts; the SDK validates every leaf and proof itself. Errors must omit credentials, URLs and remote payloads. It is called only during preparation; pending RAM tasks retain their identity.
type PlanMember ¶
type Planner ¶
type Planner struct {
PermissionSource PermissionSource
Chain Backend
ChainID *big.Int
Caller common.Address
Sender common.Address // Zero uses Caller; otherwise route through its AccessManager.
Confirmations uint64
MaxGas uint64 // Zero uses the conservative 16,777,216 gas budget.
RecipeCache *recipes.RecipeCache
}
func (*Planner) ConfirmedSnapshot ¶
func (*Planner) PrepareExecution ¶
func (p *Planner) PrepareExecution(ctx context.Context, strategies []Strategy) (ExecutionPlan, error)
PrepareExecution authenticates candidates together and validates one selected envelope. Independent reads batch across executors; EVM effects retain order.
type Provider ¶
type Provider interface {
RecipeRequirements(provider.Snapshot, recipes.Recipe, *recipes.Tree) (RecipeRequirements, error)
PrepareRecipe(context.Context, provider.Snapshot, recipes.Recipe, *recipes.Tree, map[uint]*big.Int) ([]provider.Output, error)
}
Provider derives its configuration from authenticated program bytes. The SDK invokes this only after validating the active root, chain and account. Inputs, results, recipe bytes and permissions are copied for each invocation. Each output supplies one execution's runtime data and an optional RAM task.
type RecipeRequirements ¶
type RecipeRequirements struct {
Values []recipes.Value
Inputs []uint
Actions []string
ExclusiveTargets map[string]common.Address
}
RecipeRequirements declares authorized input ownership and the numerical expressions needed before obtaining external runtime data. This method is pure: every provider is checked before any quote or reward HTTP request.
type Sender ¶
type Sender interface {
Submit(context.Context, transaction.ExecutionRequest) error
Poll(context.Context) (*transaction.ExecutionResult, error)
Busy() bool
}
Sender owns at most one transaction and returns canonical execution evidence. Submit errors may leave Busy true: ambiguous submission retains ownership.