feat: implement Authenticator abstract contract with signTx #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Authenticator.solandsignTx().signTxand its helper functions.graph TD subgraph " " direction LR CrossModule[(CrossModule)] end subgraph "Implementation abstract" direction TB Initiator[Initiator] Authenticator[Authenticator] TxAuthManager[TxAuthManager] TxManager[TxManager] TxRunner[TxRunner] end subgraph "Base Contracts & Interfaces" direction TB IInitiator{{IInitiator}} IAuthenticator{{IAuthenticator}} TxAuthManagerBase((TxAuthManagerBase)) TxManagerBase((TxManagerBase)) TxRunnerBase((TxRunnerBase)) end subgraph "Storage (ERC7201)" direction TB CrossStore[CrossStore] end CrossModule -- inherits --> Initiator CrossModule -- inherits --> Authenticator CrossModule -- inherits --> TxAuthManager CrossModule -- inherits --> TxManager CrossModule -- inherits --> TxRunner Initiator -- implements --> IInitiator Initiator -- inherits & uses --> TxAuthManagerBase Initiator -- inherits & uses --> TxManagerBase TxAuthManager -- implements --> TxAuthManagerBase TxAuthManager -- uses storage --> CrossStore TxManager -- implements --> TxManagerBase TxManager -- inherits & uses --> TxRunnerBase TxManager -- uses storage --> CrossStore TxRunner -- implements --> TxRunnerBase Authenticator -- implements --> IAuthenticator Authenticator -- inherits & uses --> TxAuthManagerBase Authenticator -- inherits & uses --> TxManagerBase classDef interface fill:#e6f7ff,stroke:#0056b3,stroke-width:2px class IInitiator,IAuthenticator interface classDef base fill:#f0f0f0,stroke:#333,stroke-width:2px class TxAuthManagerBase,TxManagerBase,TxRunnerBase base classDef storage fill:#fffbe6,stroke:#d4a017,stroke-width:2px class CrossStore storagegraph TD %% ========================= %% High-level architecture %% ========================= subgraph "Deployed App Contract" direction TB CrossModule[(CrossModule)] style CrossModule stroke-width:2px subgraph "Abstract Impl (in CrossModule)" direction LR Initiator[Initiator] Authenticator[Authenticator] TxRunner[TxRunner] end subgraph "Shared Storage (ERC-7201 layout in callers)" direction TB CrossStore[(CrossStore)] end CrossModule -- inherits --> Initiator CrossModule -- inherits --> Authenticator CrossModule -- inherits --> TxRunner CrossModule --- CrossStore end %% ============ Facets / Delegates ============ subgraph "Delegatecall Targets (Stateless Logic Contracts)" direction TB AuthFacet[[TxAuthManagerDelegate]] TxFacet[[TxManagerDelegate]] class AuthFacet,TxFacet facet end %% ============ Interfaces ============ subgraph "Interfaces" direction TB ITxAuthManager{{ITxAuthManager}} ITxManager{{ITxManager}} class ITxAuthManager,ITxManager interface end %% ============ Wiring / Calls ============ Initiator -- "«delegatecall» initAuthState/sign/getAuthState" --> AuthFacet Initiator -- "«delegatecall» createTx/isTxRecorded/runIfCompleted" --> TxFacet Authenticator -- "«delegatecall» initAuthState/sign/getAuthState" --> AuthFacet Authenticator -- "«delegatecall» createTx/isTxRecorded/runIfCompleted" --> TxFacet AuthFacet -. implements .-> ITxAuthManager TxFacet -. implements .-> ITxManager %% Delegates operate on caller storage via ERC-7201 slots AuthFacet -- "reads/writes via delegatecall" --> CrossStore TxFacet -- "reads/writes via delegatecall" --> CrossStore %% ============ Upgradability / Address slots ============ subgraph "Facet Address Registry (in CrossModule storage)" direction TB AuthFacetAddr[(authFacetAddress)] TxFacetAddr[(txFacetAddress)] end CrossModule --- AuthFacetAddr CrossModule --- TxFacetAddr Admin[Admin/Owner/Role] -- "setAuthFacet()/setTxFacet()" --> CrossModule %% ============ Execution Path example ============ subgraph "Tx Flow (example)" direction LR User[EOA/Relayer] -->|initiateTx()| Initiator Initiator -->|"derive txID, gather signers"| Initiator Initiator -- "«delegatecall» initAuthState(signers)" --> AuthFacet Initiator -- "«delegatecall» createTx(txID,msg)" --> TxFacet Initiator -->|"sign() → «delegatecall»"| AuthFacet AuthFacet -->|"remaining=0 ?"| Initiator Initiator -->|"if completed → «delegatecall» runIfCompleted(txID)"| TxFacet TxFacet -->|"calls _runTx via TxRunner in CrossModule"| TxRunner end %% ============ Styling ============ classDef facet fill:#eef9f0,stroke:#2b8a3e,stroke-width:2px classDef interface fill:#e6f7ff,stroke:#0056b3,stroke-width:2px