Skip to content

Fix/forking merge main#403

Open
michalpalkowski wants to merge 52 commits intodojoengine:feature/forkingfrom
michalpalkowski:fix/forking-merge
Open

Fix/forking merge main#403
michalpalkowski wants to merge 52 commits intodojoengine:feature/forkingfrom
michalpalkowski:fix/forking-merge

Conversation

@michalpalkowski
Copy link

No description provided.

kariy and others added 30 commits December 2, 2025 13:55
…e#373)

Spawn a separate task on the cpu-bound blocking task for performing the actual state trie computation to avoid blocking the async executor.
…e#373)

Spawn a separate task on the cpu-bound blocking task for performing the actual state trie computation to avoid blocking the async executor.
## Summary
- Add `revert_to` method to `ClassesTrie`, `ContractsTrie`, `StoragesTrie`, and `BonsaiTrie` for unwinding trie state
- Implement `get_by_prefix` for `TrieDb` to support trie prefix operations
- Update bonsai-trie dependency to rev `95de4c6` for revert support

---------

Co-authored-by: Claude <noreply@anthropic.com>
…gine#358)

This PR introduces a state pruning mechanism to the syncing pipeline, addressing the need for nodes to manage their storage footprint by selectively retaining historical state. Currently, all synced nodes must keep the entire chain history, which can grow unbounded over time. This becomes problematic for nodes with storage constraints or those that only need recent state for their operations.

The implementation adds a `Stage::prune` trait method that works alongside the existing `Stage::execute` method, allowing each stage to define how it prunes its historical data.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Adds a new field to the state diff types for class hashes whose CASM hash has been migrated to the new hash function. This changes are part of the RPC v0.10.0 and Starknet 0.14.1 update.

## Database Changes

Introduces a new table, `MigratedCompiledClassHash` - a dupsort table for indexing the list of migrated class hashes according to the block number where the migration occurred.

This change doesn't require bumping the database version as it is backward compatible. Queries performed on the table would not fail and simply return an empty result. Which is still the expected behaviour considering that this table only make sense for Katana with 0.14.1 support which versions prior to this PR have no support for.

## References

* Starknet 0.14.1 pre-release notes. https://community.starknet.io/t/starknet-v0-14-1-prerelease-notes/116032
* SNIP34 proposal for CASM hash change. https://community.starknet.io/t/snip-34-more-efficient-casm-hashes/115979
Add support for the legacy **Deploy** transaction receipt. This is needed in order to sync Starknet Mainnet.
The `[explorer]` section in `katana.toml` was being ignored because `NodeArgsConfig` was missing the explorer field and `with_config_file()` didn't merge it. This adds the missing field and merge logic so that `explorer = true` in the config file now works the same as the `--explorer` CLI flag.
## Summary

Implements support for **stateful compression** (introduced in Starknet v0.13.4) by integrating the alias contract at address `0x2`.

**Starknet v0.13.4 Pre-release notes**: https://community.starknet.io/t/starknet-v0-13-4-pre-release-notes/115257#p-2358763-stateful-compression-11

### Alias contract

Stateful compression optimizes state diff encoding by mapping storage keys, contract addresses, and class hashes to shorter indices based on their first occurrence. This significantly reduces the data size for blob submissions to L1, as these values (typically 252-bit hashes) can be referenced by much smaller indices in subsequent state updates.

The alias contract (`0x2`) is a system contract that maintains a global counter and a value→index mapping. When a new storage key, contract address, or class hash appears in a state diff, it gets mapped to the current counter value, allowing subsequent references to use the smaller index instead of the full 32-byte value.

### Changes

- Integrate `allocate_aliases_in_storage` from blockifier to assign indices to new keys during state update extraction
- Update genesis trie writer to handle the alias contract (`0x2`) which has no class hash

---------

Co-authored-by: Ammar Arif <evergreenkary@gmail.com>
kariy and others added 22 commits December 25, 2025 10:52
This change is part of the effort to remove the dependency on the `starknet` crate by introducing a local crate that provides the `felt!` macro, instead of relying on the one provided by the `starknet` crate.
…ine#389)

