diff --git a/README.md b/README.md index 9b1a44194..1245d1a1a 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,18 @@ docker compose logs -f This allows you to monitor logs coming from e.g. the `hardhat` nodes +#### Exposing test networks on `localhost` + +It is possible to expose the test networks defined in `docker-compose.yaml` on your host machine. To do this, you can run: + +```bash +docker compose -f docker-compose.yaml -f docker-compose.local.yaml up network-britney network-vengaboys +``` + +You can then adjust your `hardhat.config.ts` to point to `http://localhost:{10001,10002}` for access to `britney`/`vengaboys` networks. You will need to use the `MNEMONIC` defined in `docker-compose.templates.yaml` if you require funded accounts. + +**Don't forget that the state of the local networks disappears after they are stopped and any deployment files created in one session will be invalid in the next one.** + ### Troubleshooting #### Problems with committing diff --git a/docker-compose.local.yaml b/docker-compose.local.yaml new file mode 100644 index 000000000..6fb0455a1 --- /dev/null +++ b/docker-compose.local.yaml @@ -0,0 +1,24 @@ +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +# +# Docker compose for exposed test networks +# +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +version: "3.9" + +services: + # ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~ + # + # Expose nodes on host ports + # + # .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo. + network-vengaboys: + ports: + - "10001:8545" + + network-britney: + ports: + - "10002:8545" diff --git a/docker-compose.templates.yaml b/docker-compose.templates.yaml index e7d528fc9..a8fc3d4e9 100644 --- a/docker-compose.templates.yaml +++ b/docker-compose.templates.yaml @@ -32,7 +32,7 @@ services: # We'll provide a single testing MNEMONIC for the project so that the test EVM nodes # account are in sync with the hardhat accounts environment: - - MNEMONIC='test test test test test test test test test test test test' + - MNEMONIC=test test test test test test test test test test test junk logging: driver: local options: diff --git a/packages/ua-utils-evm-hardhat-test/test/task/oapp/wire.test.ts b/packages/ua-utils-evm-hardhat-test/test/task/oapp/wire.test.ts index d039f7fb9..9be8a3d4e 100644 --- a/packages/ua-utils-evm-hardhat-test/test/task/oapp/wire.test.ts +++ b/packages/ua-utils-evm-hardhat-test/test/task/oapp/wire.test.ts @@ -1,8 +1,9 @@ import hre from 'hardhat' import { isFile, promptToContinue } from '@layerzerolabs/io-utils' -import { resolve } from 'path' +import { relative, resolve } from 'path' import { TASK_LZ_WIRE_OAPP } from '@layerzerolabs/ua-utils-evm-hardhat' import { deployOApp } from '../../__utils__/oapp' +import { cwd } from 'process' jest.mock('@layerzerolabs/io-utils', () => { const original = jest.requireActual('@layerzerolabs/io-utils') @@ -88,6 +89,15 @@ describe('task/oapp/wire', () => { expect(promptToContinueMock).not.toHaveBeenCalled() }) + it('should work with relative paths', async () => { + const oappConfigAbsolute = configPathFixture('valid.config.empty.js') + const oappConfig = relative(cwd(), oappConfigAbsolute) + + await hre.run(TASK_LZ_WIRE_OAPP, { oappConfig }) + + expect(promptToContinueMock).not.toHaveBeenCalled() + }) + it('should have debug output if requested (so called eye test, check the test output)', async () => { const oappConfig = configPathFixture('valid.config.connected.js') diff --git a/packages/ua-utils-evm-hardhat/src/tasks/oapp/wire.ts b/packages/ua-utils-evm-hardhat/src/tasks/oapp/wire.ts index bae7b6ab8..5b6dfc38a 100644 --- a/packages/ua-utils-evm-hardhat/src/tasks/oapp/wire.ts +++ b/packages/ua-utils-evm-hardhat/src/tasks/oapp/wire.ts @@ -15,6 +15,7 @@ import { createOAppFactory } from '@layerzerolabs/ua-utils-evm' import { OmniGraphBuilderHardhat, createConnectedContractFactory } from '@layerzerolabs/utils-evm-hardhat' import { OmniTransaction } from '@layerzerolabs/utils' import { printTransactions } from '@layerzerolabs/utils' +import { resolve } from 'path' interface TaskArgs { oappConfig: string @@ -44,7 +45,7 @@ const action: ActionType = async ({ oappConfig: oappConfigPath, logLev try { logger.verbose(`Loading config file '${oappConfigPath}'`) - rawConfig = require(oappConfigPath) + rawConfig = require(resolve(oappConfigPath)) } catch (error) { throw new Error(`Unable to read config file '${oappConfigPath}': ${error}`) }