trezoa-frozen-abi-macro

Crates.iotrezoa-frozen-abi-macro
lib.rstrezoa-frozen-abi-macro
version3.2.3
created_at2025-10-23 15:33:07.485698+00
updated_at2025-11-14 21:10:18.266886+00
descriptionTrezoa Frozen ABI Macro
homepagehttps://trezoa.xyz/
repositoryhttps://github.com/Trezoa-team/trezoa-frozen-abi-macro
max_upload_size
id1897261
size38,307
(TRZLedgerFoundation)

documentation

https://docs.rs/trezoa-frozen-abi-macro

README

Trezoa Frozen ABI Macro

Crates.io Documentation License

A procedural macro crate for generating frozen ABI (Application Binary Interface) implementations in the Trezoa blockchain ecosystem.

Overview

This crate provides procedural macros for generating stable ABI representations of Rust types, ensuring compatibility across different versions of Trezoa blockchain software. It's a core component of Trezoa's serialization and deserialization infrastructure.

Features

  • Frozen ABI Generation: Automatically generate stable ABI representations
  • Derive Macros: Easy-to-use derive macros for structs and enums
  • Version Compatibility: Ensures ABI stability across software versions
  • Rust Edition Support: Compatible with Rust 2021 edition

Usage

Add this to your Cargo.toml:

[dependencies]
trezoa-frozen-abi-macro = "3.2.3"

Basic Usage

use trezoa_frozen_abi_macro::{frozen_abi, AbiExample, AbiEnumVisitor};

#[derive(AbiExample, AbiEnumVisitor)]
#[frozen_abi(digest = "your_digest_hash_here")]
pub struct MyStruct {
    pub field1: u64,
    pub field2: String,
}

#[derive(AbiExample, AbiEnumVisitor)]
#[frozen_abi(digest = "your_digest_hash_here")]
pub enum MyEnum {
    Variant1,
    Variant2(u32),
    Variant3 { value: i64 },
}

Available Macros

  • #[frozen_abi(digest = "...")] - Generates frozen ABI implementation with digest verification
  • #[derive(AbiExample)] - Generates example instances for testing
  • #[derive(AbiEnumVisitor)] - Generates ABI visitor for enums

Migration from Solana

This crate is a migration from solana-frozen-abi-macro v1.18.26 to the Trezoa ecosystem:

  • API Compatible: Drop-in replacement for existing Solana code
  • Updated References: All internal references updated to Trezoa ecosystem
  • New Versioning: Follows Trezoa's versioning scheme (3.2.3)

Migration Guide

Replace in your Cargo.toml:

# Old
solana-frozen-abi-macro = "1.18.26"

# New
trezoa-frozen-abi-macro = "3.2.3"

Update imports in your code:

// Old
use solana_frozen_abi_macro::{frozen_abi, AbiExample};

// New
use trezoa_frozen_abi_macro::{frozen_abi, AbiExample};

Environment Variables

  • TREZOA_ABI_BULK_UPDATE - Skip ABI digest verification during bulk updates
  • TREZOA_ABI_DUMP_DIR - Directory for dumping ABI differences during testing

Development

Prerequisites

  • Rust 1.70.0 or later
  • Cargo

Building

git clone https://github.com/Trezoa-team/trezoa-frozen-abi-macro.git
cd trezoa-frozen-abi-macro
cargo build

Testing

cargo test

Checking

cargo check

Contributing

We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Guidelines

  1. Ensure all tests pass
  2. Follow Rust formatting conventions (cargo fmt)
  3. Update documentation for any API changes
  4. Add tests for new functionality

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Attribution

This crate is based on the original solana-frozen-abi-macro developed by Solana Labs. We gratefully acknowledge their work and maintain this as a compatible fork for the Trezoa ecosystem.

Links

Support

  • Email: foundation@trezoa.xyz
  • Issues: Use GitHub Issues for bug reports and feature requests
  • Community: Join our community discussions

Maintained by: Trezoa-team
License: Apache 2.0
Version: 3.2.3

Commit count: 0

cargo fmt