flashbots / ethers-provider-flashbots-bundle

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

Invalid RLP Data while parsing executed bundle in Goerli #75

Closed vladgovor77771 closed 2 years ago

vladgovor77771 commented 2 years ago

Hello, I have this code:

{
  // ...
  let txs = await Promise.all(
    [
      {
        to: "0x0000000000000000000000000000000000000000",
        from: account.wallet.address,
        nonce: await account.rpcWss.getTransactionCount(account.wallet.address),
        gasLimit: 21000,
        data: "0x",
        value: GWEI,
        chainId: config.chainId,
        type: 2,
        maxPriorityFeePerGas: priorityFee,
        maxFeePerGas: priorityFee.add(nextBaseFee),
      },
      {
        to: "0x0000000000000000000000000000000000000000",
        from: account.wallet.address,
        nonce: (await account.rpcWss.getTransactionCount(account.wallet.address)) + 1,
        gasLimit: 21000,
        data: "0x",
        value: GWEI.mul(2),
        chainId: config.chainId,
        type: 2,
        maxPriorityFeePerGas: priorityFee,
        maxFeePerGas: priorityFee.add(nextBaseFee),
      },
    ].map(account.wallet.signTransaction.bind(account.wallet))
  );
  let simulation = await this.provider!.simulate(txs, targetBlock);
  let res = await this.provider!.sendRawBundle(txs, txRequest.getBlockNumber());
  if (isRelayError(res)) {
    this.logger.warn("isRelayError");
    throw new Error(`${res.error.code}: ${res.error.message}`);
  }

  this.logger.info(`Bundle sent!`, JSON.stringify(res));
  return res.bundleTransactions.map(x => x.hash);
}

Simulation executing successfully as well as bundle itself executing in blockchain, but sendRawBundle throws with this error:

Error: invalid rlp data (argument="data", value="0x02f870050a85174876e80085174876e80d825208940000000000000000000000000000000000000000843b9aca0080c080a0622457fb76b1cc100eec72684be93b19af78510ec280b793be41f7b258afb864a029869cfacb9d5af833358cb319557313f9a58b48cf46bbc5c61cc9d92b5e9ee1", code=INVALID_ARGUMENT, version=rlp/5.6.1)

The value in error is the first signed transaction.

Looks like this issue is related to ethers rlp decode implementation https://github.com/ethers-io/ethers.js/blob/608864fc3f00390e1260048a157af00378a98e41/packages/rlp/src.ts/index.ts#L151

vladgovor77771 commented 2 years ago

Resolved this issue by updating node dependencies.. closing