mirror of
https://github.com/logos-storage/logos-storage-contracts-eth.git
synced 2026-01-08 16:23:12 +00:00
Change the cid from string to bytes (#214)
* Change the cid from string to bytes * Fix content definition * Fix cid invalid test
This commit is contained in:
parent
875e4d53ec
commit
0f2012b144
@ -3,6 +3,7 @@ module.exports = {
|
|||||||
repairRewardPercentage: 10,
|
repairRewardPercentage: 10,
|
||||||
maxNumberOfSlashes: 2,
|
maxNumberOfSlashes: 2,
|
||||||
slashPercentage: 20,
|
slashPercentage: 20,
|
||||||
|
validatorRewardPercentage: 20, // percentage of the slashed amount going to the validators
|
||||||
},
|
},
|
||||||
proofs: {
|
proofs: {
|
||||||
// period has to be less than downtime * blocktime
|
// period has to be less than downtime * blocktime
|
||||||
|
|||||||
@ -23,7 +23,7 @@ struct Ask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct Content {
|
struct Content {
|
||||||
string cid; // content id, used to download the dataset
|
bytes cid; // content id, used to download the dataset
|
||||||
bytes32 merkleRoot; // merkle root of the dataset, used to verify storage proofs
|
bytes32 merkleRoot; // merkle root of the dataset, used to verify storage proofs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -279,7 +279,7 @@ describe("Marketplace", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("is rejected when cid is missing", async function () {
|
it("is rejected when cid is missing", async function () {
|
||||||
request.content.cid = ""
|
request.content.cid = []
|
||||||
await expect(marketplace.requestStorage(request)).to.be.revertedWith(
|
await expect(marketplace.requestStorage(request)).to.be.revertedWith(
|
||||||
"Marketplace_InvalidCid"
|
"Marketplace_InvalidCid"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -34,7 +34,7 @@ const exampleRequest = async () => {
|
|||||||
collateralPerByte: 1,
|
collateralPerByte: 1,
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
cid: "zb2rhheVmk3bLks5MgzTqyznLu1zqGH5jrfTA1eAZXrjx7Vob",
|
cid: Buffer.from("zb2rhheVmk3bLks5MgzTqyznLu1zqGH5jrfTA1eAZXrjx7Vob"),
|
||||||
merkleRoot: Array.from(randomBytes(32)),
|
merkleRoot: Array.from(randomBytes(32)),
|
||||||
},
|
},
|
||||||
expiry: hours(1),
|
expiry: hours(1),
|
||||||
|
|||||||
@ -3,7 +3,7 @@ const { keccak256, defaultAbiCoder } = ethers.utils
|
|||||||
|
|
||||||
function requestId(request) {
|
function requestId(request) {
|
||||||
const Ask = "tuple(int64, uint256, uint256, uint256, uint256, uint256, int64)"
|
const Ask = "tuple(int64, uint256, uint256, uint256, uint256, uint256, int64)"
|
||||||
const Content = "tuple(string, bytes32)"
|
const Content = "tuple(bytes, bytes32)"
|
||||||
const Request =
|
const Request =
|
||||||
"tuple(address, " + Ask + ", " + Content + ", uint256, bytes32)"
|
"tuple(address, " + Ask + ", " + Content + ", uint256, bytes32)"
|
||||||
return keccak256(defaultAbiCoder.encode([Request], requestToArray(request)))
|
return keccak256(defaultAbiCoder.encode([Request], requestToArray(request)))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user