# Helpers

### Check Transaction revert reason

Since Tenderly misses on traces with `block.coinbase`use <https://tx.eth.samczsun.com/polygon/0x98798a8820fa01927c655a4223fd0f3821f7b013982e6d0d844c609237e2ef62> and click the little \[call] to see the Output data and revert reason.

<figure><img src="/files/pvHWa8CQeByTbMf4SsZe" alt=""><figcaption></figcaption></figure>

### Check if time is right to attempt a bundle that can land.

{% tabs %}
{% tab title="Nodejs" %}

```typescript
const { ethers } = require('ethers');

const ALCHEMY_KEY = "alchemy-apikey";
const provider = new ethers.providers.AlchemyProvider("matic",ALCHEMY_KEY);


const getAuthor =  async(blockNum) => {
  const response = await fetch(`https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`, {
    method: 'POST',
    headers: {
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      "id": 1,
      "jsonrpc": "2.0",
      "method": "bor_getAuthor",
      "params": [
           '0x'+blockNum.toString(16)
      ]
 }),
  });
  const json = await response.json();
  return json.result;
}

let waitBlock = 0;
provider.on('block', async(block) => {
  try {
    console.log(block);
    if (block < waitBlock) return;
    const author = await getAuthor(block);
    console.log(author);
    const validators = [
      '0x127685D6dD6683085Da4B6a041eFcef1681E5C9C',
      '0x02f70172f7f490653665c9bfac0666147c8af1f5',
      '0xd2e4bE547B21E99A668f81EEcF0298471A19808f',
      '0xb9EDE6f94D192073D8eaF85f8db677133d483249',
      '0x9eaD03F7136Fc6b4bDb0780B00a1c14aE5A8B6d0',
    ].map(x => x.toLowerCase());
    if (author && validators.includes(author.toLowerCase())) {
      console.log('Validator active');
      // You should be able to submit bundles for a while
      await tryToSubmitBundlesForAFewBlocks();
      console.log('Closing');
      process.exit(0);
    } else {
      waitBlock = block + 10; // wait 10 more blocks
    }
  } catch (err) {
    console.error(err);
  }

});
```

List of validators active found in discord for now in #validators-list
{% endtab %}
{% endtabs %}

### Minimal Repayer

Substitutes a minimal Searcher Contract to receive a fastLaneCall and simply give back the `_bidAmount` to be sure the relay is repaid.

The FastlaneAuction handler will call this contract `fastLaneCall` if this contract address is submitted in the bundle as the searcherTx.

```solidity
//SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.16;

// Example Contract that sends back _bidAmount to msg.sender
// It ignores _sender and _searcherCallData
// Used for testing purposes
contract SearcherHelperRepayerEcho {
    function fastLaneCall(
            address _sender,
            uint256 _bidAmount,
            bytes calldata _searcherCallData
    ) external payable returns (bool, bytes memory) {
        bool success;
        address to = msg.sender;
        assembly {
            // Transfer the ETH and store if it succeeded or not.
            success := call(gas(), to, _bidAmount, 0, 0, 0, 0)
        }

        require(success, "ETH_TRANSFER_FAILED");
        return (true,bytes("ok"));
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fastlane-labs.gitbook.io/polygon-fastlane/searcher-guides/helpers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
