[contracts] replace totalNodes and nodeId by slots
This commit is contained in:
parent
360c03e7c4
commit
0494b3617b
|
@ -17,14 +17,13 @@ type
|
||||||
duration*: UInt256
|
duration*: UInt256
|
||||||
proofProbability*: UInt256
|
proofProbability*: UInt256
|
||||||
reward*: UInt256
|
reward*: UInt256
|
||||||
|
slots*: uint64
|
||||||
StorageContent* = object
|
StorageContent* = object
|
||||||
cid*: string
|
cid*: string
|
||||||
erasure*: StorageErasure
|
erasure*: StorageErasure
|
||||||
por*: StoragePoR
|
por*: StoragePoR
|
||||||
StorageErasure* = object
|
StorageErasure* = object
|
||||||
totalChunks*: uint64
|
totalChunks*: uint64
|
||||||
totalNodes*: uint64
|
|
||||||
nodeId*: uint64
|
|
||||||
StoragePoR* = object
|
StoragePoR* = object
|
||||||
u*: seq[byte]
|
u*: seq[byte]
|
||||||
publicKey*: seq[byte]
|
publicKey*: seq[byte]
|
||||||
|
@ -44,7 +43,8 @@ func fromTuple(_: type StorageAsk, tupl: tuple): StorageAsk =
|
||||||
size: tupl[0],
|
size: tupl[0],
|
||||||
duration: tupl[1],
|
duration: tupl[1],
|
||||||
proofProbability: tupl[2],
|
proofProbability: tupl[2],
|
||||||
reward: tupl[3]
|
reward: tupl[3],
|
||||||
|
slots: tupl[4]
|
||||||
)
|
)
|
||||||
|
|
||||||
func fromTuple(_: type StorageContent, tupl: tuple): StorageContent =
|
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 =
|
func fromTuple(_: type StorageErasure, tupl: tuple): StorageErasure =
|
||||||
StorageErasure(
|
StorageErasure(
|
||||||
totalChunks: tupl[0],
|
totalChunks: tupl[0]
|
||||||
totalNodes: tupl[1],
|
|
||||||
nodeId: tupl[2]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func fromTuple(_: type StoragePoR, tupl: tuple): StoragePoR =
|
func fromTuple(_: type StoragePoR, tupl: tuple): StoragePoR =
|
||||||
|
|
|
@ -268,8 +268,6 @@ proc requestStorage*(self: CodexNodeRef,
|
||||||
cid: $encodedBlk.cid,
|
cid: $encodedBlk.cid,
|
||||||
erasure: StorageErasure(
|
erasure: StorageErasure(
|
||||||
totalChunks: encoded.len.uint64,
|
totalChunks: encoded.len.uint64,
|
||||||
totalNodes: 1, # TODO: store on multiple nodes
|
|
||||||
nodeId: 0 # TODO: store on multiple nodes
|
|
||||||
),
|
),
|
||||||
por: StoragePor(
|
por: StoragePor(
|
||||||
u: @[], # TODO: PoR setup
|
u: @[], # TODO: PoR setup
|
||||||
|
|
|
@ -16,14 +16,13 @@ proc example*(_: type StorageRequest): StorageRequest =
|
||||||
size: (1 * 1024 * 1024 * 1024).u256, # 1 Gigabyte
|
size: (1 * 1024 * 1024 * 1024).u256, # 1 Gigabyte
|
||||||
duration: (10 * 60 * 60).u256, # 10 hours
|
duration: (10 * 60 * 60).u256, # 10 hours
|
||||||
proofProbability: 4.u256, # require a proof roughly once every 4 periods
|
proofProbability: 4.u256, # require a proof roughly once every 4 periods
|
||||||
reward: 84.u256
|
reward: 84.u256,
|
||||||
|
slots: 42
|
||||||
),
|
),
|
||||||
content: StorageContent(
|
content: StorageContent(
|
||||||
cid: "zb2rhheVmk3bLks5MgzTqyznLu1zqGH5jrfTA1eAZXrjx7Vob",
|
cid: "zb2rhheVmk3bLks5MgzTqyznLu1zqGH5jrfTA1eAZXrjx7Vob",
|
||||||
erasure: StorageErasure(
|
erasure: StorageErasure(
|
||||||
totalChunks: 12,
|
totalChunks: 12,
|
||||||
totalNodes: 4,
|
|
||||||
nodeId: 3
|
|
||||||
),
|
),
|
||||||
por: StoragePor(
|
por: StoragePor(
|
||||||
u: @(array[480, byte].example),
|
u: @(array[480, byte].example),
|
||||||
|
|
Loading…
Reference in New Issue