Help us shape the future of Go! Take the 2026 Go Developer Survey

synapse

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStoreSessionMissing    = errors.New("upload session is unavailable")
	ErrStoreSessionClaimed    = errors.New("upload session is already claimed")
	ErrStoreSessionIncomplete = errors.New("upload session is incomplete")
	ErrStoreUploadTruncated   = errors.New("upload ended before all bytes were sent")
)
View Source
var (
	ErrTerminationEvidenceConflict  = errors.New("termination evidence conflicts with the saved transaction")
	ErrTerminationTransactionFailed = errors.New("termination transaction failed on chain")
)
View Source
var (
	ErrWalletReplayInvalidEvidence = errors.New("could not verify the saved wallet transaction")
	ErrWalletReplaySkipped         = errors.New("wallet transaction replay skipped")
	ErrWalletReplayBroadcast       = errors.New("wallet transaction replay broadcast failed")
)
View Source
var ErrProviderTransactionRejected = pdp.ErrTxRejected

ErrProviderTransactionRejected is the adapter-level identity for a provider transaction that reached a terminal rejected state.

View Source
var ErrServicePaidByAnother = errors.New("data set is paid for by another wallet")

ErrServicePaidByAnother means the chain records the data set as paid for by a wallet other than the one signing. Under this configuration its number names someone else's service, so it is never terminated; an operator has to put the original wallet or network back.

View Source
var ErrTerminationObservationUnavailable = errors.New("provider termination status unavailable")

ErrTerminationObservationUnavailable identifies an unavailable provider status read. A failed lookup is neither evidence that an earlier transaction is absent nor permission to resend it. First-request fallback requires no historical submission evidence.

Functions

func IsDataSetServiceEnded

func IsDataSetServiceEnded(err error) bool

func IsDataSetWriteBlocked

func IsDataSetWriteBlocked(err error) bool

IsDataSetWriteBlocked reports whether err means the data set can no longer accept writes because its PDP payment ended. The SDK raises it while validating the data set, before the provider is contacted, so a commit that fails this way never reached the provider.

func IsNoProviderCandidates

func IsNoProviderCandidates(err error) bool

func IsProviderCandidateWait

func IsProviderCandidateWait(err error) bool

IsProviderCandidateWait identifies an empty selection without a failed probe.

func IsProviderUnavailable

func IsProviderUnavailable(err error) bool

func IsTerminationBlocked

func IsTerminationBlocked(err error) bool

IsTerminationBlocked reports whether termination needs operator action rather than another attempt.

func LegacyPieceStorageIDLimit

func LegacyPieceStorageIDLimit(network string) uint64

LegacyPieceStorageIDLimit returns the first data set ID of the network's compact piece layout, or zero for a network without one.

func NewApprovedProviderCatalog

func NewApprovedProviderCatalog(chain cleanupChainCaller, view common.Address) (*approvedProviderCatalog, error)

NewApprovedProviderCatalog reads every page of the approved list at one chain block.

func NewClient

func NewClient(ctx context.Context, cfg ClientConfig) (*sdk.Client, error)

NewClient creates a synapse-go Client from config fields.

func NewProviderHTTPClient

func NewProviderHTTPClient(timeout time.Duration, allowPrivate bool) *http.Client

NewProviderHTTPClient applies the configured provider URL policy to HTTP requests.

func NormalizeProviderOperationError

func NormalizeProviderOperationError(ctx context.Context, err error) error

NormalizeProviderOperationError classifies failures from a known provider endpoint. Callers must not use it for chain RPC or mixed resolution work.

func ValidateNetworkChainID

func ValidateNetworkChainID(network string, actual int64) error

func ValidateWalletSubmission

func ValidateWalletSubmission(identity walletoperation.ExecutionIdentity, operationType model.WalletOperationType, amount *big.Int, submission WalletSubmission) error

ValidateWalletSubmission checks frozen identity and transaction intent without RPC calls.

Types

type ChainEpochReader

type ChainEpochReader interface {
	CurrentEpoch(ctx context.Context) (int64, error)
}

ChainEpochReader observes the chain head. Replacement uses it to decide when a terminated service has genuinely ended.

func NewChainEpochReader