This change is part of the effort to remove the dependency on the `starknet` crate. The `short_string!` macro from that crate was previously used to construct `ShortString` values at compile time, but eliminating this dependency requires an alternative approach. The previous implementation using `heapless::String` did not support const construction of arbitrary strings, so it has been replaced with a custom stack-allocated data structure that enables compile-time construction via `ShortString::from_ascii`.
When running `cargo vendor`, we're stuck with this error:

```
λ cargo vendor
error: failed to sync

Caused by:
  found duplicate version of package `starknet-crypto v0.7.4` vendored from two sources:

  	source 1: registry `crates-io`
  	source 2: https://github.com/kariy/starknet-rs?rev=2ef3088#2ef30887
```

The dependencies bump is required because we are removing the `starknet` crate patch:

```toml
[patch.crates-io]
starknet = { git = "https://github.com/kariy/starknet-rs", rev = "2ef3088" }
```

The initial reason for the patch is for this PR xJonathanLEI/starknet-rs#773 but it's no longer needed since dojoengine#256.

The dependency updates were originally meant to only make the project compile after removing the patch. Given the tight integration with `blockifier` and the breaking database format change introduced in `v0.16.0-rc.0`, this PR is now primarily about updating `blockifier`, with patch removal as a side effect.

## Database Backward Compatibility

### TransactionExecutionInfo

`blockifier` v0.16.0-rc.0 has a breaking change in the `TransactionExecutionInfo` struct. In order to maintain backward-compatibility, if database can't deserialize the `TransactionExecutionInfo` it'd simply return nothing instead of failing.

This is still temporary for now and may change once we find a better solution that doesn't require dropping old data.

### Felt Serialization

The `starknet-types-core` crate has a breaking change in `Felt` serialization (see starknet-io/types-rs#155). To maintain backward compatibility with existing databases, a `Felt32` wrapper type is used to ensure `Felt` values are always serialized as 32-byte big-endian arrays when stored in the database.

---

The reason to vendor the Cargo dependencies is to make the Katana binary build hermetic in order to achieve reproducible build process.
Temporarily disable the `snos-integration-test` CI job since the `tests/snos` crate has been removed temporarily due to conflicting `blockifier` version.
Update RPC types to Starknet JSON-RPC specification v0.10.0:

- Add `migrated_compiled_classes` to state diff
- Make `old_root` optional in pre-confirmed state updates  
- Add `transaction_index` and `event_index` to emitted events

Starknet JSON-RPC v0.10.0 specifications: https://github.com/starkware-libs/starknet-specs/blob/v0.10.0/api/starknet_api_openrpc.json

## Backward compatibility

### RPC

The new fields are made optional to allow for temporary backward-compatibility - it only matters if Katana is forking using a RPC provider that is not on v0.10. Will change once the whole ecosystem has defaulted to the new spec.

## Database

This only affect the RPC types. The internal changes are made in [dojoengine#379](dojoengine#379) and is backward compatible.
dojoengine#378)

Implements TEE (Trusted Execution Environment) integration into Katana, enabling the generation of hardware-signed attestation quotes that cryptographically bind the sequencer's execution state (state root) to a TEE (Intel TDX). Includes new katana-tee crate, RPC API extension with `tee_generateQuote` method, CLI options, and node configuration.

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: Luca Steeb <contact@luca-steeb.com>
Co-authored-by: Ammar Arif <evergreenkary@gmail.com>
Run the test suite on pushes to `release/*` branches.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Implements the `dev_setStorageAt` RPC endpoint which was previously a stub. This endpoint allows directly manipulating contract storage for development purposes. In instant mining mode, the storage is updated in the database immediately. In interval mining mode, the storage is updated in the pending block's state, ensuring the change is visible to subsequent transactions within that block, and persisted to the database when the block is mined.

Co-authored-by: Ammar Arif <kariy@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

4 participants