Documentation
¶
Index ¶
- Variables
- func GetAltForMint(ctx context.Context, data code_data.Provider, mint *common.Account) (solana.AddressLookupTable, error)
- func MakeCompressAccountTransaction(nonce *Nonce, vmConfig *common.VmConfig, memory *common.Account, ...) (solana.Transaction, error)
- func MakeExternalTransferWithAuthorityTransaction(nonce *Nonce, vmConfig *common.VmConfig, virtualSignature solana.Signature, ...) (solana.Transaction, error)
- func MakeExternalWithdrawTransaction(nonce *Nonce, vmConfig *common.VmConfig, virtualSignature solana.Signature, ...) (solana.Transaction, error)
- func MakeInternalTransferWithAuthorityTransaction(nonce *Nonce, vmConfig *common.VmConfig, virtualSignature solana.Signature, ...) (solana.Transaction, error)
- func MakeInternalWithdrawTransaction(nonce *Nonce, vmConfig *common.VmConfig, virtualSignature solana.Signature, ...) (solana.Transaction, error)
- func MakeNoncedTransaction(nonce *Nonce, instructions ...solana.Instruction) (solana.Transaction, error)
- func MakeOpenAccountTransaction(nonce *Nonce, vmConfig *common.VmConfig, memory *common.Account, ...) (solana.Transaction, error)
- func ToProtoAlt(alt solana.AddressLookupTable) *commonpb.SolanaAddressLookupTable
- type LocalNoncePool
- type MergedMemoryBankResult
- type Nonce
- type NoncePoolOption
- func WithNoncePoolMaxExpiration(d time.Duration) NoncePoolOption
- func WithNoncePoolMinExpiration(d time.Duration) NoncePoolOption
- func WithNoncePoolNodeID(id string) NoncePoolOption
- func WithNoncePoolRefreshInterval(interval time.Duration) NoncePoolOption
- func WithNoncePoolRefreshPoolInterval(interval time.Duration) NoncePoolOption
- func WithNoncePoolShutdownGracePeriod(duration time.Duration) NoncePoolOption
- func WithNoncePoolSize(size int) NoncePoolOption
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetAltForMint ¶
func GetAltForMint(ctx context.Context, data code_data.Provider, mint *common.Account) (solana.AddressLookupTable, error)
GetAltForMint gets an address lookup table to operate in a versioned transaction for the provided mint
func MakeExternalTransferWithAuthorityTransaction ¶
func MakeExternalTransferWithAuthorityTransaction( nonce *Nonce, vmConfig *common.VmConfig, virtualSignature solana.Signature, nonceMemory *common.Account, nonceIndex uint16, sourceMemory *common.Account, sourceIndex uint16, externalDestinationOwner *common.Account, externalDestination *common.Account, isCreateOnSend bool, mint *common.Account, quarks uint64, ) (solana.Transaction, error)
func MakeInternalTransferWithAuthorityTransaction ¶
func MakeInternalTransferWithAuthorityTransaction( nonce *Nonce, vmConfig *common.VmConfig, virtualSignature solana.Signature, nonceMemory *common.Account, nonceIndex uint16, sourceMemory *common.Account, sourceIndex uint16, destinationMemory *common.Account, destinationIndex uint16, quarks uint64, ) (solana.Transaction, error)
func MakeInternalWithdrawTransaction ¶
func MakeInternalWithdrawTransaction( nonce *Nonce, vmConfig *common.VmConfig, virtualSignature solana.Signature, nonceMemory *common.Account, nonceIndex uint16, sourceMemory *common.Account, sourceIndex uint16, destinationMemory *common.Account, destinationIndex uint16, ) (solana.Transaction, error)
func MakeNoncedTransaction ¶
func MakeNoncedTransaction(nonce *Nonce, instructions ...solana.Instruction) (solana.Transaction, error)
MakeNoncedTransaction makes a transaction that's backed by a nonce. The returned transaction is not signed.
func ToProtoAlt ¶
func ToProtoAlt(alt solana.AddressLookupTable) *commonpb.SolanaAddressLookupTable
Types ¶
type LocalNoncePool ¶
type LocalNoncePool struct {
// contains filtered or unexported fields
}
LocalNoncePool is a pool of nonces that are cached in memory for quick access. The LocalNoncePool will continually monitor the pool to ensure sufficient size, as well refresh nonce expiration times.
If the pool empties before it can be refilled, ErrNoAvailableNonces will be returned. Therefore, the pool should be sufficiently large such that the consumption of poolSize/2 nonces is _slower_ than the operation to top up the pool.
func NewLocalNoncePool ¶
func NewLocalNoncePool( data code_data.Provider, metricsProvider *newrelic.Application, env nonce.Environment, envInstance string, poolType nonce.Purpose, opts ...NoncePoolOption, ) (*LocalNoncePool, error)
func SelectNoncePool ¶
func SelectNoncePool(env nonce.Environment, envInstance string, poolType nonce.Purpose, pools ...*LocalNoncePool) (*LocalNoncePool, error)
SelectNoncePool selects a nonce pool from the provided set that matches the desired environment and pool type.
ErrNoncePoolNotFound is returned if no nonce pool matches the desired config.
func (*LocalNoncePool) Close ¶
func (np *LocalNoncePool) Close() error
func (*LocalNoncePool) GetNonce ¶
func (np *LocalNoncePool) GetNonce(ctx context.Context) (*Nonce, error)
func (*LocalNoncePool) Validate ¶
func (np *LocalNoncePool) Validate( env nonce.Environment, envInstance string, poolType nonce.Purpose, ) error
type MergedMemoryBankResult ¶
type MergedMemoryBankResult struct {
A *ed25519.PublicKey
B *ed25519.PublicKey
C *ed25519.PublicKey
D *ed25519.PublicKey
Indices []uint8
}
func MergeMemoryBanks ¶
func MergeMemoryBanks(accounts ...*common.Account) (*MergedMemoryBankResult, error)
type Nonce ¶
type Nonce struct {
Account *common.Account
Blockhash solana.Blockhash
// contains filtered or unexported fields
}
Nonce represents a handle to a nonce that is owned by a local nonce pool.
func (*Nonce) MarkReservedWithSignature ¶
MarkReservedWithSignature marks the nonce as reserved with a signature
func (*Nonce) ReleaseIfNotReserved ¶
ReleaseIfNotReserved releases the nonce back to the pool if the nonce has not yet been reserved (or more specifically, is still owned by the pool).
type NoncePoolOption ¶
type NoncePoolOption func(*noncePoolOpts)
NoncePoolOption configures a nonce pool.
func WithNoncePoolMaxExpiration ¶
func WithNoncePoolMaxExpiration(d time.Duration) NoncePoolOption
WithNoncePoolMaxExpiration configures the upper bound for the expiration window of claimed nonces.
func WithNoncePoolMinExpiration ¶
func WithNoncePoolMinExpiration(d time.Duration) NoncePoolOption
WithNoncePoolMinExpiration configures the lower bound for the expiration window of claimed nonces.
func WithNoncePoolNodeID ¶
func WithNoncePoolNodeID(id string) NoncePoolOption
WithNoncePoolNodeID configures the node id to use when claiming nonces.
func WithNoncePoolRefreshInterval ¶
func WithNoncePoolRefreshInterval(interval time.Duration) NoncePoolOption
WithNoncePoolRefreshInterval specifies how often the pool should be scanning it's free list for refresh candidates. Candidates are claimed nonces whose expiration is <= 2/3 of the min expiration.
func WithNoncePoolRefreshPoolInterval ¶
func WithNoncePoolRefreshPoolInterval(interval time.Duration) NoncePoolOption
WithNoncePoolRefreshPoolInterval configures the pool to refresh the set of nonces at this duration. If the pool size is 1/2 the desired size, nonces will be fetched from DB. This condition is also checked (asynchronously) every time a nonce is pulled from the pool.
func WithNoncePoolShutdownGracePeriod ¶
func WithNoncePoolShutdownGracePeriod(duration time.Duration) NoncePoolOption
WithNoncePoolShutdownGracePeriod configures the amount of time given for cleanup on call to Close().
func WithNoncePoolSize ¶
func WithNoncePoolSize(size int) NoncePoolOption
WithNoncePoolSize configures the desired size of the pool.
The pool will use this size to determine how much to load when the pool starts up, or when the pool gets low. It can be viewed as 'target memory' in a GC, with the actual pool size behaving like a saw-tooth graph.
The pool does not have any mechanism to shrink the pool to this size beyond the natural consumption of nonces.