func NewChainEpochReader(source blockNumberSource) ChainEpochReader

NewChainEpochReader reads the epoch from the chain head.

The wall-clock estimate available elsewhere in the SDK derives an epoch from genesis time and can run ahead of the chain, which would let a replacement retire a source before its service has really ended. Retirement therefore only trusts an observed block number.

type CleanupContext

type CleanupContext interface {
	DeletePieceByID(context.Context, sdktypes.BigInt) (*sdktypes.WriteResult, error)
}

CleanupContext abstracts the SDK operations needed to remove PDP pieces.

type CleanupPieceState

type CleanupPieceState struct {
	Status      CleanupPieceStatus
	BlockNumber uint64
}

CleanupPieceState is an observation of one exact on-chain piece at one block.

type CleanupPieceStatus

type CleanupPieceStatus string
const (
	CleanupPiecePresent        CleanupPieceStatus = "present"
	CleanupPieceScheduled      CleanupPieceStatus = "scheduled"
	CleanupPieceDataSetCleanup CleanupPieceStatus = "dataset_cleanup"
	CleanupPieceRemoved        CleanupPieceStatus = "removed"
)

type ClientConfig

type ClientConfig struct {
	PrivateKey           string
	RPCURL               string
	WithCDN              bool
	AllowPrivateNetworks bool
	Logger               *slog.Logger
}

ClientConfig contains SynapS3 runtime settings forwarded into synapse-go.

type ClientNonceState

type ClientNonceState struct {
	Consumed    bool
	DataSetID   sdktypes.BigInt
	NextPieceID sdktypes.BigInt
}

ClientNonceState is what FWSS recorded for one add-pieces nonce. Once the pieces it signed are added, the nonce stays consumed and names the data set they joined and the piece ID that data set will assign next.

func (ClientNonceState) PieceIDs

func (s ClientNonceState) PieceIDs(count int) ([]sdktypes.BigInt, error)

PieceIDs returns the IDs a consumed nonce assigned to count pieces. PDPVerifier numbers the pieces of one request consecutively from firstAdded, and FWSS piecesAdded records firstAdded + count as the next piece ID, so they end at NextPieceID-1.

type CommitNonceReader

type CommitNonceReader interface {
	// ClientNonce reports what FWSS recorded for a nonce this node's payer
	// signed.
	ClientNonce(ctx context.Context, nonce sdktypes.BigInt) (ClientNonceState, error)
	// PieceCIDAt returns the piece CID a data set holds at a piece ID, or
	// cid.Undef when none is there.
	PieceCIDAt(ctx context.Context, dataSetID, pieceID sdktypes.BigInt) (cid.Cid, error)
}

CommitNonceReader reads the chain record that settles whether a signed add-pieces request was added, without scanning blocks or event logs.

func NewCommitNonceReader

func NewCommitNonceReader(chain viewCaller, view, verifier, payer common.Address) (CommitNonceReader, error)

NewCommitNonceReader reads nonces payer signed from the FWSS view contract and piece identities from PDPVerifier.

type CommitRejection

type CommitRejection uint8

CommitRejection classifies a SubmitCommit failure the provider answered with a 4xx status.

const (
	CommitNotRejected CommitRejection = iota
	// CommitRejectedDataSetUnavailable means the provider does not know the
	// data set (404) or reports it terminated (409).
	CommitRejectedDataSetUnavailable
	// CommitRejectedByProvider covers every other 4xx, including a piece the
	// provider no longer holds and rate limiting.
	CommitRejectedByProvider
)

func ClassifyCommitRejection

func ClassifyCommitRejection(err error) CommitRejection

ClassifyCommitRejection reports whether a SubmitCommit error is a provider 4xx. AddPieces is the only provider call SubmitCommit makes, and Curio answers every 4xx from it before sending a transaction, so a rejected submission never reached the chain.

type DataSetCreationStatusInput

type DataSetCreationStatusInput struct {
	StatusURL         string
	TransactionID     string
	ExpectedDataSetID string
}

type DataSetServiceEndedError

type DataSetServiceEndedError struct {
	Cause error
}

DataSetServiceEndedError reports typed evidence that an established data set no longer represents a writable service.

