Tree Proxy Pattern

Zaros Protocol's novel Architecture - Tree Proxy Pattern

Tree Proxy Pattern is our novel modular, and opinionated proxy pattern solution designed to address key industry problems faced by large smart contract systems, by introducing the following solutions:

  • Simplified terminology (Compared to e.g EIP-2535)

  • EIP-7201 compatible

  • Clear testing paths (leveraging BTT)

  • Composability over inheritance

  • Upgradeability

    NOTE: The pattern is still in a preliminary version.

The problems above not only make the codebase harder to navigate but also increase the risk of bugs.

How does the Tree Proxy work?

The Tree Proxy Pattern draws inspiration from EIP-1822, EIP-2535, and EIP-7504, incorporating the strengths of these proposals while striving to overcome their limitations. It is designed to be compatible with EIP-7201, enabling the use of well-audited libraries like OpenZeppelin. This compatibility allows for leveraging unlimited implementation contracts without the baggage of complex terminology.

Key Benefits:

  • Simplified Terminology: By using the tree analogy, we introduce a more intuitive understanding of our system's architecture.

  • Modularity: Our pattern is designed to be modular, allowing for easier scalability and maintenance.

  • Compatibility: Supports native integration with established standards and libraries such as OpenZeppelin, enhancing security and reliability.

TPP Structure Overview

Tree Proxy Pattern vocabularyCommon name

Root

Proxy

Branch

Implementation(Module)

Leaf

Functions and Storage

LookupBranch

List of delegated functions

LookupTable

Namespace's Lookup

RootUpgrade

Upgrade

Structural Components

  • Leaf - Denotes functions, the smallest unit within the architecture, thoroughly unit tested to ensure reliability.

  • Branch - Represents modules, a collection of functionalities grouped by logic or purpose.

  • Root (Proxy) - Acts as the entry point to the architecture, channeling requests to appropriate modules.

Lookup Mechanism

LookupNamespace - Central to our architecture is the LookupTable, facilitates the efficient management and invocation of functionalities.

LookupBranch - Introduced for further granularity, the LookupBranch enables a more refined control over the integration and execution of operations within the system.

Functional Flow

  1. Branches - These are collections of leaves (functions) that have been tested in isolation and are ready for integration testing.

  2. Leaves - Prior to integration, each function undergoes rigorous unit testing to verify its performance and reliability.

  3. Namespace Functionalities and Storage - Functions are categorized and managed through namespaces, facilitating their identification and execution while maintaining a preliminary version for future updates.

Conclusion

The Tree Proxy Pattern presents a novel architecture in the realm of large smart contract systems. It builds upon the strengths of the Diamond Pattern while offering solutions to its problems. This design is particularly appealing for its programmer-friendly approach, modularity, compatibility features, and opinionated proxy pattern. Making it a significant advancement in blockchain technology.

Last updated