Skip to content
Open
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
2 changes: 1 addition & 1 deletion codex/blockexchange/engine/engine.nim
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ iterator splitBatches[T](sequence: seq[T], batchSize: int): seq[T] =

proc taskHandler*(
self: BlockExcEngine, peerCtx: BlockExcPeerCtx
) {.gcsafe, async: (raises: [CancelledError, RetriesExhaustedError]).} =
) {.async: (raises: [CancelledError, RetriesExhaustedError]).} =
# Send to the peer blocks he wants to get,
# if they present in our local store

Expand Down
16 changes: 7 additions & 9 deletions codex/blockexchange/network/network.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ const
DefaultMaxInflight* = 100

type
WantListHandler* =
proc(peer: PeerId, wantList: WantList) {.gcsafe, async: (raises: []).}
WantListHandler* = proc(peer: PeerId, wantList: WantList) {.async: (raises: []).}
BlocksDeliveryHandler* =
proc(peer: PeerId, blocks: seq[BlockDelivery]) {.gcsafe, async: (raises: []).}
proc(peer: PeerId, blocks: seq[BlockDelivery]) {.async: (raises: []).}
BlockPresenceHandler* =
proc(peer: PeerId, precense: seq[BlockPresence]) {.gcsafe, async: (raises: []).}
AccountHandler* = proc(peer: PeerId, account: Account) {.gcsafe, async: (raises: []).}
PaymentHandler* =
proc(peer: PeerId, payment: SignedState) {.gcsafe, async: (raises: []).}
PeerEventHandler* = proc(peer: PeerId) {.gcsafe, async: (raises: [CancelledError]).}
proc(peer: PeerId, precense: seq[BlockPresence]) {.async: (raises: []).}
AccountHandler* = proc(peer: PeerId, account: Account) {.async: (raises: []).}
PaymentHandler* = proc(peer: PeerId, payment: SignedState) {.async: (raises: []).}
PeerEventHandler* = proc(peer: PeerId) {.async: (raises: [CancelledError]).}

BlockExcHandlers* = object
onWantList*: WantListHandler
Expand Down Expand Up @@ -347,7 +345,7 @@ method init*(self: BlockExcNetwork) {.raises: [].} =

proc peerEventHandler(
peerId: PeerId, event: PeerEvent
): Future[void] {.gcsafe, async: (raises: [CancelledError]).} =
): Future[void] {.async: (raises: [CancelledError]).} =
if event.kind == PeerEventKind.Joined:
await self.handlePeerJoined(peerId)
elif event.kind == PeerEventKind.Left:
Expand Down
5 changes: 2 additions & 3 deletions codex/blockexchange/network/networkpeer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ logScope:
const DefaultYieldInterval = 50.millis

type
ConnProvider* =
proc(): Future[Connection] {.gcsafe, async: (raises: [CancelledError]).}
ConnProvider* = proc(): Future[Connection] {.async: (raises: [CancelledError]).}

RPCHandler* = proc(peer: NetworkPeer, msg: Message) {.gcsafe, async: (raises: []).}
RPCHandler* = proc(peer: NetworkPeer, msg: Message) {.async: (raises: []).}

NetworkPeer* = ref object of RootObj
id*: PeerId
Expand Down
5 changes: 1 addition & 4 deletions codex/blocktype.nim
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import std/hashes

export tables

import pkg/upraises

push:
{.upraises: [].}
{.push raises: [], gcsafe.}

import pkg/libp2p/[cid, multicodec, multihash]
import pkg/stew/[byteutils, endians2]
Expand Down
11 changes: 4 additions & 7 deletions codex/chunker.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@

# TODO: This is super inneficient and needs a rewrite, but it'll do for now

import pkg/upraises

push:
{.upraises: [].}
{.push raises: [], gcsafe.}

import pkg/questionable
import pkg/questionable/results
Expand All @@ -31,7 +28,7 @@ type
ChunkerError* = object of CatchableError
ChunkBuffer* = ptr UncheckedArray[byte]
Reader* = proc(data: ChunkBuffer, len: int): Future[int] {.
gcsafe, async: (raises: [ChunkerError, CancelledError])
async: (raises: [ChunkerError, CancelledError])
.}

