Skip to content

Commit

Permalink
DEBUG output times of processing txs
Browse files Browse the repository at this point in the history
DEBUG increase time to wait for submitted
  • Loading branch information
markspanbroek committed Nov 14, 2024
1 parent b188834 commit d239164
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions codex/contracts/market.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import ../logutils
import ../market
import ./marketplace
import ./proofs
import pkg/chronos

export market

Expand Down Expand Up @@ -98,8 +99,11 @@ method mySlots*(market: OnChainMarket): Future[seq[SlotId]] {.async.} =
method requestStorage(market: OnChainMarket, request: StorageRequest){.async.} =
convertEthersError:
debug "Requesting storage"
debugEcho "approving funds", Moment.now()

Check warning on line 102 in codex/contracts/market.nim

View check run for this annotation

Codecov / codecov/patch

codex/contracts/market.nim#L102

Added line #L102 was not covered by tests
await market.approveFunds(request.price())
debugEcho "requesting storage", Moment.now()
discard await market.contract.requestStorage(request).confirm(1)
debugEcho "done requesting storage", Moment.now()

Check warning on line 106 in codex/contracts/market.nim

View check run for this annotation

Codecov / codecov/patch

codex/contracts/market.nim#L104-L106

Added lines #L104 - L106 were not covered by tests

method getRequest(market: OnChainMarket,
id: RequestId): Future[?StorageRequest] {.async.} =
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/testpurchasing.nim
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,24 @@ twonodessuite "Purchasing", debug1 = true, debug2 = false:
let data = await RandomChunker.example(blocks=2)
let cid = client1.upload(data).get
let id = client1.requestStorage(cid,
duration=100.u256,
duration=10*60.u256,
reward=2.u256,
proofProbability=3.u256,
expiry=30,
expiry=5*60,
collateral=200.u256,
nodes=3.uint,
tolerance=1.uint).get
check eventually(client1.purchaseStateIs(id, "submitted"), timeout = 10*1000)
check eventually(client1.purchaseStateIs(id, "submitted"), timeout = 4*60*1000)
debugEcho "client state: ", client1.getPurchase(id).?state
node1.restart()
client1.restart()

check eventually client1.purchaseStateIs(id, "submitted")
let request = client1.getPurchase(id).get.request.get
check request.ask.duration == 100.u256
check request.ask.duration == (10*60).u256
check request.ask.reward == 2.u256
check request.ask.proofProbability == 3.u256
check request.expiry == 30
check request.expiry == 5*60
check request.ask.collateral == 200.u256
check request.ask.slots == 3'u64
check request.ask.maxSlotLoss == 1'u64
Expand Down

0 comments on commit d239164

Please sign in to comment.