async_sequencer

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DisableTransactionSchedulingConfigEnvName = envConfigPrefix + "DISABLE_TRANSACTION_SCHEDULING"

	DisableTransactionSubmissionConfigEnvName = envConfigPrefix + "DISABLE_TRANSACTION_SUBMISSION"

	MaxGlobalFailedFulfillmentsConfigEnvName = envConfigPrefix + "MAX_GLOBAL_FAILED_FULFILLMENTS"

	EnableSubsidizerChecksConfigEnvName = envConfigPrefix + "ENABLE_SUBSIDIZER_CHECKS"
)

Variables

View Source
var (
	ErrInvalidFulfillmentSignature       = errors.New("invalid fulfillment signature")
	ErrInvalidFulfillmentStateTransition = errors.New("invalid fulfillment state transition")
	ErrCouldNotGetIntentLock             = errors.New("could not get intent lock")
)
View Source
var (
	ErrInvalidActionStateTransition = errors.New("invalid action state transition")
)
View Source
var (
	ErrInvalidIntentStateTransition = errors.New("invalid intent state transition")
)

Functions

func New

func New(data code_data.Provider, scheduler Scheduler, configProvider ConfigProvider) async.Service

Types

type ActionHandler

type ActionHandler interface {
	// Note: New fulfillment states are not recorded until the very end of a worker
	//       run, which is why we need to pass it into this function.
	OnFulfillmentStateChange(ctx context.Context, fulfillmentRecord *fulfillment.Record, newState fulfillment.State) error
}

func NewCloseDormantAccountActionHandler

func NewCloseDormantAccountActionHandler(data code_data.Provider) ActionHandler

func NewCloseEmptyAccountActionHandler

func NewCloseEmptyAccountActionHandler(data code_data.Provider) ActionHandler

func NewNoPrivacyTransferActionHandler

func NewNoPrivacyTransferActionHandler(data code_data.Provider) ActionHandler

func NewNoPrivacyWithdrawActionHandler

func NewNoPrivacyWithdrawActionHandler(data code_data.Provider) ActionHandler

func NewOpenAccountActionHandler

func NewOpenAccountActionHandler(data code_data.Provider) ActionHandler

func NewPrivateTransferActionHandler

func NewPrivateTransferActionHandler(data code_data.Provider) ActionHandler

func NewSaveRecentRootActionHandler

func NewSaveRecentRootActionHandler(data code_data.Provider) ActionHandler

type CloseCommitmentVaultFulfillmentHandler

type CloseCommitmentVaultFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*CloseCommitmentVaultFulfillmentHandler) CanSubmitToBlockchain

func (h *CloseCommitmentVaultFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

Assumption: Commitment vault closing is pre-sorted to the very last position in the line

func (*CloseCommitmentVaultFulfillmentHandler) IsRevoked

func (h *CloseCommitmentVaultFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*CloseCommitmentVaultFulfillmentHandler) MakeOnDemandTransaction

func (h *CloseCommitmentVaultFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*CloseCommitmentVaultFulfillmentHandler) OnFailure

func (h *CloseCommitmentVaultFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*CloseCommitmentVaultFulfillmentHandler) OnSuccess

func (h *CloseCommitmentVaultFulfillmentHandler) OnSuccess(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) error

func (*CloseCommitmentVaultFulfillmentHandler) SupportsOnDemandTransactions

func (h *CloseCommitmentVaultFulfillmentHandler) SupportsOnDemandTransactions() bool

type CloseDormantAccountActionHandler

type CloseDormantAccountActionHandler struct {
	// contains filtered or unexported fields
}

func (*CloseDormantAccountActionHandler) OnFulfillmentStateChange

func (h *CloseDormantAccountActionHandler) OnFulfillmentStateChange(ctx context.Context, fulfillmentRecord *fulfillment.Record, newState fulfillment.State) error

type CloseDormantTimelockAccountFulfillmentHandler

type CloseDormantTimelockAccountFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*CloseDormantTimelockAccountFulfillmentHandler) CanSubmitToBlockchain

func (h *CloseDormantTimelockAccountFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

func (*CloseDormantTimelockAccountFulfillmentHandler) IsRevoked

func (h *CloseDormantTimelockAccountFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*CloseDormantTimelockAccountFulfillmentHandler) MakeOnDemandTransaction

func (h *CloseDormantTimelockAccountFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*CloseDormantTimelockAccountFulfillmentHandler) OnFailure

func (h *CloseDormantTimelockAccountFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*CloseDormantTimelockAccountFulfillmentHandler) OnSuccess

func (h *CloseDormantTimelockAccountFulfillmentHandler) OnSuccess(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) error

func (*CloseDormantTimelockAccountFulfillmentHandler) SupportsOnDemandTransactions

func (h *CloseDormantTimelockAccountFulfillmentHandler) SupportsOnDemandTransactions() bool

type CloseEmptyAccountActionHandler

type CloseEmptyAccountActionHandler struct {
	// contains filtered or unexported fields
}

func (*CloseEmptyAccountActionHandler) OnFulfillmentStateChange

func (h *CloseEmptyAccountActionHandler) OnFulfillmentStateChange(ctx context.Context, fulfillmentRecord *fulfillment.Record, newState fulfillment.State) error

type CloseEmptyTimelockAccountFulfillmentHandler

type CloseEmptyTimelockAccountFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*CloseEmptyTimelockAccountFulfillmentHandler) CanSubmitToBlockchain

func (h *CloseEmptyTimelockAccountFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

func (*CloseEmptyTimelockAccountFulfillmentHandler) IsRevoked

func (h *CloseEmptyTimelockAccountFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*CloseEmptyTimelockAccountFulfillmentHandler) MakeOnDemandTransaction

func (h *CloseEmptyTimelockAccountFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*CloseEmptyTimelockAccountFulfillmentHandler) OnFailure

func (h *CloseEmptyTimelockAccountFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*CloseEmptyTimelockAccountFulfillmentHandler) OnSuccess

func (h *CloseEmptyTimelockAccountFulfillmentHandler) OnSuccess(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) error

func (*CloseEmptyTimelockAccountFulfillmentHandler) SupportsOnDemandTransactions

func (h *CloseEmptyTimelockAccountFulfillmentHandler) SupportsOnDemandTransactions() bool

type ConfigProvider

type ConfigProvider func() *conf

ConfigProvider defines how config values are pulled

func WithEnvConfigs

func WithEnvConfigs() ConfigProvider

WithEnvConfigs returns configuration pulled from environment variables

type EstablishRelationshipIntentHandler

type EstablishRelationshipIntentHandler struct {
	// contains filtered or unexported fields
}

func (*EstablishRelationshipIntentHandler) OnActionUpdated

func (h *EstablishRelationshipIntentHandler) OnActionUpdated(ctx context.Context, intentId string) error

type FulfillmentHandler

type FulfillmentHandler interface {
	// CanSubmitToBlockchain determines whether the given fulfillment can be
	// scheduled for submission to the blockchain.
	//
	// Implementations must consider global, account, intent, action and local
	// state relevant to the type of fulfillment being handled to determine if
	// it's safe to schedule.
	//
	// Implementations do not need to validate basic preconditions or basic
	// circuit breaking checks, which is performed by the contextual scheduler.
	CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

	// SupportsOnDemandTransactions returns whether a fulfillment type supports
	// on demand transaction creation
	SupportsOnDemandTransactions() bool

	// MakeOnDemandTransaction constructs a transaction at the time of submission
	// to the blockchain. This is an optimization for the nonce pool. Implementations
	// should not modify the provided fulfillment record or selected nonce, but rather
	// use relevant fields to make the corresponding transaction.
	MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

	// OnSuccess is a callback function executed on a finalized transaction.
	OnSuccess(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) error

	// OnFailure is a callback function executed upon detecting a failed
	// transaction.
	//
	// In general, for automated and manual recovery, the steps should be
	//   1. Ensure the assigned nonce is transitioned back to available
	//      state with the correct blockhash.
	//   2. Update the fulfillment record with a new transaction, plus relevant
	//      metadata (eg. nonce, signature, etc), that does the exact same operation
	//      The fulfillment's state should be pending, so the fulfillment worker can
	//      begin submitting it immediately. The worker does this when recovered = true.
	OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

	// IsRevoked checks whether a fulfillment in the unknown state is revoked.
	// It also provides a hint as to whether the nonce was used or not. When in
	// doubt, say no or error out and let a human decide.
	IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)
}

func NewCloseCommitmentVaultFulfillmentHandler

func NewCloseCommitmentVaultFulfillmentHandler(data code_data.Provider) FulfillmentHandler

func NewCloseDormantTimelockAccountFulfillmentHandler

func NewCloseDormantTimelockAccountFulfillmentHandler(data code_data.Provider) FulfillmentHandler

func NewCloseEmptyTimelockAccountFulfillmentHandler

func NewCloseEmptyTimelockAccountFulfillmentHandler(data code_data.Provider) FulfillmentHandler

func NewInitializeCommitmentProofFulfillmentHandler

func NewInitializeCommitmentProofFulfillmentHandler(data code_data.Provider) FulfillmentHandler

func NewInitializeLockedTimelockAccountFulfillmentHandler

func NewInitializeLockedTimelockAccountFulfillmentHandler(data code_data.Provider) FulfillmentHandler

func NewNoPrivacyTransferWithAuthorityFulfillmentHandler

func NewNoPrivacyTransferWithAuthorityFulfillmentHandler(data code_data.Provider) FulfillmentHandler

func NewNoPrivacyWithdrawFulfillmentHandler

func NewNoPrivacyWithdrawFulfillmentHandler(data code_data.Provider) FulfillmentHandler

func NewOpenCommitmentVaultFulfillmentHandler

func NewOpenCommitmentVaultFulfillmentHandler(data code_data.Provider) FulfillmentHandler

func NewPermanentPrivacyTransferWithAuthorityFulfillmentHandler

func NewPermanentPrivacyTransferWithAuthorityFulfillmentHandler(data code_data.Provider, configProvider ConfigProvider) FulfillmentHandler

func NewSaveRecentRootFulfillmentHandler

func NewSaveRecentRootFulfillmentHandler(data code_data.Provider) FulfillmentHandler

func NewTemporaryPrivacyTransferWithAuthorityFulfillmentHandler

func NewTemporaryPrivacyTransferWithAuthorityFulfillmentHandler(data code_data.Provider, configProvider ConfigProvider) FulfillmentHandler

func NewTransferWithCommitmentFulfillmentHandler

func NewTransferWithCommitmentFulfillmentHandler(data code_data.Provider) FulfillmentHandler

func NewUploadCommitmentProofFulfillmentHandler

func NewUploadCommitmentProofFulfillmentHandler(data code_data.Provider) FulfillmentHandler

func NewVerifyCommitmentProofFulfillmentHandler

func NewVerifyCommitmentProofFulfillmentHandler(data code_data.Provider) FulfillmentHandler

type InitializeCommitmentProofFulfillmentHandler

type InitializeCommitmentProofFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*InitializeCommitmentProofFulfillmentHandler) CanSubmitToBlockchain

func (h *InitializeCommitmentProofFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

Assumption: Commitment vault opening is pre-sorted at the very front of the line

func (*InitializeCommitmentProofFulfillmentHandler) IsRevoked

func (h *InitializeCommitmentProofFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*InitializeCommitmentProofFulfillmentHandler) MakeOnDemandTransaction

func (h *InitializeCommitmentProofFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*InitializeCommitmentProofFulfillmentHandler) OnFailure

func (h *InitializeCommitmentProofFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*InitializeCommitmentProofFulfillmentHandler) OnSuccess

func (h *InitializeCommitmentProofFulfillmentHandler) OnSuccess(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) error

func (*InitializeCommitmentProofFulfillmentHandler) SupportsOnDemandTransactions

func (h *InitializeCommitmentProofFulfillmentHandler) SupportsOnDemandTransactions() bool

type InitializeLockedTimelockAccountFulfillmentHandler

type InitializeLockedTimelockAccountFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*InitializeLockedTimelockAccountFulfillmentHandler) CanSubmitToBlockchain

func (h *InitializeLockedTimelockAccountFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

func (*InitializeLockedTimelockAccountFulfillmentHandler) IsRevoked

func (h *InitializeLockedTimelockAccountFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*InitializeLockedTimelockAccountFulfillmentHandler) MakeOnDemandTransaction

func (h *InitializeLockedTimelockAccountFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*InitializeLockedTimelockAccountFulfillmentHandler) OnFailure

func (h *InitializeLockedTimelockAccountFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*InitializeLockedTimelockAccountFulfillmentHandler) OnSuccess

func (*InitializeLockedTimelockAccountFulfillmentHandler) SupportsOnDemandTransactions

func (h *InitializeLockedTimelockAccountFulfillmentHandler) SupportsOnDemandTransactions() bool

type IntentHandler

type IntentHandler interface {
	// Note: As of right now, we're restricted to checking actions, whose state is
	//       guaranteed to be updated by the time this is called. As a result, the
	//       intent handler should just get the records as needed since they need
	//       a global view anyways.
	OnActionUpdated(ctx context.Context, intentId string) error
}

func NewEstablishRelationshipIntentHandler

func NewEstablishRelationshipIntentHandler(data code_data.Provider) IntentHandler

func NewMigrateToPrivacy2022IntentHandler

func NewMigrateToPrivacy2022IntentHandler(data code_data.Provider) IntentHandler

func NewOpenAccountsIntentHandler

func NewOpenAccountsIntentHandler(data code_data.Provider) IntentHandler

func NewReceivePaymentsPrivatelyIntentHandler

func NewReceivePaymentsPrivatelyIntentHandler(data code_data.Provider) IntentHandler

func NewReceivePaymentsPubliclyIntentHandler

func NewReceivePaymentsPubliclyIntentHandler(data code_data.Provider) IntentHandler

func NewSaveRecentRootIntentHandler

func NewSaveRecentRootIntentHandler(data code_data.Provider) IntentHandler

func NewSendPrivatePaymentIntentHandler

func NewSendPrivatePaymentIntentHandler(data code_data.Provider) IntentHandler

func NewSendPublicPaymentIntentHandler

func NewSendPublicPaymentIntentHandler(data code_data.Provider) IntentHandler

type MigrateToPrivacy2022IntentHandler

type MigrateToPrivacy2022IntentHandler struct {
	// contains filtered or unexported fields
}

func (*MigrateToPrivacy2022IntentHandler) OnActionUpdated

func (h *MigrateToPrivacy2022IntentHandler) OnActionUpdated(ctx context.Context, intentId string) error

type NoPrivacyTransferActionHandler

type NoPrivacyTransferActionHandler struct {
	// contains filtered or unexported fields
}

func (*NoPrivacyTransferActionHandler) OnFulfillmentStateChange

func (h *NoPrivacyTransferActionHandler) OnFulfillmentStateChange(ctx context.Context, fulfillmentRecord *fulfillment.Record, newState fulfillment.State) error

type NoPrivacyTransferWithAuthorityFulfillmentHandler

type NoPrivacyTransferWithAuthorityFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*NoPrivacyTransferWithAuthorityFulfillmentHandler) CanSubmitToBlockchain

func (h *NoPrivacyTransferWithAuthorityFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

func (*NoPrivacyTransferWithAuthorityFulfillmentHandler) IsRevoked

func (h *NoPrivacyTransferWithAuthorityFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*NoPrivacyTransferWithAuthorityFulfillmentHandler) MakeOnDemandTransaction

func (h *NoPrivacyTransferWithAuthorityFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*NoPrivacyTransferWithAuthorityFulfillmentHandler) OnFailure

func (h *NoPrivacyTransferWithAuthorityFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*NoPrivacyTransferWithAuthorityFulfillmentHandler) OnSuccess

func (*NoPrivacyTransferWithAuthorityFulfillmentHandler) SupportsOnDemandTransactions

func (h *NoPrivacyTransferWithAuthorityFulfillmentHandler) SupportsOnDemandTransactions() bool

type NoPrivacyWithdrawActionHandler

type NoPrivacyWithdrawActionHandler struct {
	// contains filtered or unexported fields
}

func (*NoPrivacyWithdrawActionHandler) OnFulfillmentStateChange

func (h *NoPrivacyWithdrawActionHandler) OnFulfillmentStateChange(ctx context.Context, fulfillmentRecord *fulfillment.Record, newState fulfillment.State) error

type NoPrivacyWithdrawFulfillmentHandler

type NoPrivacyWithdrawFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*NoPrivacyWithdrawFulfillmentHandler) CanSubmitToBlockchain

func (h *NoPrivacyWithdrawFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

func (*NoPrivacyWithdrawFulfillmentHandler) IsRevoked

func (h *NoPrivacyWithdrawFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*NoPrivacyWithdrawFulfillmentHandler) MakeOnDemandTransaction

func (h *NoPrivacyWithdrawFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*NoPrivacyWithdrawFulfillmentHandler) OnFailure

func (h *NoPrivacyWithdrawFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*NoPrivacyWithdrawFulfillmentHandler) OnSuccess

func (h *NoPrivacyWithdrawFulfillmentHandler) OnSuccess(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) error

func (*NoPrivacyWithdrawFulfillmentHandler) SupportsOnDemandTransactions

func (h *NoPrivacyWithdrawFulfillmentHandler) SupportsOnDemandTransactions() bool

type OpenAccountActionHandler

type OpenAccountActionHandler struct {
	// contains filtered or unexported fields
}

func (*OpenAccountActionHandler) OnFulfillmentStateChange

func (h *OpenAccountActionHandler) OnFulfillmentStateChange(ctx context.Context, fulfillmentRecord *fulfillment.Record, newState fulfillment.State) error

type OpenAccountsIntentHandler

type OpenAccountsIntentHandler struct {
	// contains filtered or unexported fields
}

func (*OpenAccountsIntentHandler) OnActionUpdated

func (h *OpenAccountsIntentHandler) OnActionUpdated(ctx context.Context, intentId string) error

type OpenCommitmentVaultFulfillmentHandler

type OpenCommitmentVaultFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*OpenCommitmentVaultFulfillmentHandler) CanSubmitToBlockchain

func (h *OpenCommitmentVaultFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

Assumption: Commitment vault opening is pre-sorted at the very front of the line

func (*OpenCommitmentVaultFulfillmentHandler) IsRevoked

func (h *OpenCommitmentVaultFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*OpenCommitmentVaultFulfillmentHandler) MakeOnDemandTransaction

func (h *OpenCommitmentVaultFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*OpenCommitmentVaultFulfillmentHandler) OnFailure

func (h *OpenCommitmentVaultFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*OpenCommitmentVaultFulfillmentHandler) OnSuccess

func (h *OpenCommitmentVaultFulfillmentHandler) OnSuccess(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) error

func (*OpenCommitmentVaultFulfillmentHandler) SupportsOnDemandTransactions

func (h *OpenCommitmentVaultFulfillmentHandler) SupportsOnDemandTransactions() bool

type PermanentPrivacyTransferWithAuthorityFulfillmentHandler

type PermanentPrivacyTransferWithAuthorityFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*PermanentPrivacyTransferWithAuthorityFulfillmentHandler) CanSubmitToBlockchain

func (h *PermanentPrivacyTransferWithAuthorityFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

func (*PermanentPrivacyTransferWithAuthorityFulfillmentHandler) IsRevoked

func (h *PermanentPrivacyTransferWithAuthorityFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*PermanentPrivacyTransferWithAuthorityFulfillmentHandler) MakeOnDemandTransaction

func (*PermanentPrivacyTransferWithAuthorityFulfillmentHandler) OnFailure

func (h *PermanentPrivacyTransferWithAuthorityFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*PermanentPrivacyTransferWithAuthorityFulfillmentHandler) OnSuccess

func (*PermanentPrivacyTransferWithAuthorityFulfillmentHandler) SupportsOnDemandTransactions

func (h *PermanentPrivacyTransferWithAuthorityFulfillmentHandler) SupportsOnDemandTransactions() bool

type PrivateTransferActionHandler

type PrivateTransferActionHandler struct {
	// contains filtered or unexported fields
}

func (*PrivateTransferActionHandler) OnFulfillmentStateChange

func (h *PrivateTransferActionHandler) OnFulfillmentStateChange(ctx context.Context, fulfillmentRecord *fulfillment.Record, newState fulfillment.State) error

There's many fulfillments for a private transfer action, so we define success and failure purely based on our ability to move funds to/from the user accounts.

type ReceivePaymentsPrivatelyIntentHandler

type ReceivePaymentsPrivatelyIntentHandler struct {
	// contains filtered or unexported fields
}

func (*ReceivePaymentsPrivatelyIntentHandler) OnActionUpdated

func (h *ReceivePaymentsPrivatelyIntentHandler) OnActionUpdated(ctx context.Context, intentId string) error

type ReceivePaymentsPubliclyIntentHandler

type ReceivePaymentsPubliclyIntentHandler struct {
	// contains filtered or unexported fields
}

func (*ReceivePaymentsPubliclyIntentHandler) OnActionUpdated

func (h *ReceivePaymentsPubliclyIntentHandler) OnActionUpdated(ctx context.Context, intentId string) error

type SaveRecentRootActionHandler

type SaveRecentRootActionHandler struct {
	// contains filtered or unexported fields
}

func (*SaveRecentRootActionHandler) OnFulfillmentStateChange

func (h *SaveRecentRootActionHandler) OnFulfillmentStateChange(ctx context.Context, fulfillmentRecord *fulfillment.Record, newState fulfillment.State) error

type SaveRecentRootFulfillmentHandler

type SaveRecentRootFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*SaveRecentRootFulfillmentHandler) CanSubmitToBlockchain

