Documentation ¶
Index ¶
- func BlobShareRange(txs [][]byte, txIndex, blobIndex int, appVersion uint64) (shares.Range, error)
- func Deconstruct(s Square, decoder types.TxDecoder) (core.Txs, error)
- func Size(len int) int
- func TxShareRange(txs [][]byte, txIndex int, appVersion uint64) (shares.Range, error)
- type Builder
- func (b *Builder) AppendBlobTx(blobTx coretypes.BlobTx) bool
- func (b *Builder) AppendTx(tx []byte) bool
- func (b *Builder) BlobShareLength(pfbIndex, blobIndex int) (int, error)
- func (b *Builder) Export() (Square, error)
- func (b *Builder) FindBlobStartingIndex(pfbIndex, blobIndex int) (int, error)
- func (b *Builder) FindTxShareRange(txIndex int) (shares.Range, error)
- func (b *Builder) GetWrappedPFB(txIndex int) (*coretypes.IndexWrapper, error)
- func (b *Builder) NumPFBs() int
- func (b *Builder) NumTxs() int
- type Square
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlobShareRange ¶
BlobShareRange returns the range of share indexes that the blob, identified by txIndex and blobIndex, occupies. The range is end exclusive.
func Deconstruct ¶
Deconstruct takes a square and returns the ordered list of block transactions that constructed that square
This method uses the wrapped pfbs in the PFB namespace to identify and decode the blobs. Data that may be included in the square but isn't recognised by the square construction algorithm will be ignored
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func (*Builder) AppendBlobTx ¶
AppendBlobTx attempts to allocate the blob transaction to the square. It returns false if there is not enough space in the square to fit the transaction.
func (*Builder) AppendTx ¶
AppendTx attempts to allocate the transaction to the square. It returns false if there is not enough space in the square to fit the transaction.
func (*Builder) BlobShareLength ¶
BlobShareLength returns the amount of shares a blob takes up in the square. It takes the index of the pfb in the tx set and the index of the blob within the PFB. TODO: we could look in to creating a map to avoid O(n) lookup when we expect large numbers of blobs
func (*Builder) FindBlobStartingIndex ¶
FindBlobStartingIndex returns the starting share index of the blob in the square. It takes the index of the pfb in the tx set and the index of the blob within the PFB.
func (*Builder) FindTxShareRange ¶
FindTxShareRange returns the range of shares occupied by the tx at txIndex. The indexes are both inclusive.
func (*Builder) GetWrappedPFB ¶
func (b *Builder) GetWrappedPFB(txIndex int) (*coretypes.IndexWrapper, error)
type Square ¶
Square is a 2D square of shares with symmetrical sides that are always a power of 2.
func Build ¶
Build takes an arbitrary long list of (prioritized) transactions and builds a square that is never greater than maxSquareSize. It also returns the ordered list of transactions that are present in the square and which have all PFBs trailing regular transactions. Note, this function does not check the underlying validity of the transactions. Errors should not occur and would reflect a violation in an invariant.
func Construct ¶
Construct takes the exact list of ordered transactions and constructs a square, validating that
- all blobTxs are ordered after non-blob transactions
- the transactions don't collectively exceed the maxSquareSize.
Note that this function does not check the underlying validity of the transactions.
func EmptySquare ¶
func EmptySquare() Square
EmptySquare returns a 1x1 square with a single tail padding share