[marketplace] Use dynamically sized arrays for PoR

ABI encoding sometimes fails on large byte arrays of fixed size.
This commit is contained in:
Mark Spanbroek 2022-04-07 15:44:56 +02:00 committed by markspanbroek
parent b145e66a68
commit 6aa2894521
2 changed files with 4 additions and 6 deletions

View File

@ -95,8 +95,6 @@ contract Marketplace is Collateral {
return requestState[requestId].selectedOffer;
}
uint256 private constant POR_SECTORS = 10; // amount of sectors in PoR scheme
struct Request {
address client;
Ask ask;
@ -125,9 +123,9 @@ contract Marketplace is Collateral {
}
struct PoR {
bytes1[POR_SECTORS * 48] u; // parameters u_1..u_s
bytes1[96] publicKey; // public key
bytes1[512] name; // random name
bytes u; // parameters u_1..u_s
bytes publicKey; // public key
bytes name; // random name
}
struct RequestState {

View File

@ -4,7 +4,7 @@ const { keccak256, defaultAbiCoder } = ethers.utils
function requestId(request) {
const Ask = "tuple(uint256, uint256, uint256, uint256)"
const Erasure = "tuple(uint64, uint64, uint64)"
const PoR = "tuple(bytes1[480], bytes1[96], bytes1[512])"
const PoR = "tuple(bytes, bytes, bytes)"
const Content = "tuple(string, " + Erasure + ", " + PoR + ")"
const Request =
"tuple(address, " + Ask + ", " + Content + ", uint256, bytes32)"