Documentation
¶
Index ¶
- Variables
- func BytesToHashSlice(b []byte) []common.Hash
- func HashSliceToBytes(hashes []common.Hash) []byte
- func NewPredicateTx(chainID *big.Int, nonce uint64, to *common.Address, gas uint64, ...) *types.Transaction
- func PackPredicate(predicate []byte) []byte
- func UnpackPredicate(paddedPredicate []byte) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
var PredicateEndByte = byte(0xff)
PredicateEndByte is used as a delimiter for the bytes packed into a precompile predicate. Precompile predicates are encoded in the Access List of transactions in the access tuples which means that its length must be a multiple of 32 (common.HashLength). For messages with a length that does not comply to that, this delimiter is used to append/remove padding.
Functions ¶
func BytesToHashSlice ¶
BytesToHashSlice packs [b] into a slice of hash values with zero padding to the right if the length of b is not a multiple of 32.
func HashSliceToBytes ¶
HashSliceToBytes serializes a []common.Hash into a tightly packed byte array.
func NewPredicateTx ¶
func NewPredicateTx( chainID *big.Int, nonce uint64, to *common.Address, gas uint64, gasFeeCap *big.Int, gasTipCap *big.Int, value *big.Int, data []byte, accessList types.AccessList, predicateAddress common.Address, predicateBytes []byte, ) *types.Transaction
NewPredicateTx returns a transaction with the predicateAddress/predicateBytes tuple packed and added to the access list of the transaction.
func PackPredicate ¶
PackPredicate packs predicate by delimiting the actual message with PredicateEndByte and zero padding to reach a length that is a multiple of 32.
func UnpackPredicate ¶
UnpackPredicate unpacks a predicate by stripping right padded zeroes, checking for the delimter, ensuring there is not excess padding, and returning the original message. Returns an error if it finds an incorrect encoding.
Types ¶
This section is empty.