Skip to content

Conversation

@natanasow
Copy link
Member

Signed-off-by: nikolay [email protected]

Description:

The basic transfer needs 21k gas but hollow account creation needs 587k gas

Related issue(s):

Fixes #

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@natanasow natanasow marked this pull request as draft January 26, 2023 12:15
Nana-EC
Nana-EC previously approved these changes Jan 26, 2023
Copy link
Contributor

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

LG.
Do the current images support testing this E2E in an acceptance test?
If so let's add one for hollow account creation when the appropriate gas for account creation is provided in a transfer transaction

@georgi-l95
Copy link
Member

Yes, the current image support is allowing us to write some E2E tests. I think it's a good idea.

@codecov-commenter
Copy link

Codecov Report

Base: 73.76% // Head: 73.79% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (f059b8a) compared to base (0ed591b).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head f059b8a differs from pull request most recent head 319b26b. Consider uploading reports for the commit 319b26b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #844      +/-   ##
==========================================
+ Coverage   73.76%   73.79%   +0.02%     
==========================================
  Files          29       29              
  Lines        1776     1778       +2     
  Branches      324      325       +1     
==========================================
+ Hits         1310     1312       +2     
  Misses        372      372              
  Partials       94       94              
Impacted Files Coverage Δ
packages/relay/src/lib/constants.ts 100.00% <ø> (ø)
packages/relay/src/lib/eth.ts 82.26% <100.00%> (+0.06%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@natanasow natanasow requested a review from Nana-EC January 26, 2023 17:26
lukelee-sl
lukelee-sl previously approved these changes Jan 26, 2023
@lukelee-sl
Copy link
Contributor

My guess is that there is a small chance of a race condition where we will give the wrong gas estimate for a toAccount that is being create.

Copy link
Contributor

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

LG. You can take this out of draft.
Minor nits

@Nana-EC Nana-EC added enhancement New feature or request limechain P1 labels Jan 28, 2023
@Nana-EC Nana-EC added this to the 0.17.0 milestone Jan 28, 2023
@Nana-EC
Copy link
Contributor

Nana-EC commented Jan 28, 2023

My guess is that there is a small chance of a race condition where we will give the wrong gas estimate for a toAccount that is being create.

Should be fine as network will charge the lower gas amount if the it determines the account is existent by the time one of the relay submitted accounts hits the network.

natanasow and others added 4 commits January 30, 2023 18:04
Signed-off-by: nikolay <[email protected]>
Signed-off-by: nikolay <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>
@georgi-l95 georgi-l95 force-pushed the fix-estimateGas-for-hollow-account-creation branch from 319b26b to 1ef2a60 Compare January 30, 2023 16:15
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@georgi-l95 georgi-l95 marked this pull request as ready for review January 30, 2023 16:36
@Nana-EC Nana-EC modified the milestones: 0.17.0, 0.18.0 Jan 30, 2023
Copy link
Contributor

@lukelee-sl lukelee-sl left a comment

Choose a reason for hiding this comment

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

LGTM

@lukelee-sl lukelee-sl modified the milestones: 0.18.0, 0.17.0 Jan 30, 2023
@Nana-EC Nana-EC merged commit 9b23b7b into main Jan 30, 2023
@Nana-EC Nana-EC deleted the fix-estimateGas-for-hollow-account-creation branch January 30, 2023 20:02
Nana-EC pushed a commit that referenced this pull request Jan 30, 2023
Hollow account creation requires an accurate gas amount response

- add a `TX_HOLLOW_ACCOUNT_CREATION_GAS` to capture the necessary gas amount
- Update `eth_estimateGas` to check in the case of a transfer transaction if the recipient exists or not. If so return update gas, if not default to current flow
- Update unit and acceptance tests


Signed-off-by: nikolay <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>
Co-authored-by: georgi-l95 <[email protected]>
Nana-EC pushed a commit that referenced this pull request Jan 30, 2023
Hollow account creation requires an accurate gas amount response

- add a `TX_HOLLOW_ACCOUNT_CREATION_GAS` to capture the necessary gas amount
- Update `eth_estimateGas` to check in the case of a transfer transaction if the recipient exists or not. If so return update gas, if not default to current flow
- Update unit and acceptance tests

Signed-off-by: nikolay <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>
Co-authored-by: georgi-l95 <[email protected]>
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
Nana-EC added a commit that referenced this pull request Jan 30, 2023
Hollow account creation requires an accurate gas amount response

- add a `TX_HOLLOW_ACCOUNT_CREATION_GAS` to capture the necessary gas amount
- Update `eth_estimateGas` to check in the case of a transfer transaction if the recipient exists or not. If so return update gas, if not default to current flow
- Update unit and acceptance tests

Signed-off-by: nikolay <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
Co-authored-by: Nikolay Atanasow <[email protected]>
Co-authored-by: georgi-l95 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request limechain P1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants