Skip to content

feat(EVM-1189): [AI] remove machine default start trap#541

Draft
0xVolosnikov wants to merge 1 commit intodevfrom
vv-evm-1189-remove-machine-default-start-trap
Draft

feat(EVM-1189): [AI] remove machine default start trap#541
0xVolosnikov wants to merge 1 commit intodevfrom
vv-evm-1189-remove-machine-default-start-trap

Conversation

@0xVolosnikov
Copy link
Contributor

@0xVolosnikov 0xVolosnikov commented Feb 27, 2026

What ❔

  • Renamed the machine start trap symbol to _machine_start_trap.
  • Removed legacy linker alias usage and obsolete TODO around startup trap naming.

Why ❔

  • Makes startup trap entry naming explicit and consistent.
  • Simplifies low-level startup wiring by removing legacy indirection.

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 changed the title EVM-1189: remove machine default start trap feat(EVM-1189): remove machine default start trap Feb 27, 2026
@0xVolosnikov 0xVolosnikov marked this pull request as draft February 27, 2026 22:44
@0xVolosnikov 0xVolosnikov requested a review from Copilot February 27, 2026 22:56
@github-actions
Copy link
Contributor

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 479,408 477,840 (-0.33%) 310,728 310,028 (-0.23%) 0 0 (+0.00%) 42,170 41,953 (-0.51%)
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,545,271 147,549,608 (+0.00%) 118,078,779 118,068,828 (-0.01%) 5,160 5,160 (+0.00%) 7,345,983 7,349,555 (+0.05%)
precompiles process_transaction 73,481,847 73,486,587 (+0.01%) 58,781,279 58,791,083 (+0.02%) 160 160 (+0.00%) 3,674,502 3,673,236 (-0.03%)
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,893,550 146,898,332 (+0.00%) 117,506,738 117,510,260 (+0.00%) 180 180 (+0.00%) 7,345,983 7,346,298 (+0.00%)
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 142,039 146,831 (+3.37%) 106,039 110,511 (+4.22%) 2,250 2,270 (+0.89%) 0 0 (+0.00%)

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

This PR cleans up low-level trap entry wiring in zksync_os by eliminating the legacy machine_default_start_trap symbol and making _machine_start_trap the explicit machine trap entry point.

Changes:

  • Rename the assembly trap entry label from machine_default_start_trap to _machine_start_trap.
  • Remove the linker-script PROVIDE alias that previously mapped _machine_start_trap to machine_default_start_trap.
  • Remove an obsolete TODO related to the legacy trap entry point.

Reviewed changes

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

File Description
zksync_os/src/main.rs Removes an obsolete TODO comment about the legacy trap entry symbol.
zksync_os/src/lds/link.x Drops the legacy PROVIDE(_machine_start_trap = ...) alias.
zksync_os/src/asm/asm_reduced.S Renames the exported trap entry symbol to _machine_start_trap.

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

Comment on lines 32 to 36
/* # Start trap function override
By default uses the riscv crates default trap handler
but by providing the `_start_trap` symbol external crates can override.
*/
PROVIDE(_start_trap = default_start_trap);
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

Removing PROVIDE(_machine_start_trap = ...) changes _machine_start_trap from a weak/defaulted symbol into a required strong definition (now coming from asm_reduced.S). If downstream code previously overrode _machine_start_trap by defining it elsewhere, this will start failing with duplicate symbol errors. If override-ability is still desired, consider keeping a weak default (e.g., via PROVIDE or making the asm definition weak) or explicitly documenting that overrides are no longer supported.

Copilot uses AI. Check for mistakes.
*/
.section .trap, "ax"
.global machine_default_start_trap
.global _machine_start_trap
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

Defining _machine_start_trap as a global (strong) symbol means it can no longer be overridden by another object file without causing a duplicate symbol link error. If the previous PROVIDE(_machine_start_trap = machine_default_start_trap) behavior was intentionally allowing overrides, consider marking this symbol weak (or restoring a weak alias pattern) to preserve that behavior while keeping the new name.

Suggested change
.global _machine_start_trap
.weak _machine_start_trap

Copilot uses AI. Check for mistakes.
@0xVolosnikov 0xVolosnikov changed the title feat(EVM-1189): remove machine default start trap feat(EVM-1189): [AI] remove machine default start trap Feb 28, 2026
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.

2 participants