Skip to content
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

Cleanup rpc pkg #2437

Open
17 of 23 tasks
rianhughes opened this issue Feb 10, 2025 · 0 comments
Open
17 of 23 tasks

Cleanup rpc pkg #2437

rianhughes opened this issue Feb 10, 2025 · 0 comments
Assignees
Labels
Good first issue Good for newcomers Refactor RPC JSON RPC API

Comments

@rianhughes
Copy link
Contributor

rianhughes commented Feb 10, 2025

Currently there is a lot of duplicated code in the rpc v6, v7 and v8 sub packages. We should remove duplicated code (types, functions, tests) where possible. For example, the blockHashAndNumber function (and associated type BlockHashAndNumber) has not changed between v6, v7 and v8. This means that we can remove this function (and type) from v7 and v8, and have the top level handler use the code in v6 instead (specifically update the MethodsV0_8 and MethodsV0_7 functions). See this PR as an example. We should do this for all RPC methods. I would suggest doing the following:

  1. Create a PR for each RPC method (this will make it easier to track changes, work on, and review)
  2. If the RPC method has not changed between (eg) v6, v7 and v8, then we can just re-use the v6 code in v7 and v8. This means the corresponding code (function, types, tests) should be deleted in v7 and v8.
  3. If the RPC function has changed, then we should not remove the function. However, if the associated type has not changed, then we should probably delete it.
  4. To keep track of all the changes being made, and still to be made, to the RPC pkg, please add a new bullet point here and link the associated PR.

Remaining endpoints to check

  • starknet_getBlockWithReceipts
  • starknet_getCompiledCasm
  • starknet_specVersion
  • starknet_subscribeEvents
  • starknet_subscribeTransactionStatus
  • starknet_getBlockWithTxs
  • starknet_getTransactionByHash
  • starknet_getTransactionReceipt
  • starknet_getBlockTransactionCount
  • starknet_getTransactionByBlockIdAndIndex
  • starknet_getStateUpdate
  • starknet_addInvokeTransaction
  • starknet_addDeployAccountTransaction
  • starknet_addDeclareTransaction
  • starknet_getTransactionStatus
  • starknet_call
  • starknet_estimateFee
  • starknet_estimateMessageFee
  • starknet_traceTransaction --> decided not to go for refactoring after all. Not exactly straightfoward.
  • starknet_simulateTransactions
  • starknet_traceBlockTransactions
  • juno_subscribeNewHeads / starknet_subscribeNewHeads
  • juno_unsubscribe / starknet_unsubscribe
@rianhughes rianhughes added the RPC JSON RPC API label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Good for newcomers Refactor RPC JSON RPC API
Projects
None yet
Development

No branches or pull requests

3 participants