@@ -158,10 +158,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::construct(
158158 state.initial_balance = runtime.getValueReceived ();
159159 }
160160
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));
165162 return fc::outcome::success ();
166163}
167164
@@ -189,11 +186,9 @@ fc::outcome::result<InvocationOutput> MultiSigActor::propose(
189186 // approve pending tx
190187 OUTCOME_TRY (state.approveTransaction (actor, runtime, tx_number));
191188
192- // commit state
193- OUTCOME_TRY (state_cid, runtime.getIpfsDatastore ()->setCbor (state));
194- OUTCOME_TRY (runtime.commit (ActorSubstateCID{state_cid}));
195-
196189 OUTCOME_TRY (encoded_result, codec::cbor::encode (tx_number));
190+
191+ OUTCOME_TRY (runtime.commitState (state));
197192 return InvocationOutput{Buffer{encoded_result}};
198193}
199194
@@ -211,10 +206,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::approve(
211206 OUTCOME_TRY (
212207 state.approveTransaction (actor, runtime, tx_params.transaction_number ));
213208
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));
218210 return fc::outcome::success ();
219211}
220212
@@ -239,10 +231,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::cancel(
239231 return VMExitCode::MULTISIG_ACTOR_FORBIDDEN;
240232 }
241233
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));
246235 return fc::outcome::success ();
247236}
248237
@@ -264,10 +253,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::addSigner(
264253 state.signers .push_back (add_signer_params.signer );
265254 if (add_signer_params.increase_threshold ) state.threshold ++;
266255
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));
271257 return fc::outcome::success ();
272258}
273259
@@ -296,10 +282,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::removeSigner(
296282 if (state.threshold < 1 || state.signers .size () < state.threshold )
297283 return VMExitCode::MULTISIG_ACTOR_ILLEGAL_ARGUMENT;
298284
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));
303286 return fc::outcome::success ();
304287}
305288
@@ -324,10 +307,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::swapSigner(
324307 return VMExitCode::MULTISIG_ACTOR_NOT_FOUND;
325308 *old_signer = swap_signer_params.new_signer ;
326309
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));
331311 return fc::outcome::success ();
332312}
333313
@@ -349,10 +329,7 @@ fc::outcome::result<InvocationOutput> MultiSigActor::changeThreshold(
349329
350330 state.threshold = change_threshold_params.new_threshold ;
351331
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));
356333 return fc::outcome::success ();
357334}
358335
0 commit comments