flashbots / ethers-provider-flashbots-bundle

Flashbots provider for ethers.js
547 stars 215 forks source link

error: 'execution reverted', #73

Open guojixu opened 2 years ago

guojixu commented 2 years ago

When I construct a transaction, the transaction is to send a data to my personal contract through my account. Then simulate this transaction through the eth_callBundle method of flashbots, but the response I received shows an error, so I would like to ask you to help solve the problem, or point out the reason for the error, thank you for your help. Below is my code and error message。

 const Tx = {
    to: my_contract.address,
    from: Wallet.address,
    data: Payload,
    chainId: 1,
    maxPriorityFeePerGas: 0,
    maxFeePerGas: nextBaseFee,
    gasLimit: 250000,
    nonce: nonce + 1,
    type: 2,
  };
  console.log(Tx);
  const TxSigned = await Wallet.signTransaction(Tx);
  const signedTxs = [TxSigned];
  const simulatedResp = await callBundleFlashbots(signedTxs, targetBlockNumber);

the response is :

simulatedResp {
  bundleGasPrice: '816000544',
  bundleHash: '0x6114e885fcf513af79cdcd72ba3192eff297fc58772f6681b022a83594fbca43',
  coinbaseDiff: '128523349703840',
  ethSentToCoinbase: '0',
  gasFees: '128523349703840',
  results: [
    {
      coinbaseDiff: '0',
      error: 'execution reverted',
      ethSentToCoinbase: '0',
      fromAddress: '0x446E90CDd028cBDf8aCcd47C2C3AD50F585C2e15',
      gasFees: '0',
      gasPrice: '0',
      gasUsed: 28155,
      revert: '\x00\x00\x00',
      toAddress: '0x35e456AE04D641F2c13c52C7e637645CE92c293c',
      txHash: '0xe78add5bc73e08ad291b8eafb77cff3b8f900264edf54e619fdb7a84eebd4d3c'
    }
 ]
}
epheph commented 2 years ago

This seems like a standard transaction failure with a single transaction. There's a null revert message, you could deploy the contract with expressive require statements (like require(msg.value % 2 == 0, "Even value required."); . I imagine your Payload doesn't correspond to calldata that succeeds on that contract (or expects value). You could use a tool like Tenderly to simulate and see where the actual failure is, but i do not believe this is a failure on the Flashbots side.

ahmediblao1 commented 2 years ago

hey i have same error ! did you solve it

epheph commented 2 years ago

Fix your transaction. If you take that exact transaction and send it to ethereum, it will also fail. Flashbots is just telling you about the failure before you send it.

ahmediblao1 commented 2 years ago

ye i did that! but now The step to transfer in Eth is working. The step to move the NFT isn't working..

ahmediblao1 commented 2 years ago

{ transaction: tx({ to: '0x377A825a415A6ee3Fdf3c65d80b26E9279650bef', gasLimit: 73294, data: '0x42842e0e000000000000000000000000eeda7a919871689fe103655062123a9f78338d99000000000000000000000000eeda7a919871689fe103655062123a9f78338d9900000000000000000000000000000000000000000000000000000000000000d5' }), signer: compromisedWallet },

i put the nft contract address in TO : value put idk where to put the save wallet address that i want the nft in

epheph commented 2 years ago

gasPrice?

ahmediblao1 commented 2 years ago

Base: 27 | Priority: 4