mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-01-12 22:43:42 +08:00
cargo fmt
This commit is contained in:
@@ -18,7 +18,7 @@ use blockstack_lib::vm::ast::build_ast;
|
||||
use blockstack_lib::vm::contexts::GlobalContext;
|
||||
use blockstack_lib::vm::costs::LimitedCostTracker;
|
||||
use blockstack_lib::vm::errors::InterpreterResult;
|
||||
use blockstack_lib::vm::{ContractContext, eval_all};
|
||||
use blockstack_lib::vm::{eval_all, ContractContext};
|
||||
use rand::Rng;
|
||||
|
||||
use blockstack_lib::clarity_vm::database::marf::MarfedKV;
|
||||
@@ -490,10 +490,7 @@ fn expensive_contract_test(scaling: u32, buildup_count: u32, genesis_size: u32)
|
||||
this_cost
|
||||
}
|
||||
|
||||
pub fn execute_in_epoch(
|
||||
program: &str,
|
||||
epoch: StacksEpochId,
|
||||
) -> InterpreterResult<Option<Value>> {
|
||||
pub fn execute_in_epoch(program: &str, epoch: StacksEpochId) -> InterpreterResult<Option<Value>> {
|
||||
let contract_id = QualifiedContractIdentifier::transient();
|
||||
let mut contract_context = ContractContext::new(contract_id.clone());
|
||||
let mut marf = MemoryBackingStore::new();
|
||||
|
||||
@@ -8,9 +8,7 @@ use blockstack_lib::clarity_vm::database::marf::MarfedKV;
|
||||
use blockstack_lib::types::chainstate::StacksBlockId;
|
||||
use blockstack_lib::types::proof::ClarityMarfTrieId;
|
||||
use blockstack_lib::vm::database::NULL_BURN_STATE_DB;
|
||||
use blockstack_lib::{
|
||||
vm::database::NULL_HEADER_DB, vm::types::QualifiedContractIdentifier,
|
||||
};
|
||||
use blockstack_lib::{vm::database::NULL_HEADER_DB, vm::types::QualifiedContractIdentifier};
|
||||
use criterion::Criterion;
|
||||
|
||||
pub fn rollback_log_memory_test() {
|
||||
@@ -47,13 +45,16 @@ pub fn rollback_log_memory_test() {
|
||||
}
|
||||
|
||||
conn.as_transaction(|conn| {
|
||||
let (ct_ast, _ct_analysis) =
|
||||
conn.analyze_smart_contract(&contract_identifier, &contract).unwrap();
|
||||
let (ct_ast, _ct_analysis) = conn
|
||||
.analyze_smart_contract(&contract_identifier, &contract)
|
||||
.unwrap();
|
||||
|
||||
assert!(format!(
|
||||
"{:?}",
|
||||
conn.initialize_smart_contract(&contract_identifier, &ct_ast, &contract, |_, _| false)
|
||||
.unwrap_err()
|
||||
conn.initialize_smart_contract(&contract_identifier, &ct_ast, &contract, |_, _| {
|
||||
false
|
||||
})
|
||||
.unwrap_err()
|
||||
)
|
||||
.contains("MemoryBalanceExceeded"));
|
||||
});
|
||||
@@ -114,9 +115,12 @@ pub fn ccall_memory_test() {
|
||||
let (ct_ast, ct_analysis) = conn
|
||||
.analyze_smart_contract(&contract_identifier, &contract)
|
||||
.unwrap();
|
||||
conn.initialize_smart_contract(&contract_identifier, &ct_ast, &contract, |_, _| {
|
||||
false
|
||||
})
|
||||
conn.initialize_smart_contract(
|
||||
&contract_identifier,
|
||||
&ct_ast,
|
||||
&contract,
|
||||
|_, _| false,
|
||||
)
|
||||
.unwrap();
|
||||
conn.save_analysis(&contract_identifier, &ct_analysis)
|
||||
.unwrap();
|
||||
|
||||
@@ -12,7 +12,11 @@ use std::fs;
|
||||
use blockstack_lib::chainstate::stacks::index::{marf::MARF, storage::TrieFileStorage};
|
||||
use blockstack_lib::types::chainstate::{MARFValue, StacksBlockId};
|
||||
|
||||
pub fn begin(marf: &mut MARF<StacksBlockId>, chain_tip: &StacksBlockId, next_chain_tip: &StacksBlockId) -> Result<(), Error> {
|
||||
pub fn begin(
|
||||
marf: &mut MARF<StacksBlockId>,
|
||||
chain_tip: &StacksBlockId,
|
||||
next_chain_tip: &StacksBlockId,
|
||||
) -> Result<(), Error> {
|
||||
let mut tx = marf.begin_tx()?;
|
||||
tx.begin(chain_tip, next_chain_tip)?;
|
||||
Ok(())
|
||||
@@ -63,7 +67,10 @@ fn benchmark_marf_usage(
|
||||
|
||||
for _k in 0..reads_per_block {
|
||||
let (key, value) = values.as_slice().choose(&mut rng).unwrap();
|
||||
assert_eq!(marf.get_with_proof(&block_header, key).unwrap().unwrap().0, *value);
|
||||
assert_eq!(
|
||||
marf.get_with_proof(&block_header, key).unwrap().unwrap().0,
|
||||
*value
|
||||
);
|
||||
}
|
||||
|
||||
let mut next_block_header = (i + 1).to_le_bytes().to_vec();
|
||||
|
||||
Reference in New Issue
Block a user