Skip to content

Commit 641d19c

Browse files
committed
Deal with serde transparent
1 parent b895662 commit 641d19c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

actors/evm/tests/contracts/NotificationReceiver.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,21 @@ contract NotificationReceiver {
9999
*/
100100
function processSectorContentChanged(bytes memory params) internal returns (bytes memory) {
101101

102-
/* We begin by parsing a single tuple: (sectors)
103-
*/
104-
(uint checkTupleLen, uint byteIdx) = readFixedArray(params, 0);
105-
require(checkTupleLen == 1, "Invalid params outer tuple");
102+
uint checkTupleLen;
103+
uint byteIdx = 0;
106104

105+
// We don't need to parse the SectorContentChangedParams as a tuple because
106+
// the type is encoded as serde transparent. So just parse the sectors array directly
107107
uint nSectors;
108-
(nSectors, byteIdx) = readFixedArray(params, 0);
108+
(nSectors, byteIdx) = readFixedArray(params, byteIdx);
109109
require(nSectors > 0, "Invalid non positive sectors field");
110110

111111
CBORBuffer memory ret_acc;
112112
{
113113
// Setup return value ret_acc
114114
// ret_acc accumulates return cbor array
115115
ret_acc = createCBOR(64);
116-
startFixedArray(ret_acc, 1); // SectorContentChangedReturn
116+
// No SectorContentChangedReturn outer tuple as it is serde transparent
117117
startFixedArray(ret_acc, uint64(nSectors)); // sectors: Vec<SectorReturn>
118118
}
119119
for (uint i = 0; i < nSectors; i++) {
@@ -134,7 +134,7 @@ contract NotificationReceiver {
134134
(pieceCnt, byteIdx) = readFixedArray(params, byteIdx);
135135

136136
{
137-
startFixedArray(ret_acc, 1); // SectorReturn
137+
// No SectorReturn outer tuple as it is serde transparent
138138
startFixedArray(ret_acc, uint64(pieceCnt)); // added: Vec<PieceReturn>
139139
}
140140

@@ -167,7 +167,7 @@ contract NotificationReceiver {
167167
sectorNotificationIndices[sector].push(notificationIndex);
168168
totalNotifications++;
169169
{
170-
startFixedArray(ret_acc, 1); // PieceReturn
170+
// No PieceReturn outer tuple as it is serde transparent
171171
writeBool(ret_acc, true); // accepted (set all to true)
172172
}
173173
}

0 commit comments

Comments
 (0)