Skip to content

feat: sync zone contracts with TIP-1091#682

Open
legion2002 wants to merge 2 commits into
mainfrom
agent/tip1091-sync
Open

feat: sync zone contracts with TIP-1091#682
legion2002 wants to merge 2 commits into
mainfrom
agent/tip1091-sync

Conversation

@legion2002

Copy link
Copy Markdown
Contributor

Summary

  • align the Solidity and Rust ZoneFactory ABI with TIP-1091, including fixed protocol addresses, nextZoneId, and removal of caller-supplied verifier metadata and redundant getters
  • make ZoneMessenger constructorless and bind it directly to the protocol-managed ZoneFactory address
  • require ZonePortal implementation initialization through a portal storage context and provision the fixed portal implementation, verifier, and messenger accounts in test genesis
  • update node provisioning, xtasks, docs, tests, and regenerated zone dev genesis artifacts

The Solidity ZoneFactory remains a deployable local/test stand-in. Tempo's native precompile is responsible for vanity portal addresses and ERC-1167 proxy etching.

This incorporates the delegatecall initialization guard proposed in #656.

TIP: tempoxyz/tempo#6787

Validation

  • forge build
  • cargo check -p tempo-zone-contracts -p zone-node -p tempo-xtask
  • cargo test -p tempo-zone-contracts (7 passed)
  • regenerated crates/node/assets/zone-dev-genesis.json with the repository generator
  • forge test: 253 passed; 9 stock-Forge suites could not start because the Tempo BlockHashHistory precompile is unavailable

@legion2002
legion2002 marked this pull request as ready for review July 16, 2026 13:15
@legion2002

Copy link
Copy Markdown
Contributor Author

cyclops audit fast

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

cc @legion2002

Cyclops audit event published. View workflow run

Config: config: default, iterations: 1, hours: default

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c27d24bae1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

mapping(address => bool) internal _validVerifiers;
address internal _verifier;
address internal _messenger;
address public owner;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Initialize the factory owner on normal deployments

When this ZoneFactory is deployed as a regular Solidity contract, nextZoneId is initialized by the creation code but owner remains address(0) because the constructor that assigned msg.sender was removed. Both createZone and transferOwnership require msg.sender == owner, so any normally deployed local/test stand-in is permanently unusable unless storage slot 3 is patched by hand. If the reference contract is still meant to be deployable, it needs a constructor or initializer that sets owner.

Useful? React with 👍 / 👎.

messengerFactory.setPortal(OTHER_ZONE_ID, otherPortal);

messenger = new ZoneMessenger(address(messengerFactory));
messenger = ZoneMessenger(ZONE_MESSENGER_ADDRESS);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Etch the fixed messenger before exercising it

In this setup only ZONE_FACTORY_ADDRESS is etched; unlike tests that call _deployZoneFactory(), ZONE_MESSENGER_ADDRESS still has no code. Binding messenger to that empty address means zoneFactory() decodes empty returndata and relayMessage() calls either no-op or fail expectations instead of testing the constructorless messenger. Etch type(ZoneMessenger).runtimeCode at the fixed messenger address before assigning this handle.

Useful? React with 👍 / 👎.

@tempoxyz-bot tempoxyz-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👁️ Cyclops Review — No actionable findings.

The consolidated worker reports found the TIP-1091 fixed-address refactor internally consistent. The following non-blocking areas are called out for human confirmation:

Reviewer Callouts
  • Fixed-address genesis/dependency provisioning: Verify production/dev genesis seeds ZoneFactory.owner and ZoneFactory.nextZoneId correctly and installs code at ZONE_PORTAL_IMPL_ADDRESS, ZONE_VERIFIER_ADDRESS, and ZONE_MESSENGER_ADDRESS; consider extending crates/node/src/dev.rs preflight checks beyond the factory presence check.
  • Portal proxy deployment semantics: Confirm the production factory/proxy path, node portal discovery, and tests all exercise the intended TIP-1091 protocol-etched proxy deployment model.
  • Global messenger reentrancy guard: Confirm no legitimate cross-zone relay path needs nested relay execution through the singleton messenger in one transaction.
  • Legacy receiver/router compatibility: Consider operator-facing warnings for old callback receivers using zoneFactory.messenger() authentication and for xtask/src/deploy_router.rs non-fixed factory overrides.

Comment thread xtask/src/zone_utils.rs
Comment on lines +24 to +25
/// Explorer: https://explore.moderato.tempo.xyz/address/0x5aF2000000000000000000000000000000000000
pub(crate) const MODERATO_ZONE_FACTORY: Address = ZONE_FACTORY_ADDRESS;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The fixed factory is not active on Moderato yet, while the previous factory remains live. Landing this before the network activation breaks the default create-zone, zone-info, and deploy-router flows. Can we remove this change until the factory precompile is activated on testnet?

function messenger() external view returns (address);
function zones(uint32 zoneId) external view returns (ZoneInfo memory);
function zoneCount() external view returns (uint32);
function nextZoneId() external view returns (uint32);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The existing skills in this repo still call the removed zoneCount() and verifier() methods. Can we update the skills as well?

@0xKitsune 0xKitsune left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Lgtm, just a few comments.

Comment on lines +9 to +13
pub const ZONE_PORTAL_PREFIX: FixedBytes<12> = fixed_bytes!("5AD000000000000000000000");
pub const ZONE_PORTAL_IMPL_ADDRESS: Address =
address!("0x5AD1000000000000000000000000000000000000");
pub const ZONE_VERIFIER_ADDRESS: Address = address!("0x5a56000000000000000000000000000000000000");
pub const ZONE_MESSENGER_ADDRESS: Address = address!("0x5A4d000000000000000000000000000000000000");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Will this break existing flows on Testnet before these are live?

returns (bytes4)
{
if (msg.sender != zoneFactory.messenger()) {
if (msg.sender != ZONE_MESSENGER_ADDRESS) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same thing here, this will break if we redeploy contracts on testnet until the precompiles are live. Can we update to remove this (and related changes) since we will need to redeploy on testnet before the precompiles are live?

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