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

Zero Cost EthereumTransaction on Success #1084

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Nana-EC
Copy link
Contributor

@Nana-EC Nana-EC commented Nov 20, 2024

Description:
On many EVM chains execution costs are fully captured in gas. Thus submitting transactions to execution nodes bears no
cost to the relay node. On Hedera it is necessary to charge a fee for EthereumTransaction HAPI submissions (just like
all other HAPI transactions).

This HIP suggests the network logic not charge successful EthereumTransaction submissions, but instead only charge the
regular HAPI fee for badly formed transactions.

Related issue(s):

Fixes #1083

Notes for reviewer:

Checklist

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

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
@Nana-EC Nana-EC self-assigned this Nov 20, 2024
Copy link

netlify bot commented Nov 20, 2024

Deploy Preview for hedera-hips ready!

Name Link
🔨 Latest commit bf07111
🔍 Latest deploy log https://app.netlify.com/sites/hedera-hips/deploys/67610904480e8a0007ecb169
😎 Deploy Preview https://deploy-preview-1084--hedera-hips.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
@Neurone
Copy link
Contributor

Neurone commented Nov 20, 2024

on Success
[...]
2. As a relay operator I will pay the HAPI transaction fee for EthereumTransaction submissions that fail.

I think referring to success/failure can be misleading in the HIP's title and description. I suggest using something like well-formed, formally valid, etc.

  • If the EthereumTransaction succeeds, do not charge the AccountId submitter
  • If the EthereumTransaction fails, charge the AccountId submitter

I recommend dropping the success/failure wording and clearly stating the list of results for which the submitter will be charged $0.0001 (e.g., WRONG_NONCE, INVALID_SIGNATURE, etc.).

Any results not in the list above will be free for the submitter, whether it's an EVM error or not (e.g., CONTRACT_REVERT_EXECUTED, SUCCESS, etc.).

Nana-EC and others added 4 commits November 20, 2024 13:17
Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
Changes for clarity and list of examples
Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
@rbair23
Copy link
Member

rbair23 commented Nov 20, 2024

@Neurone I agree, the text has been updated, but I think it would benefit from being even more precise.

Comment on lines +69 to +73
- The `relay` is charged if the `evm tx` cannot be parsed or is otherwise malformed
- The `relay` is charged if the `EOA` specified in the `evm tx` refers to a non-existent account
- The `relay` is charged if the `evm tx` was not properly signed by the keys of the `EOA`
- The `relay` is charged if the `EOA` has insufficient funds to pay the intrinsic gas fee
- The `relay` is charged if the `nonce` check fails
Copy link
Member

@quiet-node quiet-node Nov 21, 2024

Choose a reason for hiding this comment

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

This indeed highlights a list of prechecks performed by the Relay to validate transactions and reject them if any conditions are met, ensuring they are not forwarded to the network unnecessarily, thus avoiding charges. Notably, the Hedera JSON-RPC Relay already handles and rejects these scenarios. However, there are additional prechecks currently performed by the Relay that are not mentioned here:

  • Transaction type
  • Gas price
  • Gas limit
  • Chain ID
  • Value
  • calldata size (not exceed 128KB maximum)

I recommend considering these prechecks and including them in this HIP for greater clarity and completeness.

Copy link
Member

Choose a reason for hiding this comment

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

I agree, thank you @quiet-node! Can you please reply to this comment with a suggested replacement (you can click the icon of a document with the + and - signs within it to offer a suggestion) and we will get it applied to the HIP text.

Copy link
Contributor

Choose a reason for hiding this comment

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

If a precheck is performed by the Relay, doesn't this mean that if it fails, the Relay will never send a transaction to a Hedera node, meaning the relay account can never be charged for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct.
A relay will only submit to a CN a transaction that passes it's prechecks.
If it fails it is in the best interest of the relay to not submit to a CN otherwise it will be charged.

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
@Nana-EC
Copy link
Contributor Author

Nana-EC commented Dec 7, 2024

@Neurone added an explicit clarification of response codes.
For not it's probably better to not the cases for which no charge to the relay account is made.
Listing the cases where it will may be lengthy and that list may grow over time, but the non charged cases are less likely to grow

@Neurone
Copy link
Contributor

Neurone commented Dec 9, 2024

Hi Nana, good. Listing the cases for which the operator is not charged is perfectly fine and clear, thanks.

HIP/hip-1084.md Outdated
Comment on lines 35 to 42
On Ethereum, all execution costs are paid for by the 'sender' who created, signed, and submitted the transaction. Hedera
follows a similar approach for all `ContractCallTransaction`s but also charges an additional fee for each
`EthereumTransaction` submitted via JSON-RPC relays. This fee serves as a defense against a malicious JSON-RPC relay that
might send malformed transactions to the network, where there would be no one to pay for the processing of those transactions.
This fee is unnecessary for successful transactions since the intrinsic gas fee covers the base costs (gossip & consensus).
Therefore, this HIP proposes that the fee for submitting `EthereumTransactions` to the network should only be charged if the
JSON-RPC relay submits a transaction that fails due diligence checks, such that the EOA cannot be charged for the overhead
of gossip and consensus.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
On Ethereum, all execution costs are paid for by the 'sender' who created, signed, and submitted the transaction. Hedera
follows a similar approach for all `ContractCallTransaction`s but also charges an additional fee for each
`EthereumTransaction` submitted via JSON-RPC relays. This fee serves as a defense against a malicious JSON-RPC relay that
might send malformed transactions to the network, where there would be no one to pay for the processing of those transactions.
This fee is unnecessary for successful transactions since the intrinsic gas fee covers the base costs (gossip & consensus).
Therefore, this HIP proposes that the fee for submitting `EthereumTransactions` to the network should only be charged if the
JSON-RPC relay submits a transaction that fails due diligence checks, such that the EOA cannot be charged for the overhead
of gossip and consensus.
On Ethereum, all execution costs are paid for by the 'sender' who created, signed, and submitted the transaction.
Hedera follows a similar approach for `ContractCallTransaction`s. However, Hedera charges an additional fee for
each `EthereumTransaction` submitted via JSON-RPC relays. This fee serves as a defense against a malicious
JSON-RPC relay that might send malformed transactions to the network, where there would be no one to pay for
the processing of those transactions.
This fee is unnecessary for successful transactions since the intrinsic gas fee covers the base costs (gossip &
consensus). Therefore, this HIP proposes that the fee for submitting `EthereumTransactions` to the network
should only be charged if the JSON-RPC relay submits a transaction that fails due diligence checks, such that the
EOA cannot be charged for the overhead of gossip and consensus.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes applied

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

6 participants