@@ -108,7 +108,7 @@ impl<B: Backend + ShardBackend> ShardLevelState<B> {
108108 shard_id : ShardId ,
109109 transaction : & Transaction ,
110110 sender : & Address ,
111- shard_owner : & Address ,
111+ shard_owners : & [ Address ] ,
112112 ) -> StateResult < ( ) > {
113113 debug_assert_eq ! ( Ok ( ( ) ) , transaction. verify( ) ) ;
114114 match transaction {
@@ -123,7 +123,7 @@ impl<B: Backend + ShardBackend> ShardLevelState<B> {
123123 nonce,
124124 owners,
125125 ..
126- } => Ok ( self . set_world_owners ( * shard_id, * world_id, * nonce, & owners, sender, shard_owner ) ?) ,
126+ } => Ok ( self . set_world_owners ( * shard_id, * world_id, * nonce, & owners, sender, shard_owners ) ?) ,
127127 Transaction :: AssetMint {
128128 metadata,
129129 registrar,
@@ -173,11 +173,11 @@ impl<B: Backend + ShardBackend> ShardLevelState<B> {
173173 nonce : u64 ,
174174 owners : & [ Address ] ,
175175 sender : & Address ,
176- shard_owner : & Address ,
176+ shard_owners : & [ Address ] ,
177177 ) -> StateResult < ( ) > {
178178 let world: World = self . world ( world_id) ?. ok_or_else ( || TransactionError :: InvalidWorldId ( world_id) ) ?;
179179
180- if shard_owner != sender && !world. world_owners ( ) . contains ( sender) {
180+ if !shard_owners . contains ( sender) && !world. world_owners ( ) . contains ( sender) {
181181 return Err ( TransactionError :: InsufficientPermission . into ( ) )
182182 }
183183
@@ -510,12 +510,12 @@ impl<B: Backend + ShardBackend> ShardState<B> for ShardLevelState<B> {
510510 shard_id : ShardId ,
511511 transaction : & Transaction ,
512512 sender : & Address ,
513- shard_owner : & Address ,
513+ shard_owners : & [ Address ] ,
514514 ) -> StateResult < TransactionInvoice > {
515515 ctrace ! ( TX , "Execute {:?}(TxHash:{:?})" , transaction, transaction. hash( ) ) ;
516516
517517 self . create_checkpoint ( TRANSACTION_CHECKPOINT ) ;
518- let result = self . apply_internal ( shard_id, transaction, sender, shard_owner ) ;
518+ let result = self . apply_internal ( shard_id, transaction, sender, shard_owners ) ;
519519 match result {
520520 Ok ( _) => {
521521 cinfo ! ( TX , "Tx({}) is applied" , transaction. hash( ) ) ;
@@ -573,7 +573,7 @@ mod tests {
573573
574574 let sender = address ( ) ;
575575 let shard_owner = address ( ) ;
576- let result = state. apply ( shard_id, & transaction, & sender, & shard_owner) ;
576+ let result = state. apply ( shard_id, & transaction, & sender, & [ shard_owner] ) ;
577577 assert_eq ! ( Ok ( TransactionInvoice :: Success ) , result) ;
578578
579579 let metadata = state. metadata ( ) ;
@@ -602,7 +602,7 @@ mod tests {
602602
603603 let sender = address ( ) ;
604604 let shard_owner = address ( ) ;
605- let result = state. apply ( shard_id, & transaction, & sender, & shard_owner) ;
605+ let result = state. apply ( shard_id, & transaction, & sender, & [ shard_owner] ) ;
606606 assert_eq ! ( Ok ( TransactionInvoice :: Success ) , result) ;
607607
608608 let metadata = state. metadata ( ) ;
@@ -636,7 +636,7 @@ mod tests {
636636 expected: 0 ,
637637 found: 1
638638 } ) ) ) ,
639- state. apply( shard_id, & transaction, & sender, & shard_owner)
639+ state. apply( shard_id, & transaction, & sender, & [ shard_owner] )
640640 ) ;
641641
642642 let metadata = state. metadata ( ) ;
@@ -672,7 +672,7 @@ mod tests {
672672
673673 let sender = address ( ) ;
674674 let shard_owner = address ( ) ;
675- let result = state. apply ( shard_id, & transaction, & sender, & shard_owner) ;
675+ let result = state. apply ( shard_id, & transaction, & sender, & [ shard_owner] ) ;
676676 assert_eq ! ( Ok ( TransactionInvoice :: Success ) , result) ;
677677
678678 let transaction_hash = transaction. hash ( ) ;
@@ -709,7 +709,7 @@ mod tests {
709709
710710 let sender = address ( ) ;
711711 let shard_owner = address ( ) ;
712- let result = state. apply ( shard_id, & transaction, & sender, & shard_owner) ;
712+ let result = state. apply ( shard_id, & transaction, & sender, & [ shard_owner] ) ;
713713 assert_eq ! ( Ok ( TransactionInvoice :: Success ) , result) ;
714714
715715 let transaction_hash = transaction. hash ( ) ;
@@ -752,7 +752,7 @@ mod tests {
752752
753753 let sender = address ( ) ;
754754 let shard_owner = address ( ) ;
755- assert_eq ! ( Ok ( TransactionInvoice :: Success ) , state. apply( shard_id, & mint, & sender, & shard_owner) ) ;
755+ assert_eq ! ( Ok ( TransactionInvoice :: Success ) , state. apply( shard_id, & mint, & sender, & [ shard_owner] ) ) ;
756756
757757 let asset_scheme_address = AssetSchemeAddress :: new ( mint_hash, shard_id) ;
758758 let asset_scheme = state. asset_scheme ( & asset_scheme_address) ;
@@ -802,7 +802,7 @@ mod tests {
802802 } ;
803803 let transfer_hash = transfer. hash ( ) ;
804804
805- assert_eq ! ( Ok ( TransactionInvoice :: Success ) , state. apply( shard_id, & transfer, & sender, & shard_owner) ) ;
805+ assert_eq ! ( Ok ( TransactionInvoice :: Success ) , state. apply( shard_id, & transfer, & sender, & [ shard_owner] ) ) ;
806806
807807 let asset0_address = AssetAddress :: new ( transfer_hash, 0 , shard_id) ;
808808 let asset0 = state. asset ( & asset0_address) ;
@@ -844,7 +844,7 @@ mod tests {
844844
845845 let sender = address ( ) ;
846846 let shard_owner = address ( ) ;
847- assert_eq ! ( Ok ( TransactionInvoice :: Success ) , state. apply( shard_id, & mint, & sender, & shard_owner) ) ;
847+ assert_eq ! ( Ok ( TransactionInvoice :: Success ) , state. apply( shard_id, & mint, & sender, & [ shard_owner] ) ) ;
848848
849849 let asset_scheme_address = AssetSchemeAddress :: new ( mint_hash, shard_id) ;
850850 let asset_scheme = state. asset_scheme ( & asset_scheme_address) ;
@@ -881,7 +881,7 @@ mod tests {
881881
882882 let sender = address ( ) ;
883883 let shard_owner = address ( ) ;
884- let failed_invoice = state. apply ( shard_id, & failed_transfer, & sender, & shard_owner) . unwrap ( ) ;
884+ let failed_invoice = state. apply ( shard_id, & failed_transfer, & sender, & [ shard_owner] ) . unwrap ( ) ;
885885 assert_eq ! (
886886 TransactionInvoice :: Fail ( TransactionError :: ScriptHashMismatch ( Mismatch {
887887 expected: lock_script_hash,
@@ -928,7 +928,10 @@ mod tests {
928928 } ;
929929 let successful_transfer_hash = successful_transfer. hash ( ) ;
930930
931- assert_eq ! ( Ok ( TransactionInvoice :: Success ) , state. apply( shard_id, & successful_transfer, & sender, & shard_owner) ) ;
931+ assert_eq ! (
932+ Ok ( TransactionInvoice :: Success ) ,
933+ state. apply( shard_id, & successful_transfer, & sender, & [ shard_owner] )
934+ ) ;
932935
933936 let asset0_address = AssetAddress :: new ( successful_transfer_hash, 0 , shard_id) ;
934937 let asset0 = state. asset ( & asset0_address) ;
@@ -979,7 +982,7 @@ mod tests {
979982 }
980983 }
981984 } ;
982- assert_eq ! ( Ok ( TransactionInvoice :: Success ) , state. apply( shard_id, & transaction, & shard_owner, & shard_owner) ) ;
985+ assert_eq ! ( Ok ( TransactionInvoice :: Success ) , state. apply( shard_id, & transaction, & shard_owner, & [ shard_owner] ) ) ;
983986
984987 let world = state. world ( world_id) ;
985988 assert_eq ! ( Ok ( Some ( World :: new_with_nonce( new_owners, 1 ) ) ) , world) ;
@@ -1015,7 +1018,7 @@ mod tests {
10151018 } ;
10161019
10171020 let shard_owner = Address :: random ( ) ;
1018- assert_eq ! ( Ok ( TransactionInvoice :: Success ) , state. apply( shard_id, & transaction, & sender, & shard_owner) ) ;
1021+ assert_eq ! ( Ok ( TransactionInvoice :: Success ) , state. apply( shard_id, & transaction, & sender, & [ shard_owner] ) ) ;
10191022
10201023 let world = state. world ( world_id) ;
10211024 assert_eq ! ( Ok ( Some ( World :: new_with_nonce( owners, 1 ) ) ) , world) ;
@@ -1061,7 +1064,7 @@ mod tests {
10611064 let shard_owner = address ( ) ;
10621065 assert_eq ! (
10631066 Ok ( TransactionInvoice :: Fail ( TransactionError :: InsufficientPermission ) ) ,
1064- state. apply( shard_id, & transaction, & sender, & shard_owner)
1067+ state. apply( shard_id, & transaction, & sender, & [ shard_owner] )
10651068 ) ;
10661069 let world = state. world ( world_id) ;
10671070 assert_eq ! ( Ok ( Some ( World :: new_with_nonce( owners, 0 ) ) ) , world) ;
0 commit comments