# Reader that splits input data into fixed-size chunks
Expand Down Expand Up @@ -77,7 +74,7 @@ proc new*(

proc reader(
data: ChunkBuffer, len: int
): Future[int] {.gcsafe, async: (raises: [ChunkerError, CancelledError]).} =
): Future[int] {.async: (raises: [ChunkerError, CancelledError]).} =
var res = 0
try:
while res < len:
Expand Down Expand Up @@ -105,7 +102,7 @@ proc new*(

proc reader(
data: ChunkBuffer, len: int
): Future[int] {.gcsafe, async: (raises: [ChunkerError, CancelledError]).} =
): Future[int] {.async: (raises: [ChunkerError, CancelledError]).} =
var total = 0
try:
while total < len:
Expand Down
3 changes: 1 addition & 2 deletions codex/clock.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

import pkg/chronos
import pkg/stew/endians2
import pkg/upraises
import pkg/stint

type
Clock* = ref object of RootObj
SecondsSince1970* = int64
Timeout* = object of CatchableError

method now*(clock: Clock): SecondsSince1970 {.base, gcsafe, upraises: [].} =
method now*(clock: Clock): SecondsSince1970 {.base, gcsafe, raises: [].} =
raiseAssert "not implemented"

method waitUntil*(
Expand Down
12 changes: 6 additions & 6 deletions codex/conf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ const

proc parseCmdArg*(
T: typedesc[MultiAddress], input: string
): MultiAddress {.upraises: [ValueError].} =
): MultiAddress {.raises: [ValueError].} =
var ma: MultiAddress
try:
let res = MultiAddress.init(input)
Expand Down Expand Up @@ -619,7 +619,7 @@ proc parseCmdArg*(T: type Duration, val: string): T =

proc readValue*(
r: var TomlReader, val: var EthAddress
) {.upraises: [SerializationError, IOError].} =
) {.raises: [SerializationError, IOError].} =
val = EthAddress.init(r.readValue(string)).get()

proc readValue*(r: var TomlReader, val: var SignedPeerRecord) =
Expand Down Expand Up @@ -647,7 +647,7 @@ proc readValue*(r: var TomlReader, val: var MultiAddress) =

proc readValue*(
r: var TomlReader, val: var NBytes
) {.upraises: [SerializationError, IOError].} =
) {.raises: [SerializationError, IOError].} =
var value = 0'i64
var str = r.readValue(string)
let count = parseSize(str, value, alwaysBin = true)
Expand All @@ -658,7 +658,7 @@ proc readValue*(

proc readValue*(
r: var TomlReader, val: var ThreadCount
) {.upraises: [SerializationError, IOError].} =
) {.raises: [SerializationError, IOError].} =
var str = r.readValue(string)
try:
val = parseCmdArg(ThreadCount, str)
Expand All @@ -667,7 +667,7 @@ proc readValue*(

proc readValue*(
r: var TomlReader, val: var Duration
) {.upraises: [SerializationError, IOError].} =
) {.raises: [SerializationError, IOError].} =
var str = r.readValue(string)
var dur: Duration
let count = parseDuration(str, dur)
Expand Down Expand Up @@ -734,7 +734,7 @@ proc stripAnsi*(v: string): string =

res