func (h *SaveRecentRootFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

Assumption: Saving a recent root is pre-sorted to the back of the line

func (*SaveRecentRootFulfillmentHandler) IsRevoked

func (h *SaveRecentRootFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*SaveRecentRootFulfillmentHandler) MakeOnDemandTransaction

func (h *SaveRecentRootFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*SaveRecentRootFulfillmentHandler) OnFailure

func (h *SaveRecentRootFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*SaveRecentRootFulfillmentHandler) OnSuccess

func (h *SaveRecentRootFulfillmentHandler) OnSuccess(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) error

func (*SaveRecentRootFulfillmentHandler) SupportsOnDemandTransactions

func (h *SaveRecentRootFulfillmentHandler) SupportsOnDemandTransactions() bool

type SaveRecentRootIntentHandler

type SaveRecentRootIntentHandler struct {
	// contains filtered or unexported fields
}

func (*SaveRecentRootIntentHandler) OnActionUpdated

func (h *SaveRecentRootIntentHandler) OnActionUpdated(ctx context.Context, intentId string) error

type Scheduler

type Scheduler interface {
	// CanSubmitToBlockchain determines whether the given fulfillment can be
	// scheduled for submission to the blockchain.
	CanSubmitToBlockchain(ctx context.Context, record *fulfillment.Record) (bool, error)
}

Scheduler decides when fulfillments can be scheduled for submission to the blockchain. It does not manage the internal state of a fulfillment.

func NewContextualScheduler

func NewContextualScheduler(data code_data.Provider, configProvider ConfigProvider) Scheduler

NewContextualScheduler returns a scheduler that utilizes the global, account, intent, action and local context of a fulfillment to determine whether scheduling submission to the blockchain should occur.

The implementations has generic handling for:

  1. Precondition checks
  2. Circuit breaker safety mechanisms
  3. Subisider sanity checks

The implementation defers contextualized scheduling logic to handler implementations.

The implementation makes the following assumptions:

  1. We have full control of user account balances via a timelock account. Otherwise, we'd require a much more complex solution for the knapsack problem (likely a wavefunction collapse implementation).
  2. Fulfillments that require client signatures are validated to guarantee success before being created.

type SendPrivatePaymentIntentHandler

type SendPrivatePaymentIntentHandler struct {
	// contains filtered or unexported fields
}

func (*SendPrivatePaymentIntentHandler) OnActionUpdated

func (h *SendPrivatePaymentIntentHandler) OnActionUpdated(ctx context.Context, intentId string) error

type SendPublicPaymentIntentHandler

type SendPublicPaymentIntentHandler struct {
	// contains filtered or unexported fields
}

func (*SendPublicPaymentIntentHandler) OnActionUpdated

func (h *SendPublicPaymentIntentHandler) OnActionUpdated(ctx context.Context, intentId string) error

type TemporaryPrivacyTransferWithAuthorityFulfillmentHandler

type TemporaryPrivacyTransferWithAuthorityFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*TemporaryPrivacyTransferWithAuthorityFulfillmentHandler) CanSubmitToBlockchain

