Skip to content

Commit

Permalink
[L2EP] Disables empty transaction check for Arbitrum and Metis (#3153)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamed-mehany authored Jan 16, 2024
1 parent 7025734 commit b1bfa12
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-jokes-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/layer2-sequencer-health-adapter': major
---

Disable empty transaction check for Arbitrum and Metis
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import {
export const supportedEndpoints = ['health']

const defaultRequireTxFailure = {
[Networks.Arbitrum]: true,
[Networks.Arbitrum]: false,
[Networks.Base]: false,
[Networks.Metis]: true,
[Networks.Metis]: false,
[Networks.Optimism]: false,
[Networks.Scroll]: false,
[Networks.Starkware]: true,
Expand All @@ -44,7 +44,7 @@ export const inputParameters: InputParameters<TInputParameters> = {
requireTxFailure: {
required: false,
description:
'Require the EA to attempt a tx as final proof whether the chain is healthy. This is `true` by default except when `network`=`base`',
'Require the EA to attempt a tx as final proof whether the chain is healthy. This is `false` by default except when `network`=`starkware`',
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ export const mockResponseSuccessBlock = (): void => {
'Origin',
])

nock('https://andromeda.metis.io/?owner=1088')
nock('https://andromeda.metis.io/')
.post('/', { jsonrpc: '2.0', method: 'eth_blockNumber', params: [], id: /^\d+$/ })
.query({ owner: 1088 })
.reply(200, () => ({ jsonrpc: '2.0', id: 1, result: '0x42d293' }), [
'Content-Type',
'application/json',
Expand Down Expand Up @@ -177,8 +178,9 @@ export const mockResponseFailureBlock = (): void => {
'Origin',
])

nock('https://andromeda.metis.io/?owner=1088')
nock('https://andromeda.metis.io')
.post('/', { jsonrpc: '2.0', method: 'eth_blockNumber', params: [], id: /^\d+$/ })
.query({ owner: 1088 })
.reply(200, () => ({ jsonrpc: '2.0', id: 1, result: '0x00' }), [
'Content-Type',
'application/json',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,20 @@ describe('execute', () => {

describe('arbitrum network', () => {
it('should return success when transaction submission is known', async () => {
mockResponseFailureHealth()
mockResponseFailureBlock()

const data: AdapterRequest = {
id,
data: {
network: 'arbitrum',
requireTxFailure: true,
},
}

await sendRequestAndExpectStatus(data, 0)
})

it('should return failure if tx not required', async () => {
mockResponseFailureHealth()
mockResponseFailureBlock()

const data: AdapterRequest = {
Expand Down Expand Up @@ -166,6 +165,7 @@ describe('execute', () => {
id,
data: {
network: 'metis',
requireTxFailure: true,
},
}

Expand All @@ -190,7 +190,6 @@ describe('execute', () => {

describe('scroll network', () => {
it('should return success when transaction submission is known', async () => {
mockResponseFailureHealth()
mockResponseFailureBlock()

const data: AdapterRequest = {
Expand All @@ -205,7 +204,6 @@ describe('execute', () => {
})

it('should return failure if tx not required', async () => {
mockResponseFailureHealth()
mockResponseFailureBlock()

const data: AdapterRequest = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ describe('execute', () => {

describe('arbitrum network', () => {
it('should return success when all methods succeed', async () => {
mockResponseSuccessHealth()
mockResponseSuccessBlock()

const data: AdapterRequest = {
Expand All @@ -127,21 +126,20 @@ describe('execute', () => {
})

it('should return transaction submission is successful', async () => {
mockResponseFailureHealth()
mockResponseFailureBlock()

const data: AdapterRequest = {
id,
data: {
network: 'arbitrum',
requireTxFailure: true,
},
}

await sendRequestAndExpectStatus(data, 0)
})

it('should return failure if tx not required even if it would be successful', async () => {
mockResponseFailureHealth()
mockResponseFailureBlock()

const data: AdapterRequest = {
Expand Down Expand Up @@ -313,6 +311,7 @@ describe('execute', () => {
id,
data: {
network: 'metis',
requireTxFailure: true,
},
}

Expand Down

0 comments on commit b1bfa12

Please sign in to comment.