Skip to content

Commit

Permalink
debug: Logging
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista committed Dec 12, 2023
1 parent 0b8657e commit 89fbcd1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 25 deletions.
5 changes: 5 additions & 0 deletions docker-compose.templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ services:
# account are in sync with the hardhat accounts
environment:
- MNEMONIC='test test test test test test test test test test test test'
logging:
driver: local
options:
max-size: "5m"
compress: "false"

# EVM node for testing purposes
evm-node:
Expand Down
4 changes: 0 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@ services:
extends:
file: docker-compose.templates.yaml
service: evm-node
logging:
driver: local

network-britney:
extends:
file: docker-compose.templates.yaml
service: evm-node
logging:
driver: local

# ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
#
Expand Down
34 changes: 17 additions & 17 deletions packages/ua-utils-evm-hardhat-test/test/task/oapp/wire.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,31 +105,31 @@ describe('task/oapp/wire', () => {
expect(promptToContinueMock).toHaveBeenCalledTimes(2)
}, 30_000)

// it('should return undefined if the user decides not to continue', async () => {
// const oappConfig = configPathFixture('valid.config.connected.js')
it('should return undefined if the user decides not to continue', async () => {
const oappConfig = configPathFixture('valid.config.connected.js')

// promptToContinueMock.mockResolvedValue(false)
promptToContinueMock.mockResolvedValue(false)

// const result = await hre.run(TASK_LZ_WIRE_OAPP, { oappConfig })
const result = await hre.run(TASK_LZ_WIRE_OAPP, { oappConfig })

// expect(result).toBeUndefined()
// expect(promptToContinueMock).toHaveBeenCalledTimes(2)
// })
expect(result).toBeUndefined()
expect(promptToContinueMock).toHaveBeenCalledTimes(2)
})

// it('should return a list of transactions if the user decides to continue', async () => {
// console.log('here')
it('should return a list of transactions if the user decides to continue', async () => {
console.log('here')

// const oappConfig = configPathFixture('valid.config.connected.js')
const oappConfig = configPathFixture('valid.config.connected.js')

// promptToContinueMock
// .mockResolvedValueOnce(false) // We don't want to see the list
// .mockResolvedValueOnce(true) // We want to continue
promptToContinueMock
.mockResolvedValueOnce(false) // We don't want to see the list
.mockResolvedValueOnce(true) // We want to continue

// const result = await hre.run(TASK_LZ_WIRE_OAPP, { oappConfig })
const result = await hre.run(TASK_LZ_WIRE_OAPP, { oappConfig })

// console.log('here again')
console.log('here again')

// expect(result).toEqual([])
// })
expect(result).toEqual([])
})
})
})
6 changes: 2 additions & 4 deletions packages/ua-utils-evm-hardhat/src/tasks/oapp/wire.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,9 @@ const action: ActionType<TaskArgs> = async ({ oappConfig: oappConfigPath, logLev
throw new Error(`An error occurred while getting the OApp configuration: ${error}`)
}

// We'll just save the printed transactions for users that want to see them
const printedTransactions = printTransactions(transactions)

// Flood users with debug output
logger.verbose(`Created a list of wiring transactions`)
logger.debug(`Following transactions are necessary:\n\n${printJson(transactions)}`)

// If there are no transactions that need to be executed, we'll just exit
if (transactions.length === 0) {
Expand All @@ -134,7 +132,7 @@ const action: ActionType<TaskArgs> = async ({ oappConfig: oappConfigPath, logLev

// Ask them whether they want to see them
const previewTransactions = await promptToContinue(`Would you like to preview the transactions before continuing?`)
if (previewTransactions) logger.info(`\n${printedTransactions}`)
if (previewTransactions) logger.info(`\n${printTransactions(transactions)}`)

// Now ask the user whether they want to go ahead with signing them
const go = await promptToContinue()
Expand Down

0 comments on commit 89fbcd1

Please sign in to comment.