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

Invalid gas computation/fork block in checkOutEternalGas #1745

Closed
dimalit opened this issue Dec 7, 2023 · 2 comments · Fixed by #1768, #1781 or #1782
Closed

Invalid gas computation/fork block in checkOutEternalGas #1745

dimalit opened this issue Dec 7, 2023 · 2 comments · Fixed by #1768, #1781 or #1782
Assignees
Labels
bug Something isn't working epic:eth-compatibility
Milestone

Comments

@dimalit
Copy link
Contributor

dimalit commented Dec 7, 2023

checkOutEternalGas uses Constantinople:
if ( externalGas >= baseGasRequired( ConstantinopleSchedule ) ) (libethereum/Transaction.cpp:193)

This can lead to rejection of PoW transactions with enough, but not that many gas.

For example, transaction with 50kb of data would actually require 800k of gas, but PoW mechanism will reject it if supplied less than 3.6M gas.
See also #1600

This will need to be done as a patch so the state roots do not diverge

@DmytroNazarenko DmytroNazarenko added this to the SKALE 2.3 milestone Dec 7, 2023
@DmytroNazarenko DmytroNazarenko added bug Something isn't working epic:eth-compatibility labels Dec 7, 2023
@DmytroNazarenko DmytroNazarenko moved this to Ready For Pickup in SKALE Engineering 🚀 Dec 7, 2023
@dimalit dimalit moved this from Ready For Pickup to In Progress in SKALE Engineering 🚀 Dec 12, 2023
@dimalit dimalit moved this from In Progress to To Do in SKALE Engineering 🚀 Dec 12, 2023
@dimalit dimalit moved this from To Do to Code Review in SKALE Engineering 🚀 Dec 14, 2023
@dimalit dimalit moved this from Code Review to To Do in SKALE Engineering 🚀 Dec 14, 2023
@dimalit dimalit moved this from To Do to Ready For Pickup in SKALE Engineering 🚀 Dec 14, 2023
@dimalit dimalit moved this from Ready For Pickup to In Progress in SKALE Engineering 🚀 Dec 14, 2023
@dimalit dimalit linked a pull request Dec 19, 2023 that will close this issue
@PolinaKiporenko PolinaKiporenko moved this from In Progress to Code Review in SKALE Engineering 🚀 Dec 21, 2023
@DmytroNazarenko DmytroNazarenko linked a pull request Jan 10, 2024 that will close this issue
@DmytroNazarenko DmytroNazarenko moved this from Code Review to In Progress in SKALE Engineering 🚀 Jan 10, 2024
@PolinaKiporenko PolinaKiporenko moved this from In Progress to Code Review in SKALE Engineering 🚀 Jan 12, 2024
@dimalit dimalit moved this from Code Review to Ready For Release Candidate in SKALE Engineering 🚀 Jan 15, 2024
@DmytroNazarenko
Copy link
Collaborator

skaled: 3.18.0-beta.0
patch: correctForkInPowPatchTimestamp

@DmytroNazarenko DmytroNazarenko moved this from Ready For Release Candidate to Merged To Release Candidate in SKALE Engineering 🚀 Jan 23, 2024
@EvgeniyZZ EvgeniyZZ moved this from Merged To Release Candidate to QA in SKALE Engineering 🚀 Jan 23, 2024
@oleksandrSydorenkoJ
Copy link

Verified on Regression network
Skale chain: aged-wry-finished-skale
skaled: 3.18.0-beta.0
patch: correctForkInPowPatchTimestamp

