Documentation ¶
Index ¶
- Constants
- type Builder
- type Config
- type Opt
- func WithExpiryBuffer(buf uint) Opt
- func WithMaxCollectionByteSize(limit uint64) Opt
- func WithMaxCollectionSize(size uint) Opt
- func WithMaxCollectionTotalGas(limit uint64) Opt
- func WithMaxPayerTransactionRate(rate float64) Opt
- func WithRateLimitDryRun(dryRun bool) Opt
- func WithUnlimitedPayers(payers ...flow.Address) Opt
Constants ¶
View Source
const ( DefaultExpiryBuffer uint = 15 // 15 blocks for collections to be included DefaultMaxPayerTransactionRate float64 = 0 // no rate limiting )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is the builder for collection block payloads. Upon providing a payload hash, it also memorizes the payload contents.
NOTE: Builder is NOT safe for use with multiple goroutines. Since the HotStuff event loop is the only consumer of this interface and is single threaded, this is OK.
func NewBuilder ¶
func NewBuilder( db *badger.DB, tracer module.Tracer, protoState protocol.State, clusterState clusterstate.State, mainHeaders storage.Headers, clusterHeaders storage.Headers, payloads storage.ClusterPayloads, transactions mempool.Transactions, log zerolog.Logger, epochCounter uint64, opts ...Opt, ) (*Builder, error)
func (*Builder) BuildOn ¶
func (b *Builder) BuildOn(parentID flow.Identifier, setter func(*flow.Header) error, sign func(*flow.Header) error) (*flow.Header, error)
BuildOn creates a new block built on the given parent. It produces a payload that is valid with respect to the un-finalized chain it extends.
type Config ¶ added in v0.11.0
type Config struct { // MaxCollectionSize is the maximum size of collections. MaxCollectionSize uint // ExpiryBuffer is how much buffer we add when considering transaction // expiry. If the buffer is set to 10, and a transaction actually expires // in 15 blocks, we consider it expired in 5 (15-10) blocks. This accounts // for the time between the collection being built and being included in // block. ExpiryBuffer uint // DryRunRateLimit will, when enabled, log when a transaction would have // been omitted from a collection due to rate limiting settings. Rate // limiting settings are not actually enforced while dry-run is true. DryRunRateLimit bool // MaxPayerTransactionRate is the maximum number of transactions per payer // per collection. Fractional values greater than 1 are rounded down. // Fractional values 0<k<1 mean that only 1 transaction every ceil(1/k) // collections is allowed. // // A negative value or 0 indicates no rate limiting. MaxPayerTransactionRate float64 // UnlimitedPayer is a set of addresses which are not affected by per-payer // rate limiting. UnlimitedPayers map[flow.Address]struct{} // MaxCollectionByteSize is the maximum byte size of a collection. MaxCollectionByteSize uint64 // MaxCollectionTotalGas is the maximum of total of gas per collection (sum of maxGasLimit over transactions) MaxCollectionTotalGas uint64 }
Config is the configurable options for the collection builder.
func DefaultConfig ¶ added in v0.11.0
func DefaultConfig() Config
type Opt ¶
type Opt func(config *Config)
func WithExpiryBuffer ¶
func WithMaxCollectionByteSize ¶ added in v0.11.0
func WithMaxCollectionSize ¶
func WithMaxCollectionTotalGas ¶ added in v0.11.0
func WithMaxPayerTransactionRate ¶ added in v0.11.0
func WithRateLimitDryRun ¶ added in v0.26.16
func WithUnlimitedPayers ¶ added in v0.11.0
Click to show internal directories.
Click to hide internal directories.