1212//
1313// You should have received a copy of the GNU General Public License
1414// along with this program. If not, see <http://www.gnu.org/licenses/>.
15- use std:: cell:: LazyCell ;
1615use std:: collections:: { BTreeSet , HashMap } ;
16+ use std:: sync:: LazyLock ;
1717
1818use clarity:: boot_util:: boot_code_addr;
1919use clarity:: codec:: StacksMessageCodec ;
@@ -62,7 +62,7 @@ pub const SK_2: &str = "4ce9a8f7539ea93753a36405b16e8b57e15a552430410709c2b6d65d
6262pub const SK_3 : & str = "cb95ddd0fe18ec57f4f3533b95ae564b3f1ae063dbf75b46334bd86245aef78501" ;
6363
6464/// The private key for the faucet account.
65- pub const FAUCET_PRIV_KEY : LazyCell < StacksPrivateKey > = LazyCell :: new ( || {
65+ pub static FAUCET_PRIV_KEY : LazyLock < StacksPrivateKey > = LazyLock :: new ( || {
6666 StacksPrivateKey :: from_hex ( "510f96a8efd0b11e211733c1ac5e3fa6f3d3fcdd62869e376c47decb3e14fea101" )
6767 . expect ( "Failed to parse private key" )
6868} ) ;
@@ -709,6 +709,8 @@ pub struct ExpectedTransactionOutput {
709709pub struct ExpectedBlockOutput {
710710 /// The expected block marf
711711 pub marf_hash : TrieHash ,
712+ /// The epoch in which the test block was expected to be evaluated
713+ pub evaluated_epoch : StacksEpochId ,
712714 /// The expected outputs for each transaction, in input order.
713715 pub transactions : Vec < ExpectedTransactionOutput > ,
714716 /// The total execution cost of the block.
@@ -735,25 +737,25 @@ impl ExpectedResult {
735737 Ok ( epoch_receipt) => {
736738 let transactions: Vec < ExpectedTransactionOutput > = epoch_receipt
737739 . tx_receipts
738- . iter ( )
740+ . into_iter ( )
739741 . map ( |r| {
740- let tx = match & r. transaction {
741- TransactionOrigin :: Stacks ( tx) => Some ( tx. payload . clone ( ) ) ,
742+ let tx = match r. transaction {
743+ TransactionOrigin :: Stacks ( tx) => Some ( tx. payload ) ,
742744 TransactionOrigin :: Burn ( ..) => None ,
743745 } ;
744746 ExpectedTransactionOutput {
745747 tx,
746- return_type : r. result . clone ( ) ,
747- cost : r. execution_cost . clone ( ) ,
748- vm_error : r. vm_error . clone ( ) ,
748+ return_type : r. result ,
749+ cost : r. execution_cost ,
750+ vm_error : r. vm_error ,
749751 }
750752 } )
751753 . collect ( ) ;
752- let total_block_cost = epoch_receipt. anchored_block_cost . clone ( ) ;
753754 ExpectedResult :: Success ( ExpectedBlockOutput {
754755 marf_hash,
756+ evaluated_epoch : epoch_receipt. evaluated_epoch ,
755757 transactions,
756- total_block_cost,
758+ total_block_cost : epoch_receipt . anchored_block_cost ,
757759 } )
758760 }
759761 Err ( e) => ExpectedResult :: Failure ( e. to_string ( ) ) ,
@@ -873,7 +875,7 @@ impl ConsensusTest<'_> {
873875 "--------- Processed block: {sig_hash} ---------" ;
874876 "block" => ?nakamoto_block
875877 ) ;
876- let remapped_result = res. map ( |receipt| receipt. unwrap ( ) ) . into ( ) ;
878+ let remapped_result = res. map ( |receipt| receipt. unwrap ( ) ) ;
877879 // Restore chainstate for the next block
878880 self . chain . sortdb = Some ( sortdb) ;
879881 self . chain . stacks_node = Some ( stacks_node) ;
@@ -1009,14 +1011,14 @@ impl ConsensusTest<'_> {
10091011 fn compute_block_marf_root_hash (
10101012 & mut self ,
10111013 block_time : u64 ,
1012- block_txs : & Vec < StacksTransaction > ,
1014+ block_txs : & [ StacksTransaction ] ,
10131015 ) -> Result < TrieHash , String > {
10141016 let node = self . chain . stacks_node . as_mut ( ) . unwrap ( ) ;
10151017 let sortdb = self . chain . sortdb . as_ref ( ) . unwrap ( ) ;
10161018 let burndb_conn = sortdb. index_handle_at_tip ( ) ;
10171019 let chainstate = & mut node. chainstate ;
10181020
1019- let chain_tip = NakamotoChainState :: get_canonical_block_header ( chainstate. db ( ) , & sortdb)
1021+ let chain_tip = NakamotoChainState :: get_canonical_block_header ( chainstate. db ( ) , sortdb)
10201022 . unwrap ( )
10211023 . unwrap ( ) ;
10221024
@@ -1039,7 +1041,7 @@ impl ConsensusTest<'_> {
10391041 chain_tip. burn_header_height ,
10401042 ) ;
10411043 clarity_tx. rollback_block ( ) ;
1042- return result;
1044+ result
10431045 }
10441046
10451047 /// This is where the real MARF computation happens.
@@ -1049,7 +1051,7 @@ impl ConsensusTest<'_> {
10491051 fn inner_compute_block_marf_root_hash (
10501052 clarity_tx : & mut ClarityTx ,
10511053 block_time : u64 ,
1052- block_txs : & Vec < StacksTransaction > ,
1054+ block_txs : & [ StacksTransaction ] ,
10531055 burn_header_height : u32 ,
10541056 ) -> Result < TrieHash , String > {
10551057 clarity_tx
0 commit comments