example TX

    const tx = {
        from: addressFrom,
        to: addressTo,
        chainId: "0x57fe5f2b",
        value: web3.utils.toWei('100', 'ether'),
        data: "0x000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000358663930636138303438323031366238333031383661303934383866643565303130373836323963633139346339333364393633316239343420202020202020202020202020203866653130623164383062393063343437643933303139623030303030333063656537393338653965626132653931323131623738623332396532363220202020202020202020202020206639306361383034383230313662383330313836613039343838666435653031303738363239636331393463393333643936333162393434202020202020202020202020202038666531306231643830623930633434376439333031396230303030303330636565373933386539656261326539313231316237386233323965323632202020202020202020202020202066393063613830343832303136623833303138366130393438386664356530313037383632396363313934633933336439363331623934342020202020202020202020202020386665313062316438306239306334343764393330313962303030303033306365653739333865396562613265393132313162373862333239653236322020202020202020202020202020663930636138303438323031366238333031383661303934383866643565303130373836323963633139346339333364393633316239343420202020202020202020202020203866653130623164383062393063343437643933303139623030303030333063656537393338653965626132653931323131623738623332396532363220202020202020202020202020206639306361383034383230313662383330313836613039343838666435653031303738363239636331393463393333643936333162393434202020202020202020202020202038666531306231643830623930633434376439333031396230303030303330636565373933386539656261326539313231316237386233323965323632202020202020202020202020202066393063613830343832303136623833303138366130393438386664356530313037383632396363313934633933336439363331623934342020202020202020202020202020386665313062316438306239306334343764393330313962303030303033306365653739333865396562613265393132313162373862333239653236320000000000000000",
        nonce: await web3.eth.getTransactionCount(addressFrom)
    };

before patch

tx 1
Estimate free gas:  35160
> eth.getTransactionReceipt('0x8856eca253b7f2d0ff2dc2256f6ed5e4c1063615e04a6d83f2e93daf2b5bf546')
null
tx 2
Estimate free gas:  79880
> eth.getTransactionReceipt('0xacc223c3f8b1e7474d7443e408a75e8d07540cd9734da6126b2edbb83ebb5be5')
{
  blockHash: "0xc6d83654d36288c4dd7dd9338bd1341bfd37a67fb5dcc854f00dca9d0658ad34",
  blockNumber: 42275,
  contractAddress: null,
  cumulativeGasUsed: 35160,
  from: "0x71cbe3fede33905d4d1bf2bd51f9d4a62375e659",
  gasUsed: 35160,
  logs: [],
  logsBloom: "0x0...0"
 status: "0x1",
  to: "0x88fd5e01078629cc194c933d9631b9448fe10b1d",
  transactionHash: "0xacc223c3f8b1e7474d7443e408a75e8d07540cd9734da6126b2edbb83ebb5be5",
  transactionIndex: 0
}

after patch timestamp

Estimate free gas:  35160

> eth.getTransactionReceipt('0x8856eca253b7f2d0ff2dc2256f6ed5e4c1063615e04a6d83f2e93daf2b5bf546')
{
  blockHash: "0xca5eed7d135b7ff6ad0c41ef421c5762b2df65dd55a378bc8718b221ac156096",
  blockNumber: 42272,
  contractAddress: null,
  cumulativeGasUsed: 35160,
  from: "0x71cbe3fede33905d4d1bf2bd51f9d4a62375e659",
  gasUsed: 35160,
  logs: [],
  logsBloom: "0x0..0",
  status: "0x1",
  to: "0x88fd5e01078629cc194c933d9631b9448fe10b1d",
  transactionHash: "0x8856eca253b7f2d0ff2dc2256f6ed5e4c1063615e04a6d83f2e93daf2b5bf546",
  transactionIndex: 0
}

Estimate free gas:  79880
> eth.getTransactionReceipt('0xacc223c3f8b1e7474d7443e408a75e8d07540cd9734da6126b2edbb83ebb5be5')
{
  blockHash: "0x55ee63ec1f17a7e3d37e8de8d59706ccdd9cf919cdcadc93da590bcbf7ee8624",
  blockNumber: 42275,
  contractAddress: null,
  cumulativeGasUsed: 35160,
  from: "0x71cbe3fede33905d4d1bf2bd51f9d4a62375e659",
  gasUsed: 35160,
  logs: [],
  logsBloom: "0x0..0",
  status: "0x1",
  to: "0x88fd5e01078629cc194c933d9631b9448fe10b1d",
  transactionHash: "0xacc223c3f8b1e7474d7443e408a75e8d07540cd9734da6126b2edbb83ebb5be5",
  transactionIndex: 0
}

@EvgeniyZZ EvgeniyZZ moved this from QA to Done in SKALE Engineering 🚀 Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment