Skip to content

Commit

Permalink
updating test fixtures after NamedChain renames. Tower tests pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Apr 11, 2023
1 parent 746ac6d commit 7e8c87a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
7 changes: 6 additions & 1 deletion ol/tower/src/next_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use diem_client::BlockingClient as DiemClient;
use diem_crypto::HashValue;
use diem_types::ol_vdf_difficulty::VDFDifficulty;
use ol::{config::AppCfg, node::node::Node};
use ol_types::block::GENESIS_VDF_ITERATIONS;
use ol_types::block::{GENESIS_VDF_ITERATIONS, GENESIS_VDF_SECURITY_PARAM};
use serde::{Deserialize, Serialize};

/// container for the next proof parameters to be fed to VDF prover.
Expand All @@ -26,8 +26,13 @@ pub struct NextProof {
impl NextProof {
/// create a genesis proof
pub fn genesis_proof(config: &AppCfg) -> Self {
// NOTE: can't set defautlsin VDFDifficulty::default() because of circular dependency
let mut diff = VDFDifficulty::default();

diff.difficulty = GENESIS_VDF_ITERATIONS.clone();
diff.security = GENESIS_VDF_SECURITY_PARAM.clone();
diff.prev_diff = GENESIS_VDF_ITERATIONS.clone();
diff.prev_sec = GENESIS_VDF_SECURITY_PARAM.clone();

NextProof {
diff,
Expand Down
4 changes: 2 additions & 2 deletions ol/tower/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ fn test_mine_genesis() {
assert_eq!(latest_block.height, 0, "test");

// Test the expected proof is writtent to file correctly.
let correct_proof = "003bd51aaf75164d499dca73c79a57718fb5736b436d5195be1284550960f28e50002c4f00539cc53d8c0be2be7822bc32b1dc1edbde523b28ac7c8f4c6803bb5417";
let correct_proof = "0068b32edb7244719b08c21fb786e7c25912a453c0ce895bc674a932a5509fda6d00020af97c69235a0387afe5e6cba13bdb4b6fd5a0e251dea265989c71b5b4db11";
assert_eq!(hex::encode(&latest_block.proof), correct_proof, "test");

test_helper_clear_block_dir(&configs_fixture.get_block_dir());
Expand Down Expand Up @@ -424,7 +424,7 @@ pub fn test_make_configs_fixture() -> AppCfg {
let mut cfg = AppCfg::default();
cfg.workspace.node_home = PathBuf::from(".");
cfg.workspace.block_dir = "test_blocks_temp_1".to_owned();
cfg.chain_info.chain_id = NamedChain::STAGE;
cfg.chain_info.chain_id = NamedChain::TESTNET;
cfg.profile.auth_key = "3e4629ba1e63114b59a161e89ad4a083b3a31b5fd59e39757c493e96398e4df2"
.parse()
.unwrap();
Expand Down
1 change: 0 additions & 1 deletion ol/tower/test_blocks_temp_1/proof_0.json

This file was deleted.

4 changes: 2 additions & 2 deletions ol/tower/tests/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ fn test_genesis_preimage() {

let first_preimage = tower::preimage::genesis_preimage(&configs);
let encoded = hex::encode(&first_preimage);
println!("proof:\n{:?}", encoded);
// println!("proof:\n{:?}", encoded);

let correct_preimage = "3e4629ba1e63114b59a161e89ad4a083b3a31b5fd59e39757c493e96398e4df2000000000000000000004445564e455464000000000000000002000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050726f74657374732072616765206163726f737320746865206e6174696f6e".to_owned();
let correct_preimage = "3e4629ba1e63114b59a161e89ad4a083b3a31b5fd59e39757c493e96398e4df2000000000000000000544553544e455464000000000000000002000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050726f74657374732072616765206163726f737320746865206e6174696f6e".to_owned();

assert_eq!(encoded, correct_preimage, "Preimages do not match")
}
1 change: 0 additions & 1 deletion types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ diem-workspace-hack = { version = "0.1", path = "../crates/diem-workspace-hack"

# //////// 0L ////////
sha2 = "0.9.1"
ol-types = { path = "../ol/types" }

[dev-dependencies]
regex = "1.4.3"
Expand Down
1 change: 0 additions & 1 deletion types/src/ol_vdf_difficulty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use move_core_types::{
};
use serde::{Deserialize, Serialize};

use ol_types::block::GENESIS_VDF_ITERATIONS;
/// difficulty of the VDF proof, for use as on-chain representation and in `tower`
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct VDFDifficulty {
Expand Down

0 comments on commit 7e8c87a

Please sign in to comment.