Documentation ¶
Index ¶
- Constants
- func AddressIndex(i uint) []byte
- func Bytes32Index(i uint) []byte
- func DecompressTransaction(ctx context.Context, provider *ethrpc.Provider, contract common.Address, ...) (common.Address, []byte, error)
- func FindPastData(pastData *CBuffer, data []byte) int
- func GenBatch(from uint, to uint, max uint, itemplate func(uint) []byte) []byte
- func GetTotals(ctx context.Context, provider *ethrpc.Provider, contract common.Address, ...) (uint, uint, error)
- func LoadAddresses(ctx context.Context, provider *ethrpc.Provider, contract common.Address, ...) (uint, map[string]uint, error)
- func LoadBytes32(ctx context.Context, provider *ethrpc.Provider, contract common.Address, ...) (uint, map[string]uint, error)
- func LoadBytes4() map[string]uint
- func LoadIndexes(ci *Compressor) error
- func LoadState(ctx context.Context, provider *ethrpc.Provider, contract common.Address, ...) (uint, map[string]uint, uint, map[string]uint, error)
- func LoadStorage(ctx context.Context, provider *ethrpc.Provider, contract common.Address, ...) (uint, map[string]uint, error)
- func NormalizeSignature(signature []byte) ([]byte, error)
- func NormalizeTransactionSignature(transaction *sequence.Transaction) error
- func ParseBatchResult(to map[string]uint, res []byte, offset uint) error
- type CBuffer
- func (cb *CBuffer) Data() []byte
- func (cb *CBuffer) End(uncompressed []byte, t EncodeType)
- func (cb *CBuffer) Len() int
- func (cb *CBuffer) Restore(snap *Snapshot)
- func (cb *CBuffer) Snapshot() *Snapshot
- func (cb *CBuffer) WriteByte(b byte)
- func (cb *CBuffer) WriteBytes(b []byte)
- func (cb *CBuffer) WriteInt(i uint)
- type Compressor
- func (cm *Compressor) IsSaneCompression(input []byte, entrypoint common.Address, transaction *sequence.Transaction, ...) error
- func (cm *Compressor) SetOnLoadedIndexes(f func(uint, uint))
- func (cm *Compressor) StartIndexUpdater()
- func (cm *Compressor) TryCompress(input []byte, entrypoint common.Address, transaction *sequence.Transaction) (common.Address, []byte, EncodeType, error)
- type CostModel
- type Decoder
- func (d *Decoder) Buffer() []byte
- func (d *Decoder) FlagNode() error
- func (d *Decoder) FlagSubdigest() error
- func (d *Decoder) LogFlag(flag string)
- func (d *Decoder) ReadAbi4Bytes() error
- func (d *Decoder) ReadAbiDynamic() error
- func (d *Decoder) ReadAbiStatic(flag uint) error
- func (d *Decoder) ReadAddress(flag uint) error
- func (d *Decoder) ReadAddressStorage(flag uint) error
- func (d *Decoder) ReadAndLoad32Bytes() ([]byte, error)
- func (d *Decoder) ReadBranch() error
- func (d *Decoder) ReadBytes32(flag uint) error
- func (d *Decoder) ReadBytes32Storage(flag uint) error
- func (d *Decoder) ReadCopyCalldata() error
- func (d *Decoder) ReadDynamicSignature() error
- func (d *Decoder) ReadExecute() error
- func (d *Decoder) ReadFlag() error
- func (d *Decoder) ReadLiteral(flag uint) error
- func (d *Decoder) ReadMirrorFlag() error
- func (d *Decoder) ReadNBytes(flag uint) error
- func (d *Decoder) ReadNFlags(n uint) error
- func (d *Decoder) ReadNested() error
- func (d *Decoder) ReadNestedFlags(flag uint) error
- func (d *Decoder) ReadNonce() error
- func (d *Decoder) ReadPow10Misc() error
- func (d *Decoder) ReadPow2() error
- func (d *Decoder) ReadSaveAddress() error
- func (d *Decoder) ReadSaveBytes32() error
- func (d *Decoder) ReadSequenceSignatureV2(flag uint) error
- func (d *Decoder) ReadSignature(flag uint) error
- func (d *Decoder) ReadTransaction() error
- func (d *Decoder) ReadTransactions() error
- type EncodeType
- type Encoder
- func (c *Encoder) Encode4Bytes(bytes []byte) []byte
- func (c *Encoder) EncodeWordBytes32(word []byte) ([]byte, EncodeType, error)
- func (c *Encoder) EncodeWordOptimized(pastData *CBuffer, word []byte, saveWord bool) ([]byte, EncodeType, error)
- func (c *Encoder) WriteBranchSignaturePart(dest *CBuffer, branch []byte) (EncodeType, error)
- func (c *Encoder) WriteBytesOptimized(dest *CBuffer, bytes []byte, saveWord bool) (EncodeType, error)
- func (c *Encoder) WriteChainedSignature(dest *CBuffer, signature []byte) (EncodeType, error)
- func (c *Encoder) WriteDynamicSignaturePart(dest *CBuffer, address []byte, weight uint, signature []byte) (EncodeType, error)
- func (c *Encoder) WriteExecute(dest *CBuffer, wallet []byte, transaction *sequence.Transaction) (EncodeType, error)
- func (c *Encoder) WriteNBytesRaw(dest *CBuffer, bytes []byte) (EncodeType, error)
- func (c *Encoder) WriteNestedSignaturePart(dest *CBuffer, weight uint, threshold uint, branch []byte) (EncodeType, error)
- func (c *Encoder) WriteNonce(dest *CBuffer, nonce *big.Int, randomNonce bool) (EncodeType, error)
- func (c *Encoder) WriteSignature(dest *CBuffer, signature []byte, mayUseBytes bool) (EncodeType, error)
- func (c *Encoder) WriteSignatureBody(dest *CBuffer, noChain bool, body []byte) (EncodeType, error)
- func (c *Encoder) WriteSignatureTree(dest *CBuffer, tree []byte) (EncodeType, error)
- func (c *Encoder) WriteTransaction(dest *CBuffer, transaction *sequence.Transaction) (EncodeType, error)
- func (c *Encoder) WriteTransactions(dest *CBuffer, transactions sequence.Transactions) (EncodeType, error)
- func (c *Encoder) WriteWord(word []byte, dest *CBuffer, useStorage bool) (EncodeType, error)
- type References
- type Snapshot
Constants ¶
View Source
const ( METHOD_EXECUTE_1 uint = iota METHOD_EXECUTE_N METHOD_READ_ADDRESS METHOD_READ_BYTES32 METHOD_READ_SIZES METHOD_READ_STORAGE_SLOTS METHOD_DECOMPRESS_1 METHOD_DECOMPRESS_N )
View Source
const ( FLAG_READ_POWER_OF_10_MISC uint = iota FLAG_READ_BYTES32_1_BYTES FLAG_READ_BYTES32_2_BYTES FLAG_READ_BYTES32_3_BYTES FLAG_READ_BYTES32_4_BYTES FLAG_READ_BYTES32_5_BYTES FLAG_READ_BYTES32_6_BYTES FLAG_READ_BYTES32_7_BYTES FLAG_READ_BYTES32_8_BYTES FLAG_READ_BYTES32_9_BYTES FLAG_READ_BYTES32_10_BYTES FLAG_READ_BYTES32_11_BYTES FLAG_READ_BYTES32_12_BYTES FLAG_READ_BYTES32_13_BYTES FLAG_READ_BYTES32_14_BYTES FLAG_READ_BYTES32_15_BYTES FLAG_READ_BYTES32_16_BYTES FLAG_READ_BYTES32_17_BYTES FLAG_READ_BYTES32_18_BYTES FLAG_READ_BYTES32_19_BYTES FLAG_READ_BYTES32_20_BYTES FLAG_READ_BYTES32_21_BYTES FLAG_READ_BYTES32_22_BYTES FLAG_READ_BYTES32_23_BYTES FLAG_READ_BYTES32_24_BYTES FLAG_READ_BYTES32_25_BYTES FLAG_READ_BYTES32_26_BYTES FLAG_READ_BYTES32_27_BYTES FLAG_READ_BYTES32_28_BYTES FLAG_READ_BYTES32_29_BYTES FLAG_READ_BYTES32_30_BYTES FLAG_READ_BYTES32_31_BYTES FLAG_READ_BYTES32_32_BYTES FLAG_SAVE_ADDRESS FLAG_SAVE_BYTES32 FLAG_READ_ADDRESS_2 FLAG_READ_ADDRESS_3 FLAG_READ_ADDRESS_4 FLAG_READ_EXECUTE FLAG_READ_BYTES32_2 FLAG_READ_BYTES32_3 FLAG_READ_BYTES32_4 FLAG_READ_POW_10_MANTISSA FLAG_READ_N_BYTES FLAG_READ_POWER_OF_2 FLAG_ABI_0_PARAM FLAG_ABI_1_PARAM FLAG_ABI_2_PARAMS FLAG_ABI_3_PARAMS FLAG_ABI_4_PARAMS FLAG_ABI_5_PARAMS FLAG_ABI_6_PARAMS FLAG_NESTED_N_FLAGS_8 FLAG_NESTED_N_FLAGS_16 FLAG_SIGNATURE_W0 FLAG_SIGNATURE_W1 FLAG_SIGNATURE_W2 FLAG_SIGNATURE_W3 FLAG_SIGNATURE_W4 FLAG_ADDRESS_W0 FLAG_ADDRESS_W1 FLAG_ADDRESS_W2 FLAG_ADDRESS_W3 FLAG_ADDRESS_W4 FLAG_NODE FLAG_BRANCH FLAG_SUBDIGEST FLAG_NESTED FLAG_DYNAMIC_SIGNATURE FLAG_S_SIG_NO_CHAIN FLAG_S_SIG FLAG_S_L_SIG_NO_CHAIN FLAG_S_L_SIG FLAG_READ_CHAINED FLAG_READ_CHAINED_L FLAG_READ_DYNAMIC_ABI FLAG_NO_OP FLAG_MIRROR_FLAG FLAG_COPY_CALLDATA FLAG_READ_STORE_FLAG )
View Source
const BYTES4_TABLE = "" /* 2048-byte string literal not displayed */
View Source
const LITERAL_ZERO = FLAG_READ_STORE_FLAG + 1
View Source
const MAX_LITERAL = 0xff - LITERAL_ZERO
Variables ¶
This section is empty.
Functions ¶
func AddressIndex ¶
func Bytes32Index ¶
func DecompressTransaction ¶
func FindPastData ¶
func LoadAddresses ¶
func LoadBytes32 ¶
func LoadBytes4 ¶
func LoadIndexes ¶
func LoadIndexes(ci *Compressor) error
func LoadStorage ¶
func NormalizeSignature ¶
func NormalizeTransactionSignature ¶
func NormalizeTransactionSignature( transaction *sequence.Transaction, ) error
Types ¶
type CBuffer ¶
type CBuffer struct { SignatureLevel uint Commited []byte Pending []byte Refs *References }
func NewCBuffer ¶
func (*CBuffer) End ¶
func (cb *CBuffer) End(uncompressed []byte, t EncodeType)
func (*CBuffer) WriteBytes ¶
type Compressor ¶
type Compressor struct { Encoder *Encoder CostModel *CostModel Contract common.Address UseStorage bool UpdateInterval uint TrailBlocks uint BatchSize uint AddressesHeight uint Bytes32Height uint LastIndexUpdate uint Provider *ethrpc.Provider // contains filtered or unexported fields }
func NewCompressor ¶
func (*Compressor) IsSaneCompression ¶
func (*Compressor) SetOnLoadedIndexes ¶
func (cm *Compressor) SetOnLoadedIndexes(f func(uint, uint))
func (*Compressor) StartIndexUpdater ¶
func (cm *Compressor) StartIndexUpdater()
func (*Compressor) TryCompress ¶
func (cm *Compressor) TryCompress( input []byte, entrypoint common.Address, transaction *sequence.Transaction, ) (common.Address, []byte, EncodeType, error)
We return two errors, the first one is the inner compression error, we returns it for traceability but the real error is the second one, which should only appear on a non-recoverable situation
type CostModel ¶
type CostModel struct { ZeroByteCost int OneByteCost int FixedCost int OverHeadPersentage int // 0 - 1000 }
func GetCostModel ¶
func NewCostModel ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
func (*Decoder) FlagSubdigest ¶
func (*Decoder) ReadAbi4Bytes ¶
func (*Decoder) ReadAbiDynamic ¶
func (*Decoder) ReadAbiStatic ¶
func (*Decoder) ReadAddress ¶
func (*Decoder) ReadAddressStorage ¶
func (*Decoder) ReadAndLoad32Bytes ¶
func (*Decoder) ReadBranch ¶
func (*Decoder) ReadBytes32 ¶
func (*Decoder) ReadBytes32Storage ¶
func (*Decoder) ReadCopyCalldata ¶
func (*Decoder) ReadDynamicSignature ¶
func (*Decoder) ReadExecute ¶
func (*Decoder) ReadLiteral ¶
func (*Decoder) ReadMirrorFlag ¶
func (*Decoder) ReadNBytes ¶
func (*Decoder) ReadNFlags ¶
func (*Decoder) ReadNested ¶
func (*Decoder) ReadNestedFlags ¶
func (*Decoder) ReadPow10Misc ¶
func (*Decoder) ReadSaveAddress ¶
func (*Decoder) ReadSaveBytes32 ¶
func (*Decoder) ReadSequenceSignatureV2 ¶
func (*Decoder) ReadSignature ¶
func (*Decoder) ReadTransaction ¶
func (*Decoder) ReadTransactions ¶
type EncodeType ¶
type EncodeType int
const ( Stateless EncodeType = iota Mirror ReadStorage WriteStorage )
func HighestPriority ¶
func HighestPriority(a EncodeType, b EncodeType) EncodeType
type Encoder ¶
type Encoder struct { AddressIndexes map[string]uint Bytes32Indexes map[string]uint Bytes4Indexes map[string]uint }
func NewEncoder ¶
func NewEncoder() *Encoder
func (*Encoder) Encode4Bytes ¶
func (*Encoder) EncodeWordBytes32 ¶
func (c *Encoder) EncodeWordBytes32(word []byte) ([]byte, EncodeType, error)
Encodes a 32 word, without any optimizations
func (*Encoder) EncodeWordOptimized ¶
func (c *Encoder) EncodeWordOptimized(pastData *CBuffer, word []byte, saveWord bool) ([]byte, EncodeType, error)
Encodes a 32 bytes word, trying to optimize it as much as possible
func (*Encoder) WriteBranchSignaturePart ¶
func (c *Encoder) WriteBranchSignaturePart(dest *CBuffer, branch []byte) (EncodeType, error)
func (*Encoder) WriteBytesOptimized ¶
func (c *Encoder) WriteBytesOptimized(dest *CBuffer, bytes []byte, saveWord bool) (EncodeType, error)
Encode N bytes, as optimized as possible
func (*Encoder) WriteChainedSignature ¶
func (c *Encoder) WriteChainedSignature(dest *CBuffer, signature []byte) (EncodeType, error)
func (*Encoder) WriteDynamicSignaturePart ¶
func (*Encoder) WriteExecute ¶
func (c *Encoder) WriteExecute(dest *CBuffer, wallet []byte, transaction *sequence.Transaction) (EncodeType, error)
func (*Encoder) WriteNBytesRaw ¶
func (c *Encoder) WriteNBytesRaw(dest *CBuffer, bytes []byte) (EncodeType, error)
Encodes N bytes, without any optimizations
func (*Encoder) WriteNestedSignaturePart ¶
func (*Encoder) WriteNonce ¶
func (*Encoder) WriteSignature ¶
func (*Encoder) WriteSignatureBody ¶
func (*Encoder) WriteSignatureTree ¶
func (c *Encoder) WriteSignatureTree(dest *CBuffer, tree []byte) (EncodeType, error)
func (*Encoder) WriteTransaction ¶
func (c *Encoder) WriteTransaction(dest *CBuffer, transaction *sequence.Transaction) (EncodeType, error)
func (*Encoder) WriteTransactions ¶
func (c *Encoder) WriteTransactions(dest *CBuffer, transactions sequence.Transactions) (EncodeType, error)
type References ¶
type References struct {
// contains filtered or unexported fields
}
func (*References) Copy ¶
func (r *References) Copy() *References
type Snapshot ¶
type Snapshot struct { Commited []byte SignatureLevel uint Refs *References }
Click to show internal directories.
Click to hide internal directories.