Documentation ¶
Index ¶
- Constants
- func CobraInitTxnProcessor(cmd *cobra.Command, txconf *TxnProcessorConf)
- type AddressBook
- type AddressBookConf
- type AddressBookPropNamesConf
- type HDWallet
- type HDWalletConf
- type HDWalletConfPropNames
- type HDWalletRequest
- type TxnContext
- type TxnDelayTracker
- type TxnProcessor
- type TxnProcessorConf
Constants ¶
const ( // Window - Dataset size for moving average Window = 100 // MinDelay - minimum delay before first try MinDelay = 100 * time.Millisecond // MaxDelay - maximum delay between tries MaxDelay = 10 * time.Second // Factor - exponential backoff factor Factor = 1.3 // InitialDelayFraction - start with a large faction of the current average InitialDelayFraction = 0.8 // FirstRetryFraction - then retry with exponential backoff using a fraction of that initial delay FirstRetryDelayFraction = 0.15 // TracerFrequency - run an aggressive txn every X txns, and reset average TracerFrequency = 25 // TracerDivisor - when a tracer runs, it runs at this division of the average TracerDivisor = 5 // ResetThreshold - if a tracer comes in below this threshold of the average, we reset ResetThreshold = 0.3 )
Intention is that these values are a good baseline for the low-level exponential backoff retry of getting transaction receipts up to a maximum time. The maximum time is configured outside of this code, as when a transction receipt never comes back we cannot infer anything about the timing of successful transactions
Variables ¶
This section is empty.
Functions ¶
func CobraInitTxnProcessor ¶
func CobraInitTxnProcessor(cmd *cobra.Command, txconf *TxnProcessorConf)
CobraInitTxnProcessor sets the standard command-line parameters for the txnprocessor
Types ¶
type AddressBook ¶
type AddressBook interface {
// contains filtered or unexported methods
}
AddressBook looks up RPC URLs based on a remote registry, and optionally resolves hostnames to IP addresses using a hosts file
func NewAddressBook ¶
func NewAddressBook(conf *AddressBookConf, rpcConf *maidenlanedeth.RPCConf) AddressBook
NewAddressBook construtor
type AddressBookConf ¶
type AddressBookConf struct { maidenlanedutils.HTTPRequesterConf AddressbookURLPrefix string `json:"urlPrefix"` HostsFile string `json:"hostsFile"` PropNames AddressBookPropNamesConf `json:"propNames"` }
AddressBookConf configuration
type AddressBookPropNamesConf ¶
type AddressBookPropNamesConf struct {
RPCEndpoint string `json:"endpoint"`
}
AddressBookPropNamesConf configures the JSON property names to extract from the GET response on the API
type HDWallet ¶
type HDWallet interface {
SignerFor(request *HDWalletRequest) (maidenlanedeth.TXSigner, error)
}
HDWallet interface
type HDWalletConf ¶
type HDWalletConf struct { maidenlanedutils.HTTPRequesterConf // URLTemplate is a go template such as: "https://someconstant-{{.InstanceID}}/api/v1/{{.WalletID}}/{{.Index}}" URLTemplate string `json:"urlTemplate"` ChainID string `json:"chainID"` PropNames HDWalletConfPropNames `json:"propNames"` }
HDWalletConf configuration
type HDWalletConfPropNames ¶
type HDWalletConfPropNames struct { Address string `json:"address"` PrivateKey string `json:"privateKey"` }
HDWalletConfPropNames prop names for processing JSON responses
type HDWalletRequest ¶
HDWalletRequest is the struct that is extracted from a specially formatted 'from' string, by IsHDWalletRequest
func IsHDWalletRequest ¶
func IsHDWalletRequest(fromAddr string) *HDWalletRequest
IsHDWalletRequest validates a from address to see if it is a HD wallet signing request
type TxnContext ¶
type TxnContext interface { // Return the Go context Context() context.Context // Get the headers of the message Headers() *maidenlanedmessages.CommonHeaders // Unmarshal the supplied message into a give type Unmarshal(msg interface{}) error // Send an error reply SendErrorReply(status int, err error) // Send an error reply SendErrorReplyWithTX(status int, err error, txHash string) // Send an error reply SendErrorReplyWithGapFill(status int, err error, gapFillTxHash string, gapFillSucceeded bool) // Send a reply that can be marshaled into bytes. // Sets all the common headers on behalf of the caller, based on the request context Reply(replyMsg maidenlanedmessages.ReplyWithHeaders) // Get a string summary String() string }
TxnContext is passed for each message that arrives at the bridge
type TxnDelayTracker ¶
type TxnDelayTracker interface { GetInitialDelay() (delay time.Duration) GetRetryDelay(initialDelay time.Duration, retry int) (delay time.Duration) ReportSuccess(timeTaken time.Duration) }
TxnDelayTracker - helps manage delays when checking for txn receipts
func NewTxnDelayTracker ¶
func NewTxnDelayTracker() TxnDelayTracker
NewTxnDelayTracker - constructs a new tracker
type TxnProcessor ¶
type TxnProcessor interface { OnMessage(TxnContext) Init(maidenlanedeth.RPCClient) ResolveAddress(from string) (resolvedFrom string, err error) }
TxnProcessor interface is called for each message, as is responsible for tracking all in-flight messages
func NewTxnProcessor ¶
func NewTxnProcessor(conf *TxnProcessorConf, rpcConf *maidenlanedeth.RPCConf) TxnProcessor
NewTxnProcessor constructor for message procss
type TxnProcessorConf ¶
type TxnProcessorConf struct { AlwaysManageNonce bool `json:"alwaysManageNonce"` AttemptGapFill bool `json:"attemptGapFill"` MaxTXWaitTime int `json:"maxTXWaitTime"` SendConcurrency int `json:"sendConcurrency"` OrionPrivateAPIS bool `json:"orionPrivateAPIs"` HexValuesInReceipt bool `json:"hexValuesInReceipt"` AddressBookConf AddressBookConf `json:"addressBook"` HDWalletConf HDWalletConf `json:"hdWallet"` }
TxnProcessorConf configuration for the message processor