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: Implement MirrorNodeContractQuery #2073

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

0xivanov
Copy link
Contributor

@0xivanov 0xivanov commented Nov 11, 2024

Description:
A new MirrorNodeContractQuery is added to support EVM gas estimation and simulation. The inputs should match that of ContractExecuteTransaction as devs will be looking to calculate the cost of a follow up transaction.

This query issues an api/v1/contracts/call to the mirror node web3 module that support estimate and simulation of state changing transactions.

Related issue(s):

Fixes #2076

Notes for reviewer:

Checklist

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

Signed-off-by: Ivan Ivanov <[email protected]>
@0xivanov 0xivanov self-assigned this Nov 11, 2024
Signed-off-by: Ivan Ivanov <[email protected]>
Signed-off-by: Ivan Ivanov <[email protected]>
Signed-off-by: Ivan Ivanov <[email protected]>
@0xivanov 0xivanov changed the title feat(wip): Implement MirrorNodeContractQuery feat: Implement MirrorNodeContractQuery Nov 12, 2024
Copy link

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

Nice start.
Missing some fields.
Also you might be able to leverage some Mirror Node web3 module tests as references of example calls.
@kselveliev should be able to help

String hexData = Hex.toHexString(data);
return String.format("""
{
"data": "%s",
Copy link

Choose a reason for hiding this comment

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

Also missing from
Note from is also optional in the case we're simulating a contract create flow in which the data contains contract bytecode

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

@0xivanov 0xivanov marked this pull request as ready for review November 14, 2024 11:55
@0xivanov 0xivanov requested a review from a team as a code owner November 14, 2024 11:55
Signed-off-by: Ivan Ivanov <[email protected]>
@0xivanov 0xivanov requested review from a team as code owners November 14, 2024 12:33
.execute(testEnv.client);

var contractId = Objects.requireNonNull(response.getReceipt(testEnv.client).contractId);

Choose a reason for hiding this comment

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

Write a comment why we do this

@@ -40,7 +42,7 @@
/**
* Utility class used internally by the sdk.
*/
class EntityIdHelper {
public class EntityIdHelper {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note:
Made this class public in order to access it from the tests, changed most public methods to package private

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.

Implement MirrorNodeContractQuery
3 participants