codec

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidWorkchain = errors.New("workchain value outside valid int8 range [-128, 127]")
View Source
var LeafDomainSeparator [32]byte

0x0000000000000000000000000000000000000000000000000000000000000000

Functions

func AddressBytesToTONAddress

func AddressBytesToTONAddress(bytes []byte) (*address.Address, error)

This method is not part of the interface as it's TON specific AddressBytesToAddress converts a byte slice representing a TON address into its ton address representation, only supporting standard TON addresses.

func AddressBytesToTONAddressWithBurning

func AddressBytesToTONAddressWithBurning(bytes []byte) *address.Address

AddressBytesToTONAddressWithBurning converts a byte slice representing a TON address into an *address.Address. This codec only supports standard TON addresses (MsgAddr std); variable-length (VarAddress) and external addresses are not supported.

It first attempts to parse the bytes as raw format: 4 byte workchain (int32) + 32 byte data. If that fails, it attempts user-friendly format (36 bytes): 1 byte flags + 1 byte workchain + 32 bytes data + 2 bytes CRC16. If parsing fails (invalid format, length, or CRC16), returns the zero address to indicate funds should be burned. This is only used in the hot path in plugin (executecodec.go and msghasher.go) where we want to avoid errors and just burn funds if the address is invalid.

Format disambiguation: the two 36-byte formats are safely distinguished because valid user-friendly flag bytes (0x11, 0x51, 0x91, 0xD1) always produce an out-of-range int32 when interpreted as the high byte of a big-endian workchain, causing raw-format parsing to fail workchain validation. Only then is the input re-tried as a user-friendly address with CRC16 verification.

func NewCommitPluginCodecV1

func NewCommitPluginCodecV1() cciptypes.CommitPluginCodec

func NewExecutePluginCodecV1

func NewExecutePluginCodecV1(extraDataCodec ccipocr3.ExtraDataCodecBundle) ccipocr3.ExecutePluginCodec

func NewExtraDataDecoder

func NewExtraDataDecoder() ccipocr3.SourceChainExtraDataCodec

NewExtraDataDecoder creates a new ExtraDataDecoder

func NewMessageHasherV1

func NewMessageHasherV1(lg logger.Logger, extraDataCodec ccipocr3.ExtraDataCodecBundle) ccipocr3.MessageHasher

Types

type RawAddr

type RawAddr [tvm.AddressLength]byte

RawAddr is a fixed-size byte array representing a TON standard address

func ToRawAddr

func ToRawAddr(addr *address.Address) (RawAddr, error)

ToRawAddr converts an address.Address to a RawAddr. Returns an error if the address is nil, not a standard address, or has invalid data length.

type TokenDataEncoder

type TokenDataEncoder struct{}

func NewTokenDataEncoder

func NewTokenDataEncoder() TokenDataEncoder

func (TokenDataEncoder) EncodeUSDC

func (t TokenDataEncoder) EncodeUSDC(_ context.Context, message ccipocr3.Bytes, attestation ccipocr3.Bytes) (ccipocr3.Bytes, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL