Skip to content

fix: Make contract deployer hook EVM-friendly#538

Merged
antoniolocascio merged 13 commits intodevfrom
vv-fix-contract-deployer
Mar 3, 2026
Merged

fix: Make contract deployer hook EVM-friendly#538
antoniolocascio merged 13 commits intodevfrom
vv-fix-contract-deployer

Conversation

@0xVolosnikov
Copy link
Contributor

@0xVolosnikov 0xVolosnikov commented Feb 27, 2026

What ❔

Ppretend to be an empty account if caller is unauthorized

Why ❔

Is this a breaking change?

  • Yes
  • No

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted.

@0xVolosnikov 0xVolosnikov marked this pull request as ready for review February 27, 2026 20:59
@0xVolosnikov
Copy link
Contributor Author

0xVolosnikov commented Feb 27, 2026

We should check that this change is compatible with our upgrade flow. Alternatively we can on a higher level pretend that ContractDeployer isn't a hook if caller isn't X. But still we have to figure the exact upgrade flow first.

Iiuc, we want to deploy proxy there and then initialize it, so I guess it's already a bit complex (huh): https://github.com/matter-labs/era-contracts/blob/84e5c59386b6b324d6547c9ad551e43f9a22fc93/l1-contracts/contracts/l2-upgrades/L2ComplexUpgrader.sol#L39

UPD: it was decided to keep ContractDeployer hook and remove ContractDeployer contract for now

This comment was marked as outdated.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

system_hooks/src/call_hooks/contract_deployer_temp.rs:49

  • The constant L2_COMPLEX_UPGRADER_ADDRESS defined on line 114 duplicates COMPLEX_UPGRADER_ADDRESS already present in addresses_constants.rs (line 63). Both have the value B160::from_limbs([0x800f, 0, 0]). The locally defined constant should be removed and the one from addresses_constants.rs used instead (it is accessible via the existing wildcard import), to avoid having two constants for the same address that could diverge in the future.

Additionally, the redundant authorization check at line 149 (if caller != L2_COMPLEX_UPGRADER_ADDRESS) inside contract_deployer_hook_inner is now dead code: the outer contract_deployer_temp_hook function already returns early for unauthorized callers before ever calling into this inner function. The inner check should be removed.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

system_hooks/src/call_hooks/contract_deployer_temp.rs:147

  • The comment on line 147 contains a typo: "anauthorized" should be "unauthorized".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


[dependencies]
ruint = { workspace = true, default-features = false }
ruint = { workspace = true, default-features = false, features = ["serde"] }
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

The ruint/serde feature is now added unconditionally to the ruint dependency. The existing comment on line 27 says "serde derivation has to be disabled for risc-v target until we update ruint version". Since the workspace now uses ruint 1.16 (which presumably resolved the risc-v issue), the comment on line 27 is now stale and misleading. It should either be updated to reflect the current state (i.e., that ruint 1.16 fixed the risc-v issue), or removed. Additionally, adding the feature unconditionally (rather than only via the serde feature) makes the serde feature's "ruint/serde" entry on line 28 a no-op, since ruint/serde is already always enabled.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Benchmark report

Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%)
block_19299001 process_block 315,681,952 315,681,952 (+0.00%) 273,016,552 273,016,552 (+0.00%) 410,630 410,630 (+0.00%) 9,023,830 9,023,830 (+0.00%)
block_22244135 process_block 197,585,908 197,585,908 (+0.00%) 170,670,116 170,670,116 (+0.00%) 172,040 172,040 (+0.00%) 6,040,788 6,040,788 (+0.00%)
precompiles bn254_ecadd 53,268 53,268 (+0.00%) 47,816 47,816 (+0.00%) 0 0 (+0.00%) 1,363 1,363 (+0.00%)
precompiles bn254_ecmul 728,781 728,781 (+0.00%) 564,593 564,593 (+0.00%) 0 0 (+0.00%) 41,047 41,047 (+0.00%)
precompiles bn254_pairing 72,336,733 72,336,733 (+0.00%) 57,808,589 57,808,589 (+0.00%) 0 0 (+0.00%) 3,632,036 3,632,036 (+0.00%)
precompiles ecrecover 477,602 479,689 (+0.44%) 309,738 311,013 (+0.41%) 0 0 (+0.00%) 41,966 42,169 (+0.48%)
precompiles id 927 927 (+0.00%) 927 927 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles keccak 137,579 137,579 (+0.00%) 137,579 137,579 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles modexp 31,267,857 31,267,857 (+0.00%) 20,610,037 20,610,037 (+0.00%) 0 0 (+0.00%) 2,664,455 2,664,455 (+0.00%)
precompiles p256_verify 748,861 748,861 (+0.00%) 470,169 470,169 (+0.00%) 0 0 (+0.00%) 69,673 69,673 (+0.00%)
precompiles point_evaluation 52,918,413 52,918,413 (+0.00%) 40,570,377 40,570,377 (+0.00%) 0 0 (+0.00%) 3,087,009 3,087,009 (+0.00%)
precompiles process_block 147,551,205 147,545,023 (-0.00%) 118,069,689 118,078,911 (+0.01%) 5,160 5,160 (+0.00%) 7,349,739 7,345,888 (-0.05%)
precompiles process_transaction 73,485,299 73,483,586 (-0.00%) 58,790,023 58,788,958 (-0.00%) 160 160 (+0.00%) 3,673,179 3,673,017 (-0.00%)
precompiles ripemd 8,013 8,013 (+0.00%) 8,013 8,013 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles run_tx_loop 146,899,434 146,893,638 (-0.00%) 117,497,598 117,507,206 (+0.01%) 180 180 (+0.00%) 7,349,739 7,345,888 (-0.05%)
precompiles sha256 13,168 13,168 (+0.00%) 13,168 13,168 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles system_init 46,785 46,785 (+0.00%) 46,785 46,785 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles verify_and_apply_batch 145,910 146,831 (+0.63%) 109,910 110,511 (+0.55%) 2,250 2,270 (+0.89%) 0 0 (+0.00%)

@antoniolocascio antoniolocascio merged commit dca15ec into dev Mar 3, 2026
20 checks passed
@antoniolocascio antoniolocascio deleted the vv-fix-contract-deployer branch March 3, 2026 09:49
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