Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Fix the gas limit of privacy marker transaction #66

Closed
MadelineMurray opened this issue Mar 17, 2020 · 2 comments
Closed

Fix the gas limit of privacy marker transaction #66

MadelineMurray opened this issue Mar 17, 2020 · 2 comments
Labels
bug Something isn't working P3 Medium privacy TeamRevenant

Comments

@MadelineMurray
Copy link
Contributor

The public transaction gas usage is calculated in the following way:

Gas usage = TX_BASE_COST + (TX_DATA_ZERO * NO_OF_ZEROS) + (TX_DATA_NON_ZERO * NO_OF_NON_ZEROS)

where,

TX_BASE_COST = 21000
TX_DATA_ZERO = 4
NO_OF_ZEROS = number of "00" in the hex payload of the transaction
TX_DATA_NON_ZERO = 68 pre-istanbul / 16 post-istanbul (as in istanbul hard fork)
NO_OF_NON_ZEROS = number of non-"00" in the hex payload of the transaction i.e. number of pairs in the hex that are not "00"

The PMT has 32 bytes of non-zero hex. It therefore consumes:

Gas usage of PMT = 21000 + (4 * 0) + (68 * 32) = 21000 + 2176 = 23176

Post-Instanbul the PMT will consume:

Gas usage of PMT post-istanbul = 21000 + (4 * 0) + (16 * 32) = 21000 + 512 = 21512

Invoking the Privacy Precompiled Contract consumes 0 gas.

More info: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2028.md

Comments from the original JI https://jira.hyperledger.org/browse/BESU-75:

Madeline Murray - Need to confirm where the extra 2992 is coming from

Madeline Murray - Document where extra gas is coming from.

Also update in Besu and web3js, and web3j

Ivaylo Kirilov September 16, 20the changes required in Besu are documentation related only

Ivaylo Kirilov September 17, 2019, 12:14 AM

fixed in web3j - hyperledger/web3j#1029

@MadelineMurray MadelineMurray added the bug Something isn't working label Mar 24, 2020
@MadelineMurray
Copy link
Contributor Author

Investigate and confirm if changes still needed here.

@MadelineMurray MadelineMurray added the P3 Medium label Jun 14, 2020
@MadelineMurray
Copy link
Contributor Author

Is this change also needed in web3js-eea? Or has it been addressed somewhere along the way?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working P3 Medium privacy TeamRevenant
Projects
None yet
Development

No branches or pull requests

2 participants