File tree Expand file tree Collapse file tree 2 files changed +50
-4
lines changed
contracts/examples/multisig Expand file tree Collapse file tree 2 files changed +50
-4
lines changed Original file line number Diff line number Diff line change 259259 "refund" : " *"
260260 }
261261 },
262+ {
263+ "step" : " scCall" ,
264+ "comment" : " check that account data got cleaned up" ,
265+ "txId" : " check-cleanup-1" ,
266+ "tx" : {
267+ "from" : " address:paul" ,
268+ "to" : " address:multisig" ,
269+ "value" : " 0" ,
270+ "function" : " getActionData" ,
271+ "arguments" : [" 4" ],
272+ "gasLimit" : " 1,000,000" ,
273+ "gasPrice" : " 0"
274+ },
275+ "expect" : {
276+ "out" : [ " " ],
277+ "status" : " " ,
278+ "logs" : [],
279+ "gas" : " *" ,
280+ "refund" : " *"
281+ }
282+ },
283+ {
284+ "step" : " scCall" ,
285+ "comment" : " check that account data got cleaned up" ,
286+ "txId" : " check-cleanup-2" ,
287+ "tx" : {
288+ "from" : " address:paul" ,
289+ "to" : " address:multisig" ,
290+ "value" : " 0" ,
291+ "function" : " getActionSigners" ,
292+ "arguments" : [" 4" ],
293+ "gasLimit" : " 1,000,000" ,
294+ "gasPrice" : " 0"
295+ },
296+ "expect" : {
297+ "out" : [ " " ],
298+ "status" : " " ,
299+ "logs" : [],
300+ "gas" : " *" ,
301+ "refund" : " *"
302+ }
303+ },
262304 {
263305 "step" : " checkState" ,
264306 "accounts" : {
Original file line number Diff line number Diff line change @@ -350,6 +350,14 @@ pub trait Multisig {
350350
351351 fn perform_action ( & self , action_id : usize ) -> SCResult < MultiResultVec < BoxedBytes > > {
352352 let action = self . get_action_data ( action_id) ;
353+
354+ // clean up storage
355+ // happens before actual execution, because the async_call kills contract execution,
356+ // so cleanup cannot happen afterwards
357+ self . set_action_data ( action_id, & Action :: Nothing ) ;
358+ self . set_action_signer_ids ( action_id, & [ ] [ ..] ) ;
359+ self . set_pending_action_count ( self . get_pending_action_count ( ) - 1 ) ;
360+
353361 let mut result = Vec :: < BoxedBytes > :: new ( ) ;
354362 match action {
355363 Action :: Nothing => { } ,
@@ -411,10 +419,6 @@ pub trait Multisig {
411419 } ,
412420 }
413421
414- // clean up storage
415- self . set_action_data ( action_id, & Action :: Nothing ) ;
416- self . set_action_signer_ids ( action_id, & [ ] [ ..] ) ;
417- self . set_pending_action_count ( self . get_pending_action_count ( ) - 1 ) ;
418422 Ok ( result. into ( ) )
419423 }
420424}
You can’t perform that action at this time.
0 commit comments