Wrong tx.hash in autotask logs/notification

I have an autotask attached to a relayer to execute a function once a week, then send a notification to Slack with the transaction hash.

    const tx = await checkpointerContract.connect(signer).checkpointGaugesAboveRelativeWeight(CHECKPOINTING_THRESHOLD, {value: ethers.utils.parseEther(MAX_ETH_TO_BRIDGE)});

    const { notificationClient } = context;
    try {
            channelAlias: '#defender-alerts',
            subject: 'Mainnet gauges checkpointed',
            message: 'Transaction hash: ' + tx.hash + '; threshold: ' + CHECKPOINTING_THRESHOLD
    } catch (error) {
        console.error('Failed to send notification', error);

This morning, the autotask ran correctly but the console logs and the notification print out an invalid transaction hash

2023-07-27T00:05:30.248Z	INFO	{
  chainId: 1,
  hash: '0x4dcbe5232c1baed1f20c76e718b2b51b0aef9d08c23207f41b9048e4c21662d0',
  transactionId: '3a80f3bb-6dca-4ff1-b607-5b286521353d',
  value: BigNumber { _hex: '0x016345785d8a0000', _isBigNumber: true },
  gasLimit: BigNumber { _hex: '0xa59db8', _isBigNumber: true },
  to: '0x343688C5cB92115a52cA485af7f62B4B7A2e9CcC',
  from: '0xe9735f7d85a57bfb860c1e2c1c7b4f587ba0f6e7',
  data: '0xd14cfe3b000000000000000000000000000000000000000000000000000110d9316ec000',
  nonce: 49,
  status: 'sent',
  speed: 'fast',
  validUntil: '2023-07-27T08:05:29.512Z',
  createdAt: '2023-07-27T00:05:30.070Z',
  sentAt: '2023-07-27T00:05:30.070Z',
  pricedAt: '2023-07-27T00:05:30.070Z',
  isPrivate: true,
  maxFeePerGas: BigNumber { _hex: '0x0b7f54b003', _isBigNumber: true },
  maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
  wait: [Function (anonymous)]
2023-07-27T00:05:30.248Z	INFO	Sending slack notification with id: '....'. Message: Transaction hash: 0x4dcbe5232c1baed1f20c76e718b2b51b0aef9d08c23207f41b9048e4c21662d0; threshold: 300000000000000
END RequestId: b1dfbee5-d5a2-4e10-970a-421fa2310fe9
2023-07-27T00:05:41.541Z	INFO	Notification with id: '....' was sent successfully.

The actual hash of the submitted transaction is this one

There are no retries programmed into the autotask that could have caused the second hash, it only ran once, and the keys to the relayer only exist in Defender. Where did that invalid tx.hash come from?

Link to the autotask if it helps admins take a look

Hi @markusbkoch

It looks like your transaction was replaced internally resulting in a different hash, when a transaction hasn't been confirmed in a given time frame we bump the gas a certain percent and resubmit the transaction. The hash sent in your notification is the initial tx hash.

I have a solution to account for this scenario though it requires a little more setup. You will need 1 autotask and 1 sentinel.

Your autotask should handle sending the transaction and nothing else. You should set up a sentinel that monitors the address of your relayer and set the transaction properties field to status == 'success'. This will alert you whenever a transaction has been confirmed for this relayer. You can then select a slack notification for the sentinel to forward the notification to.

Hope that makes sense.

Thank you. I don't see an option to create a sentinel that monitors the relayer address, though. What am I missing?

Sorry its a little confusing, when choosing a contract sentinel you can put in the address of an EOA and it will work the same

I see, thank you. I was able to set it up. The issue with this approach is I don't have the same level of context in the sentinel as I do in the autotask. The notification is constrained to "Relayer did something" as opposed to being as detailed as it could be in the autotask. Not really sure what the best solution to this would be, but just thought I'd flag the use case anyway. Thanks for the help.

You could also trigger an autotask from your sentinel rather than a notification and you could put your notification logic and any other processing you want to do inside of the autotask