-
Notifications
You must be signed in to change notification settings - Fork 68
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
fix: resolved evm addresses for from
and to
addresses in returned transactions
#2185
fix: resolved evm addresses for from
and to
addresses in returned transactions
#2185
Conversation
applied to eth_getBlockByNumber, eth_getBlockByHash Signed-off-by: Logan Nguyen <[email protected]>
…ethod Signed-off-by: Logan Nguyen <[email protected]>
… method Signed-off-by: Logan Nguyen <[email protected]>
Signed-off-by: Logan Nguyen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions for consideration
…sactionByBlockNumberAndIndex into a shared method Signed-off-by: Logan Nguyen <[email protected]>
…s values if null from Mirror Node Signed-off-by: Logan Nguyen <[email protected]>
d8b2159
to
9a3e1ab
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2185 +/- ##
=======================================
Coverage 75.15% 75.15%
=======================================
Files 13 13
Lines 644 644
Branches 118 118
=======================================
Hits 484 484
Misses 115 115
Partials 45 45 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more suggestions
const fromAccountInfo = await mirrorNode.get(`/accounts/${tx.from}`); | ||
const toAccountInfo = await mirrorNode.get(`/accounts/${tx.to}`); | ||
|
||
if (fromAccountInfo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can simplify
if (fromAccountInfo) { | |
if (fromAccountInfo?.evmAddress) { | |
tx.from = fromAccountInfo.evm_address; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed in the fix
@@ -61,6 +61,21 @@ describe('@api-batch-1 RPC Server Acceptance Tests', function () { | |||
const ONE_TINYBAR = Utils.add0xPrefix(Utils.toHex(Constants.TINYBAR_TO_WEIBAR_COEF)); | |||
const sendRawTransaction = relay.sendRawTransaction; | |||
|
|||
const resolveEvmAddress = async (tx: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const resolveEvmAddress = async (tx: any) => { | |
const resolveAccountEvmAddresses = async (tx: any) => { |
or
const resolveEvmAddress = async (tx: any) => { | |
const extractAccountEvmAddresses = async (tx: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed in the fix
@@ -61,6 +61,21 @@ describe('@api-batch-1 RPC Server Acceptance Tests', function () { | |||
const ONE_TINYBAR = Utils.add0xPrefix(Utils.toHex(Constants.TINYBAR_TO_WEIBAR_COEF)); | |||
const sendRawTransaction = relay.sendRawTransaction; | |||
|
|||
const resolveEvmAddress = async (tx: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments on the function to explain behaviour and function signature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed in the fix
Signed-off-by: Logan Nguyen <[email protected]>
Quality Gate passedIssues Measures |
Description:
resolved long zero addresses to EVM addresses for the following RPC endpoints:
eth_getTransactionByBlockHashAndIndex
eth_getTransactionByBlockNumberAndIndex
eth_getBlockByHash
eth_getBlockByNumber
fixed unit tests where necessary
Related issue(s):
Fixes #2128
Notes for reviewer:
Checklist