func (*DataSetServiceEndedError) Error

func (e *DataSetServiceEndedError) Error() string

func (*DataSetServiceEndedError) Unwrap

func (e *DataSetServiceEndedError) Unwrap() error

type DataSetTarget

type DataSetTarget interface {
	StorageTarget
	ContextIdentity() storage.ContextIdentity
	CreateStoreSession(ctx context.Context) (string, error)
	UploadStoreSession(ctx context.Context, serviceURL, sessionID string, reader io.Reader, opts *storage.StoreOptions) (*storage.StoreResult, error)
	FinalizeStoreSession(ctx context.Context, serviceURL, sessionID string, pieceCID cid.Cid) error
	PresignForCommit(context.Context, []storage.PieceInput) ([]byte, error)
	SubmitPull(context.Context, storage.PullRequest) (*storage.PullResult, error)
	SubmitCommit(context.Context, storage.CommitRequest) (*storage.CommitSubmission, error)
	GetCommitStatus(context.Context, string) (*storage.CommitStatus, error)
	PieceStatus(context.Context, cid.Cid) (*storage.PieceStatus, error)
	// CheckWritable reads the data set's chain state and reports whether it
	// still accepts new pieces. It contacts no provider.
	CheckWritable(context.Context) error
}

DataSetTarget is an immutable existing data set used for piece operations.

type NoProviderCandidatesError

type NoProviderCandidatesError struct {
	Cause error
}

NoProviderCandidatesError reports that automatic selection cannot currently satisfy a newly authorized replica slot.

func (*NoProviderCandidatesError) Error

func (e *NoProviderCandidatesError) Error() string

func (*NoProviderCandidatesError) Unwrap

func (e *NoProviderCandidatesError) Unwrap() error

type PDPBatchUploadProbe

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

func NewPDPBatchUploadProbe

func NewPDPBatchUploadProbe(allowPrivate bool) *PDPBatchUploadProbe

func (*PDPBatchUploadProbe) Probe

Probe measures only the PUT phase; the upload session is intentionally not finalized.

type PDPStatusChecker

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

func NewPDPStatusChecker

func NewPDPStatusChecker(opts PDPStatusCheckerOptions) *PDPStatusChecker

func (*PDPStatusChecker) CheckDataSetCreationStatus

func (c *PDPStatusChecker) CheckDataSetCreationStatus(ctx context.Context, input DataSetCreationStatusInput) PDPStatusResult

func (*PDPStatusChecker) FindParkedPiece

func (c *PDPStatusChecker) FindParkedPiece(ctx context.Context, serviceURL string, pieceCID cid.Cid) (ParkedPieceState, error)

FindParkedPiece checks the provider-local piece endpoint once. Its client uses the same redirect, DNS, and private-network protections as status polling.

type PDPStatusCheckerOptions

type PDPStatusCheckerOptions struct {
	Timeout              time.Duration
	AllowPrivateNetworks bool
}

type PDPStatusResult

type PDPStatusResult struct {
	State          PDPStatusState
	StatusURL      string
	TxStatus       string
	DataSetID      string
	DataSetCreated bool
	Error          string
}

type PDPStatusState

type PDPStatusState string
const (
	PDPStatusPending     PDPStatusState = "pending"
	PDPStatusConfirmed   PDPStatusState = "confirmed"
	PDPStatusRejected    PDPStatusState = "rejected"
	PDPStatusMismatch    PDPStatusState = "mismatch"
	PDPStatusUnavailable PDPStatusState = "unavailable"
	PDPStatusUnknown     PDPStatusState = "unknown"
)

type ParkedPieceChecker

type ParkedPieceChecker interface {
	FindParkedPiece(context.Context, string, cid.Cid) (ParkedPieceState, error)
}

ParkedPieceChecker observes the provider's parked-piece endpoint without treating an on-chain lookup as evidence that an upload did not happen.

type ParkedPieceState

type ParkedPieceState string

ParkedPieceState describes the provider-local state of a content-addressed piece before it has been committed on chain.

const (
	ParkedPieceMissing    ParkedPieceState = "missing"
	ParkedPieceProcessing ParkedPieceState = "processing"
	ParkedPieceReady      ParkedPieceState = "parked"
)

