Remove PoR parameters, add merkle root for storage proofs

This commit is contained in:
Mark Spanbroek 2023-10-18 16:27:42 +02:00 committed by markspanbroek
parent 14e453ac31
commit efafa43910
3 changed files with 5 additions and 33 deletions

View File

@ -23,19 +23,8 @@ struct Ask {
}
struct Content {
string cid; // content id (if part of a larger set, the chunk cid)
Erasure erasure; // Erasure coding attributes
PoR por; // Proof of Retrievability parameters
}
struct Erasure {
uint64 totalChunks; // the total number of chunks in the larger data set
}
struct PoR {
bytes u; // parameters u_1..u_s
bytes publicKey; // public key
bytes name; // random name
string cid; // content id, used to download the dataset
bytes merkleRoot; // merkle root of the dataset, used to verify storage proofs
}
enum RequestState {

View File

@ -32,14 +32,7 @@ const exampleRequest = async () => {
},
content: {
cid: "zb2rhheVmk3bLks5MgzTqyznLu1zqGH5jrfTA1eAZXrjx7Vob",
erasure: {
totalChunks: 12,
},
por: {
u: Array.from(randomBytes(480)),
publicKey: Array.from(randomBytes(96)),
name: Array.from(randomBytes(512)),
},
merkleRoot: Array.from(randomBytes(32))
},
expiry: now + hours(1),
nonce: hexlify(randomBytes(32)),

View File

@ -3,9 +3,7 @@ const { keccak256, defaultAbiCoder } = ethers.utils
function requestId(request) {
const Ask = "tuple(int64, uint256, uint256, uint256, uint256, uint256, int64)"
const Erasure = "tuple(uint64)"
const PoR = "tuple(bytes, bytes, bytes)"
const Content = "tuple(string, " + Erasure + ", " + PoR + ")"
const Content = "tuple(string, bytes)"
const Request =
"tuple(address, " + Ask + ", " + Content + ", uint256, bytes32)"
return keccak256(defaultAbiCoder.encode([Request], requestToArray(request)))
@ -23,16 +21,8 @@ function askToArray(ask) {
]
}
function erasureToArray(erasure) {
return [erasure.totalChunks]
}
function porToArray(por) {
return [por.u, por.publicKey, por.name]
}
function contentToArray(content) {
return [content.cid, erasureToArray(content.erasure), porToArray(content.por)]
return [content.cid, content.merkleRoot]
}
function requestToArray(request) {