From 6aa2894521faa53a9896e800caf713499b33c318 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Thu, 7 Apr 2022 15:44:56 +0200 Subject: [PATCH] [marketplace] Use dynamically sized arrays for PoR ABI encoding sometimes fails on large byte arrays of fixed size. --- contracts/Marketplace.sol | 8 +++----- test/ids.js | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/contracts/Marketplace.sol b/contracts/Marketplace.sol index 99a55a9..1eba224 100644 --- a/contracts/Marketplace.sol +++ b/contracts/Marketplace.sol @@ -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 { diff --git a/test/ids.js b/test/ids.js index adcedce..053488f 100644 --- a/test/ids.js +++ b/test/ids.js @@ -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)"