type PaymentAccountInfo

type PaymentAccountInfo struct {
	Funds               *big.Int
	AvailableFunds      *big.Int
	LockupCurrent       *big.Int
	LockupRate          *big.Int
	LockupLastSettledAt *big.Int
	FundedUntilEpoch    *big.Int
	FundedUntilTime     *time.Time
	RunwaySeconds       *int64
	LockupRatePerDay    *big.Int
	LockupRatePerMonth  *big.Int
	NoActiveSpend       bool
}

PaymentAccountInfo holds USDFC payment contract account state.

type ProviderInventory

type ProviderInventory struct {
	Selection     providerselect.Inventory
	Providers     map[string]storage.Provider
	PartialErrors map[string]string
}

type ProviderTarget

type ProviderTarget interface {
	StorageTarget
	CreateDataSet(context.Context, *storage.CreateDataSetOptions) (*storage.CreateDataSetResult, error)
	WaitForDataSetCreated(context.Context, string, sdktypes.BigInt) (*storage.CreateDataSetResult, error)
	// ContextIdentity is the payer, chain, and record keeper the target signs
	// for. Client data set IDs are only unique within it.
	ContextIdentity() storage.ContextIdentity
	// FindDataSetByClientDataSetID reads the chain for the data set a create
	// request with this ID produced. Not found only means none is visible yet.
	FindDataSetByClientDataSetID(context.Context, sdktypes.BigInt) (storage.DataSetRef, bool, error)
}

ProviderTarget is an unbound provider used to create or resume creation of a data set. Creating a data set does not mutate the target into a bound one.

type ProviderUnavailableError

type ProviderUnavailableError struct {
	Cause error
}

ProviderUnavailableError reports a recoverable provider or transport dependency failure.

func (*ProviderUnavailableError) Error

func (e *ProviderUnavailableError) Error() string

func (*ProviderUnavailableError) Unwrap

func (e *ProviderUnavailableError) Unwrap() error

type PullErrorDisposition

type PullErrorDisposition uint8
const (
	PullErrorUnknown PullErrorDisposition = iota
	PullErrorRetryable
	PullErrorTerminal
)

func ClassifyPullError

func ClassifyPullError(err error) PullErrorDisposition

ClassifyPullError keeps SDK-specific pull failures at the adapter boundary. Provider and caller interruptions remain retryable; deterministic request or provider rejection errors are terminal. Unknown errors use the task's bounded retry budget so a newly introduced SDK error cannot create a permanent loop.

type ReadinessCheck

type ReadinessCheck struct {
	ID            string          `json:"id"`
	Status        ReadinessStatus `json:"status"`
	Message       string          `json:"message"`
	Action        string          `json:"action,omitempty"`
	RequiredUSDFC string          `json:"required_usdfc,omitempty"`
}

type ReadinessChecker

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

func NewReadinessChecker

func NewReadinessChecker(cfg ReadinessConfig, runtime ReadinessClient, opts ...ReadinessCheckerOption) *ReadinessChecker

func (*ReadinessChecker) CheckDraft

func (*ReadinessChecker) CheckRuntime

func (c *ReadinessChecker) CheckRuntime(ctx context.Context) ReadinessResult

type ReadinessCheckerOption

type ReadinessCheckerOption func(*ReadinessChecker)

func WithReadinessClientFactory

func WithReadinessClientFactory(factory ReadinessClientFactory) ReadinessCheckerOption

func WithReadinessLogger

func WithReadinessLogger(logger *slog.Logger) ReadinessCheckerOption

func WithReadinessTimeout

func WithReadinessTimeout(timeout time.Duration) ReadinessCheckerOption

type ReadinessClient

type ReadinessClient interface {
	ProviderInventory(context.Context, ReadinessConfig) (ProviderInventory, error)
	Address() common.Address
	Chain() chain.Chain
	ResolvedAddresses() sdk.ResolvedAddresses
	Payments() readinessPayments
	Storage() readinessStorage
	Close() error
}

func AdaptReadinessClient

func AdaptReadinessClient(client *sdk.Client) ReadinessClient

type ReadinessClientFactory

type ReadinessClientFactory func(context.Context, ReadinessConfig) (ReadinessClient, error)