func (h *TemporaryPrivacyTransferWithAuthorityFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

func (*TemporaryPrivacyTransferWithAuthorityFulfillmentHandler) IsRevoked

func (h *TemporaryPrivacyTransferWithAuthorityFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*TemporaryPrivacyTransferWithAuthorityFulfillmentHandler) MakeOnDemandTransaction

func (*TemporaryPrivacyTransferWithAuthorityFulfillmentHandler) OnFailure

func (h *TemporaryPrivacyTransferWithAuthorityFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*TemporaryPrivacyTransferWithAuthorityFulfillmentHandler) OnSuccess

func (*TemporaryPrivacyTransferWithAuthorityFulfillmentHandler) SupportsOnDemandTransactions

func (h *TemporaryPrivacyTransferWithAuthorityFulfillmentHandler) SupportsOnDemandTransactions() bool

type TransferWithCommitmentFulfillmentHandler

type TransferWithCommitmentFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*TransferWithCommitmentFulfillmentHandler) CanSubmitToBlockchain

func (h *TransferWithCommitmentFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

func (*TransferWithCommitmentFulfillmentHandler) IsRevoked

func (h *TransferWithCommitmentFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*TransferWithCommitmentFulfillmentHandler) MakeOnDemandTransaction

func (h *TransferWithCommitmentFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*TransferWithCommitmentFulfillmentHandler) OnFailure

func (h *TransferWithCommitmentFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*TransferWithCommitmentFulfillmentHandler) OnSuccess

func (h *TransferWithCommitmentFulfillmentHandler) OnSuccess(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) error

func (*TransferWithCommitmentFulfillmentHandler) SupportsOnDemandTransactions

func (h *TransferWithCommitmentFulfillmentHandler) SupportsOnDemandTransactions() bool

type UploadCommitmentProofFulfillmentHandler

type UploadCommitmentProofFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*UploadCommitmentProofFulfillmentHandler) CanSubmitToBlockchain

func (h *UploadCommitmentProofFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

Assumption: Commitment vault opening is pre-sorted at the very front of the line

func (*UploadCommitmentProofFulfillmentHandler) IsRevoked

func (h *UploadCommitmentProofFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*UploadCommitmentProofFulfillmentHandler) MakeOnDemandTransaction

func (h *UploadCommitmentProofFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*UploadCommitmentProofFulfillmentHandler) OnFailure

func (h *UploadCommitmentProofFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*UploadCommitmentProofFulfillmentHandler) OnSuccess

func (h *UploadCommitmentProofFulfillmentHandler) OnSuccess(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) error

func (*UploadCommitmentProofFulfillmentHandler) SupportsOnDemandTransactions

func (h *UploadCommitmentProofFulfillmentHandler) SupportsOnDemandTransactions() bool

type VerifyCommitmentProofFulfillmentHandler

type VerifyCommitmentProofFulfillmentHandler struct {
	// contains filtered or unexported fields
}

func (*VerifyCommitmentProofFulfillmentHandler) CanSubmitToBlockchain

func (h *VerifyCommitmentProofFulfillmentHandler) CanSubmitToBlockchain(ctx context.Context, fulfillmentRecord *fulfillment.Record) (scheduled bool, err error)

Assumption: Commitment vault opening is pre-sorted at the very front of the line

func (*VerifyCommitmentProofFulfillmentHandler) IsRevoked

func (h *VerifyCommitmentProofFulfillmentHandler) IsRevoked(ctx context.Context, fulfillmentRecord *fulfillment.Record) (revoked bool, nonceUsed bool, err error)

func (*VerifyCommitmentProofFulfillmentHandler) MakeOnDemandTransaction

func (h *VerifyCommitmentProofFulfillmentHandler) MakeOnDemandTransaction(ctx context.Context, fulfillmentRecord *fulfillment.Record, selectedNonce *transaction_util.SelectedNonce) (*solana.Transaction, error)

func (*VerifyCommitmentProofFulfillmentHandler) OnFailure

func (h *VerifyCommitmentProofFulfillmentHandler) OnFailure(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) (recovered bool, err error)

func (*VerifyCommitmentProofFulfillmentHandler) OnSuccess

func (h *VerifyCommitmentProofFulfillmentHandler) OnSuccess(ctx context.Context, fulfillmentRecord *fulfillment.Record, txnRecord *transaction.Record) error

func (*VerifyCommitmentProofFulfillmentHandler) SupportsOnDemandTransactions

func (h *VerifyCommitmentProofFulfillmentHandler) SupportsOnDemandTransactions() bool

Jump to

Keyboard shortcuts

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