Skip to content

Starknet 0.14.0 #2949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft

Starknet 0.14.0 #2949

wants to merge 25 commits into from

Conversation

EgeCaner
Copy link
Contributor

@EgeCaner EgeCaner commented Jul 2, 2025

Purpose of this PR is to see the whole changes regarding version 0.14.0 and RPCv9 anb this PR will be divided in multiple small PRs to facilitate the review process.

Initial plan is to divide this into following PRs, I will attach link to PRs as I create them.

  • Cache for submitted transactions - PR

    • In 0.14.0 feeder will no longer return RECEIVED status, we will serve RECEIVED status from cache
  • Gateway URL split "Two distinct URLs for GW and FGW" - PR

    • feeder will be at feeder.{chain_name}.starknet.io/feeder_gateway
    • gateway will be at {chain_name}.starknet.io/gateway

    While the chain is on v0.13.5, both URLs will point to their respective 0.13.5 locations so that users can upgrade their nodes to a 0.14.0-compatible version while the chain hasn’t upgraded yet.

  • Preconfirmed block type - PR

  • Polling logic without RPCv9 -PR

  • RPCv9 init - since rpc/v9 package will contain many duplicate code from previous rpcs this PR will be just duplicate of rpcv8 adjusted as a base for rpcv9 - PR

  • RPCv9 related changes

    • Methods with new statuses - PR
    • starknet_getMessageStatus response includes ExecutionStatus in RPCv9 - PR
    • Fee units are constrained on fee estimation - PR
      • Only WEI for message fee estimation
      • Only FRI for starknet_estimateFee
    • L1Handler handler traces will be REVERTIBLE_FUNCTION_INVOCATION - PR
    • New GW errors
    • Blockifier upgrade - PR

EgeCaner and others added 14 commits July 2, 2025 13:56
* SubmittedTransactionCache: implementation and test

* Added SubmittedTransactionsCache parameters to Node.Config

* Integrate cache into RPC

* Added test cases for RECEIVED status

* Fix linter warning

* Update rpc/rpccore/submitted_transaction_cache_test.go

Increase readability by storing txhashes and reusing them later rather than rescontructing hashes again

Co-authored-by: Rian Hughes <[email protected]>
Signed-off-by: Ege Caner <[email protected]>

* Update rpc/rpccore/submitted_transaction_cache_test.go

Increase readability by introducing `firstTxnHash` variable rather than using felt.Zero

Co-authored-by: Rian Hughes <[email protected]>
Signed-off-by: Ege Caner <[email protected]>

* AddTransaction: return result as nil when err not nil

* SubmittedTransactionsCache: Remove function added

* rpcv6 and remove from cache on gw success response and adaptTransaction function introduced to reduce cyclomatic complexity

* rpc v7, v8: remove from cache on gw success reponse

* removed duplicated test on submitted txn cache test

* extract txn cache tests in to its own test

* txn cache: passing by reference rather than value

* SubmittedTransactionsCache: Doc

---------

Signed-off-by: Ege Caner <[email protected]>
Co-authored-by: Rian Hughes <[email protected]>
* Gateway: URL split

* go back to previous urls except 'sepolia-integration'
* bump blockifier version

* Blockifier VersionedConstants: use function from blockifier to read constants from file and update files 'versioned_constants/' to be compatible with new version

* Use Tip field

* Set 'strict_nonce_check' field to 'true' and 'TransactionContext.block_context' field from 'BlockContext' to 'Arc<BlockContext>'

* Address linter suggestion

* Updated minimum requried rust version in README and MAKEFILE

* use short name for 'Tip'

---------

Co-authored-by: Rodrigo <[email protected]>
* blockifier version bumped to release candidate

* blockifier versioned constants updated
* use txhash from gateway response in cache

* rpcv6 add_transaction use txHash from gateway response inserting to cache

* update urls

* Update validator_test tx commitments, blockhash uses post0_13_4

* SubmittedTransactionsCache test uses mockGateway instead of test gateway

* remove omitted field from test gwResponse
* rpcv9 init

* add rpcv9 tx validation to validator

