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

Pallet ethereum does not write transactions that revert to its Pending storage item #178

Closed
JoshOrndorff opened this issue Oct 29, 2020 · 1 comment · Fixed by #188
Closed

Comments

@JoshOrndorff
Copy link
Contributor

When pallet ethereum executes Ethereum transactions submitted to its transact extrinsic, the correct flow is as follows.

Execute the transaction against the EVM,
Insert the transaction hash along with its receipt and status in the Pending item
On block finalization, include the transaction hash in the EndBlock digest
On block import write the transaction metadata to aux storage.

But when transactions revert, they are never inserted into the Pending storage item, and the rest of the flow is skipped. From an end user perspective, this means I cannot query for transaction receipts for reverted transactions.

The problem is that the transact function returns early when a revert happens thanks to the ? on this line https://github.com/paritytech/frontier/blob/bb79f231ea5d3785d9f543aa9d9a4454cf5b59b1/frame/ethereum/src/lib.rs#L169-L177

As a concrete test case, I've been using this simple contract deploy which will always fail

pragma solidity >=0.4.22 <0.7.0;

contract WillFail {
    constructor() public {
        require(2 == 1);
    }
}
@JoshOrndorff
Copy link
Contributor Author

JoshOrndorff commented Oct 30, 2020

Deploying the same contract against ganache gives me this transaction receipt:

{
    transactionHash: '0xacae1f7c00b20a1f625181cb787fd9e5e38c5899ec5e58fad4ffb58670eedae7',
    transactionIndex: 0,
    blockHash: '0xfa6cb2ad108e627191f2885ca28057de27509e59933bdc42b86aa3b533cf510b',
    blockNumber: 3,
    from: '0x6be02d1d3665660d22ff9624b7be0551ee1ac91b',
    to: null,
    gasUsed: 54666,
    cumulativeGasUsed: 54666,
    contractAddress: '0x5c4242beB94dE30b922f57241f1D02f36e906915',
    logs: [],
    status: false,
    logsBloom: '0x000000000000000000000000000...00000000000000000000000000'
  }

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 a pull request may close this issue.

1 participant