Add proof probability to Request

This commit is contained in:
Mark Spanbroek 2022-03-03 08:11:20 +01:00 committed by markspanbroek
parent 036a214427
commit ee4683e50c
3 changed files with 4 additions and 0 deletions

View File

@ -98,6 +98,7 @@ contract Marketplace is Collateral {
uint256 duration; uint256 duration;
uint256 size; uint256 size;
bytes32 contentHash; bytes32 contentHash;
uint256 proofProbability;
uint256 maxPrice; uint256 maxPrice;
uint256 expiry; uint256 expiry;
bytes32 nonce; bytes32 nonce;

View File

@ -7,6 +7,7 @@ const exampleRequest = () => ({
duration: 150, // 150 blocks ≈ half an hour duration: 150, // 150 blocks ≈ half an hour
size: 1 * 1024 * 1024 * 1024, // 1 Gigabyte size: 1 * 1024 * 1024 * 1024, // 1 Gigabyte
contentHash: sha256("0xdeadbeef"), contentHash: sha256("0xdeadbeef"),
proofProbability: 5, // require a proof roughly once every 5^2 periods
maxPrice: 84, maxPrice: 84,
expiry: now() + hours(1), expiry: now() + hours(1),
nonce: hexlify(randomBytes(32)), nonce: hexlify(randomBytes(32)),

View File

@ -11,6 +11,7 @@ function requestId(request) {
"bytes32", "bytes32",
"uint256", "uint256",
"uint256", "uint256",
"uint256",
"bytes32", "bytes32",
], ],
requestToArray(request) requestToArray(request)
@ -33,6 +34,7 @@ function requestToArray(request) {
request.duration, request.duration,
request.size, request.size,
request.contentHash, request.contentHash,
request.proofProbability,
request.maxPrice, request.maxPrice,
request.expiry, request.expiry,
request.nonce, request.nonce,