@@ -260,6 +260,7 @@ pub fn publish_subnet_contracts_to_l1(
260260 mut l1_nonce : u64 ,
261261 config : & Config ,
262262 miner : PrincipalData ,
263+ admin : PrincipalData ,
263264) -> u64 {
264265 // Publish the subnet traits contract
265266 let trait_standard_contract_name = "subnet-traits" ;
@@ -298,9 +299,15 @@ pub fn publish_subnet_contracts_to_l1(
298299 & format ! (
299300 "(define-data-var miner principal '{})" ,
300301 & miner
302+ ) ,
303+ ) . replace (
304+ "(define-data-var admin principal tx-sender)" ,
305+ & format ! (
306+ "(define-data-var admin principal '{})" ,
307+ & admin
301308 ) ,
302- ) . replace (
303- "(use-trait nft-trait 'SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait.nft-trait)" ,
309+ ) . replace (
310+ "(use-trait nft-trait 'SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait.nft-trait)" ,
304311 "(use-trait nft-trait .sip-traits.nft-trait)"
305312 ) . replace (
306313 "(use-trait ft-trait 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard.sip-010-trait)" ,
@@ -411,7 +418,12 @@ fn l1_integration_test() {
411418 thread:: sleep ( Duration :: from_millis ( 10_000 ) ) ;
412419
413420 wait_for_target_l1_block ( & sortition_db, MOCKNET_EPOCH_2_1 ) ;
414- publish_subnet_contracts_to_l1 ( 0 , & config, miner_account. clone ( ) . into ( ) ) ;
421+ publish_subnet_contracts_to_l1 (
422+ 0 ,
423+ & config,
424+ miner_account. clone ( ) . into ( ) ,
425+ miner_account. clone ( ) . into ( ) ,
426+ ) ;
415427
416428 // Wait for exactly two stacks blocks.
417429 wait_for_next_stacks_block ( & sortition_db) ;
@@ -493,7 +505,12 @@ fn l1_deposit_and_withdraw_asset_integration_test() {
493505 thread:: sleep ( Duration :: from_millis ( 10_000 ) ) ;
494506 wait_for_target_l1_block ( & sortition_db, MOCKNET_EPOCH_2_1 ) ;
495507
496- l1_nonce = publish_subnet_contracts_to_l1 ( l1_nonce, & config, miner_account. clone ( ) . into ( ) ) ;
508+ l1_nonce = publish_subnet_contracts_to_l1 (
509+ l1_nonce,
510+ & config,
511+ miner_account. clone ( ) . into ( ) ,
512+ user_addr. clone ( ) . into ( ) ,
513+ ) ;
497514
498515 // Publish a simple FT and NFT
499516 let ft_content = include_str ! ( "../../../../core-contracts/contracts/helper/simple-ft.clar" ) ;
@@ -606,12 +623,11 @@ fn l1_deposit_and_withdraw_asset_integration_test() {
606623 submit_tx ( l1_rpc_origin, & l1_mint_ft_tx) ;
607624 submit_tx ( l1_rpc_origin, & l1_mint_nft_tx) ;
608625
609- // Register the contract (submitted by miner)
610- let account = get_account ( & l1_rpc_origin, & miner_account) ;
626+ // Register the contract
611627 let subnet_setup_ft_tx = make_contract_call (
612- & MOCKNET_PRIVATE_KEY_2 ,
628+ & MOCKNET_PRIVATE_KEY_1 ,
613629 LAYER_1_CHAIN_ID_TESTNET ,
614- account . nonce ,
630+ l1_nonce ,
615631 1_000_000 ,
616632 & user_addr,
617633 config. burnchain . contract_identifier . name . as_str ( ) ,
@@ -621,12 +637,12 @@ fn l1_deposit_and_withdraw_asset_integration_test() {
621637 Value :: Principal ( PrincipalData :: Contract ( subnet_ft_contract_id. clone ( ) ) ) ,
622638 ] ,
623639 ) ;
624- submit_tx ( l1_rpc_origin , & subnet_setup_ft_tx ) ;
640+ l1_nonce += 1 ;
625641
626642 let subnet_setup_nft_tx = make_contract_call (
627- & MOCKNET_PRIVATE_KEY_2 ,
643+ & MOCKNET_PRIVATE_KEY_1 ,
628644 LAYER_1_CHAIN_ID_TESTNET ,
629- account . nonce + 1 ,
645+ l1_nonce ,
630646 1_000_000 ,
631647 & user_addr,
632648 config. burnchain . contract_identifier . name . as_str ( ) ,
@@ -636,6 +652,9 @@ fn l1_deposit_and_withdraw_asset_integration_test() {
636652 Value :: Principal ( PrincipalData :: Contract ( subnet_nft_contract_id. clone ( ) ) ) ,
637653 ] ,
638654 ) ;
655+ l1_nonce += 1 ;
656+
657+ submit_tx ( l1_rpc_origin, & subnet_setup_ft_tx) ;
639658 submit_tx ( l1_rpc_origin, & subnet_setup_nft_tx) ;
640659
641660 wait_for_next_stacks_block ( & sortition_db) ;
@@ -1305,7 +1324,12 @@ fn l1_deposit_and_withdraw_stx_integration_test() {
13051324 thread:: sleep ( Duration :: from_millis ( 10_000 ) ) ;
13061325 wait_for_target_l1_block ( & sortition_db, MOCKNET_EPOCH_2_1 ) ;
13071326
1308- l1_nonce = publish_subnet_contracts_to_l1 ( l1_nonce, & config, miner_account. clone ( ) . into ( ) ) ;
1327+ l1_nonce = publish_subnet_contracts_to_l1 (
1328+ l1_nonce,
1329+ & config,
1330+ miner_account. clone ( ) . into ( ) ,
1331+ user_addr. clone ( ) . into ( ) ,
1332+ ) ;
13091333
13101334 // The burnchain should have registered what the listener recorded.
13111335 let tip = burndb
@@ -1686,7 +1710,12 @@ fn l2_simple_contract_calls() {
16861710 thread:: sleep ( Duration :: from_millis ( 10_000 ) ) ;
16871711 wait_for_target_l1_block ( & sortition_db, MOCKNET_EPOCH_2_1 ) ;
16881712
1689- publish_subnet_contracts_to_l1 ( 0 , & config, miner_account. clone ( ) . into ( ) ) ;
1713+ publish_subnet_contracts_to_l1 (
1714+ 0 ,
1715+ & config,
1716+ miner_account. clone ( ) . into ( ) ,
1717+ user_addr. clone ( ) . into ( ) ,
1718+ ) ;
16901719
16911720 wait_for_next_stacks_block ( & sortition_db) ;
16921721 wait_for_next_stacks_block ( & sortition_db) ;
@@ -1813,7 +1842,12 @@ fn nft_deposit_and_withdraw_integration_test() {
18131842 thread:: sleep ( Duration :: from_millis ( 10_000 ) ) ;
18141843 wait_for_target_l1_block ( & sortition_db, MOCKNET_EPOCH_2_1 ) ;
18151844
1816- l1_nonce = publish_subnet_contracts_to_l1 ( l1_nonce, & config, miner_account. clone ( ) . into ( ) ) ;
1845+ l1_nonce = publish_subnet_contracts_to_l1 (
1846+ l1_nonce,
1847+ & config,
1848+ miner_account. clone ( ) . into ( ) ,
1849+ user_addr. clone ( ) . into ( ) ,
1850+ ) ;
18171851
18181852 // Publish a simple NFT onto L1
18191853 let nft_content = include_str ! ( "../../../../core-contracts/contracts/helper/simple-nft.clar" ) ;
@@ -1869,12 +1903,11 @@ fn nft_deposit_and_withdraw_integration_test() {
18691903 let subnet_nft_contract_id =
18701904 QualifiedContractIdentifier :: new ( user_addr. into ( ) , ContractName :: from ( "simple-nft" ) ) ;
18711905
1872- // Setup subnet contract (submitted by miner)
1873- let account = get_account ( & l2_rpc_origin, & miner_account) ;
1906+ // Setup subnet contract
18741907 let subnet_setup_nft_tx = make_contract_call (
1875- & MOCKNET_PRIVATE_KEY_2 ,
1908+ & MOCKNET_PRIVATE_KEY_1 ,
18761909 LAYER_1_CHAIN_ID_TESTNET ,
1877- account . nonce + 1 ,
1910+ l1_nonce ,
18781911 1_000_000 ,
18791912 & user_addr,
18801913 config. burnchain . contract_identifier . name . as_str ( ) ,
@@ -1884,6 +1917,7 @@ fn nft_deposit_and_withdraw_integration_test() {
18841917 Value :: Principal ( PrincipalData :: Contract ( subnet_nft_contract_id. clone ( ) ) ) ,
18851918 ] ,
18861919 ) ;
1920+ l1_nonce += 1 ;
18871921
18881922 submit_tx ( & l2_rpc_origin, & subnet_nft_publish) ;
18891923 submit_tx ( l1_rpc_origin, & subnet_setup_nft_tx) ;
0 commit comments