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

refactor: Reuse v6 starknet_getTransactionByHash handler for v7 #2486

Merged
merged 9 commits into from
Mar 6, 2025

Conversation

hudem1
Copy link
Contributor

@hudem1 hudem1 commented Feb 14, 2025

rpc pkg cleanup according to issue #2437

  • for v6: Updated handler code to take into account pending block as well.

  • for v7: Reuse v6 handler for v7 as the logic is the same.

  • for v8: The logic is the same as v6/v7, but not exactly the returned Transaction type (more particularly, Resource type inside Transaction type). Therefore, we cannot refactor v8's types or logic

@hudem1 hudem1 mentioned this pull request Feb 14, 2025
23 tasks
Copy link
Contributor

@AnkushinDaniil AnkushinDaniil left a comment

Choose a reason for hiding this comment

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

We should also be handling the pending block in v6 in the same way. As far as I know, this difference happened because the old code for v6 was copied in #2419 . You can use the same code from v7 and continue refactoring.

Copy link

codecov bot commented Feb 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.66%. Comparing base (4d16137) to head (c1d66a0).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2486      +/-   ##
==========================================
+ Coverage   74.21%   74.66%   +0.44%     
==========================================
  Files         138      139       +1     
  Lines       16844    16726     -118     
==========================================
- Hits        12501    12488      -13     
+ Misses       3488     3404      -84     
+ Partials      855      834      -21     

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

@hudem1
Copy link
Contributor Author

hudem1 commented Feb 17, 2025

We should also be handling the pending block in v6 in the same way. As far as I know, this difference happened because the old code for v6 was copied in #2419 . You can use the same code from v7 and continue refactoring.

Ah yes indeed, good catch! I updated v6 code, and I could then reuse v6 handler for v7.

@hudem1 hudem1 changed the title fix: Distinguish between ErrTxnHashNotFound and ErrInternal refactor: Reuse v6 starknet_getTransactionByHash handler for v7 Feb 20, 2025
@rianhughes rianhughes self-requested a review February 24, 2025 14:29
})
}

// Convert a v6 transaction object to a v7 transaction object
func AdaptV6TxToV7(t *testing.T, tx *rpcv6.Transaction) *rpc.Transaction {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can un-export this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link

Choose a reason for hiding this comment

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

Transfer coins Ethereum

Copy link
Contributor

@rianhughes rianhughes left a comment

Choose a reason for hiding this comment

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

Just need to un-export AdaptV6TxToV7 and then it looks good to me

@rodrigo-pino rodrigo-pino merged commit a7dbcb8 into main Mar 6, 2025
18 of 19 checks passed
@rodrigo-pino rodrigo-pino deleted the hudem1/rpc-cleanup-getTransactionByHash branch March 6, 2025 17:20
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.

5 participants