# Wrong tx.hash in autotask logs/notification

**URL:** <https://forum.openzeppelin.com/t/wrong-tx-hash-in-autotask-logs-notification/37221>\
**Category:** Defender\
**Tags:** etherscan-verify\
**Created:** [July 27, 2023, 12:53pm UTC](https://forum.openzeppelin.com/t/wrong-tx-hash-in-autotask-logs-notification/37221 "2023-07-27T12:53:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![markusbkoch](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/markusbkoch/32/19038_2.png) [@markusbkoch](https://forum.openzeppelin.com/u/markusbkoch)\
**Post date:** [July 27, 2023, 12:53pm UTC](https://forum.openzeppelin.com/t/wrong-tx-hash-in-autotask-logs-notification/37221/1 "2023-07-27T12:53:55Z")

</div>

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.

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

    const { notificationClient } = context;
    try {
        notificationClient.send({
            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](https://etherscan.io/tx/0x4dcbe5232c1baed1f20c76e718b2b51b0aef9d08c23207f41b9048e4c21662d0) transaction hash

```auto
Logs
AUTOTASK START
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
AUTOTASK COMPLETE
2023-07-27T00:05:41.541Z	INFO	Notification with id: '....' was sent successfully.

```

The actual hash of the submitted transaction is [this one](https://etherscan.io/tx/0x27d8b9725d4e86220a0d2f81df82356f42138aa059978898eca8705f99db7acc)

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?

---

<div class="post-metadata">

**Author:** ![markusbkoch](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/markusbkoch/32/19038_2.png) [@markusbkoch](https://forum.openzeppelin.com/u/markusbkoch)\
**Post date:** [July 27, 2023, 12:55pm UTC](https://forum.openzeppelin.com/t/wrong-tx-hash-in-autotask-logs-notification/37221/2 "2023-07-27T12:55:04Z")

</div>

[Link to the autotask](https://defender.openzeppelin.com/#/autotask/621b7001-fdb7-4780-96eb-d0f87aaadd84) if it helps admins take a look

---

<div class="post-metadata">

**Author:** ![dylkil](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dylkil/32/14336_2.png) [@dylkil](https://forum.openzeppelin.com/u/dylkil)\
**Post date:** [July 27, 2023, 1:17pm UTC](https://forum.openzeppelin.com/t/wrong-tx-hash-in-autotask-logs-notification/37221/3 "2023-07-27T13:17:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![markusbkoch](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/markusbkoch/32/19038_2.png) [@markusbkoch](https://forum.openzeppelin.com/u/markusbkoch)\
**Post date:** [July 27, 2023, 2:05pm UTC](https://forum.openzeppelin.com/t/wrong-tx-hash-in-autotask-logs-notification/37221/4 "2023-07-27T14:05:29Z")

</div>

Thank you. I don't see an option to create a sentinel that monitors the relayer address, though. What am I missing?  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/zeppelin/original/3X/3/4/341fc2ab7edf19d83cf0422c203d865f6af5a6a5.png)

---

<div class="post-metadata">

**Author:** ![dylkil](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dylkil/32/14336_2.png) [@dylkil](https://forum.openzeppelin.com/u/dylkil)\
**Post date:** [July 27, 2023, 2:15pm UTC](https://forum.openzeppelin.com/t/wrong-tx-hash-in-autotask-logs-notification/37221/5 "2023-07-27T14:15:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![markusbkoch](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/markusbkoch/32/19038_2.png) [@markusbkoch](https://forum.openzeppelin.com/u/markusbkoch)\
**Post date:** [July 27, 2023, 2:45pm UTC](https://forum.openzeppelin.com/t/wrong-tx-hash-in-autotask-logs-notification/37221/6 "2023-07-27T14:45:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dylkil](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dylkil/32/14336_2.png) [@dylkil](https://forum.openzeppelin.com/u/dylkil)\
**Post date:** [July 27, 2023, 4:10pm UTC](https://forum.openzeppelin.com/t/wrong-tx-hash-in-autotask-logs-notification/37221/7 "2023-07-27T16:10:58Z")

</div>

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
