mirror of
https://github.com/logos-storage/logos-storage-contracts-eth.git
synced 2026-01-07 07:43:08 +00:00
Add a parameter, `saturation` to the network-level configuration, under `SlotReservationConfig`. This parameter represents the percentage of total time before expiry that all addresses are eligible to reserve a slot. Total time is the duration between request creation and expiry. Valid range is [0, 99]. Note, this parameter is not yet used anywhere.
64 lines
1.3 KiB
JavaScript
64 lines
1.3 KiB
JavaScript
const { ethers } = require("hardhat")
|
|
const { hours } = require("./time")
|
|
const { hexlify, randomBytes } = ethers.utils
|
|
|
|
const exampleConfiguration = () => ({
|
|
collateral: {
|
|
repairRewardPercentage: 10,
|
|
maxNumberOfSlashes: 5,
|
|
slashCriterion: 3,
|
|
slashPercentage: 10,
|
|
},
|
|
proofs: {
|
|
period: 10,
|
|
timeout: 5,
|
|
downtime: 64,
|
|
zkeyHash: "",
|
|
downtimeProduct: 67,
|
|
},
|
|
reservations: {
|
|
saturation: 20,
|
|
},
|
|
})
|
|
|
|
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,
|
|
collateral: 200,
|
|
},
|
|
content: {
|
|
cid: "zb2rhheVmk3bLks5MgzTqyznLu1zqGH5jrfTA1eAZXrjx7Vob",
|
|
merkleRoot: Array.from(randomBytes(32)),
|
|
},
|
|
expiry: hours(1),
|
|
nonce: hexlify(randomBytes(32)),
|
|
expansion: 60, // 60% of nodes are eligible halfway to when all addresses eligible
|
|
}
|
|
}
|
|
|
|
const exampleProof = () => ({
|
|
a: { x: 1, y: 2 },
|
|
b: { x: [3, 4], y: [5, 6] },
|
|
c: { x: 7, y: 8 },
|
|
})
|
|
|
|
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,
|
|
}
|