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

Split Transaction Gas Calculation from EVM Calculation #2659

Merged
merged 8 commits into from
Aug 19, 2021

Conversation

shemnon
Copy link
Contributor

@shemnon shemnon commented Aug 18, 2021

In preparation for the EVM library pull out the transaction related gas
calculations and move them into their own TransactionGasCalculator.

This has 4 calls right now, none of which occur inside the EVM:

  • Intrinsic gas cost
  • Code Deposit gas cost
  • Max refund quotient
  • Max Privacy Marker Transaction intrinsic gas cost.

Signed-off-by: Danno Ferrin danno.ferrin@gmail.com

Changelog

In preparation for the EVM library pull out the transaction related gas
calculations and move them into their own `TransactionGasCalculator.`

This has 4 calls right now, none of which occur inside the EVM:
* Intrinsic gas cost
* Code Deposit gas cost
* Max refund quotient
* Max Privacy Marker Transaction intrinsic gas cost.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
*
* <ul>
* <li><b>Operation Gas Deductions:</b> Deducting the operation's gas cost from the VM's current
* message frame because the
Copy link
Contributor

Choose a reason for hiding this comment

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

finish sentence

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That incomplete sentence dates back to Pantheon code. But because I touched it I get to fix it ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

It's only fair.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

public interface TransactionGasCalculator {

/**
* Returns a {@link Transaction}s intrinsic gas cost, i.e. the cost deriving from it's encoded
Copy link
Contributor

Choose a reason for hiding this comment

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

typo it's

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

/**
* Provides various gas cost lookups and calculations used during block processing.
*
* <p>The {@code GasCalculator} is meant to encapsulate all {@link Gas}-related calculations except
Copy link
Member

Choose a reason for hiding this comment

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

s/GasCalculator/TransactionGasCalculator

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
New files should conform to the Hyperledger Copyright and License policy

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Copy link
Contributor

@garyschulte garyschulte 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 minor bit of copypasta in javadoc

garyschulte and others added 3 commits August 19, 2021 11:30
Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
…nsactionGasCalc

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

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

🚢

@shemnon shemnon merged commit f9b17cf into hyperledger:main Aug 19, 2021
@shemnon
Copy link
Contributor Author

shemnon commented Aug 19, 2021

Thanks Gary.

@shemnon shemnon deleted the transactionGasCalc branch February 26, 2022 18:42
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
)

In preparation for the EVM library pull out the transaction related gas
calculations and move them into their own `TransactionGasCalculator.`

This has 4 calls right now, none of which occur inside the EVM:
* Intrinsic gas cost
* Code Deposit gas cost
* Max refund quotient
* Max Privacy Marker Transaction intrinsic gas cost.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
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.

4 participants