mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-06-17 02:24:48 +08:00
removed a lot of curst
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -236,7 +236,6 @@ name = "blockstack-core"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"assert-json-diff",
|
||||
"backtrace",
|
||||
"chrono",
|
||||
"curve25519-dalek",
|
||||
"ed25519-dalek",
|
||||
|
||||
@@ -43,7 +43,6 @@ name = "block_limits"
|
||||
harness = false
|
||||
|
||||
[dependencies]
|
||||
backtrace = "0.3.50"
|
||||
rand = "=0.7.2"
|
||||
rand_chacha = "=0.2.2"
|
||||
serde = "1"
|
||||
|
||||
@@ -2778,9 +2778,6 @@ impl SortitionDB {
|
||||
|
||||
/// Get the canonical burn chain tip -- the tip of the longest burn chain we know about.
|
||||
/// Break ties deterministically by ordering on burnchain block hash.
|
||||
///
|
||||
///
|
||||
// Use this one!
|
||||
pub fn get_canonical_sortition_tip(conn: &Connection) -> Result<SortitionId, db_error> {
|
||||
let qry = "SELECT sortition_id FROM snapshots WHERE pox_valid = 1 ORDER BY block_height DESC, burn_header_hash ASC LIMIT 1";
|
||||
match conn.query_row(qry, NO_PARAMS, |row| row.get(0)).optional() {
|
||||
|
||||
@@ -313,13 +313,6 @@ impl BurnStateDB for TestSimBurnStateDB {
|
||||
panic!("Not implemented in TestSim");
|
||||
}
|
||||
|
||||
fn get_burn_header_hash_using_consensus_hash(
|
||||
&self,
|
||||
height: u32,
|
||||
) -> Option<BurnchainHeaderHash> {
|
||||
panic!("Not implemented in TestSim");
|
||||
}
|
||||
|
||||
fn get_stacks_epoch(&self, height: u32) -> Option<StacksEpoch> {
|
||||
let epoch_begin_index = match self.epoch_bounds.binary_search(&(height as u64)) {
|
||||
Ok(index) => index,
|
||||
@@ -386,9 +379,6 @@ impl HeadersDB for TestSimHeadersDB {
|
||||
Some(BurnchainHeaderHash(id_bhh.0.clone()))
|
||||
}
|
||||
}
|
||||
fn get_consensus_hash_for_block(&self, id_bhh: &StacksBlockId) -> Option<ConsensusHash> {
|
||||
None
|
||||
}
|
||||
|
||||
fn get_vrf_seed_for_block(&self, _bhh: &StacksBlockId) -> Option<VRFSeed> {
|
||||
None
|
||||
|
||||
@@ -66,7 +66,6 @@ use serde::Serialize;
|
||||
use serde_json::json;
|
||||
use util::strings::StacksString;
|
||||
|
||||
use chainstate::burn::ConsensusHash;
|
||||
use codec::StacksMessageCodec;
|
||||
|
||||
use std::convert::TryFrom;
|
||||
@@ -556,9 +555,6 @@ impl HeadersDB for CLIHeadersDB {
|
||||
None
|
||||
}
|
||||
}
|
||||
fn get_consensus_hash_for_block(&self, id_bhh: &StacksBlockId) -> Option<ConsensusHash> {
|
||||
None
|
||||
}
|
||||
|
||||
fn get_vrf_seed_for_block(&self, id_bhh: &StacksBlockId) -> Option<VRFSeed> {
|
||||
let conn = self.conn();
|
||||
|
||||
@@ -25,17 +25,12 @@ use core::StacksEpoch;
|
||||
pub mod marf;
|
||||
|
||||
impl HeadersDB for DBConn {
|
||||
// Is this it?
|
||||
fn get_stacks_block_header_hash_for_block(
|
||||
&self,
|
||||
id_bhh: &StacksBlockId,
|
||||
) -> Option<BlockHeaderHash> {
|
||||
// I think it's this one.
|
||||
get_stacks_header_info(self, id_bhh).map(|x| x.anchored_header.block_hash())
|
||||
}
|
||||
fn get_consensus_hash_for_block(&self, id_bhh: &StacksBlockId) -> Option<ConsensusHash> {
|
||||
get_stacks_header_info(self, id_bhh).map(|x| x.consensus_hash)
|
||||
}
|
||||
|
||||
fn get_burn_header_hash_for_block(
|
||||
&self,
|
||||
@@ -111,27 +106,6 @@ impl BurnStateDB for SortitionHandleTx<'_> {
|
||||
&self,
|
||||
height: u32,
|
||||
) -> Option<BurnchainHeaderHash> {
|
||||
// // DO NOT SUBMIT: remove the unwrap
|
||||
// let sn = match SortitionDB::get_block_snapshot_consensus(self.tx(), consensus_hash).unwrap() {
|
||||
// Some(sn) => {
|
||||
// if !sn.pox_valid {
|
||||
// warn!(
|
||||
// "No such chain tip consensus hash {}: not on a valid PoX fork",
|
||||
// consensus_hash
|
||||
// );
|
||||
// // return Err(db_error::InvalidPoxSortition);
|
||||
// // DO NOT SUBMIT: handle this error
|
||||
// return None;
|
||||
// }
|
||||
// sn
|
||||
// }
|
||||
// None => {
|
||||
// test_debug!("No such chain tip consensus hash {}", consensus_hash);
|
||||
// // return Err(db_error::NotFoundError);
|
||||
// // DO NOT SUBMIT: handle this error
|
||||
// return None;
|
||||
// }
|
||||
// };
|
||||
let sortition_id = SortitionDB::get_canonical_sortition_tip(self.tx()).unwrap();
|
||||
self.get_burn_header_hash(height, &sortition_id)
|
||||
}
|
||||
@@ -187,7 +161,6 @@ impl BurnStateDB for SortitionDBConn<'_> {
|
||||
&self,
|
||||
height: u32,
|
||||
) -> Option<BurnchainHeaderHash> {
|
||||
|
||||
let sortition_id = SortitionDB::get_canonical_sortition_tip(self.conn()).unwrap();
|
||||
self.get_burn_header_hash(height, &sortition_id)
|
||||
}
|
||||
|
||||
@@ -89,7 +89,6 @@ pub trait HeadersDB {
|
||||
) -> Option<BlockHeaderHash>;
|
||||
fn get_burn_header_hash_for_block(&self, id_bhh: &StacksBlockId)
|
||||
-> Option<BurnchainHeaderHash>;
|
||||
fn get_consensus_hash_for_block(&self, id_bhh: &StacksBlockId) -> Option<ConsensusHash>;
|
||||
fn get_vrf_seed_for_block(&self, id_bhh: &StacksBlockId) -> Option<VRFSeed>;
|
||||
fn get_burn_block_time_for_block(&self, id_bhh: &StacksBlockId) -> Option<u64>;
|
||||
fn get_burn_block_height_for_block(&self, id_bhh: &StacksBlockId) -> Option<u32>;
|
||||
@@ -122,9 +121,6 @@ impl HeadersDB for &dyn HeadersDB {
|
||||
) -> Option<BlockHeaderHash> {
|
||||
(*self).get_stacks_block_header_hash_for_block(id_bhh)
|
||||
}
|
||||
fn get_consensus_hash_for_block(&self, id_bhh: &StacksBlockId) -> Option<ConsensusHash> {
|
||||
(*self).get_consensus_hash_for_block(id_bhh)
|
||||
}
|
||||
fn get_burn_header_hash_for_block(&self, bhh: &StacksBlockId) -> Option<BurnchainHeaderHash> {
|
||||
(*self).get_burn_header_hash_for_block(bhh)
|
||||
}
|
||||
@@ -218,9 +214,6 @@ impl HeadersDB for NullHeadersDB {
|
||||
None
|
||||
}
|
||||
}
|
||||
fn get_consensus_hash_for_block(&self, id_bhh: &StacksBlockId) -> Option<ConsensusHash> {
|
||||
None
|
||||
}
|
||||
fn get_vrf_seed_for_block(&self, _bhh: &StacksBlockId) -> Option<VRFSeed> {
|
||||
None
|
||||
}
|
||||
@@ -710,23 +703,9 @@ impl<'a> ClarityDatabase<'a> {
|
||||
&mut self,
|
||||
burnchain_block_height: u32,
|
||||
) -> BurnchainHeaderHash {
|
||||
let bt = backtrace::Backtrace::new();
|
||||
warn!("look5 {:?}", bt);
|
||||
// let block_height = self.get_current_block_height();
|
||||
// let id_bhh = self.get_index_block_header_hash(block_height);
|
||||
// conn.query_row(
|
||||
// "SELECT * FROM block_headers WHERE index_block_hash = ?",
|
||||
// [id_bhh].iter(),
|
||||
// |x| Ok(StacksHeaderInfo::from_row(x).expect("Bad stacks header info in database")),
|
||||
// let consensus_hash = self
|
||||
// .headers_db
|
||||
// .get_consensus_hash_for_block(&id_bhh)
|
||||
// .expect("Failed to get block data.");
|
||||
let answer5 = self.burn_state_db
|
||||
self.burn_state_db
|
||||
.get_burn_header_hash_using_consensus_hash(burnchain_block_height)
|
||||
.expect("Failed to get block data.");
|
||||
warn!("answer5: {:?}", answer5);
|
||||
answer5
|
||||
}
|
||||
|
||||
pub fn get_burnchain_block_height(&mut self, id_bhh: &StacksBlockId) -> Option<u32> {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use chainstate::burn::ConsensusHash;
|
||||
use vm::analysis::type_checker::natives::SimpleNativeFunction;
|
||||
use vm::analysis::type_checker::TypedNativeFunction;
|
||||
use vm::functions::define::DefineFunctions;
|
||||
@@ -2026,7 +2025,6 @@ mod test {
|
||||
Value,
|
||||
};
|
||||
|
||||
use crate::chainstate::burn::ConsensusHash;
|
||||
use crate::types::chainstate::VRFSeed;
|
||||
use crate::types::chainstate::{BlockHeaderHash, BurnchainHeaderHash};
|
||||
use crate::types::chainstate::{SortitionId, StacksAddress, StacksBlockId};
|
||||
@@ -2051,9 +2049,6 @@ mod test {
|
||||
) -> Option<BurnchainHeaderHash> {
|
||||
None
|
||||
}
|
||||
fn get_consensus_hash_for_block(&self, id_bhh: &StacksBlockId) -> Option<ConsensusHash> {
|
||||
None
|
||||
}
|
||||
fn get_vrf_seed_for_block(&self, _bhh: &StacksBlockId) -> Option<VRFSeed> {
|
||||
Some(
|
||||
VRFSeed::from_hex(
|
||||
|
||||
@@ -494,8 +494,6 @@ pub fn special_get_block_info(
|
||||
Value::from(miner_address)
|
||||
}
|
||||
BlockInfoProperty::BurnchainHeaderHashByBurnchainHeight => {
|
||||
let bt = backtrace::Backtrace::new();
|
||||
warn!("look1 {:?}", bt);
|
||||
let burnchain_header_hash = env
|
||||
.global_context
|
||||
.database
|
||||
|
||||
@@ -363,24 +363,15 @@ fn integration_test_get_info() {
|
||||
assert_eq!(
|
||||
chain_state.clarity_eval_read_only(
|
||||
burn_dbconn, bhh, &contract_identifier, "(test-6)"),
|
||||
Value::some(Value::buff_from(last_burn_header.clone()).unwrap()).unwrap());
|
||||
Value::some(Value::buff_from(last_burn_header).unwrap()).unwrap());
|
||||
assert_eq!(
|
||||
chain_state.clarity_eval_read_only(
|
||||
burn_dbconn, bhh, &contract_identifier, "(test-7)"),
|
||||
Value::some(Value::buff_from(last_vrf_seed).unwrap()).unwrap());
|
||||
|
||||
warn!("look1");
|
||||
let twelve_result = chain_state.clarity_eval_read_only(
|
||||
burn_dbconn, bhh, &contract_identifier, "(test-12)");
|
||||
warn!("twelve_result {:?}", twelve_result);
|
||||
|
||||
let consensus_hash = chain_tip.metadata.consensus_hash;
|
||||
// let header_hash1 = burn_dbconn.get_burn_header_hash_using_consensus_hash(0);
|
||||
let header_hash1 = hex_bytes("0000000000000000000000000000000000000000000000000000000000000000").unwrap();
|
||||
warn!("header_hash1 {:?}", header_hash1);
|
||||
|
||||
// assert_eq!(twelve_result,
|
||||
// Value::some(Value::buff_from(last_burn_header).unwrap()).unwrap());
|
||||
assert_eq!(twelve_result,
|
||||
Value::some(Value::buff_from(header_hash1).unwrap()).unwrap());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user