* silence linter duplicate warning

* bump spec version

* use mock gateway instead of gw test client rpcv9:submitted_txn_cache_test
* starknet PreConfirmedBlock type

* core pre_confirmed_block

* pre_confirmed block sn2core adapter

* extract starknet state diff into its own type

* preconfirmed adapter comment

* Feeder: get_pre_confirmed_block

* Sync: pre_confirmed_block polling

* Comply with Reader interface

* CandidateTxs map to list

* Add new version

* sync.PendingData type

* use PendingData in sync and switching from polling pending to preconfirmed

* Sequencer empty PendingData impl, and generate sync mock

* update test with PendingData

* Update sync test to compare against pendingData

* PreConfirmed block return number

* Allow rpcv9 BlockHeader to omit parent hash, since PreConfirmed block does not have one

* Preconfirmed block does not return BlockStatus

* RPC < 9 should use latestBlock when pendingID, custom pending state accessor that return latest block if node is fetching preconfirmed block

* Remove PreconfirmedStateReader/Writer reuse PendingStateReader/Writer

* Pending and PendingData types moved from 'sync' to 'core'

* Move rpc pending data wrappers to own file

* Use PendingDataInterface to access pendind data

* update tests

* move Pending back to sync

* remove invalid return

* New starknet finality statuses

* Only keep FINALITY_STATUSES in spec

* New Tx statuses and unknown execution status

* pending data wrapper for rpcv9 to serve pending block till 0.14.0

* Preconfirmed block sn2core adapter test

* Sync TestPendingData for preconfirmed block

* PendingDataWrapper test

* add get_preconfirmed_block to test feeder

* Add post 0.14.0 behaviour test for some endpoints for RPC v < 9

* remove blockchain.pendingBlockFn for favoring pendingBlockFn of RPCs

* linter errors

* PreConfirmedBlock RPCv9 integration draft

* add methods where we need to support pre_confirmed, block to RPCv9

* TransactionByHash: query candidate txs

* TestTranasctionByHash from pre_confirmed block

* Add test for class related methods and blockTransactionCount

* expose json-rpc server v9

* PendingState RPC wrappers for RPC version < 9

* remove redundant functions

* Feeder PreConfirmedBlock test

* Bring pending subscription back to rpcv9 to serve before 0.14.0

* RPCv9 if tx is pending block use 'ACCEPTED_ON_L2', if in preconfirmed block use 'PRE_CONFIRMED' finality status'

* fix tests

* BlockWithReceitps support pending block finality RPCv9

* remove test block data and mock the header

* adjust comments

* Update polling messages

* sync store empty pending/pre_confirmed block based on head blockVer

* revert default rpc path to v8

* fix linter long line

* Events indexing rather than append

* reference receivers

* block, class, state_update receive by reference

* NewPreConfirmed, NewPending and AsPendingData return value types

* StateUpdate: indexing instead of append, return by value

* For RPCv9 rename 'EventsArg' to 'EventArgs'

* RPCv9 returns 'EventsChunk' as value

* subscription adjust error message for pre_confirmed

* Susbcription: use bool as value and refactor long lines

* RPCv9 TransactionStatus return value type

* remove unused linter directives

* comment for 'TxnFinalityStatus' iota +4

* refactor TestAdaptPreConfirmed, gocyclo

* refactor: feeder newTestServer

* add validator to jsonrpcServerV09

* sync pending in single goroutine

* add TODO comment
Blockifier, convert l2 gas to l1 gas when NoL2Gas GasVectorComputationMode and use overidden values in response
* getMessageStatus return ExecutionStatus

* Add unknown execution status
* rpcv9 estimateFee only return FRI, estimateMessageFee only return WEI

* linter fix
Introduce new config param PreConfirmedPollInterval
* L1Handler Tx Trace is not REVERTIBLE_FUNCTION_INVOCATION

* L1Handler traces return revert reason

* RPC version < 9 returns dummy L1_Handler trace for reverted trace

* update comments

* fix test

* use ExecuteInvocation.FunctionInvocation == nil as reverted flag

