Skip to content

Conversation

@YukiTsuchida
Copy link
Contributor

@YukiTsuchida YukiTsuchida commented Nov 13, 2025

  • Extract TxAuthManager/TxManager into logic contracts, invoked via delegatecall, to resolve CrossSimpleModule size limit.

Contract Size

via_ir = false

| Contract                                        | Runtime Size (B) | Initcode Size (B) | Runtime Margin (B) | Initcode Margin (B) |
| CrossSimpleModule                               | 22,251           | 23,408            | 2,325              | 25,744              |
| TxAuthManager                                   | 4,161            | 4,193             | 20,415             | 44,959              |
| TxManager                                       | 4,038            | 4,070             | 20,538             | 45,082              |

via_ir = true

| Contract                                        | Runtime Size (B) | Initcode Size (B) | Runtime Margin (B) | Initcode Margin (B) |
| CrossSimpleModule                               | 18,359           | 19,352            | 6,217              | 29,800              |
| TxAuthManager                                   | 4,209            | 4,236             | 20,367             | 44,916              |
| TxManager                                       | 4,254            | 4,281             | 20,322             | 44,871              |

Architecture

graph TD
    subgraph " "
        direction LR
        CrossSimpleModule
    end

    subgraph "Core Module (Execution Context)"
        direction TB
        CrossModule[(CrossModule)]
        Initiator
        DelegatedLogicHandler
    end

    subgraph "Logic Implementations (Separate Contracts)"
        direction TB
        style TxAuthManager fill:#e6ffed,stroke:#006400,stroke-width:2px
        style TxManager fill:#e6ffed,stroke:#006400,stroke-width:2px
        
        TxAuthManager
        TxManager
    end

    subgraph "Bases & Implementations (Internal)"
        direction TB
        style TxAuthManagerBase fill:#f0f0f0,stroke:#333,stroke-width:2px
        style TxManagerBase fill:#f0f0f0,stroke:#333,stroke-width:2px
        style TxRunnerBase fill:#f0f0f0,stroke:#333,stroke-width:2px
        style TxRunner fill:#f5f5f5,stroke:#555,stroke-width:1px

        TxAuthManagerBase(("TxAuthManagerBase"))
        TxManagerBase(("TxManagerBase"))
        TxRunnerBase(("TxRunnerBase"))
        TxRunner["TxRunner"] -- "implements" --> TxRunnerBase
    end

    subgraph "Interfaces (External APIs)"
        direction TB
        style ITxAuthManager fill:#e6f7ff,stroke:#0056b3,stroke-width:2px
        style ITxManager fill:#e6f7ff,stroke:#0056b3,stroke-width:2px
        style IInitiator fill:#e6f7ff,stroke:#0056b3,stroke-width:2px

        ITxAuthManager{{"ITxAuthManager"}}
        ITxManager{{"ITxManager"}}
        IInitiator{{"IInitiator"}}
    end

    subgraph "Storage (ERC-7201)"
        direction TB
        style CrossStore fill:#fffbe6,stroke:#d4a017,stroke-width:2px
        CrossStore
    end

    %% --- Links ---
    CrossSimpleModule -- "inherits" --> CrossModule

    %% Core Module Inheritance
    CrossModule -- "inherits" --> Initiator
    CrossModule -- "inherits" --> DelegatedLogicHandler
    CrossModule -- "inherits" --> CrossStore

    %% Logic Handler (Bridge)
    DelegatedLogicHandler -- "implements" --> TxAuthManagerBase
    DelegatedLogicHandler -- "implements" --> TxManagerBase
    DelegatedLogicHandler -. "uses" .-> ITxAuthManager
    DelegatedLogicHandler -. "uses" .-> ITxManager
    DelegatedLogicHandler -. "delegatecall<br>staticcall" .-> TxAuthManager
    DelegatedLogicHandler -. "delegatecall<br>staticcall" .-> TxManager

    %% Core Logic Components
    Initiator -- "implements" --> IInitiator
    Initiator -- "inherits" --> TxAuthManagerBase
    Initiator -- "inherits" --> TxManagerBase

    %% Logic Contract Inheritance
    TxAuthManager -- "implements" --> ITxAuthManager
    TxAuthManager -- "inherits" --> TxAuthManagerBase
    TxAuthManager -- "inherits" --> CrossStore

    TxManager -- "implements" --> ITxManager
    TxManager -- "inherits" --> TxManagerBase
    TxManager -- "inherits" --> TxRunner
    TxManager -- "inherits" --> CrossStore
Loading

@github-actions
Copy link

github-actions bot commented Nov 13, 2025

LCOV of commit 8878dce during Coverage Report #109

Summary coverage rate:
  lines......: 31.5% (82 of 260 lines)
  functions..: 35.8% (24 of 67 functions)
  branches...: no data found

Files changed coverage rate:
                                     |Lines       |Functions  |Branches    
  Filename                           |Rate     Num|Rate    Num|Rate     Num
  =========================================================================
  src/core/CrossModule.sol           |39.3%     28| 0.0%    11|    -      0
  src/core/CrossSimpleModule.sol     |28.6%      7| 0.0%     2|    -      0
  src/core/DelegatedLogicHandler.sol | 300%      3| 0.0%     1|    -      0
  src/core/Initiator.sol             | 200%      2| 0.0%     1|    -      0
  src/core/SimpleContractRegistry.sol|33.3%      6| 0.0%     2|    -      0
  src/core/TxAtomicSimple.sol        |16.7%     24| 0.0%     4|    -      0
  src/core/TxAuthManager.sol         |    -      0|    -     0|    -      0
  src/core/TxAuthManagerBase.sol     |    -      0|    -     0|    -      0
  src/core/TxManager.sol             |    -      0|    -     0|    -      0
  src/core/TxManagerBase.sol         |    -      0|    -     0|    -      0
  src/core/TxRunner.sol              |    -      0|    -     0|    -      0
  src/core/TxRunnerBase.sol          |    -      0|    -     0|    -      0

⛔ The code coverage is too low: 31.54. Expected at least 100.
Full coverage report

@YukiTsuchida YukiTsuchida changed the title feat: split contracts refactor: Extract TxAuthManager and TxManager into separate contracts Nov 14, 2025
@YukiTsuchida YukiTsuchida marked this pull request as ready for review November 14, 2025 00:18
@YukiTsuchida YukiTsuchida self-assigned this Nov 14, 2025
@YukiTsuchida YukiTsuchida changed the title refactor: Extract TxAuthManager and TxManager into separate contracts refactor: Extract TxAuthManager/TxManager logic via delegatecall to resolve contract size limit Nov 14, 2025
OwnableIBCHandler as IBCHandler
} from "@hyperledger-labs/yui-ibc-solidity/contracts/core/25-handler/OwnableIBCHandler.sol";

// === App ===
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy sample

function _runTxIfCompleted(bytes32 txID) internal virtual override {
CrossStore.TxStorage storage t = _getTxStorage();
if (t.txStatus[txID] != MsgInitiateTxResponse.InitiateTxStatus.INITIATE_TX_STATUS_VERIFIED) return;
if (t.txStatus[txID] == MsgInitiateTxResponse.InitiateTxStatus.INITIATE_TX_STATUS_VERIFIED) return;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix bug

Copy link
Member

@mattsu6666 mattsu6666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM✅

@YukiTsuchida YukiTsuchida merged commit 9caf95d into feature/coordinator Nov 14, 2025
4 of 5 checks passed
@YukiTsuchida YukiTsuchida mentioned this pull request Dec 12, 2025
@YukiTsuchida YukiTsuchida deleted the split-contract branch January 16, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants