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

feat: support deterministic proxy contract deployment transaction (#2287) #2393

Merged
merged 2 commits into from
Apr 24, 2024

Conversation

quiet-node
Copy link
Collaborator

@quiet-node quiet-node commented Apr 23, 2024

Description:
This PR adds support for the deterministic proxy contract deployment transaction by incorporating a utility function capable of identifying whether a signed transaction corresponds to the deterministic proxy contract deployment transaction. Upon recognition of such a transaction, it will skip the gasPrice precheck and proceed with submission to the network. In addition to this feature, unit tests, integration and e2e tests have been included to ensure the correct behavior.

*Notice: Currently, the hedera-local package is at its most recent version and exclusively supports the NETWORK_NODE_IMAGE_TAG up to 0.49.0-alpha.3. However, the deterministic proxy contract deployment transaction feature is supported in the services at tag 0.49.0-alpha.5. Consequently, ABI Batch 1 and Websocket Batch 2 CI tasks are configured with networkTag set to 0.49.1, which is the latest official services version encompassing 0.49.0-alpha.5. Nonetheless, in the near future, when hedera-local updates the NETWORK_NODE_IMAGE_TAG to a version supporting the deterministic deployment transaction, these configurations will be deprecated and removed. This ticket is established to monitor this transition.

Related issue(s):

Fixes #2287

Notes for reviewer:

Checklist

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

Copy link

github-actions bot commented Apr 23, 2024

Tests

    2 files  147 suites   13s ⏱️
818 tests 817 ✔️ 1 💤 0
830 runs  829 ✔️ 1 💤 0

Results for commit ee91eae.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 23, 2024

Acceptance Tests

     28 files     358 suites   34m 27s ⏱️
   585 tests    577 ✔️ 3 💤   5
1 603 runs  1 575 ✔️ 9 💤 19

Results for commit ee91eae.

♻️ This comment has been updated with latest results.

@quiet-node quiet-node force-pushed the 2287-foundry-create2-deterministic-support branch from 1265fcf to ef15012 Compare April 23, 2024 20:24
…action

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
@quiet-node quiet-node force-pushed the 2287-foundry-create2-deterministic-support branch from cf0456e to 539e674 Compare April 24, 2024 00:23
@quiet-node quiet-node changed the title feat: support deterministic deployment proxy contract transaction (#2287) feat: support deterministic proxy contract deployment transaction (#2287) Apr 24, 2024
@@ -175,4 +175,10 @@ export default {
NEW_HEADS: 'newHeads',
NEW_PENDING_TRANSACTIONS: 'newPendingTransactions',
},

// @source: Foundry related constants below can be found at https://github.com/Arachnid/deterministic-deployment-proxy?tab=readme-ov-file#latest-outputs
Copy link
Member

Choose a reason for hiding this comment

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

I think we want to remove references to "Foundry" as this can be relevant to others.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah thanks for the good catch! Hmm I did try to make sure that I remove all the references to Foundry but welp missing that one! Pushing the fix in soon!

);
const result = precheck.gasPrice(
parsedDeterministicDeploymentTransaction,
100 * constants.TINYBAR_TO_WEIBAR_COEF,
Copy link
Member

Choose a reason for hiding this comment

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

would this test be more meaningful of the gasPrice were a low number like 0 or 1 tinyBar?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm my understanding for this case is this. The 100 * constants.TINYBAR_TO_WEIBAR_COEF (100 hbars) arg right there is the minimum gasPrice to compared against the parsedDeterministicDeploymentTransaction.gasPrice (10 hbars).

The comparing condition is

const passes = txGasPrice >= minGasPrice || Precheck.isDeterministicDeploymentTransaction(tx);

in which, txGasPrice = parsedDeterministicDeploymentTransaction.gasPrice (10 hbars), and minGasPrice = 100 * constants.TINYBAR_TO_WEIBAR_COEF (100 hbars).

So if the minGasPrice is set to 0 or 1, then the condition txGasPrice >= minGasPrice (10 >= 1) will be true, and regardless the outcome of the Precheck.isDeterministicDeploymentTransaction(tx); this passes will be true.

But if the minGasPrice is set to be greater than 10, then the condition txGasPrice >= minGasPrice (10 >= 100) will be false -> now this condition will rely on the outcome of the Precheck.isDeterministicDeploymentTransaction(tx); function -> and because it's the deterministic deployment the outcome will be true -> the passes will be true.

More, isn't the whole purpose of this feature is to bypass deterministic deployment when its gasPrice (10hbar) is too low compared to network's gasPrice (minimum is 71 hbars for localnet)?

Copy link
Member

Choose a reason for hiding this comment

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

Ah makes sense. I was incorrect in the way that the parameter was used.

Copy link
Member

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

Looks good. Just a comment or two

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Copy link

sonarcloud bot commented Apr 24, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.5% Duplication on New Code

See analysis details on SonarCloud

Copy link
Collaborator

@AlfredoG87 AlfredoG87 left a comment

Choose a reason for hiding this comment

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

LGTM, just resolve @lukelee-sl suggestions before merging.

Copy link
Member

@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

@quiet-node quiet-node merged commit 0390cbb into main Apr 24, 2024
29 of 33 checks passed
@quiet-node quiet-node deleted the 2287-foundry-create2-deterministic-support branch April 24, 2024 17:19
quiet-node added a commit that referenced this pull request Apr 24, 2024
) (#2393)

* feat: supported foundry deterministic deployment proxy contract transaction

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

* fix: removed Foundry reference

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

---------

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
quiet-node added a commit that referenced this pull request Apr 24, 2024
) (#2393)

* feat: supported foundry deterministic deployment proxy contract transaction

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

* fix: removed Foundry reference

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

---------

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
quiet-node added a commit that referenced this pull request Apr 24, 2024
) (#2393)

* feat: supported foundry deterministic deployment proxy contract transaction

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

* fix: removed Foundry reference

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

---------

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
quiet-node added a commit that referenced this pull request Apr 25, 2024
) (#2393)

* feat: supported foundry deterministic deployment proxy contract transaction

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

* fix: removed Foundry reference

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

---------

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Nana-EC pushed a commit that referenced this pull request Apr 25, 2024
* test: broke websocket acceptancetest CI task into smaller separate batches (#2382) (#2401)

test: divided ws-server total acceptancetest into batches (#2382)

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

* feat: support deterministic proxy contract deployment transaction (#2287) (#2393)

* feat: supported foundry deterministic deployment proxy contract transaction

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

* fix: removed Foundry reference

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

---------

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

* pkg: bumped hedera-local to 2.23.0

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>

---------

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Foundry Create2 Support
3 participants