[marketplace] Specify size per slot, instead of total size
Reasoning: it was unclear exactly how much storage a host should have available for a slot. The division size/slots can have a non-integer value.
This commit is contained in:
parent
3e9fffb526
commit
9ab65ae5a6
|
@ -129,11 +129,11 @@ contract Marketplace is Collateral, Proofs {
|
|||
}
|
||||
|
||||
struct Ask {
|
||||
uint256 size; // size of requested storage in number of bytes
|
||||
uint64 slots; // the number of requested slots
|
||||
uint256 slotSize; // amount of storage per slot (in number of bytes)
|
||||
uint256 duration; // how long content should be stored (in seconds)
|
||||
uint256 proofProbability; // how often storage proofs are required
|
||||
uint256 reward; // amount of tokens paid per second per slot to hosts
|
||||
uint64 slots; // the total number of hosts that store the data set
|
||||
}
|
||||
|
||||
struct Content {
|
||||
|
|
|
@ -5,11 +5,11 @@ const { hexlify, randomBytes } = ethers.utils
|
|||
const exampleRequest = () => ({
|
||||
client: hexlify(randomBytes(20)),
|
||||
ask: {
|
||||
size: 1 * 1024 * 1024 * 1024, // 1 Gigabyte
|
||||
slots: 4,
|
||||
slotSize: 1 * 1024 * 1024 * 1024, // 1 Gigabyte
|
||||
duration: hours(10),
|
||||
proofProbability: 4, // require a proof roughly once every 4 periods
|
||||
reward: 84,
|
||||
slots: 4,
|
||||
},
|
||||
content: {
|
||||
cid: "zb2rhheVmk3bLks5MgzTqyznLu1zqGH5jrfTA1eAZXrjx7Vob",
|
||||
|
|
10
test/ids.js
10
test/ids.js
|
@ -2,7 +2,7 @@ const { ethers } = require("hardhat")
|
|||
const { keccak256, defaultAbiCoder } = ethers.utils
|
||||
|
||||
function requestId(request) {
|
||||
const Ask = "tuple(uint256, uint256, uint256, uint256, int64)"
|
||||
const Ask = "tuple(int64, uint256, uint256, uint256, uint256)"
|
||||
const Erasure = "tuple(uint64)"
|
||||
const PoR = "tuple(bytes, bytes, bytes)"
|
||||
const Content = "tuple(string, " + Erasure + ", " + PoR + ")"
|
||||
|
@ -12,7 +12,13 @@ function requestId(request) {
|
|||
}
|
||||
|
||||
function askToArray(ask) {
|
||||
return [ask.size, ask.duration, ask.proofProbability, ask.reward, ask.slots]
|
||||
return [
|
||||
ask.slots,
|
||||
ask.slotSize,
|
||||
ask.duration,
|
||||
ask.proofProbability,
|
||||
ask.reward,
|
||||
]
|
||||
}
|
||||
|
||||
function erasureToArray(erasure) {
|
||||
|
|
Loading…
Reference in New Issue