feat(chain-spec): pre-allocate rollup STRK fee token at the canonical mainnet address#583
Merged
Conversation
…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>
There was a problem hiding this comment.
⚠️ 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
Codec benchmark diff vs
|
| 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% |
|
`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 Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 akatana init rollupgenesis. Addscrates/chain-spec/src/fee_token.rsand points the rollupfee_contracts(eth+strk) at it.🤖 Generated with Claude Code