* Add test for reverted L1Handler trace

* add AdaptVMTransaction L1Handler reverted for rpc < 9
* InvalidTransactionNonce error returns data

* fix linter

* New Gw errors

* Test case for errors

* add test for InvalidTransactionNonce as ValidationFailure

* gatewayError.CompilationFailed returns data starting from rpcv8
Copy link
Contributor

github-actions bot commented Jul 2, 2025

Minimum supported Rust version is 1.86.0, previous 1.85.1. Please update the README file, the Makefile, and this workflow.

Copy link

codecov bot commented Jul 2, 2025

Codecov Report

Attention: Patch coverage is 80.74957% with 791 lines in your changes missing coverage. Please review.

Project coverage is 72.96%. Comparing base (f950632) to head (2ec2fee).

Files with missing lines Patch % Lines
rpc/v9/subscriptions.go 62.62% 162 Missing and 32 partials ⚠️
rpc/v9/transaction.go 76.47% 139 Missing and 25 partials ⚠️
rpc/v9/storage.go 74.88% 38 Missing and 16 partials ⚠️
rpc/v9/trace.go 78.77% 35 Missing and 17 partials ⚠️
rpc/v9/block.go 83.18% 31 Missing and 6 partials ⚠️
rpc/v9/estimate_fee.go 38.59% 34 Missing and 1 partial ⚠️
rpc/v9/compiled_casm.go 75.49% 19 Missing and 6 partials ⚠️
rpc/v9/class.go 77.45% 21 Missing and 2 partials ⚠️
rpc/v9/helpers.go 82.05% 18 Missing and 3 partials ⚠️
rpc/v9/events.go 78.48% 12 Missing and 5 partials ⚠️
... and 25 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2949      +/-   ##
==========================================
+ Coverage   72.19%   72.96%   +0.77%     
==========================================
  Files         262      284      +22     
  Lines       28368    32499    +4131     
==========================================
+ Hits        20479    23713    +3234     
- Misses       6496     7230     +734     
- Partials     1393     1556     +163     

☔ 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.

@rodrigo-pino rodrigo-pino changed the title 0.14.0 beta Starknet 0.14.0 Jul 2, 2025
EgeCaner added 2 commits July 7, 2025 16:49
* Getter for TransactionStateDiffs

* special handling for preconfirmed block on single tx trace

* extract preconfirmed trace into own function

* test for sync.PendingStateBeforeIndex
…ed to [0,latest] (#2963)

bound event query range to [0, latest] when block numbers out of upper bound
EgeCaner added 2 commits July 9, 2025 14:51
* Return exhausted iter, instead of raising error when from block > to block

* add test
* blockifier feature node_api

* trace return inner execution resources l1_gas and l2_gas
…for latest (#2965)

* Pending Data never nil

* tests

* remove unused error

* remove prints
* rpcv9 handling for rejeceted historical txs

* test for rejected status on RPCv9
EgeCaner added 2 commits July 10, 2025 17:48
…m rpcv7 (#2971)

* add failure reason for rejected tx

* remove revert reason from rpcv7

* test for failure reason

* add rpc test for REJECTED txn status

* omit if failure reason not present instead of error
wojciechos and others added 2 commits July 11, 2025 11:48
* refactor: improve UnmarshalJSON method for BlockID across multiple RPC versions

* Replace string comparison with JSON unmarshalling for block tags.
* Add error handling for unknown block tags in UnmarshalJSON.
* Update logic for handling "latest" and "pending" tags in rpc/v6, rpc/v7, rpc/v8, and rpc/v9.

* feat: add starknet_getNonce method to rpcv9 and update  handler

* Introduced the starknet_getNonce method in rpcv9 with appropriate parameters.
* Updated the handler for starknet_getNonce to use the new rpcv9 handler.

* test: add unit tests for nonce retrieval in rpcv9

* fix: update nonce API documentation link in rpcv9

---------

Co-authored-by: thiagodeev <[email protected]>
pending data wrappers: add block number to pending block
* always provide pending state

* add test for pendig data wrapper
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.

3 participants