type ReadinessConfig

type ReadinessConfig struct {
	Network              string
	RPCURL               string
	PrivateKey           string
	WithCDN              bool
	AllowPrivateNetworks bool
	DefaultCopies        int
	AnchorProviderTier   string
	ProviderTimeout      time.Duration
	ProviderConcurrency  int
}

func ReadinessConfigFromFilecoinConfig

func ReadinessConfigFromFilecoinConfig(cfg config.FilecoinConfig) ReadinessConfig

type ReadinessMode

type ReadinessMode string
const (
	ReadinessModeRuntime ReadinessMode = "runtime"
	ReadinessModeDraft   ReadinessMode = "draft"
)

type ReadinessResult

type ReadinessResult struct {
	Status        ReadinessStatus   `json:"status"`
	Mode          ReadinessMode     `json:"mode"`
	CheckedAt     time.Time         `json:"checked_at"`
	Checks        []ReadinessCheck  `json:"checks"`
	PartialErrors map[string]string `json:"partial_errors,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadinessResult) Finish

func (r *ReadinessResult) Finish()

Finish updates the aggregate readiness status from the contained checks.

type ReadinessStatus

type ReadinessStatus string
const (
	ReadinessStatusReady   ReadinessStatus = "ready"
	ReadinessStatusWarning ReadinessStatus = "warning"
	ReadinessStatusBlocked ReadinessStatus = "blocked"
	ReadinessStatusUnknown ReadinessStatus = "unknown"
)

type ServiceTerminator

type ServiceTerminator interface {
	PDPVerifierAddress() common.Address
	TerminateService(ctx context.Context, dataSetID sdktypes.BigInt, onSubmitted func(string) error) (*TerminationResult, error)
	// VerifyServicePayer reads the data set's record and fails with
	// ErrServicePaidByAnother when this wallet does not pay for it; any other
	// error means the record could not be read. It sends nothing, so a caller can
	// check before committing to a termination.
	VerifyServicePayer(ctx context.Context, dataSetID sdktypes.BigInt) error
	// ContextIdentity reports the payer, chain, and record keeper this
	// terminator signs for, so a caller can tell that a recorded request was
	// made under another one.
	ContextIdentity() storage.ContextIdentity
}

ServiceTerminator is the destructive service-lifecycle boundary. It is used only after replacement cleanup authorization and the retirement safety gate have both passed.

type StorageClient

type StorageClient interface {
	ContextIdentity() storage.ContextIdentity
	PDPVerifierAddress() common.Address
	Download(ctx context.Context, pieceCID cid.Cid, opts *storage.DownloadOptions) (io.ReadCloser, error)
	PrepareUpload(ctx context.Context, dataSize uint64, targets []StorageTarget) (*sdkcosts.MultiContextCosts, error)
	SelectUploadTargets(ctx context.Context, opts storage.SelectUploadContextsOptions) ([]StorageTarget, error)
	OpenProviderTarget(ctx context.Context, providerID sdktypes.BigInt, opts storage.NewProviderContextOptions) (ProviderTarget, error)
	OpenDataSetTarget(ctx context.Context, dataSetID sdktypes.BigInt, opts storage.NewDataSetContextOptions) (DataSetTarget, error)
	FindMatchingDataSet(ctx context.Context, providerID sdktypes.BigInt, metadata map[string]string, withCDN bool) (*storage.DataSetRef, error)
	OpenCleanupContext(ctx context.Context, dataSetID sdktypes.BigInt, opts storage.NewDataSetContextOptions) (CleanupContext, error)
	// DeletionState reads exact piece or data-set cleanup evidence at one block.
	// Removed data sets require the caller's recorded creation identity.
	DeletionState(ctx context.Context, dataSetID, pieceID sdktypes.BigInt) (CleanupPieceState, error)
}

StorageClient abstracts the synapse-go storage service for download plus staged provider operations.

type StorageServiceAdapter

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

StorageServiceAdapter adapts synapse-go's concrete immutable storage contexts to SynapS3's testable staged storage interface.

func AdaptStorageService

func AdaptStorageService(service *storage.Service, dataSets *warmstorage.Service, identity storage.ContextIdentity) *StorageServiceAdapter

AdaptStorageService wraps the SDK storage service. dataSets reads the FWSS service state that termination checks before every request, and identity is what this service signs for: destructive requests refuse a record that belongs to another payer.

func (*StorageServiceAdapter) ConfigureCleanupChain

func (s *StorageServiceAdapter) ConfigureCleanupChain(chain cleanupChainCaller) error

ConfigureCleanupChain uses the existing chain connection for exact piece and scheduled-removal reads during cleanup.

func (*StorageServiceAdapter) ConfigureProviderHTTPClient

func (s *StorageServiceAdapter) ConfigureProviderHTTPClient(allowPrivate bool)

ConfigureProviderHTTPClient preserves the deployment URL policy for uploads.

func (*StorageServiceAdapter) ConfigureTerminationChain

func (s *StorageServiceAdapter) ConfigureTerminationChain(chain terminationTransactionReader)

ConfigureTerminationChain uses the existing chain connection to observe saved transactions.

func (*StorageServiceAdapter) ContextIdentity

func (s *StorageServiceAdapter) ContextIdentity() storage.ContextIdentity

ContextIdentity reports the payer, chain, and record keeper this service signs for.

func (*StorageServiceAdapter) DeletionState

func (s *StorageServiceAdapter) DeletionState(ctx context.Context, dataSetID, pieceID sdktypes.BigInt) (CleanupPieceState, error)

func (*StorageServiceAdapter) Download

func (s *StorageServiceAdapter) Download(ctx context.Context, pieceCID cid.Cid, opts *storage.DownloadOptions) (io.ReadCloser, error)

func (*StorageServiceAdapter) FindMatchingDataSet

func (s *StorageServiceAdapter) FindMatchingDataSet(
	ctx context.Context,
	providerID sdktypes.BigInt,
	metadata map[string]string,
	withCDN bool,
) (*storage.DataSetRef, error)

func (*StorageServiceAdapter) ObserveTermination

func (s *StorageServiceAdapter) ObserveTermination(ctx context.Context, dataSetID sdktypes.BigInt, known TerminationResult) (*TerminationResult, bool, error)

ObserveTermination reads chain and provider evidence without sending a request.

func (*StorageServiceAdapter) ObserveTerminationDirect

func (s *StorageServiceAdapter) ObserveTerminationDirect(ctx context.Context, dataSetID sdktypes.BigInt, known TerminationResult) (*TerminationResult, bool, error)

ObserveTerminationDirect checks the admitted transaction without consulting a provider request that can still describe a preceding failed attempt.

func (*StorageServiceAdapter) OpenCleanupContext

func (*StorageServiceAdapter) OpenDataSetTarget

func (*StorageServiceAdapter) OpenProviderTarget

func (*StorageServiceAdapter) PDPVerifierAddress

func (s *StorageServiceAdapter) PDPVerifierAddress() common.Address

func (*StorageServiceAdapter) PrepareUpload

func (s *StorageServiceAdapter) PrepareUpload(ctx context.Context, dataSize uint64, targets []StorageTarget) (*sdkcosts.MultiContextCosts, error)

func (*StorageServiceAdapter) SelectUploadTargets

func (*StorageServiceAdapter) SetTransferCounters

func (s *StorageServiceAdapter) SetTransferCounters(counters *observability.TransferCounters)

func (*StorageServiceAdapter) TerminateService

func (s *StorageServiceAdapter) TerminateService(ctx context.Context, dataSetID sdktypes.BigInt, onSubmitted func(string) error) (*TerminationResult, error)

TerminateService is a destructive boundary used only after the retirement safety gate passes. It reads the payer-checked chain record before sending and records a known submission through onSubmitted before waiting. Direct fallback requires no submission evidence.

func (*StorageServiceAdapter) TerminateServiceDirect

func (s *StorageServiceAdapter) TerminateServiceDirect(ctx context.Context, dataSetID sdktypes.BigInt, onSubmitted func(string) error) (*TerminationResult, error)

TerminateServiceDirect submits a fresh transaction after the caller has verified that the preceding attempt reverted and explicitly authorized another paid attempt.

func (*StorageServiceAdapter) VerifyServicePayer

func (s *StorageServiceAdapter) VerifyServicePayer(ctx context.Context, dataSetID sdktypes.BigInt) error

VerifyServicePayer checks ownership without sending a transaction.

type StorageTarget

type StorageTarget interface {
	ProviderID() sdktypes.BigInt
	DataSetRef() (storage.DataSetRef, bool)
	GetProviderInfo() storage.Provider
	CDNEnabled() bool
	PieceURL(cid.Cid) string
	ServiceURL() string
}

StorageTarget abstracts the immutable identity shared by provider and data set targets returned by synapse-go.

type TerminationBlockedError

type TerminationBlockedError struct {
	Reason    string
	Shortfall *big.Int
	Err       error
}

TerminationBlockedError means the service cannot be terminated until an operator resolves something the gateway must not decide on its own, such as settling outstanding payment debt. It is never retried automatically.

func (*TerminationBlockedError) Error

func (e *TerminationBlockedError) Error() string

func (*TerminationBlockedError) Unwrap

func (e *TerminationBlockedError) Unwrap() error

type TerminationResult

type TerminationResult struct {
	TxHash          string
	ConfirmedTxHash string
	ReceiptStatus   *uint64
	EndEpoch        *int64
}

TerminationResult retains submission evidence and the verified service end, when known. A submitted transaction does not establish its end epoch.

type WalletInfo

type WalletInfo struct {
	Address              string
	Network              string
	ChainID              int64
	Nonce                *uint64
	CurrentEpoch         *big.Int
	EpochDurationSeconds int64
	PaymentsAddress      string
	USDFCAddress         string
	USDFCDecimals        uint8
	FILGasBalance        *big.Int
	USDFCWalletBalance   *big.Int
	PaymentAccount       *PaymentAccountInfo
	Errors               map[string]string
}

WalletInfo holds a snapshot of the wallet's on-chain state. Fields are nil when the corresponding RPC call failed; see Errors for details.

type WalletOperator

type WalletOperator interface {
	WalletIdentity() walletoperation.ExecutionIdentity
	FundUSDFC(ctx context.Context, amount *big.Int) (WalletSubmission, error)
	WithdrawUSDFC(ctx context.Context, amount *big.Int) (WalletSubmission, error)
	ApproveFWSS(ctx context.Context) (WalletSubmission, error)
	RebroadcastSignedTransaction(ctx context.Context, operationType model.WalletOperationType, amount *big.Int, submission WalletSubmission, observationTimeout time.Duration) error
}

WalletOperator broadcasts wallet payment transactions.

type WalletQuerier

type WalletQuerier interface {
	WalletIdentity() walletoperation.ExecutionIdentity
	GetWalletInfo(ctx context.Context) (*WalletInfo, error)
}

WalletQuerier provides on-chain wallet state for the admin dashboard.

func NewWalletQuerier

func NewWalletQuerier(paySvc *payments.Service, address common.Address, c chain.Chain, addrs sdk.ResolvedAddresses) WalletQuerier

NewWalletQuerier creates a WalletQuerier backed by synapse-go payments.Service.

type WalletReplayClient

type WalletReplayClient interface {
	ChainID(context.Context) (*big.Int, error)
	TransactionReceipt(context.Context, common.Hash) (*ethtypes.Receipt, error)
	TransactionByHash(context.Context, common.Hash) (*ethtypes.Transaction, bool, error)
	NonceAt(context.Context, common.Address, *big.Int) (uint64, error)
	PendingNonceAt(context.Context, common.Address) (uint64, error)
	SendTransaction(context.Context, *ethtypes.Transaction) error
}

WalletReplayClient observes and sends the exact transaction retained by the ledger.

type WalletSubmission

type WalletSubmission struct {
	TxHash            string
	SignedTransaction []byte
}

WalletSubmission identifies one signed transaction, including when sending fails.

func WalletSubmissionFromWriteResult

func WalletSubmissionFromWriteResult(res *sdktypes.WriteResult, err error, action string) (WalletSubmission, error)

WalletSubmissionFromWriteResult retains broadcast evidence and its error chain while keeping signed transaction bytes out of error messages.

Jump to

Keyboard shortcuts

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