Skip to content

Commit

Permalink
Renaming evm hardhat tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
sirarthurmoney committed Feb 8, 2024
1 parent 973e418 commit dec56d4
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 38 deletions.
4 changes: 2 additions & 2 deletions packages/ua-devtools-evm-hardhat/src/constants/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export const TASK_LZ_OAPP_WIRE = 'lz:oapp:wire'
export const TASK_LZ_OAPP_CONFIG_GET_DEFAULT = 'lz:oapp:config:get:default'
export const TASK_LZ_OAPP_CONFIG_GET_EXECUTOR = 'lz:oapp:config:get:executor'
export const TASK_LZ_OAPP_CONFIG_GET = 'lz:oapp:config:get'
export const TASK_LZ_OAPP_CONFIG_CHECK = 'lz:oapp:config:check'
export const TASK_LZ_OAPP_ENFORCED_OPTIONS_GET = 'lz:oapp:enforced:options:get'
export const TASK_LZ_OAPP_PEERS_GET = 'lz:oapp:peers:get'
export const TASK_LZ_OAPP_ENFORCED_OPTS_GET = 'lz:oapp:enforced:opts:get'
export const TASK_LZ_OAPP_CONFIG_INIT = 'lz:oapp:config:init'

export const SUBTASK_LZ_OAPP_WIRE_CONFIGURE = '::lz:oapp:wire:configure'
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const action: ActionType<TaskArgs> = async ({ logLevel = 'info', networks: netwo

task(
TASK_LZ_OAPP_CONFIG_GET_DEFAULT,
'Outputs the default Send and Receive Messaging Library versions and the default application config',
'Outputs the Default OApp Config. Each config contains Send & Receive Librarys, Send Uln & Executor Configs, and Recieve Executor Configs',
action
)
.addParam('networks', 'Comma-separated list of networks', undefined, types.csv, true)
Expand Down
4 changes: 2 additions & 2 deletions packages/ua-devtools-evm-hardhat/src/tasks/oapp/config.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ const action: ActionType<TaskArgs> = async ({ logLevel = 'info', oappConfig }) =

task(
TASK_LZ_OAPP_CONFIG_GET,
'Outputs the default Send and Receive Messaging Library versions and the default application config',
'Outputs Custom OApp Config, Default OApp Config, and Active OApp Config. Each config contains Send & Receive Librarys, Send Uln & Executor Configs, and Recieve Executor Configs',
action
)
.addParam('logLevel', 'Logging level. One of: error, warn, info, verbose, debug, silly', 'info', types.logLevel)
.addParam('oappConfig', 'Path to your LayerZero OApp config', undefined, types.string)
.addParam('oappConfig', 'Path to your LayerZero OApp config', './layerzero.config.js', types.string)
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const action: ActionType<TaskArgs> = async ({ logLevel = 'info' }, hre): Promise

if (process.env.LZ_ENABLE_EXPERIMENTAL_TASK_LZ_OAPP_CONFIG_INIT) {
task(TASK_LZ_OAPP_CONFIG_INIT, 'Initialize an OApp configuration file', action)
.addParam('oappConfig', 'Path to the new LayerZero OApp config', undefined, types.string)
.addParam('oappConfig', 'Path to the new LayerZero OApp config', './layerzero.config.js', types.string)
.addParam('logLevel', 'Logging level. One of: error, warn, info, verbose, debug, silly', 'info', types.logLevel)
.addParam(
'ci',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ActionType } from 'hardhat/types'
import { task } from 'hardhat/config'
import { createLogger, printCrossTable, printRecord, setDefaultLogLevel } from '@layerzerolabs/io-devtools'
import { TASK_LZ_OAPP_ENFORCED_OPTIONS_GET } from '@/constants/tasks'
import { TASK_LZ_OAPP_ENFORCED_OPTS_GET } from '@/constants/tasks'
import { printLogo } from '@layerzerolabs/io-devtools/swag'
import { OAppOmniGraph } from '@layerzerolabs/ua-devtools'
import { createConnectedContractFactory, types } from '@layerzerolabs/devtools-evm-hardhat'
Expand All @@ -17,7 +17,7 @@ interface TaskArgs {
logLevel?: string
}

export const enforcedOptionsGet: ActionType<TaskArgs> = async ({ oappConfig: oappConfigPath, logLevel = 'info' }) => {
export const enforcedOptsGet: ActionType<TaskArgs> = async ({ oappConfig: oappConfigPath, logLevel = 'info' }) => {
printLogo()

// We'll set the global logging level to get as much info as needed
Expand Down Expand Up @@ -86,10 +86,10 @@ export const enforcedOptionsGet: ActionType<TaskArgs> = async ({ oappConfig: oap
}
}

task(TASK_LZ_OAPP_ENFORCED_OPTIONS_GET, 'Outputs table of OApp enforced options using layerzero.config')
task(TASK_LZ_OAPP_ENFORCED_OPTS_GET, 'Outputs table of OApp enforced options using layerzero.config')
.addParam('oappConfig', 'Path to your LayerZero OApp config', './layerzero.config.js', types.string)
.addParam('logLevel', 'Logging level. One of: error, warn, info, verbose, debug, silly', 'info', types.logLevel)
.setAction(enforcedOptionsGet)
.setAction(enforcedOptsGet)

/**
* Updates the enforced options object based on the provided encoded enforced options.
Expand Down
4 changes: 2 additions & 2 deletions packages/ua-devtools-evm-hardhat/src/tasks/oapp/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './wire'
import './config.check'
import './peers.get'
import './config.get.default'
import './config.get.executor'
import './config.get'
import './enforced.options.get'
import './enforced.opts.get'
import './config.init'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ActionType } from 'hardhat/types'
import { task } from 'hardhat/config'
import { createLogger, printBoolean, printCrossTable, setDefaultLogLevel } from '@layerzerolabs/io-devtools'
import { TASK_LZ_OAPP_CONFIG_CHECK } from '@/constants/tasks'
import { TASK_LZ_OAPP_PEERS_GET } from '@/constants/tasks'
import { printLogo } from '@layerzerolabs/io-devtools/swag'
import { OAppOmniGraph } from '@layerzerolabs/ua-devtools'
import { createConnectedContractFactory, types } from '@layerzerolabs/devtools-evm-hardhat'
Expand Down Expand Up @@ -79,10 +79,6 @@ const action: ActionType<TaskArgs> = async ({ oappConfig: oappConfigPath, logLev
}
}

task(
TASK_LZ_OAPP_CONFIG_CHECK,
'outputs visual console table to show current state of oapp connections via configuration',
action
)
.addParam('oappConfig', 'Path to your LayerZero OApp config', undefined, types.string)
task(TASK_LZ_OAPP_PEERS_GET, 'Outputs OApp peer connections', action)
.addParam('oappConfig', 'Path to your LayerZero OApp config', './layerzero.config.js', types.string)
.addParam('logLevel', 'Logging level. One of: error, warn, info, verbose, debug, silly', 'info', types.logLevel)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`task lz:oapp:config:check should show a standard lzReceive setting for all pathways 1`] = `
exports[`task lz:oapp:peers:get should show a standard lzReceive setting for all pathways 1`] = `
[
"┌───────────┬───────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────┐
│ from → to │ britney │ vengaboys │ tango │
Expand Down Expand Up @@ -38,7 +38,7 @@ exports[`task lz:oapp:config:check should show a standard lzReceive setting for
]
`;

exports[`task lz:oapp:config:check should show all chains are connected after running wire with three networks 1`] = `
exports[`task lz:oapp:peers:get should show all chains are connected after running wire with three networks 1`] = `
[
"┌───────────┬─────────┬───────────┬───────┐
│ from → to │ britney │ vengaboys │ tango │
Expand All @@ -58,7 +58,7 @@ exports[`task lz:oapp:config:check should show all chains are connected after ru
]
`;

exports[`task lz:oapp:config:check should show all chains are connected after running wire with two networks 1`] = `
exports[`task lz:oapp:peers:get should show all chains are connected after running wire with two networks 1`] = `
[
"┌───────────┬─────────┬───────────┐
│ from → to │ britney │ vengaboys │
Expand All @@ -76,7 +76,7 @@ exports[`task lz:oapp:config:check should show all chains are connected after ru
]
`;

exports[`task lz:oapp:config:check should show all chains are connected expect one after running wire with three networks 1`] = `
exports[`task lz:oapp:peers:get should show all chains are connected expect one after running wire with three networks 1`] = `
[
"┌───────────┬─────────┬───────────┬───────┐
│ from → to │ britney │ vengaboys │ tango │
Expand All @@ -96,7 +96,7 @@ exports[`task lz:oapp:config:check should show all chains are connected expect o
]
`;

exports[`task lz:oapp:config:check should show all chains are not connected expect one after running wire with three networks 1`] = `
exports[`task lz:oapp:peers:get should show all chains are not connected expect one after running wire with three networks 1`] = `
[
"┌───────────┬─────────┬───────────┬───────┐
│ from → to │ britney │ vengaboys │ tango │
Expand All @@ -116,7 +116,7 @@ exports[`task lz:oapp:config:check should show all chains are not connected expe
]
`;

exports[`task lz:oapp:config:check should show different combined enforced options for all pathways 1`] = `
exports[`task lz:oapp:peers:get should show different combined enforced options for all pathways 1`] = `
[
"┌───────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ from → to │ britney │ vengaboys │ tango │
Expand Down Expand Up @@ -230,7 +230,7 @@ exports[`task lz:oapp:config:check should show different combined enforced optio
]
`;

exports[`task lz:oapp:config:check should show enforced options for one pathway 1`] = `
exports[`task lz:oapp:peers:get should show enforced options for one pathway 1`] = `
[
"┌───────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬───────────┬───────┐
│ from → to │ britney │ vengaboys │ tango │
Expand Down Expand Up @@ -260,7 +260,7 @@ exports[`task lz:oapp:config:check should show enforced options for one pathway
]
`;

exports[`task lz:oapp:config:check should show no chains are connected with two networks 1`] = `
exports[`task lz:oapp:peers:get should show no chains are connected with two networks 1`] = `
[
"┌───────────┬─────────┬───────────┐
│ from → to │ britney │ vengaboys │
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { resolve } from 'path'
import { isFile } from '@layerzerolabs/io-devtools'
import { deployOApp } from '../../__utils__/oapp'
import {
TASK_LZ_OAPP_CONFIG_CHECK,
TASK_LZ_OAPP_ENFORCED_OPTIONS_GET,
TASK_LZ_OAPP_PEERS_GET,
TASK_LZ_OAPP_ENFORCED_OPTS_GET,
TASK_LZ_OAPP_WIRE,
} from '@layerzerolabs/ua-devtools-evm-hardhat'
import { deployEndpoint, setupDefaultEndpoint } from '../../__utils__/endpoint'

describe(`task ${TASK_LZ_OAPP_CONFIG_CHECK}`, () => {
describe(`task ${TASK_LZ_OAPP_PEERS_GET}`, () => {
const CONFIGS_BASE_DIR = resolve(__dirname, '__data__', 'configs')
const configPathFixture = (fileName: string): string => {
const path = resolve(CONFIGS_BASE_DIR, fileName)
Expand All @@ -29,63 +29,63 @@ describe(`task ${TASK_LZ_OAPP_CONFIG_CHECK}`, () => {
it('should show no chains are connected with two networks', async () => {
const consoleSpy = jest.spyOn(console, 'log')
const oappConfig = configPathFixture('valid.config.connected.js')
await hre.run(TASK_LZ_OAPP_CONFIG_CHECK, { oappConfig })
await hre.run(TASK_LZ_OAPP_PEERS_GET, { oappConfig })
expect(consoleSpy.mock.lastCall).toMatchSnapshot()
})

it('should show all chains are connected after running wire with two networks', async () => {
const consoleSpy = jest.spyOn(console, 'log')
const oappConfig = configPathFixture('valid.config.connected.js')
await hre.run(TASK_LZ_OAPP_WIRE, { oappConfig, ci: true })
await hre.run(TASK_LZ_OAPP_CONFIG_CHECK, { oappConfig })
await hre.run(TASK_LZ_OAPP_PEERS_GET, { oappConfig })
expect(consoleSpy.mock.lastCall).toMatchSnapshot()
})

it('should show all chains are connected after running wire with three networks', async () => {
const consoleSpy = jest.spyOn(console, 'log')
const oappConfig = configPathFixture('valid.multi.network.config.connected.js')
await hre.run(TASK_LZ_OAPP_WIRE, { oappConfig, ci: true })
await hre.run(TASK_LZ_OAPP_CONFIG_CHECK, { oappConfig })
await hre.run(TASK_LZ_OAPP_PEERS_GET, { oappConfig })
expect(consoleSpy.mock.lastCall).toMatchSnapshot()
})

it('should show all chains are connected expect one after running wire with three networks', async () => {
const consoleSpy = jest.spyOn(console, 'log')
const oappConfig = configPathFixture('valid.multi.network.config.missing.connection.js')
await hre.run(TASK_LZ_OAPP_WIRE, { oappConfig, ci: true })
await hre.run(TASK_LZ_OAPP_CONFIG_CHECK, { oappConfig })
await hre.run(TASK_LZ_OAPP_PEERS_GET, { oappConfig })
expect(consoleSpy.mock.lastCall).toMatchSnapshot()
})

it('should show all chains are not connected expect one after running wire with three networks', async () => {
const consoleSpy = jest.spyOn(console, 'log')
const oappConfig = configPathFixture('valid.multi.network.config.one.connection.js')
await hre.run(TASK_LZ_OAPP_WIRE, { oappConfig, ci: true })
await hre.run(TASK_LZ_OAPP_CONFIG_CHECK, { oappConfig })
await hre.run(TASK_LZ_OAPP_PEERS_GET, { oappConfig })
expect(consoleSpy.mock.lastCall).toMatchSnapshot()
})

it('should show enforced options for one pathway', async () => {
const consoleSpy = jest.spyOn(console, 'log')
const oappConfig = configPathFixture('valid.multi.network.one.pathway.enforced.options.js')
await hre.run(TASK_LZ_OAPP_WIRE, { oappConfig, ci: true })
await hre.run(TASK_LZ_OAPP_ENFORCED_OPTIONS_GET, { oappConfig })
await hre.run(TASK_LZ_OAPP_ENFORCED_OPTS_GET, { oappConfig })
expect(consoleSpy.mock.lastCall).toMatchSnapshot()
})

it('should show a standard lzReceive setting for all pathways', async () => {
const consoleSpy = jest.spyOn(console, 'log')
const oappConfig = configPathFixture('valid.multi.network.lzreceive.enforced.options.js')
await hre.run(TASK_LZ_OAPP_WIRE, { oappConfig, ci: true })
await hre.run(TASK_LZ_OAPP_ENFORCED_OPTIONS_GET, { oappConfig })
await hre.run(TASK_LZ_OAPP_ENFORCED_OPTS_GET, { oappConfig })
expect(consoleSpy.mock.lastCall).toMatchSnapshot()
})

it('should show different combined enforced options for all pathways', async () => {
const consoleSpy = jest.spyOn(console, 'log')
const oappConfig = configPathFixture('valid.multi.network.enforced.options.js')
await hre.run(TASK_LZ_OAPP_WIRE, { oappConfig, ci: true })
await hre.run(TASK_LZ_OAPP_ENFORCED_OPTIONS_GET, { oappConfig })
await hre.run(TASK_LZ_OAPP_ENFORCED_OPTS_GET, { oappConfig })
expect(consoleSpy.mock.lastCall).toMatchSnapshot()
})
})

0 comments on commit dec56d4

Please sign in to comment.