Skip to content

feat: add support for updating SL chain id#452

Open
antoniolocascio wants to merge 10 commits intoalocascio-interop-rootsfrom
alocascio-sl-chain-id
Open

feat: add support for updating SL chain id#452
antoniolocascio wants to merge 10 commits intoalocascio-interop-rootsfrom
alocascio-sl-chain-id

Conversation

@antoniolocascio
Copy link
Contributor

@antoniolocascio antoniolocascio commented Dec 11, 2025

What ❔

This PR adds support for setting the settlement layer chain id via a service transaction.
Depends on matter-labs/era-contracts#1926

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.

pub upgrade_tx_hash: Bytes32,
/// Linear keccak256 hash of interop roots
pub interop_roots_rolling_hash: Bytes32,
/// New settlement layer chain id, if updated. 0 otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we explicitly forbid setting it to 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer applicable in the new version

pub mod interop_root_reporter;
pub mod l1_messenger;
pub mod l2_base_token;
pub mod new_sl_chain_id_reporter;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe rename it to "SystemContextEventHook"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed it

);
}

let new_sl_chain_id = U256::from_be_bytes(topics[1].as_u8_array());
Copy link
Contributor

Choose a reason for hiding this comment

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

Validate that it isn't zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer applicable I think


use super::history_counter::{HistoryCounter, HistoryCounterSnapshotId};

pub type NewSettlementLayerChainIdSnapshotId = HistoryCounterSnapshotId;
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: I think we should move all this custom storages from zk_ee

@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 run_prepared 310,911,846 310,912,439 (+0.00%) 268,246,070 268,246,503 (+0.00%) 410,610 410,620 (+0.00%) 9,024,004 9,024,004 (+0.00%)
block_22244135 run_prepared 191,025,490 191,626,357 (+0.31%) 164,109,430 164,710,137 (+0.37%) 172,020 172,030 (+0.01%) 6,040,935 6,040,935 (+0.00%)
precompiles bn254_ecadd 53,197 53,197 (+0.00%) 47,745 47,745 (+0.00%) 0 0 (+0.00%) 1,363 1,363 (+0.00%)
precompiles bn254_ecmul 731,034 731,034 (+0.00%) 566,846 566,846 (+0.00%) 0 0 (+0.00%) 41,047 41,047 (+0.00%)
precompiles bn254_pairing 72,689,623 72,689,623 (+0.00%) 58,161,479 58,161,479 (+0.00%) 0 0 (+0.00%) 3,632,036 3,632,036 (+0.00%)
precompiles ecrecover 479,150 477,671 (-0.31%) 311,194 310,139 (-0.34%) 0 0 (+0.00%) 41,989 41,883 (-0.25%)
precompiles id 933 933 (+0.00%) 933 933 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles keccak 137,578 137,578 (+0.00%) 137,578 137,578 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles modexp 32,084,999 32,084,999 (+0.00%) 21,427,179 21,427,179 (+0.00%) 0 0 (+0.00%) 2,664,455 2,664,455 (+0.00%)
precompiles p256_verify 750,769 750,769 (+0.00%) 472,077 472,077 (+0.00%) 0 0 (+0.00%) 69,673 69,673 (+0.00%)
precompiles point_evaluation 51,158,394 51,158,394 (+0.00%) 39,535,766 39,535,766 (+0.00%) 0 0 (+0.00%) 2,905,657 2,905,657 (+0.00%)
precompiles process_transaction 73,836,155 73,836,112 (-0.00%) 59,139,363 59,139,468 (+0.00%) 160 160 (+0.00%) 3,673,558 3,673,521 (-0.00%)
precompiles ripemd 8,028 8,028 (+0.00%) 8,028 8,028 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles run_prepared 148,151,884 148,153,725 (+0.00%) 118,682,536 118,685,673 (+0.00%) 5,050 5,060 (+0.20%) 7,347,137 7,346,773 (-0.00%)
precompiles sha256 13,167 13,167 (+0.00%) 13,167 13,167 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles verify_and_apply_batch 132,219 134,534 (+1.75%) 97,499 99,654 (+2.21%) 2,170 2,180 (+0.46%) 0 0 (+0.00%)

0xVolosnikov pushed a commit that referenced this pull request Jan 8, 2026
## What ❔
Subset of #452 without tests, as those depend on native prover input
run.
<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- The `Why` has to be clear to non-Matter Labs entities running their
own ZK Chain -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Is this a breaking change?
- [ ] Yes
- [ ] No

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] 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.
RomanHiden pushed a commit to RomanHiden/zksync-os that referenced this pull request Jan 19, 2026
## What ❔
Subset of matter-labs#452 without tests, as those depend on native prover input
run.
<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- The `Why` has to be clear to non-Matter Labs entities running their
own ZK Chain -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Is this a breaking change?
- [ ] Yes
- [ ] No

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] 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.
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