nim-codex/dagger/por/timing/prooftiming.nim
markspanbroek 03fa370624
Proving (#66)
* Add Proving object, which maintains contract id's to watch

* [proving] invoke callback when proof is required

# Conflicts:
#	dagger/por/timing/periods.nim
#	dagger/por/timing/prooftiming.nim

* [proving] check proof requirements for all our contracts

# Conflicts:
#	tests/dagger/helpers/mockprooftiming.nim

* Update vendor/dagger-contracts

* [proving] call onProofRequired() when proof is required soon

* [proving] stop checking contracts that have ended

* [proving] Remove duplicated funcs

* [proving] Implement ProofTiming on top of smart contract

* [proving] Fix race condition in waitUntilNextPeriod()

Sometimes waitUntilNextPeriod would take a while to
determine the current period, leading to unexpected results.

Splits waitUntilNextPeriod() into getCurrentPeriod()
and waitUntilPeriod(), to ensure that we're really waiting
for the period that we think we're waiting for.
2022-04-08 15:58:16 -06:00

36 lines
1.0 KiB
Nim

import pkg/chronos
import pkg/stint
import ./periods
export chronos
export stint
export periods
type
ProofTiming* = ref object of RootObj
ContractId* = array[32, byte]
method periodicity*(proofTiming: ProofTiming):
Future[Periodicity] {.base, async.} =
raiseAssert("not implemented")
method getCurrentPeriod*(proofTiming: ProofTiming):
Future[Period] {.base, async.} =
raiseAssert("not implemented")
method waitUntilPeriod*(proofTiming: ProofTiming,
period: Period) {.base, async.} =
raiseAssert("not implemented")
method isProofRequired*(proofTiming: ProofTiming,
id: ContractId): Future[bool] {.base, async.} =
raiseAssert("not implemented")
method willProofBeRequired*(proofTiming: ProofTiming,
id: ContractId): Future[bool] {.base, async.} =
raiseAssert("not implemented")
method getProofEnd*(proofTiming: ProofTiming,
id: ContractId): Future[UInt256] {.base, async.} =
raiseAssert("not implemented")