Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions archivist/archivist.nim
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ proc connectMarketplace(s: NodeServer) {.async.} =
datastore = s.repoStore.metaDs,
storage = MarketplaceStorage.new(s.repoStore),
options = MarketplaceOptions(
marketplaceAddress: config.marketplaceAddress,
rewardRecipient: config.rewardRecipient,
maxPriorityFeePerGas: config.maxPriorityFeePerGas,
requestCacheSize: config.marketplaceRequestCacheSize,
validationEnabled: config.validator,
validationMaxSlots: some config.validatorMaxSlots,
validationGroups: config.validatorGroups,
Expand Down
7 changes: 0 additions & 7 deletions archivist/conf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,6 @@ type
name: "eth-provider"
.}: string

ethAccount* {.
desc: "The Ethereum account that is used for storage contracts",
defaultValue: EthAddress.none,
defaultValueDesc: "",
name: "eth-account"
.}: Option[EthAddress]

ethPrivateKey* {.
desc: "File containing Ethereum private key for storage contracts",
defaultValue: string.none,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,16 @@ suite "Command line interface":
.waitForOutput(expectedOutput)
.start()

test "warns about invalid marketplace address":
discard await testbed.node
.persistence()
.marketplaceAddress("0xDEADDEADDEADDEADDEADDEADDEADDEADDEADDEAD")
.waitForOutput("Unable to start marketplace")
.start()

test "automatically uses local config.toml":
let
expectedOutput = "Persistence enabled, but no Ethereum account was set"
expectedOutput = "Persistence enabled, but no Ethereum private key was set"
configFile = "config.toml"
content = "persistence=true"

Expand Down
1 change: 1 addition & 0 deletions tests/testbed.nim
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export node.log
export node.persistence
export node.ethPrivateKey
export node.noEthPrivateKey
export node.marketplaceAddress
export node.circomR1cs
export node.noCircomR1cs
export node.circomWasm
Expand Down
7 changes: 7 additions & 0 deletions tests/testbed/builders/node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type NodeBuilder = ref object
logTopics: seq[string]
persistence: bool
ethPrivateKey: ? ?string
marketplaceAddress: ?string
validator: bool
validatorGroups: ?int
validatorGroupIndex: ?int
Expand Down Expand Up @@ -93,6 +94,10 @@ func noEthPrivateKey*(builder: NodeBuilder): NodeBuilder =
builder.ethPrivateKey = some none string
builder

func marketplaceAddress*(builder: NodeBuilder, address: string): NodeBuilder =
builder.marketplaceAddress = some address
builder

func validator*(builder: NodeBuilder): NodeBuilder =
builder.persistence = true
builder.validator = true
Expand Down Expand Up @@ -246,6 +251,8 @@ proc start*(builder: NodeBuilder): Future[Node] {.async.} =
arguments.add("--eth-provider=" & builder.testbed.hardhatInstance.jsonRpcUrl)
if ethPrivateKey =? builder.ethPrivateKeyResolved:
arguments.add("--eth-private-key=" & ethPrivateKey)
if marketplaceAddress =? builder.marketplaceAddress:
arguments.add("--marketplace-address=" & marketplaceAddress)
if builder.validator:
arguments.add("--validator")
if groups =? builder.validatorGroups:
Expand Down