@@ -158,10 +158,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::construct(
158
158
state.initial_balance = runtime.getValueReceived ();
159
159
}
160
160
161
- // commit state
162
- OUTCOME_TRY (state_cid, runtime.getIpfsDatastore ()->setCbor (state));
163
- OUTCOME_TRY (runtime.commit (ActorSubstateCID{state_cid}));
164
-
161
+ OUTCOME_TRY (runtime.commitState (state));
165
162
return fc::outcome::success ();
166
163
}
167
164
@@ -189,11 +186,9 @@ fc::outcome::result<InvocationOutput> MultiSigActor::propose(
189
186
// approve pending tx
190
187
OUTCOME_TRY (state.approveTransaction (actor, runtime, tx_number));
191
188
192
- // commit state
193
- OUTCOME_TRY (state_cid, runtime.getIpfsDatastore ()->setCbor (state));
194
- OUTCOME_TRY (runtime.commit (ActorSubstateCID{state_cid}));
195
-
196
189
OUTCOME_TRY (encoded_result, codec::cbor::encode (tx_number));
190
+
191
+ OUTCOME_TRY (runtime.commitState (state));
197
192
return InvocationOutput{Buffer{encoded_result}};
198
193
}
199
194
@@ -211,10 +206,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::approve(
211
206
OUTCOME_TRY (
212
207
state.approveTransaction (actor, runtime, tx_params.transaction_number ));
213
208
214
- // commit state
215
- OUTCOME_TRY (state_cid, runtime.getIpfsDatastore ()->setCbor (state));
216
- OUTCOME_TRY (runtime.commit (ActorSubstateCID{state_cid}));
217
-
209
+ OUTCOME_TRY (runtime.commitState (state));
218
210
return fc::outcome::success ();
219
211
}
220
212
@@ -239,10 +231,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::cancel(
239
231
return VMExitCode::MULTISIG_ACTOR_FORBIDDEN;
240
232
}
241
233
242
- // commit state
243
- OUTCOME_TRY (state_cid, runtime.getIpfsDatastore ()->setCbor (state));
244
- OUTCOME_TRY (runtime.commit (ActorSubstateCID{state_cid}));
245
-
234
+ OUTCOME_TRY (runtime.commitState (state));
246
235
return fc::outcome::success ();
247
236
}
248
237
@@ -264,10 +253,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::addSigner(
264
253
state.signers .push_back (add_signer_params.signer );
265
254
if (add_signer_params.increase_threshold ) state.threshold ++;
266
255
267
- // commit state
268
- OUTCOME_TRY (state_cid, runtime.getIpfsDatastore ()->setCbor (state));
269
- OUTCOME_TRY (runtime.commit (ActorSubstateCID{state_cid}));
270
-
256
+ OUTCOME_TRY (runtime.commitState (state));
271
257
return fc::outcome::success ();
272
258
}
273
259
@@ -296,10 +282,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::removeSigner(
296
282
if (state.threshold < 1 || state.signers .size () < state.threshold )
297
283
return VMExitCode::MULTISIG_ACTOR_ILLEGAL_ARGUMENT;
298
284
299
- // commit state
300
- OUTCOME_TRY (state_cid, runtime.getIpfsDatastore ()->setCbor (state));
301
- OUTCOME_TRY (runtime.commit (ActorSubstateCID{state_cid}));
302
-
285
+ OUTCOME_TRY (runtime.commitState (state));
303
286
return fc::outcome::success ();
304
287
}
305
288
@@ -324,10 +307,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::swapSigner(
324
307
return VMExitCode::MULTISIG_ACTOR_NOT_FOUND;
325
308
*old_signer = swap_signer_params.new_signer ;
326
309
327
- // commit state
328
- OUTCOME_TRY (state_cid, runtime.getIpfsDatastore ()->setCbor (state));
329
- OUTCOME_TRY (runtime.commit (ActorSubstateCID{state_cid}));
330
-
310
+ OUTCOME_TRY (runtime.commitState (state));
331
311
return fc::outcome::success ();
332
312
}
333
313
@@ -349,10 +329,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::changeThreshold(
349
329
350
330
state.threshold = change_threshold_params.new_threshold ;
351
331
352
- // commit state
353
- OUTCOME_TRY (state_cid, runtime.getIpfsDatastore ()->setCbor (state));
354
- OUTCOME_TRY (runtime.commit (ActorSubstateCID{state_cid}));
355
-
332
+ OUTCOME_TRY (runtime.commitState (state));
356
333
return fc::outcome::success ();
357
334
}
358
335
0 commit comments