mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-09 20:45:38 +00:00
71cd35112b
* [docs] fix two client scenario: add missing collateral * [integration] separate step to wait for node to be started * [cli] add option to specify ethereum private key * Remove unused imports * Fix warnings * [integration] move type definitions to correct place * [integration] wait a bit longer for a node to start in debug mode When e.g. running against Taiko test net rpc, the node start takes longer * [integration] simplify handling of codex node and client * [integration] add Taiko integration test * [contracts] await token approval confirmation before next tx * [contracts] deployment address of marketplace on Taiko * [cli] --eth-private-key now takes a file name Instead of supplying the private key on the command line, expect the private key to be in a file with the correct permissions. * [utils] Fixes undeclared `activeChroniclesStream` on Windows * [build] update nim-ethers to include PR #52 Co-authored-by: Eric Mastro <eric.mastro@gmail.com> * [cli] Better error messages when reading eth private key Co-authored-by: Eric Mastro <eric.mastro@gmail.com> * [integration] simplify reading of cmd line arguments Co-authored-by: Eric Mastro <eric.mastro@gmail.com> * [build] update to latest version of nim-ethers * [contracts] updated contract address for Taiko L2 * [build] update codex contracts to latest version --------- Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
41 lines
1.6 KiB
Nim
41 lines
1.6 KiB
Nim
import std/unittest
|
|
import std/tempfiles
|
|
import codex/utils/fileutils
|
|
import ./nodes
|
|
|
|
suite "Command line interface":
|
|
|
|
let account = "4242424242424242424242424242424242424242"
|
|
let key = "4242424242424242424242424242424242424242424242424242424242424242"
|
|
|
|
test "complains when persistence is enabled without ethereum account":
|
|
let node = startNode(@["--persistence"])
|
|
node.waitUntilOutput("Persistence enabled, but no Ethereum account was set")
|
|
node.stop()
|
|
|
|
test "complains when validator is enabled without ethereum account":
|
|
let node = startNode(@["--validator"])
|
|
node.waitUntilOutput("Validator enabled, but no Ethereum account was set")
|
|
node.stop()
|
|
|
|
test "complains when ethereum account is set when not needed":
|
|
let node = startNode(@["--eth-account=" & account])
|
|
node.waitUntilOutput("Ethereum account was set, but neither persistence nor validator is enabled")
|
|
node.stop()
|
|
|
|
test "complains when ethereum private key is set when not needed":
|
|
let keyFile = genTempPath("", "")
|
|
discard secureWriteFile(keyFile, key)
|
|
let node = startNode(@["--eth-private-key=" & keyFile])
|
|
node.waitUntilOutput("Ethereum account was set, but neither persistence nor validator is enabled")
|
|
node.stop()
|
|
discard removeFile(keyFile)
|
|
|
|
test "complains when ethereum private key file has wrong permissions":
|
|
let unsafeKeyFile = genTempPath("", "")
|
|
discard unsafeKeyFile.writeFile(key, 0o666)
|
|
let node = startNode(@["--persistence", "--eth-private-key=" & unsafeKeyFile])
|
|
node.waitUntilOutput("Ethereum private key file does not have safe file permissions")
|
|
node.stop()
|
|
discard removeFile(unsafeKeyFile)
|