2021-11-02 08:04:51 +00:00
|
|
|
const { ethers } = require("hardhat")
|
2022-09-22 02:21:49 +00:00
|
|
|
const { hours } = require("./time")
|
2023-01-17 10:07:12 +00:00
|
|
|
const { hexlify, randomBytes } = ethers.utils
|
2021-11-02 08:04:51 +00:00
|
|
|
|
2023-01-17 12:55:58 +00:00
|
|
|
const exampleConfiguration = () => ({
|
|
|
|
collateral: {
|
2023-03-30 09:11:21 +00:00
|
|
|
repairRewardPercentage: 10,
|
|
|
|
maxNumberOfSlashes: 5,
|
2023-01-17 12:55:58 +00:00
|
|
|
slashCriterion: 3,
|
|
|
|
slashPercentage: 10,
|
|
|
|
},
|
|
|
|
proofs: {
|
|
|
|
period: 10,
|
|
|
|
timeout: 5,
|
|
|
|
downtime: 64,
|
2024-01-30 05:36:27 +00:00
|
|
|
zkeyHash: "",
|
2024-08-14 05:50:32 +00:00
|
|
|
downtimeProduct: 67,
|
2023-01-17 12:55:58 +00:00
|
|
|
},
|
2024-10-03 01:01:21 +00:00
|
|
|
reservations: {
|
|
|
|
maxReservations: 3,
|
|
|
|
},
|
2023-01-17 12:55:58 +00:00
|
|
|
})
|
|
|
|
|
2022-09-22 02:21:49 +00:00
|
|
|
const exampleRequest = async () => {
|
|
|
|
return {
|
|
|
|
client: hexlify(randomBytes(20)),
|
|
|
|
ask: {
|
|
|
|
slots: 4,
|
|
|
|
slotSize: 1 * 1024 * 1024 * 1024, // 1 Gigabyte
|
|
|
|
duration: hours(10),
|
|
|
|
proofProbability: 4, // require a proof roughly once every 4 periods
|
|
|
|
reward: 84,
|
|
|
|
maxSlotLoss: 2,
|
2023-03-08 11:02:34 +00:00
|
|
|
collateral: 200,
|
2022-04-06 12:26:56 +00:00
|
|
|
},
|
2022-09-22 02:21:49 +00:00
|
|
|
content: {
|
|
|
|
cid: "zb2rhheVmk3bLks5MgzTqyznLu1zqGH5jrfTA1eAZXrjx7Vob",
|
2024-01-10 14:12:18 +00:00
|
|
|
merkleRoot: Array.from(randomBytes(32)),
|
2022-04-06 12:26:56 +00:00
|
|
|
},
|
2024-05-06 13:13:32 +00:00
|
|
|
expiry: hours(1),
|
2022-09-22 02:21:49 +00:00
|
|
|
nonce: hexlify(randomBytes(32)),
|
|
|
|
}
|
|
|
|
}
|
2022-02-15 16:01:54 +00:00
|
|
|
|
2024-01-18 12:50:54 +00:00
|
|
|
const exampleProof = () => ({
|
|
|
|
a: { x: 1, y: 2 },
|
2024-01-25 12:13:32 +00:00
|
|
|
b: { x: [3, 4], y: [5, 6] },
|
|
|
|
c: { x: 7, y: 8 },
|
2024-01-18 12:50:54 +00:00
|
|
|
})
|
2024-01-18 12:37:33 +00:00
|
|
|
|
2024-01-25 08:59:01 +00:00
|
|
|
const invalidProof = () => ({
|
|
|
|
a: { x: 0, y: 0 },
|
|
|
|
b: { x: [0, 0], y: [0, 0] },
|
|
|
|
c: { x: 0, y: 0 },
|
|
|
|
})
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
exampleConfiguration,
|
|
|
|
exampleRequest,
|
|
|
|
exampleProof,
|
|
|
|
invalidProof,
|
|
|
|
}
|