Skip to content

Commit b710380

Browse files
siriusyimlovel8
authored andcommitted
fix: πŸ› compile and deserializeGetClaimsReturn failure
1 parent cb71eaa commit b710380

File tree

36 files changed

+2770
-9479
lines changed

36 files changed

+2770
-9479
lines changed

β€Žpackage.jsonβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"git-cz": "^4.9.0",
3535
"global": "^4.4.0",
3636
"hardhat-abi-exporter": "2.10.1",
37-
"release-it": "^17.1.1"
37+
"release-it": "^17.1.1",
38+
"solidity-cborutils": "^2.0.0"
3839
},
3940
"devDependencies": {
4041
"@glif/filecoin-address": "^2.0.43",

β€Žsrc/v0.8/vendor/filecoin-solidity-api/contracts/v0.8/cbor/AccountCbor.solβ€Ž

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ library AccountCBOR {
3535
/// @notice serialize AuthenticateMessageParams struct to cbor in order to pass as arguments to an account actor
3636
/// @param params AuthenticateMessageParams to serialize as cbor
3737
/// @return cbor serialized data as bytes
38-
function serializeAuthenticateMessageParams(AccountTypes.AuthenticateMessageParams memory params) internal pure returns (bytes memory) {
38+
function serializeAuthenticateMessageParams(
39+
AccountTypes.AuthenticateMessageParams memory params
40+
) internal pure returns (bytes memory) {
3941
uint256 capacity = 0;
4042

4143
capacity += Misc.getPrefixSize(2);
@@ -54,7 +56,13 @@ library AccountCBOR {
5456
/// @notice deserialize AuthenticateMessageParams struct from cbor encoded bytes coming from an account actor call
5557
/// @param rawResp cbor encoded response
5658
/// @return ret new instance of AuthenticateMessageParams created based on parsed data
57-
function deserializeAuthenticateMessageParams(bytes memory rawResp) internal pure returns (AccountTypes.AuthenticateMessageParams memory ret) {
59+
function deserializeAuthenticateMessageParams(
60+
bytes memory rawResp
61+
)
62+
internal
63+
pure
64+
returns (AccountTypes.AuthenticateMessageParams memory ret)
65+
{
5866
uint byteIdx = 0;
5967
uint len;
6068

β€Žsrc/v0.8/vendor/filecoin-solidity-api/contracts/v0.8/cbor/VerifRegCbor.solβ€Ž

Lines changed: 73 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ library VerifRegCBOR {
4141
/// @notice serialize GetClaimsParams struct to cbor in order to pass as arguments to the verified registry actor
4242
/// @param params GetClaimsParams to serialize as cbor
4343
/// @return cbor serialized data as bytes
44-
function serializeGetClaimsParams(VerifRegTypes.GetClaimsParams memory params) internal pure returns (bytes memory) {
44+
function serializeGetClaimsParams(
45+
VerifRegTypes.GetClaimsParams memory params
46+
) internal pure returns (bytes memory) {
4547
uint256 capacity = 0;
4648
uint claimIdsLen = params.claim_ids.length;
4749

@@ -66,9 +68,12 @@ library VerifRegCBOR {
6668
/// @notice deserialize GetClaimsReturn struct from cbor encoded bytes coming from a verified registry actor call
6769
/// @param rawResp cbor encoded response
6870
/// @return ret new instance of GetClaimsReturn created based on parsed data
69-
function deserializeGetClaimsReturn(bytes memory rawResp) internal pure returns (VerifRegTypes.GetClaimsReturn memory ret) {
71+
function deserializeGetClaimsReturn(
72+
bytes memory rawResp
73+
) internal pure returns (VerifRegTypes.GetClaimsReturn memory ret) {
7074
uint byteIdx = 0;
7175
uint len;
76+
uint ilen;
7277

7378
(len, byteIdx) = rawResp.readFixedArray(byteIdx);
7479
assert(len == 2);
@@ -82,27 +87,33 @@ library VerifRegCBOR {
8287
ret.batch_info.fail_codes = new CommonTypes.FailCode[](len);
8388

8489
for (uint i = 0; i < len; i++) {
85-
(len, byteIdx) = rawResp.readFixedArray(byteIdx);
86-
assert(len == 2);
87-
88-
(ret.batch_info.fail_codes[i].idx, byteIdx) = rawResp.readUInt32(byteIdx);
89-
(ret.batch_info.fail_codes[i].code, byteIdx) = rawResp.readUInt32(byteIdx);
90+
(ilen, byteIdx) = rawResp.readFixedArray(byteIdx);
91+
assert(ilen == 2);
92+
93+
(ret.batch_info.fail_codes[i].idx, byteIdx) = rawResp.readUInt32(
94+
byteIdx
95+
);
96+
(ret.batch_info.fail_codes[i].code, byteIdx) = rawResp.readUInt32(
97+
byteIdx
98+
);
9099
}
91100

92101
(len, byteIdx) = rawResp.readFixedArray(byteIdx);
93102
ret.claims = new VerifRegTypes.Claim[](len);
94103

95104
for (uint i = 0; i < len; i++) {
96-
(len, byteIdx) = rawResp.readFixedArray(byteIdx);
97-
assert(len == 8);
105+
(ilen, byteIdx) = rawResp.readFixedArray(byteIdx);
106+
assert(ilen == 8);
98107

99108
(ret.claims[i].provider, byteIdx) = rawResp.readFilActorId(byteIdx);
100109
(ret.claims[i].client, byteIdx) = rawResp.readFilActorId(byteIdx);
101110
(ret.claims[i].data, byteIdx) = rawResp.readBytes(byteIdx);
102111
(ret.claims[i].size, byteIdx) = rawResp.readUInt64(byteIdx);
103112
(ret.claims[i].term_min, byteIdx) = rawResp.readChainEpoch(byteIdx);
104113
(ret.claims[i].term_max, byteIdx) = rawResp.readChainEpoch(byteIdx);
105-
(ret.claims[i].term_start, byteIdx) = rawResp.readChainEpoch(byteIdx);
114+
(ret.claims[i].term_start, byteIdx) = rawResp.readChainEpoch(
115+
byteIdx
116+
);
106117
(ret.claims[i].sector, byteIdx) = rawResp.readFilActorId(byteIdx);
107118
}
108119

@@ -112,7 +123,9 @@ library VerifRegCBOR {
112123
/// @notice serialize AddVerifiedClientParams struct to cbor in order to pass as arguments to the verified registry actor
113124
/// @param params AddVerifiedClientParams to serialize as cbor
114125
/// @return cbor serialized data as bytes
115-
function serializeAddVerifiedClientParams(VerifRegTypes.AddVerifiedClientParams memory params) internal pure returns (bytes memory) {
126+
function serializeAddVerifiedClientParams(
127+
VerifRegTypes.AddVerifiedClientParams memory params
128+
) internal pure returns (bytes memory) {
116129
uint256 capacity = 0;
117130
bytes memory allowance = params.allowance.serializeBigInt();
118131

@@ -131,7 +144,9 @@ library VerifRegCBOR {
131144
/// @notice serialize RemoveExpiredAllocationsParams struct to cbor in order to pass as arguments to the verified registry actor
132145
/// @param params RemoveExpiredAllocationsParams to serialize as cbor
133146
/// @return cbor serialized data as bytes
134-
function serializeRemoveExpiredAllocationsParams(VerifRegTypes.RemoveExpiredAllocationsParams memory params) internal pure returns (bytes memory) {
147+
function serializeRemoveExpiredAllocationsParams(
148+
VerifRegTypes.RemoveExpiredAllocationsParams memory params
149+
) internal pure returns (bytes memory) {
135150
uint256 capacity = 0;
136151
uint allocationIdsLen = params.allocation_ids.length;
137152

@@ -156,9 +171,16 @@ library VerifRegCBOR {
156171
/// @notice deserialize RemoveExpiredAllocationsReturn struct from cbor encoded bytes coming from a verified registry actor call
157172
/// @param rawResp cbor encoded response
158173
/// @return ret new instance of RemoveExpiredAllocationsReturn created based on parsed data
159-
function deserializeRemoveExpiredAllocationsReturn(bytes memory rawResp) internal pure returns (VerifRegTypes.RemoveExpiredAllocationsReturn memory ret) {
174+
function deserializeRemoveExpiredAllocationsReturn(
175+
bytes memory rawResp
176+
)
177+
internal
178+
pure
179+
returns (VerifRegTypes.RemoveExpiredAllocationsReturn memory ret)
180+
{
160181
uint byteIdx = 0;
161182
uint len;
183+
uint ilen;
162184

163185
(len, byteIdx) = rawResp.readFixedArray(byteIdx);
164186
assert(len == 3);
@@ -179,11 +201,15 @@ library VerifRegCBOR {
179201
ret.results.fail_codes = new CommonTypes.FailCode[](len);
180202

181203
for (uint i = 0; i < len; i++) {
182-
(len, byteIdx) = rawResp.readFixedArray(byteIdx);
183-
assert(len == 2);
184-
185-
(ret.results.fail_codes[i].idx, byteIdx) = rawResp.readUInt32(byteIdx);
186-
(ret.results.fail_codes[i].code, byteIdx) = rawResp.readUInt32(byteIdx);
204+
(ilen, byteIdx) = rawResp.readFixedArray(byteIdx);
205+
assert(ilen == 2);
206+
207+
(ret.results.fail_codes[i].idx, byteIdx) = rawResp.readUInt32(
208+
byteIdx
209+
);
210+
(ret.results.fail_codes[i].code, byteIdx) = rawResp.readUInt32(
211+
byteIdx
212+
);
187213
}
188214

189215
bytes memory tmp;
@@ -196,7 +222,9 @@ library VerifRegCBOR {
196222
/// @notice serialize ExtendClaimTermsParams struct to cbor in order to pass as arguments to the verified registry actor
197223
/// @param terms ExtendClaimTermsParams to serialize as cbor
198224
/// @return cbor serialized data as bytes
199-
function serializeExtendClaimTermsParams(VerifRegTypes.ClaimTerm[] memory terms) internal pure returns (bytes memory) {
225+
function serializeExtendClaimTermsParams(
226+
VerifRegTypes.ClaimTerm[] memory terms
227+
) internal pure returns (bytes memory) {
200228
uint256 capacity = 0;
201229
uint termsLen = terms.length;
202230

@@ -224,9 +252,12 @@ library VerifRegCBOR {
224252
/// @notice deserialize BatchReturn struct from cbor encoded bytes coming from a verified registry actor call
225253
/// @param rawResp cbor encoded response
226254
/// @return ret new instance of BatchReturn created based on parsed data
227-
function deserializeBatchReturn(bytes memory rawResp) internal pure returns (CommonTypes.BatchReturn memory ret) {
255+
function deserializeBatchReturn(
256+
bytes memory rawResp
257+
) internal pure returns (CommonTypes.BatchReturn memory ret) {
228258
uint byteIdx = 0;
229259
uint len;
260+
uint ilen;
230261

231262
(len, byteIdx) = rawResp.readFixedArray(byteIdx);
232263
assert(len == 2);
@@ -237,8 +268,8 @@ library VerifRegCBOR {
237268
ret.fail_codes = new CommonTypes.FailCode[](len);
238269

239270
for (uint i = 0; i < len; i++) {
240-
(len, byteIdx) = rawResp.readFixedArray(byteIdx);
241-
assert(len == 2);
271+
(ilen, byteIdx) = rawResp.readFixedArray(byteIdx);
272+
assert(ilen == 2);
242273

243274
(ret.fail_codes[i].idx, byteIdx) = rawResp.readUInt32(byteIdx);
244275
(ret.fail_codes[i].code, byteIdx) = rawResp.readUInt32(byteIdx);
@@ -250,7 +281,9 @@ library VerifRegCBOR {
250281
/// @notice serialize RemoveExpiredClaimsParams struct to cbor in order to pass as arguments to the verified registry actor
251282
/// @param params RemoveExpiredClaimsParams to serialize as cbor
252283
/// @return cbor serialized data as bytes
253-
function serializeRemoveExpiredClaimsParams(VerifRegTypes.RemoveExpiredClaimsParams memory params) internal pure returns (bytes memory) {
284+
function serializeRemoveExpiredClaimsParams(
285+
VerifRegTypes.RemoveExpiredClaimsParams memory params
286+
) internal pure returns (bytes memory) {
254287
uint256 capacity = 0;
255288
uint claimIdsLen = params.claim_ids.length;
256289

@@ -275,9 +308,16 @@ library VerifRegCBOR {
275308
/// @notice deserialize RemoveExpiredClaimsReturn struct from cbor encoded bytes coming from a verified registry actor call
276309
/// @param rawResp cbor encoded response
277310
/// @return ret new instance of RemoveExpiredClaimsReturn created based on parsed data
278-
function deserializeRemoveExpiredClaimsReturn(bytes memory rawResp) internal pure returns (VerifRegTypes.RemoveExpiredClaimsReturn memory ret) {
311+
function deserializeRemoveExpiredClaimsReturn(
312+
bytes memory rawResp
313+
)
314+
internal
315+
pure
316+
returns (VerifRegTypes.RemoveExpiredClaimsReturn memory ret)
317+
{
279318
uint byteIdx = 0;
280319
uint len;
320+
uint ilen;
281321

282322
(len, byteIdx) = rawResp.readFixedArray(byteIdx);
283323
assert(len == 2);
@@ -298,11 +338,15 @@ library VerifRegCBOR {
298338
ret.results.fail_codes = new CommonTypes.FailCode[](len);
299339

300340
for (uint i = 0; i < len; i++) {
301-
(len, byteIdx) = rawResp.readFixedArray(byteIdx);
302-
assert(len == 2);
303-
304-
(ret.results.fail_codes[i].idx, byteIdx) = rawResp.readUInt32(byteIdx);
305-
(ret.results.fail_codes[i].code, byteIdx) = rawResp.readUInt32(byteIdx);
341+
(ilen, byteIdx) = rawResp.readFixedArray(byteIdx);
342+
assert(ilen == 2);
343+
344+
(ret.results.fail_codes[i].idx, byteIdx) = rawResp.readUInt32(
345+
byteIdx
346+
);
347+
(ret.results.fail_codes[i].code, byteIdx) = rawResp.readUInt32(
348+
byteIdx
349+
);
306350
}
307351

308352
return ret;

β€Žsrc/v0.8/vendor/filecoin-solidity-api/contracts/v0.8/helpers/MarketHelper.solβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: Apache-2.0
12
pragma solidity ^0.8.17;
23

34
import "../types/MarketTypes.sol";

β€Žsrc/v0.8/vendor/filecoin-solidity-api/contracts/vendor/solidity-BigNumber/lib/forge-std/.github/workflows/tests.ymlβ€Ž

Lines changed: 0 additions & 27 deletions
This file was deleted.

β€Žsrc/v0.8/vendor/filecoin-solidity-api/contracts/vendor/solidity-BigNumber/lib/forge-std/.gitmodulesβ€Ž

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
Β (0)