Commit 33fcd841 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

message-relayer: add in address check for better error alerting (#811)

* message-relayer: add in address check for better error alerting

* chore: add changeset

* relayer: log sending tx and tx confirmation

* lint: fix
parent 027d6258
---
'@eth-optimism/message-relayer': patch
---
Add a check for `OVM_L2MessageRelayer` in the AddressManager before attempting to relay messages to help surface errors more quickly
......@@ -151,6 +151,20 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
await sleep(this.options.pollingInterval)
try {
// Check that the correct address is set in the address manager
const relayer = await this.state.Lib_AddressManager.getAddress(
'OVM_L2MessageRelayer'
)
// If it is address(0), then message relaying is not authenticated
if (relayer !== ethers.constants.AddressZero) {
const address = await this.options.l1Wallet.getAddress()
if (relayer !== address) {
throw new Error(
`OVM_L2MessageRelayer (${relayer}) is not set to message-passer EOA ${address}`
)
}
}
this.logger.info('Checking for newly finalized transactions...')
if (
!(await this._isTransactionFinalized(
......@@ -486,11 +500,19 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
}
)
this.logger.info('Relay message transaction sent', {
transactionHash: result,
})
try {
const receipt = await result.wait()
this.logger.info('Relay message transaction sent', {
this.logger.info('Relay message included in block', {
transactionHash: receipt.transactionHash,
blockNumber: receipt.blockNumber,
gasUsed: receipt.gasUsed.toString(),
confirmations: receipt.confirmations,
status: receipt.status,
})
} catch (err) {
this.logger.error('Real relay attempt failed, skipping.', { err })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment