[contracts] replace totalNodes and nodeId by slots

This commit is contained in:
Mark Spanbroek 2022-07-20 14:18:12 +02:00 committed by markspanbroek
parent 360c03e7c4
commit 0494b3617b
3 changed files with 6 additions and 11 deletions

View File

@ -17,14 +17,13 @@ type
duration*: UInt256
proofProbability*: UInt256
reward*: UInt256
slots*: uint64
StorageContent* = object
cid*: string
erasure*: StorageErasure
por*: StoragePoR
StorageErasure* = object
totalChunks*: uint64
totalNodes*: uint64
nodeId*: uint64
StoragePoR* = object
u*: seq[byte]
publicKey*: seq[byte]
@ -44,7 +43,8 @@ func fromTuple(_: type StorageAsk, tupl: tuple): StorageAsk =
size: tupl[0],
duration: tupl[1],
proofProbability: tupl[2],
reward: tupl[3]
reward: tupl[3],
slots: tupl[4]
)
func fromTuple(_: type StorageContent, tupl: tuple): StorageContent =
@ -56,9 +56,7 @@ func fromTuple(_: type StorageContent, tupl: tuple): StorageContent =
func fromTuple(_: type StorageErasure, tupl: tuple): StorageErasure =
StorageErasure(
totalChunks: tupl[0],
totalNodes: tupl[1],
nodeId: tupl[2]
totalChunks: tupl[0]
)
func fromTuple(_: type StoragePoR, tupl: tuple): StoragePoR =

View File

@ -268,8 +268,6 @@ proc requestStorage*(self: CodexNodeRef,
cid: $encodedBlk.cid,
erasure: StorageErasure(
totalChunks: encoded.len.uint64,
totalNodes: 1, # TODO: store on multiple nodes
nodeId: 0 # TODO: store on multiple nodes
),
por: StoragePor(
u: @[], # TODO: PoR setup

View File

@ -16,14 +16,13 @@ proc example*(_: type StorageRequest): StorageRequest =
size: (1 * 1024 * 1024 * 1024).u256, # 1 Gigabyte
duration: (10 * 60 * 60).u256, # 10 hours
proofProbability: 4.u256, # require a proof roughly once every 4 periods
reward: 84.u256
reward: 84.u256,
slots: 42
),
content: StorageContent(
cid: "zb2rhheVmk3bLks5MgzTqyznLu1zqGH5jrfTA1eAZXrjx7Vob",
erasure: StorageErasure(
totalChunks: 12,
totalNodes: 4,
nodeId: 3
),
por: StoragePor(
u: @(array[480, byte].example),