chore(marketplace): use hardhat ignition (#1195)

This commit is contained in:
Arnaud 2025-06-20 17:55:00 +02:00 committed by GitHub
parent c5e424ff1b
commit 7b660e3554
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 8 deletions

View File

@ -61,6 +61,8 @@ jobs:
run: | run: |
npm install npm install
npm start & npm start &
# Wait for the contracts to be deployed
sleep 5
## Part 2 Tests ## ## Part 2 Tests ##
- name: Contract tests - name: Contract tests

View File

@ -53,6 +53,7 @@ proc openLogFile(node: HardhatProcess, logFilePath: string): IoHandle =
method start*(node: HardhatProcess) {.async.} = method start*(node: HardhatProcess) {.async.} =
let poptions = node.processOptions + {AsyncProcessOption.StdErrToStdOut} let poptions = node.processOptions + {AsyncProcessOption.StdErrToStdOut}
trace "starting node", trace "starting node",
args = node.arguments, args = node.arguments,
executable = node.executable, executable = node.executable,
@ -63,10 +64,28 @@ method start*(node: HardhatProcess) {.async.} =
node.process = await startProcess( node.process = await startProcess(
node.executable, node.executable,
node.workingDir, node.workingDir,
@["node", "--export", "deployment-localhost.json"].concat(node.arguments), @["node"].concat(node.arguments),
options = poptions, options = poptions,
stdoutHandle = AsyncProcess.Pipe, stdoutHandle = AsyncProcess.Pipe,
) )
await node.waitUntilStarted()
var execResult = await execCommandEx(
"cd " & node.workingDir() & " && " & node.workingDir() / node.executable() &
" run " & node.workingDir() / "scripts" / "mine.js --network localhost"
)
assert execResult.status == 0
execResult = await execCommandEx(
"cd " & node.workingDir() & " && " & node.workingDir() / node.executable() &
" ignition deploy ignition/modules/marketplace.js --network localhost"
)
assert execResult.status == 0
trace "hardhat post start scripts executed"
except CancelledError as error: except CancelledError as error:
raise error raise error
except CatchableError as e: except CatchableError as e:

View File

@ -139,14 +139,12 @@ template multinodesuite*(name: string, body: untyped) =
let updatedLogFile = getLogFile(role, none int) let updatedLogFile = getLogFile(role, none int)
args.add "--log-file=" & updatedLogFile args.add "--log-file=" & updatedLogFile
let node = await HardhatProcess.startNode(args, config.debugEnabled, "hardhat")
try: try:
await node.waitUntilStarted() let node = await HardhatProcess.startNode(args, config.debugEnabled, "hardhat")
except NodeProcessError as e:
raiseMultiNodeSuiteError "hardhat node not started: " & e.msg
trace "hardhat node started" trace "hardhat node started"
return node return node
except NodeProcessError as e:
raiseMultiNodeSuiteError "cannot start hardhat process: " & e.msg
proc newCodexProcess( proc newCodexProcess(
roleIdx: int, conf: CodexConfig, role: Role roleIdx: int, conf: CodexConfig, role: Role

@ -1 +1 @@
Subproject commit 2dddc260152b6e9c24ae372397f9b9b2d27ce8e4 Subproject commit dee3d7b654de02db2e8a023e37120b51150ff6cb