proc updateLogLevel*(logLevel: string) {.upraises: [ValueError].} =
proc updateLogLevel*(logLevel: string) {.raises: [ValueError].} =
# Updates log levels (without clearing old ones)
let directives = logLevel.split(";")
try:
Expand Down
23 changes: 11 additions & 12 deletions codex/contracts/market.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import std/strformat
import std/strutils
import pkg/ethers
import pkg/upraises
import pkg/questionable
import pkg/lrucache
import ../utils/exceptions
Expand Down Expand Up @@ -436,7 +435,7 @@ method canReserveSlot*(
method subscribeRequests*(
market: OnChainMarket, callback: OnRequest
): Future[MarketSubscription] {.async.} =
proc onEvent(eventResult: ?!StorageRequested) {.upraises: [].} =
proc onEvent(eventResult: ?!StorageRequested) {.raises: [].} =
without event =? eventResult, eventErr:
error "There was an error in Request subscription", msg = eventErr.msg
return
Expand All @@ -450,7 +449,7 @@ method subscribeRequests*(
method subscribeSlotFilled*(
market: OnChainMarket, callback: OnSlotFilled
): Future[MarketSubscription] {.async.} =
proc onEvent(eventResult: ?!SlotFilled) {.upraises: [].} =
proc onEvent(eventResult: ?!SlotFilled) {.raises: [].} =
without event =? eventResult, eventErr:
error "There was an error in SlotFilled subscription", msg = eventErr.msg
return
Expand All @@ -477,7 +476,7 @@ method subscribeSlotFilled*(
method subscribeSlotFreed*(
market: OnChainMarket, callback: OnSlotFreed
): Future[MarketSubscription] {.async.} =
proc onEvent(eventResult: ?!SlotFreed) {.upraises: [].} =
proc onEvent(eventResult: ?!SlotFreed) {.raises: [].} =
without event =? eventResult, eventErr:
error "There was an error in SlotFreed subscription", msg = eventErr.msg
return
Expand All @@ -491,7 +490,7 @@ method subscribeSlotFreed*(
method subscribeSlotReservationsFull*(
market: OnChainMarket, callback: OnSlotReservationsFull
): Future[MarketSubscription] {.async.} =
proc onEvent(eventResult: ?!SlotReservationsFull) {.upraises: [].} =
proc onEvent(eventResult: ?!SlotReservationsFull) {.raises: [].} =
without event =? eventResult, eventErr:
error "There was an error in SlotReservationsFull subscription",
msg = eventErr.msg
Expand All @@ -506,7 +505,7 @@ method subscribeSlotReservationsFull*(
method subscribeFulfillment(
market: OnChainMarket, callback: OnFulfillment
): Future[MarketSubscription] {.async.} =
proc onEvent(eventResult: ?!RequestFulfilled) {.upraises: [].} =
proc onEvent(eventResult: ?!RequestFulfilled) {.raises: [].} =
without event =? eventResult, eventErr:
error "There was an error in RequestFulfillment subscription", msg = eventErr.msg
return
Expand All @@ -520,7 +519,7 @@ method subscribeFulfillment(
method subscribeFulfillment(
market: OnChainMarket, requestId: RequestId, callback: OnFulfillment
): Future[MarketSubscription] {.async.} =
proc onEvent(eventResult: ?!RequestFulfilled) {.upraises: [].} =
proc onEvent(eventResult: ?!RequestFulfilled) {.raises: [].} =
without event =? eventResult, eventErr:
error "There was an error in RequestFulfillment subscription", msg = eventErr.msg
return
Expand All @@ -535,7 +534,7 @@ method subscribeFulfillment(
method subscribeRequestCancelled*(
market: OnChainMarket, callback: OnRequestCancelled
): Future[MarketSubscription] {.async.} =
proc onEvent(eventResult: ?!RequestCancelled) {.upraises: [].} =
proc onEvent(eventResult: ?!RequestCancelled) {.raises: [].} =
without event =? eventResult, eventErr:
error "There was an error in RequestCancelled subscription", msg = eventErr.msg
return
Expand All @@ -549,7 +548,7 @@ method subscribeRequestCancelled*(
method subscribeRequestCancelled*(
market: OnChainMarket, requestId: RequestId, callback: OnRequestCancelled
): Future[MarketSubscription] {.async.} =
proc onEvent(eventResult: ?!RequestCancelled) {.upraises: [].} =
proc onEvent(eventResult: ?!RequestCancelled) {.raises: [].} =
without event =? eventResult, eventErr:
error "There was an error in RequestCancelled subscription", msg = eventErr.msg
return
Expand All @@ -564,7 +563,7 @@ method subscribeRequestCancelled*(
method subscribeRequestFailed*(
market: OnChainMarket, callback: OnRequestFailed
): Future[MarketSubscription] {.async.} =
proc onEvent(eventResult: ?!RequestFailed) {.upraises: [].} =
proc onEvent(eventResult: ?!RequestFailed) {.raises: [].} =
without event =? eventResult, eventErr:
error "There was an error in RequestFailed subscription", msg = eventErr.msg
return
Expand All @@ -578,7 +577,7 @@ method subscribeRequestFailed*(
method subscribeRequestFailed*(
market: OnChainMarket, requestId: RequestId, callback: OnRequestFailed
): Future[MarketSubscription] {.async.} =
proc onEvent(eventResult: ?!RequestFailed) {.upraises: [].} =
proc onEvent(eventResult: ?!RequestFailed) {.raises: [].} =
without event =? eventResult, eventErr:
error "There was an error in RequestFailed subscription", msg = eventErr.msg
return
Expand All @@ -593,7 +592,7 @@ method subscribeRequestFailed*(
method subscribeProofSubmission*(
market: OnChainMarket, callback: OnProofSubmitted
): Future[MarketSubscription] {.async.} =
proc onEvent(eventResult: ?!ProofSubmitted) {.upraises: [].} =
proc onEvent(eventResult: ?!ProofSubmitted) {.raises: [].} =
without event =? eventResult, eventErr:
error "There was an error in ProofSubmitted subscription", msg = eventErr.msg
return
Expand Down
2 changes: 1 addition & 1 deletion codex/discovery.nim
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ method provide*(

method removeProvider*(
d: Discovery, peerId: PeerId
): Future[void] {.base, gcsafe, async: (raises: [CancelledError]).} =
): Future[void] {.base, async: (raises: [CancelledError]).} =
## Remove provider from providers table
##

Expand Down
5 changes: 1 addition & 4 deletions codex/erasure/backend.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
## This file may not be copied, modified, or distributed except according to
## those terms.

import pkg/upraises

push:
{.upraises: [].}
{.push raises: [], gcsafe.}

import ../stores

Expand Down
5 changes: 1 addition & 4 deletions codex/erasure/erasure.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
## This file may not be copied, modified, or distributed except according to
## those terms.

import pkg/upraises

push:
{.upraises: [].}
{.push raises: [], gcsafe.}

import std/[sugar, atomics, sequtils]

Expand Down
4 changes: 1 addition & 3 deletions codex/manifest/coders.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@

# This module implements serialization and deserialization of Manifest

import pkg/upraises
import times

push:
{.upraises: [].}
{.push raises: [].}

import std/tables
import std/sequtils
Expand Down
5 changes: 1 addition & 4 deletions codex/manifest/manifest.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@

# This module defines all operations on Manifest

import pkg/upraises

push:
{.upraises: [].}
{.push raises: [], gcsafe.}

import pkg/libp2p/protobuf/minprotobuf
import pkg/libp2p/[cid, multihash, multicodec]
Expand Down
19 changes: 9 additions & 10 deletions codex/market.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pkg/chronos
import pkg/upraises
import pkg/questionable
import pkg/ethers/erc20
import ./contracts/requests
Expand All @@ -23,15 +22,15 @@ type
ProofInvalidError* = object of MarketError
Subscription* = ref object of RootObj
OnRequest* =
proc(id: RequestId, ask: StorageAsk, expiry: uint64) {.gcsafe, upraises: [].}
OnFulfillment* = proc(requestId: RequestId) {.gcsafe, upraises: [].}
OnSlotFilled* = proc(requestId: RequestId, slotIndex: uint64) {.gcsafe, upraises: [].}
OnSlotFreed* = proc(requestId: RequestId, slotIndex: uint64) {.gcsafe, upraises: [].}
proc(id: RequestId, ask: StorageAsk, expiry: uint64) {.gcsafe, raises: [].}
OnFulfillment* = proc(requestId: RequestId) {.gcsafe, raises: [].}
OnSlotFilled* = proc(requestId: RequestId, slotIndex: uint64) {.gcsafe, raises: [].}
OnSlotFreed* = proc(requestId: RequestId, slotIndex: uint64) {.gcsafe, raises: [].}
OnSlotReservationsFull* =
proc(requestId: RequestId, slotIndex: uint64) {.gcsafe, upraises: [].}
OnRequestCancelled* = proc(requestId: RequestId) {.gcsafe, upraises: [].}
OnRequestFailed* = proc(requestId: RequestId) {.gcsafe, upraises: [].}
OnProofSubmitted* = proc(id: SlotId) {.gcsafe, upraises: [].}
proc(requestId: RequestId, slotIndex: uint64) {.gcsafe, raises: [].}
OnRequestCancelled* = proc(requestId: RequestId) {.gcsafe, raises: [].}
OnRequestFailed* = proc(requestId: RequestId) {.gcsafe, raises: [].}
OnProofSubmitted* = proc(id: SlotId) {.gcsafe, raises: [].}
ProofChallenge* = array[32, byte]

# Marketplace events -- located here due to the Market abstraction
Expand Down Expand Up @@ -275,7 +274,7 @@ method subscribeProofSubmission*(
): Future[Subscription] {.base, async.} =
raiseAssert("not implemented")

method unsubscribe*(subscription: Subscription) {.base, async, upraises: [].} =
method unsubscribe*(subscription: Subscription) {.base, async.} =
raiseAssert("not implemented")

method queryPastSlotFilledEvents*(
Expand Down
5 changes: 1 addition & 4 deletions codex/merkletree/codex/coders.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
## This file may not be copied, modified, or distributed except according to
## those terms.

import pkg/upraises

push:
{.upraises: [].}
{.push raises: [], gcsafe.}

import pkg/libp2p
import pkg/questionable
Expand Down
Loading
Loading