Skip to content

feat(chain-spec): pre-allocate rollup STRK fee token at the canonical mainnet address#583

Merged
kariy merged 2 commits into
mainfrom
feat/rollup-chain-spec
Jun 3, 2026
Merged

feat(chain-spec): pre-allocate rollup STRK fee token at the canonical mainnet address#583
kariy merged 2 commits into
mainfrom
feat/rollup-chain-spec

Conversation

@kariy
Copy link
Copy Markdown
Member

@kariy kariy commented Jun 2, 2026

Pre-allocates the rollup's STRK fee token at the canonical mainnet DEFAULT_STRK_FEE_TOKEN_ADDRESS (0x04718f5a…) instead of a derived address, so tooling/wallets that assume the canonical STRK address resolve it against a katana init rollup genesis. Adds crates/chain-spec/src/fee_token.rs and points the rollup fee_contracts (eth+strk) at it.

🤖 Generated with Claude Code

…nnet address

Rollup mode previously deployed a custom STRK ERC20 via UDC at the derived
address 0x2e7…, because UDC-derived addresses can't land at the canonical
Starknet mainnet STRK address (0x0471…). This made it impossible for wallets
and explorers to treat a rollup like Starknet mainnet/sepolia.

The fix mirrors the dev-mode pattern: the STRK fee token is now pre-allocated
into genesis state (class declared, contract deployed, ERC20 storage seeded
with the master account holding initial supply) at DEFAULT_STRK_FEE_TOKEN_ADDRESS,
bypassing UDC entirely. The genesis transactions builder drops the ERC20
declare+deploy txs and points its in-memory fee-token cursor at the canonical
address so the existing transfer_balance invokes keep working.

A small PreloadedStateProvider overlay lets the executor see the pre-allocated
state when processing the genesis block; init_rollup_genesis merges the
pre-allocation into the execution output before commit.

DEFAULT_APPCHAIN_FEE_TOKEN_ADDRESS is removed in favor of the canonical
constant; CLI init and the settlement bootstrap (SNOS / Katana-TEE config
hashes) are updated to bind to it. add_fee_token is extracted into a shared
chain-spec/fee_token module since dev and rollup now both call it.

Out of scope: deployment.rs INITIAL_STATE_ROOT stays at Felt::ZERO. Genesis
state is no longer empty before block 0 executes, so SNOS-proven settlement
will diverge until the settlement bootstrap publishes the real genesis state
root — tracked as a follow-up in the deployment.rs comment.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: 3a35fd2 Previous: 9fc29e2 Ratio
VersionedContractClass/compress 529 ns/iter (± 4) 373 ns/iter (± 6) 1.42

This comment was automatically generated by workflow using github-action-benchmark.

CC: @kariy

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

Codec benchmark diff vs main

Benchmark Baseline (ns) Current (ns) Δ
CompiledClass(fixture)/compress 2686623 2004810 -25.38%
CompiledClass(fixture)/decompress 2931175 2269991 -22.56%
ExecutionCheckpoint/compress 35 27 -22.86%
ExecutionCheckpoint/decompress 25 21 -16.00%
PruningCheckpoint/compress 35 27 -22.86%
PruningCheckpoint/decompress 25 20 -20.00%
VersionedHeader/compress 643 516 -19.75%
VersionedHeader/decompress 821 692 -15.71%
StoredBlockBodyIndices/compress 76 63 -17.11%
StoredBlockBodyIndices/decompress 37 31 -16.22%
StorageEntry/compress 146 124 -15.07%
StorageEntry/decompress 141 126 -10.64%
ContractNonceChange/compress 145 142 -2.07%
ContractNonceChange/decompress 234 201 -14.10%
ContractClassChange/compress 217 168 -22.58%
ContractClassChange/decompress 259 220 -15.06%
ContractStorageEntry/compress 160 131 -18.13%
ContractStorageEntry/decompress 309 272 -11.97%
GenericContractInfo/compress 140 109 -22.14%
GenericContractInfo/decompress 102 85 -16.67%
Felt/compress 82 71 -13.41%
Felt/decompress 59 46 -22.03%
BlockHash/compress 82 70 -14.63%
BlockHash/decompress 58 47 -18.97%
TxHash/compress 82 70 -14.63%
TxHash/decompress 59 47 -20.34%
ClassHash/compress 82 70 -14.63%
ClassHash/decompress 59 47 -20.34%
CompiledClassHash/compress 82 70 -14.63%
CompiledClassHash/decompress 59 47 -20.34%
BlockNumber/compress 47 39 -17.02%
BlockNumber/decompress 25 20 -20.00%
TxNumber/compress 47 39 -17.02%
TxNumber/decompress 25 20 -20.00%
FinalityStatus/compress 1 0 -100.00%
FinalityStatus/decompress 12 9 -25.00%
TypedTransactionExecutionInfo/compress 18091 10726 -40.71%
TypedTransactionExecutionInfo/decompress 3635 2908 -20.00%
VersionedContractClass/compress 373 279 -25.20%
VersionedContractClass/decompress 795 670 -15.72%
MigratedCompiledClassHash/compress 146 139 -4.79%
MigratedCompiledClassHash/decompress 138 124 -10.14%
ContractInfoChangeList/compress 1628 1168 -28.26%
ContractInfoChangeList/decompress 2237 1796 -19.71%
BlockChangeList/compress 689 514 -25.40%
BlockChangeList/decompress 903 722 -20.04%
ReceiptEnvelope/compress 30170 20216 -32.99%
ReceiptEnvelope/decompress 6131 5159 -15.85%
TrieDatabaseValue/compress 165 124 -24.85%
TrieDatabaseValue/decompress 219 185 -15.53%
TrieHistoryEntry/compress 289 225 -22.15%
TrieHistoryEntry/decompress 255 222 -12.94%

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

Runner: AMD EPYC 9V74 80-Core Processor (4 cores) · 15Gi RAM

`add_fee_token` is a builder-style genesis helper whose 8 args are each a distinct
token field; allow the lint locally rather than wrapping them in a struct that just
moves the arg list to the callers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

❌ Patch coverage is 77.23214% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.68%. Comparing base (9bde0ae) to head (2bf5976).
⚠️ Report is 431 commits behind head on main.

Files with missing lines Patch % Lines
...tes/storage/provider/provider/src/providers/mod.rs 48.57% 36 Missing ⚠️
crates/core/src/backend/mod.rs 79.48% 8 Missing ⚠️
bin/katana/src/cli/init/mod.rs 0.00% 4 Missing ⚠️
crates/chain-spec/src/rollup/utils.rs 93.61% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #583      +/-   ##
==========================================
- Coverage   73.32%   68.68%   -4.64%     
==========================================
  Files         209      322     +113     
  Lines       23132    45601   +22469     
==========================================
+ Hits        16961    31320   +14359     
- Misses       6171    14281    +8110     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kariy kariy merged commit 11bd3ae into main Jun 3, 2026
18 of 21 checks passed
@kariy kariy deleted the feat/rollup-chain-spec branch June 3, 2026 17:41
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.

1 participant