From cf2a65242d9805b0688e40f2432250461aa56561 Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Wed, 7 Oct 2020 09:36:02 -0400 Subject: [PATCH] Rename Floonet to Testnet (#3431) * Rename Floonet to Testnet * Fix test * Rename test and docker --- .github/pull_request_template.md | 2 +- CONTRIBUTING.md | 2 +- chain/src/chain.rs | 2 +- config/src/comments.rs | 2 +- config/src/config.rs | 2 +- core/src/consensus.rs | 20 ++++----- core/src/genesis.rs | 16 +++---- core/src/global.rs | 40 ++++++++--------- core/src/libtx/proof.rs | 2 +- ...sensus_floonet.rs => consensus_testnet.rs} | 44 +++++++++---------- doc/build.md | 2 +- doc/translations/build_JP.md | 2 +- doc/translations/build_KR.md | 2 +- doc/translations/build_ZH-CN.md | 2 +- ...{Dockerfile.floonet => Dockerfile.testnet} | 4 +- keychain/src/extkey_bip32.rs | 14 +++--- keychain/src/keychain.rs | 14 +++--- keychain/src/types.rs | 6 +-- keychain/src/view_key.rs | 14 +++--- p2p/src/msg.rs | 4 +- p2p/src/types.rs | 4 +- servers/src/grin/seed.rs | 8 ++-- servers/src/grin/server.rs | 2 +- servers/src/mining/mine_block.rs | 2 +- src/bin/grin.rs | 4 +- src/bin/grin.yml | 6 +-- 26 files changed, 111 insertions(+), 111 deletions(-) rename core/tests/{consensus_floonet.rs => consensus_testnet.rs} (82%) rename etc/{Dockerfile.floonet => Dockerfile.testnet} (92%) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index bffb612d1c..6acf82a1af 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -14,5 +14,5 @@ Before submitting your PR for final review, please ensure that it: * Explains whether/how the change is consensus breaking or breaks existing client functionality * Contains unit tests exercising new/changed functionality * Fully considers the potential impact of the change on other parts of the system -* Describes how you've tested the change (e.g. against Floonet, etc) +* Describes how you've tested the change (e.g. against Testnet, etc) * Updates any documentation that's affected by the PR diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 51d9a26727..663c84a520 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ Since mainnet has been released, the bar for having PRs accepted has been raised * Explains whether/how the change is consensus breaking or breaks existing client functionality * Contains unit tests exercising new/changed functionality * Fully considers the potential impact of the change on other parts of the system -* Describes how you've tested the change (e.g. against Floonet, etc) +* Describes how you've tested the change (e.g. against Testnet, etc) * Updates any documentation that's affected by the PR If submitting a PR consisting of documentation changes only, please try to ensure that the change is significantly more substantial than one or two lines. For example, working through an install document and making changes and updates throughout as you find issues is worth a PR. For typos and other small changes, either contact one of the developers, or if you think it's a significant enough error to cause problems for other users, please feel free to open an issue. diff --git a/chain/src/chain.rs b/chain/src/chain.rs index 6fb9955bc5..cd0d14e0ea 100644 --- a/chain/src/chain.rs +++ b/chain/src/chain.rs @@ -986,7 +986,7 @@ impl Chain { /// Specific tmp dir. /// Normally it's ~/.grin/main/tmp for mainnet - /// or ~/.grin/floo/tmp for floonet + /// or ~/.grin/test/tmp for Testnet pub fn get_tmp_dir(&self) -> PathBuf { let mut tmp_dir = PathBuf::from(self.db_root.clone()); tmp_dir = tmp_dir diff --git a/config/src/comments.rs b/config/src/comments.rs index 41d8235210..4a623f130c 100644 --- a/config/src/comments.rs +++ b/config/src/comments.rs @@ -87,7 +87,7 @@ fn comments() -> HashMap { #parameters used for mining as well as wallet output coinbase maturity. Can be: #AutomatedTesting - For CI builds and instant blockchain creation #UserTesting - For regular user testing (cuckoo 16) -#Floonet - For the long term floonet test network +#Testnet - For the long term test network #Mainnet - For mainnet " .to_string(), diff --git a/config/src/config.rs b/config/src/config.rs index bbc969a234..b7bb2a5033 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -168,7 +168,7 @@ impl GlobalConfig { match *chain_type { global::ChainTypes::Mainnet => {} - global::ChainTypes::Floonet => { + global::ChainTypes::Testnet => { defaults.api_http_addr = "127.0.0.1:13413".to_owned(); defaults.p2p_config.port = 13414; defaults diff --git a/core/src/consensus.rs b/core/src/consensus.rs index 3021219394..bea63da943 100644 --- a/core/src/consensus.rs +++ b/core/src/consensus.rs @@ -127,14 +127,14 @@ pub const MAX_BLOCK_WEIGHT: u64 = 40_000; /// Fork every 6 months. pub const HARD_FORK_INTERVAL: u64 = YEAR_HEIGHT / 2; -/// Floonet first hard fork height, set to happen around 2019-06-20 -pub const FLOONET_FIRST_HARD_FORK: u64 = 185_040; +/// Testnet first hard fork height, set to happen around 2019-06-20 +pub const TESTNET_FIRST_HARD_FORK: u64 = 185_040; -/// Floonet second hard fork height, set to happen around 2019-12-19 -pub const FLOONET_SECOND_HARD_FORK: u64 = 298_080; +/// Testnet second hard fork height, set to happen around 2019-12-19 +pub const TESTNET_SECOND_HARD_FORK: u64 = 298_080; -/// Floonet second hard fork height, set to happen around 2020-06-20 -pub const FLOONET_THIRD_HARD_FORK: u64 = 552_960; +/// Testnet second hard fork height, set to happen around 2020-06-20 +pub const TESTNET_THIRD_HARD_FORK: u64 = 552_960; /// AutomatedTesting and UserTesting HF1 height. pub const TESTING_FIRST_HARD_FORK: u64 = 3; @@ -152,12 +152,12 @@ pub fn header_version(height: u64) -> HeaderVersion { let hf_interval = (1 + height / HARD_FORK_INTERVAL) as u16; match chain_type { global::ChainTypes::Mainnet => HeaderVersion(hf_interval), - global::ChainTypes::Floonet => { - if height < FLOONET_FIRST_HARD_FORK { + global::ChainTypes::Testnet => { + if height < TESTNET_FIRST_HARD_FORK { HeaderVersion(1) - } else if height < FLOONET_SECOND_HARD_FORK { + } else if height < TESTNET_SECOND_HARD_FORK { HeaderVersion(2) - } else if height < FLOONET_THIRD_HARD_FORK { + } else if height < TESTNET_THIRD_HARD_FORK { HeaderVersion(3) } else if height < 4 * HARD_FORK_INTERVAL { HeaderVersion(4) diff --git a/core/src/genesis.rs b/core/src/genesis.rs index 0d46db437a..cce553f6ea 100644 --- a/core/src/genesis.rs +++ b/core/src/genesis.rs @@ -44,8 +44,8 @@ pub fn genesis_dev() -> core::Block { }) } -/// Floonet genesis block -pub fn genesis_floo() -> core::Block { +/// Testnet genesis block +pub fn genesis_test() -> core::Block { let gen = core::Block::with_header(core::BlockHeader { height: 0, timestamp: Utc.ymd(2018, 12, 28).and_hms(20, 48, 4), @@ -277,12 +277,12 @@ mod test { use util::ToHex; #[test] - fn floonet_genesis_hash() { - global::set_local_chain_type(global::ChainTypes::Floonet); - let gen_hash = genesis_floo().hash(); - println!("floonet genesis hash: {}", gen_hash.to_hex()); - let gen_bin = ser::ser_vec(&genesis_floo(), ProtocolVersion(1)).unwrap(); - println!("floonet genesis full hash: {}\n", gen_bin.hash().to_hex()); + fn testnet_genesis_hash() { + global::set_local_chain_type(global::ChainTypes::Testnet); + let gen_hash = genesis_test().hash(); + println!("testnet genesis hash: {}", gen_hash.to_hex()); + let gen_bin = ser::ser_vec(&genesis_test(), ProtocolVersion(1)).unwrap(); + println!("testnet genesis full hash: {}\n", gen_bin.hash().to_hex()); assert_eq!( gen_hash.to_hex(), "edc758c1370d43e1d733f70f58cf187c3be8242830429b1676b89fd91ccf2dab" diff --git a/core/src/global.rs b/core/src/global.rs index 6678b0f367..196e0b5259 100644 --- a/core/src/global.rs +++ b/core/src/global.rs @@ -115,18 +115,18 @@ pub enum ChainTypes { /// For User testing UserTesting, /// Protocol testing network - Floonet, + Testnet, /// Main production network Mainnet, } impl ChainTypes { - /// Short name representing the chain type ("floo", "main", etc.) + /// Short name representing the chain type ("test", "main", etc.) pub fn shortname(&self) -> String { match *self { ChainTypes::AutomatedTesting => "auto".to_owned(), ChainTypes::UserTesting => "user".to_owned(), - ChainTypes::Floonet => "floo".to_owned(), + ChainTypes::Testnet => "test".to_owned(), ChainTypes::Mainnet => "main".to_owned(), } } @@ -151,7 +151,7 @@ lazy_static! { } thread_local! { - /// Mainnet|Floonet|UserTesting|AutomatedTesting + /// Mainnet|Testnet|UserTesting|AutomatedTesting pub static CHAIN_TYPE: Cell> = Cell::new(None); /// Local feature flag for NRD kernel support. @@ -238,18 +238,18 @@ pub fn create_pow_context( } ChainTypes::Mainnet => new_cuckaroo_ctx(edge_bits, proof_size), - // Same for Floonet - ChainTypes::Floonet if edge_bits > 29 => new_cuckatoo_ctx(edge_bits, proof_size, max_sols), - ChainTypes::Floonet if valid_header_version(height, HeaderVersion(4)) => { + // Same for Testnet + ChainTypes::Testnet if edge_bits > 29 => new_cuckatoo_ctx(edge_bits, proof_size, max_sols), + ChainTypes::Testnet if valid_header_version(height, HeaderVersion(4)) => { new_cuckarooz_ctx(edge_bits, proof_size) } - ChainTypes::Floonet if valid_header_version(height, HeaderVersion(3)) => { + ChainTypes::Testnet if valid_header_version(height, HeaderVersion(3)) => { new_cuckaroom_ctx(edge_bits, proof_size) } - ChainTypes::Floonet if valid_header_version(height, HeaderVersion(2)) => { + ChainTypes::Testnet if valid_header_version(height, HeaderVersion(2)) => { new_cuckarood_ctx(edge_bits, proof_size) } - ChainTypes::Floonet => new_cuckaroo_ctx(edge_bits, proof_size), + ChainTypes::Testnet => new_cuckaroo_ctx(edge_bits, proof_size), // Everything else is Cuckatoo only _ => new_cuckatoo_ctx(edge_bits, proof_size, max_sols), @@ -299,7 +299,7 @@ pub fn initial_block_difficulty() -> u64 { match get_chain_type() { ChainTypes::AutomatedTesting => TESTING_INITIAL_DIFFICULTY, ChainTypes::UserTesting => TESTING_INITIAL_DIFFICULTY, - ChainTypes::Floonet => INITIAL_DIFFICULTY, + ChainTypes::Testnet => INITIAL_DIFFICULTY, ChainTypes::Mainnet => INITIAL_DIFFICULTY, } } @@ -308,7 +308,7 @@ pub fn initial_graph_weight() -> u32 { match get_chain_type() { ChainTypes::AutomatedTesting => TESTING_INITIAL_GRAPH_WEIGHT, ChainTypes::UserTesting => TESTING_INITIAL_GRAPH_WEIGHT, - ChainTypes::Floonet => graph_weight(0, SECOND_POW_EDGE_BITS) as u32, + ChainTypes::Testnet => graph_weight(0, SECOND_POW_EDGE_BITS) as u32, ChainTypes::Mainnet => graph_weight(0, SECOND_POW_EDGE_BITS) as u32, } } @@ -318,7 +318,7 @@ pub fn max_block_weight() -> u64 { match get_chain_type() { ChainTypes::AutomatedTesting => TESTING_MAX_BLOCK_WEIGHT, ChainTypes::UserTesting => TESTING_MAX_BLOCK_WEIGHT, - ChainTypes::Floonet => MAX_BLOCK_WEIGHT, + ChainTypes::Testnet => MAX_BLOCK_WEIGHT, ChainTypes::Mainnet => MAX_BLOCK_WEIGHT, } } @@ -360,19 +360,19 @@ pub fn txhashset_archive_interval() -> u64 { /// Production defined as a live public network, testnet[n] or mainnet. pub fn is_production_mode() -> bool { match get_chain_type() { - ChainTypes::Floonet => true, + ChainTypes::Testnet => true, ChainTypes::Mainnet => true, _ => false, } } -/// Are we in floonet? +/// Are we in testnet? /// Note: We do not have a corresponding is_mainnet() as we want any tests to be as close /// as possible to "mainnet" configuration as possible. /// We want to avoid missing any mainnet only code paths. -pub fn is_floonet() -> bool { +pub fn is_testnet() -> bool { match get_chain_type() { - ChainTypes::Floonet => true, + ChainTypes::Testnet => true, _ => false, } } @@ -448,9 +448,9 @@ mod test { } #[test] - fn floonet_header_len() { - set_local_chain_type(ChainTypes::Floonet); - test_header_len(genesis_floo()); + fn testnet_header_len() { + set_local_chain_type(ChainTypes::Testnet); + test_header_len(genesis_test()); } #[test] diff --git a/core/src/libtx/proof.rs b/core/src/libtx/proof.rs index 0c7442f262..1f595bca6d 100644 --- a/core/src/libtx/proof.rs +++ b/core/src/libtx/proof.rs @@ -412,7 +412,7 @@ impl ProofBuild for ViewKey { } let mut key = self.clone(); - let mut hasher = BIP32GrinHasher::new(self.is_floo); + let mut hasher = BIP32GrinHasher::new(self.is_test); for i in self.depth..path.depth { let child_number = path.path[i as usize]; if child_number.is_hardened() { diff --git a/core/tests/consensus_floonet.rs b/core/tests/consensus_testnet.rs similarity index 82% rename from core/tests/consensus_floonet.rs rename to core/tests/consensus_testnet.rs index 3e89e283ad..2eb6ee9618 100644 --- a/core/tests/consensus_floonet.rs +++ b/core/tests/consensus_testnet.rs @@ -12,17 +12,17 @@ // limitations under the License. use grin_core::consensus::{ - secondary_pow_ratio, valid_header_version, FLOONET_FIRST_HARD_FORK, FLOONET_SECOND_HARD_FORK, - FLOONET_THIRD_HARD_FORK, HARD_FORK_INTERVAL, + secondary_pow_ratio, valid_header_version, HARD_FORK_INTERVAL, TESTNET_FIRST_HARD_FORK, + TESTNET_SECOND_HARD_FORK, TESTNET_THIRD_HARD_FORK, }; use grin_core::core::HeaderVersion; use grin_core::global; #[test] fn test_secondary_pow_ratio() { - // Tests for Floonet chain type (covers pre and post hardfork). - global::set_local_chain_type(global::ChainTypes::Floonet); - assert_eq!(global::is_floonet(), true); + // Tests for Testnet chain type (covers pre and post hardfork). + global::set_local_chain_type(global::ChainTypes::Testnet); + assert_eq!(global::is_testnet(), true); assert_eq!(secondary_pow_ratio(1), 90); assert_eq!(secondary_pow_ratio(89), 90); @@ -63,69 +63,69 @@ fn test_secondary_pow_ratio() { #[test] fn hard_forks() { - global::set_local_chain_type(global::ChainTypes::Floonet); - assert_eq!(global::is_floonet(), true); + global::set_local_chain_type(global::ChainTypes::Testnet); + assert_eq!(global::is_testnet(), true); assert!(valid_header_version(0, HeaderVersion(1))); assert!(valid_header_version(10, HeaderVersion(1))); assert!(!valid_header_version(10, HeaderVersion(2))); assert!(valid_header_version( - FLOONET_FIRST_HARD_FORK - 1, + TESTNET_FIRST_HARD_FORK - 1, HeaderVersion(1) )); assert!(valid_header_version( - FLOONET_FIRST_HARD_FORK, + TESTNET_FIRST_HARD_FORK, HeaderVersion(2) )); assert!(valid_header_version( - FLOONET_FIRST_HARD_FORK + 1, + TESTNET_FIRST_HARD_FORK + 1, HeaderVersion(2) )); assert!(!valid_header_version( - FLOONET_FIRST_HARD_FORK, + TESTNET_FIRST_HARD_FORK, HeaderVersion(1) )); assert!(valid_header_version( - FLOONET_SECOND_HARD_FORK - 1, + TESTNET_SECOND_HARD_FORK - 1, HeaderVersion(2) )); assert!(valid_header_version( - FLOONET_SECOND_HARD_FORK, + TESTNET_SECOND_HARD_FORK, HeaderVersion(3) )); assert!(valid_header_version( - FLOONET_SECOND_HARD_FORK + 1, + TESTNET_SECOND_HARD_FORK + 1, HeaderVersion(3) )); assert!(!valid_header_version( - FLOONET_SECOND_HARD_FORK, + TESTNET_SECOND_HARD_FORK, HeaderVersion(2) )); assert!(!valid_header_version( - FLOONET_SECOND_HARD_FORK, + TESTNET_SECOND_HARD_FORK, HeaderVersion(1) )); assert!(valid_header_version( - FLOONET_THIRD_HARD_FORK - 1, + TESTNET_THIRD_HARD_FORK - 1, HeaderVersion(3) )); assert!(valid_header_version( - FLOONET_THIRD_HARD_FORK, + TESTNET_THIRD_HARD_FORK, HeaderVersion(4) )); assert!(valid_header_version( - FLOONET_THIRD_HARD_FORK + 1, + TESTNET_THIRD_HARD_FORK + 1, HeaderVersion(4) )); assert!(!valid_header_version( - FLOONET_THIRD_HARD_FORK, + TESTNET_THIRD_HARD_FORK, HeaderVersion(3) )); assert!(!valid_header_version( - FLOONET_THIRD_HARD_FORK, + TESTNET_THIRD_HARD_FORK, HeaderVersion(2) )); assert!(!valid_header_version( - FLOONET_THIRD_HARD_FORK, + TESTNET_THIRD_HARD_FORK, HeaderVersion(1) )); diff --git a/doc/build.md b/doc/build.md index 011e925ee4..b25d3a49bd 100644 --- a/doc/build.md +++ b/doc/build.md @@ -108,7 +108,7 @@ grin client --help ```sh docker build -t grin -f etc/Dockerfile . ``` -For floonet, use `etc/Dockerfile.floonet` instead +For testnet, use `etc/Dockerfile.testnet` instead You can bind-mount your grin cache to run inside the container. diff --git a/doc/translations/build_JP.md b/doc/translations/build_JP.md index c6ffa335a5..9b76056179 100644 --- a/doc/translations/build_JP.md +++ b/doc/translations/build_JP.md @@ -102,7 +102,7 @@ grin client --help ```sh docker build -t grin -f etc/Dockerfile . ``` -floonetを使用する場合、代わりに`etc/Dockerfile.floonet`を指定。 +testnetを使用する場合、代わりに`etc/Dockerfile.testnet`を指定。 コンテナ内で実行する場合、grinのキャッシュをバインドマウントすることも可能。 diff --git a/doc/translations/build_KR.md b/doc/translations/build_KR.md index 0658030382..ff20d95a57 100644 --- a/doc/translations/build_KR.md +++ b/doc/translations/build_KR.md @@ -104,7 +104,7 @@ grin client --help docker build -t grin -f etc/Dockerfile . ``` -floonet을 사용하려면 `etc/Dockerfile.floonet` 을 사용하세요. +testnet을 사용하려면 `etc/Dockerfile.testnet` 을 사용하세요. container 안에서 grin cache를 bind-mount로 사용 할 수 있습니다. ```sh diff --git a/doc/translations/build_ZH-CN.md b/doc/translations/build_ZH-CN.md index d24444b93b..eca2dbd0a1 100644 --- a/doc/translations/build_ZH-CN.md +++ b/doc/translations/build_ZH-CN.md @@ -100,7 +100,7 @@ grin client --help ```sh docker build -t grin -f etc/Dockerfile . ``` -对于 floonet, 使用 `etc/Dockerfile.floonet` 代替 +对于 testnet, 使用 `etc/Dockerfile.testnet` 代替 您可以绑定安装您的 grin 缓存以在容器中运行。 diff --git a/etc/Dockerfile.floonet b/etc/Dockerfile.testnet similarity index 92% rename from etc/Dockerfile.floonet rename to etc/Dockerfile.testnet index f0920db44a..f184d5c3f9 100644 --- a/etc/Dockerfile.floonet +++ b/etc/Dockerfile.testnet @@ -37,13 +37,13 @@ COPY --from=builder /usr/src/grin/target/release/grin /usr/local/bin/grin WORKDIR /root/.grin -RUN grin --floonet server config && \ +RUN grin --testnet server config && \ sed -i -e 's/run_tui = true/run_tui = false/' grin-server.toml VOLUME ["/root/.grin"] EXPOSE 13413 13414 13415 13416 -ENTRYPOINT ["grin", "--floonet"] +ENTRYPOINT ["grin", "--testnet"] CMD ["server", "run"] diff --git a/keychain/src/extkey_bip32.rs b/keychain/src/extkey_bip32.rs index 1db28f72a2..f28a13222b 100644 --- a/keychain/src/extkey_bip32.rs +++ b/keychain/src/extkey_bip32.rs @@ -91,15 +91,15 @@ pub trait BIP32Hasher { /// Implementation of the above that uses the standard BIP32 Hash algorithms #[derive(Clone, Debug)] pub struct BIP32GrinHasher { - is_floo: bool, + is_test: bool, hmac_sha512: Hmac, } impl BIP32GrinHasher { /// New empty hasher - pub fn new(is_floo: bool) -> BIP32GrinHasher { + pub fn new(is_test: bool) -> BIP32GrinHasher { BIP32GrinHasher { - is_floo: is_floo, + is_test: is_test, hmac_sha512: HmacSha512::new(GenericArray::from_slice(&[0u8; 128])), } } @@ -107,14 +107,14 @@ impl BIP32GrinHasher { impl BIP32Hasher for BIP32GrinHasher { fn network_priv(&self) -> [u8; 4] { - if self.is_floo { + if self.is_test { [0x03, 0x27, 0x3A, 0x10] } else { [0x03, 0x3C, 0x04, 0xA4] } } fn network_pub(&self) -> [u8; 4] { - if self.is_floo { + if self.is_test { [0x03, 0x27, 0x3E, 0x4B] } else { [0x03, 0x3C, 0x08, 0xDF] @@ -370,10 +370,10 @@ impl ExtendedPrivKey { secp: &Secp256k1, mnemonic: &str, passphrase: &str, - is_floo: bool, + is_test: bool, ) -> Result { let seed = mnemonic::to_seed(mnemonic, passphrase).map_err(Error::MnemonicError)?; - let mut hasher = BIP32GrinHasher::new(is_floo); + let mut hasher = BIP32GrinHasher::new(is_test); let key = ExtendedPrivKey::new_master(secp, &mut hasher, &seed)?; Ok(key) } diff --git a/keychain/src/keychain.rs b/keychain/src/keychain.rs index ff6c8d8765..fdb84071ac 100644 --- a/keychain/src/keychain.rs +++ b/keychain/src/keychain.rs @@ -45,8 +45,8 @@ impl ExtKeychain { } impl Keychain for ExtKeychain { - fn from_seed(seed: &[u8], is_floo: bool) -> Result { - let mut h = BIP32GrinHasher::new(is_floo); + fn from_seed(seed: &[u8], is_test: bool) -> Result { + let mut h = BIP32GrinHasher::new(is_test); let secp = secp::Secp256k1::with_caps(secp::ContextFlag::Commit); let master = ExtendedPrivKey::new_master(&secp, &mut h, seed)?; let keychain = ExtKeychain { @@ -57,10 +57,10 @@ impl Keychain for ExtKeychain { Ok(keychain) } - fn from_mnemonic(word_list: &str, extension_word: &str, is_floo: bool) -> Result { + fn from_mnemonic(word_list: &str, extension_word: &str, is_test: bool) -> Result { let secp = secp::Secp256k1::with_caps(secp::ContextFlag::Commit); - let h = BIP32GrinHasher::new(is_floo); - let master = ExtendedPrivKey::from_mnemonic(&secp, word_list, extension_word, is_floo)?; + let h = BIP32GrinHasher::new(is_test); + let master = ExtendedPrivKey::from_mnemonic(&secp, word_list, extension_word, is_test)?; let keychain = ExtKeychain { secp: secp, master: master, @@ -77,10 +77,10 @@ impl Keychain for ExtKeychain { } /// For testing - probably not a good idea to use outside of tests. - fn from_random_seed(is_floo: bool) -> Result { + fn from_random_seed(is_test: bool) -> Result { let seed: String = thread_rng().sample_iter(&Alphanumeric).take(16).collect(); let seed = blake2b(32, &[], seed.as_bytes()); - ExtKeychain::from_seed(seed.as_bytes(), is_floo) + ExtKeychain::from_seed(seed.as_bytes(), is_test) } fn root_key_id() -> Identifier { diff --git a/keychain/src/types.rs b/keychain/src/types.rs index 5de483ed5e..3270308e42 100644 --- a/keychain/src/types.rs +++ b/keychain/src/types.rs @@ -436,13 +436,13 @@ pub struct ValueExtKeychainPath { pub trait Keychain: Sync + Send + Clone { /// Generates a keychain from a raw binary seed (which has already been /// decrypted if applicable). - fn from_seed(seed: &[u8], is_floo: bool) -> Result; + fn from_seed(seed: &[u8], is_test: bool) -> Result; /// Generates a keychain from a list of space-separated mnemonic words - fn from_mnemonic(word_list: &str, extension_word: &str, is_floo: bool) -> Result; + fn from_mnemonic(word_list: &str, extension_word: &str, is_test: bool) -> Result; /// Generates a keychain from a randomly generated seed. Mostly used for tests. - fn from_random_seed(is_floo: bool) -> Result; + fn from_random_seed(is_test: bool) -> Result; /// XOR masks the keychain's master key against another key fn mask_master_key(&mut self, mask: &SecretKey) -> Result<(), Error>; diff --git a/keychain/src/view_key.rs b/keychain/src/view_key.rs index a8dcc3e093..4a321bfc1f 100644 --- a/keychain/src/view_key.rs +++ b/keychain/src/view_key.rs @@ -12,8 +12,8 @@ use crate::util::secp::key::{PublicKey, SecretKey}; use crate::util::secp::Secp256k1; use crate::SwitchCommitmentType; -/*const VERSION_FLOO_NS: [u8;4] = [0x03, 0x27, 0x3E, 0x4B]; -const VERSION_FLOO: [u8;4] = [0x03, 0x27, 0x3E, 0x4B]; +/*const VERSION_TEST_NS: [u8;4] = [0x03, 0x27, 0x3E, 0x4B]; +const VERSION_TEST: [u8;4] = [0x03, 0x27, 0x3E, 0x4B]; const VERSION_MAIN_NS: [u8;4] = [0x03, 0x3C, 0x08, 0xDF]; const VERSION_MAIN: [u8;4] = [0x03, 0x3C, 0x08, 0xDF];*/ @@ -22,8 +22,8 @@ const VERSION_MAIN: [u8;4] = [0x03, 0x3C, 0x08, 0xDF];*/ /// At the moment only depth 0 keys can be used #[derive(Clone, PartialEq, Eq, Debug)] pub struct ViewKey { - /// Whether this view key is meant for floonet or not - pub is_floo: bool, + /// Whether this view key is meant for testnet or not + pub is_test: bool, /// How many derivations this key is from the master (which is 0) pub depth: u8, /// Fingerprint of the parent key @@ -45,7 +45,7 @@ impl ViewKey { keychain: &K, ext_key: ExtendedPrivKey, hasher: &mut H, - is_floo: bool, + is_test: bool, ) -> Result where K: Keychain, @@ -69,7 +69,7 @@ impl ViewKey { let rewind_hash = Self::rewind_hash(secp, keychain.public_root_key()); Ok(Self { - is_floo, + is_test, depth, parent_fingerprint, child_number, @@ -136,7 +136,7 @@ impl ViewKey { }; Ok(Self { - is_floo: self.is_floo, + is_test: self.is_test, depth: self.depth + 1, parent_fingerprint: self.fingerprint(secp, hasher), child_number: i, diff --git a/p2p/src/msg.rs b/p2p/src/msg.rs index 11a2013596..796817ad0c 100644 --- a/p2p/src/msg.rs +++ b/p2p/src/msg.rs @@ -40,7 +40,7 @@ pub const USER_AGENT: &str = concat!("MW/Grin ", env!("CARGO_PKG_VERSION")); /// Magic numbers expected in the header of every message const OTHER_MAGIC: [u8; 2] = [73, 43]; -const FLOONET_MAGIC: [u8; 2] = [83, 59]; +const TESTNET_MAGIC: [u8; 2] = [83, 59]; const MAINNET_MAGIC: [u8; 2] = [97, 61]; // Types of messages. @@ -112,7 +112,7 @@ fn max_msg_size(msg_type: Type) -> u64 { fn magic() -> [u8; 2] { match global::get_chain_type() { - global::ChainTypes::Floonet => FLOONET_MAGIC, + global::ChainTypes::Testnet => TESTNET_MAGIC, global::ChainTypes::Mainnet => MAINNET_MAGIC, _ => OTHER_MAGIC, } diff --git a/p2p/src/types.rs b/p2p/src/types.rs index 2f93929eb9..e7a2d33d34 100644 --- a/p2p/src/types.rs +++ b/p2p/src/types.rs @@ -236,9 +236,9 @@ impl std::fmt::Display for PeerAddr { impl PeerAddr { /// Convenient way of constructing a new peer_addr from an ip_addr - /// defaults to port 3414 on mainnet and 13414 on floonet. + /// defaults to port 3414 on mainnet and 13414 on testnet. pub fn from_ip(addr: IpAddr) -> PeerAddr { - let port = if global::is_floonet() { 13414 } else { 3414 }; + let port = if global::is_testnet() { 13414 } else { 3414 }; PeerAddr(SocketAddr::new(addr, port)) } diff --git a/servers/src/grin/seed.rs b/servers/src/grin/seed.rs index 45632ec77b..7caa7e7833 100644 --- a/servers/src/grin/seed.rs +++ b/servers/src/grin/seed.rs @@ -40,7 +40,7 @@ const MAINNET_DNS_SEEDS: &[&str] = &[ "grinseed.yeastplume.org", // yeastplume@protonmail.com "mainnet-seed.grinnode.live", // info@grinnode.live ]; -const FLOONET_DNS_SEEDS: &[&str] = &[ +const TESTNET_DNS_SEEDS: &[&str] = &[ "floonet.seed.grin.icu", // gary.peverell@protonmail.com "floonet.seed.713.mw", // jasper@713.mw "floonet.seed.grin.lesceller.com", // q.lesceller@gmail.com @@ -359,8 +359,8 @@ fn listen_for_addrs( pub fn default_dns_seeds() -> Box Vec + Send> { Box::new(|| { - let net_seeds = if global::is_floonet() { - FLOONET_DNS_SEEDS + let net_seeds = if global::is_testnet() { + TESTNET_DNS_SEEDS } else { MAINNET_DNS_SEEDS }; @@ -369,7 +369,7 @@ pub fn default_dns_seeds() -> Box Vec + Send> { .iter() .map(|s| { s.to_string() - + if global::is_floonet() { + + if global::is_testnet() { ":13414" } else { ":3414" diff --git a/servers/src/grin/server.rs b/servers/src/grin/server.rs index d52e79df71..f6cf069cab 100644 --- a/servers/src/grin/server.rs +++ b/servers/src/grin/server.rs @@ -188,7 +188,7 @@ impl Server { let genesis = match config.chain_type { global::ChainTypes::AutomatedTesting => pow::mine_genesis_block().unwrap(), global::ChainTypes::UserTesting => pow::mine_genesis_block().unwrap(), - global::ChainTypes::Floonet => genesis::genesis_floo(), + global::ChainTypes::Testnet => genesis::genesis_test(), global::ChainTypes::Mainnet => genesis::genesis_main(), }; diff --git a/servers/src/mining/mine_block.rs b/servers/src/mining/mine_block.rs index 54dcb55c82..fa7cec221c 100644 --- a/servers/src/mining/mine_block.rs +++ b/servers/src/mining/mine_block.rs @@ -221,7 +221,7 @@ fn build_block( /// fn burn_reward(block_fees: BlockFees) -> Result<(core::Output, core::TxKernel, BlockFees), Error> { warn!("Burning block fees: {:?}", block_fees); - let keychain = ExtKeychain::from_random_seed(global::is_floonet())?; + let keychain = ExtKeychain::from_random_seed(global::is_testnet())?; let key_id = ExtKeychain::derive_key_id(1, 1, 0, 0, 0); let (out, kernel) = crate::core::libtx::reward::output( &keychain, diff --git a/src/bin/grin.rs b/src/bin/grin.rs index 69bfcc0af2..f602361c4f 100644 --- a/src/bin/grin.rs +++ b/src/bin/grin.rs @@ -80,8 +80,8 @@ fn real_main() -> i32 { .get_matches(); let node_config; - let chain_type = if args.is_present("floonet") { - global::ChainTypes::Floonet + let chain_type = if args.is_present("testnet") { + global::ChainTypes::Testnet } else if args.is_present("usernet") { global::ChainTypes::UserTesting } else { diff --git a/src/bin/grin.yml b/src/bin/grin.yml index b8d97fff46..8a382ec7c7 100644 --- a/src/bin/grin.yml +++ b/src/bin/grin.yml @@ -3,9 +3,9 @@ about: Lightweight implementation of the Mimblewimble protocol. author: The Grin Team args: - - floonet: - help: Run grin against the Floonet (as opposed to mainnet) - long: floonet + - testnet: + help: Run grin against the Testnet (as opposed to mainnet) + long: testnet takes_value: false - usernet: help: Run grin as a local-only network. Doesn't block peer connections but will not connect to any peer or seed