Skip to content

Commit

Permalink
Rename Floonet to Testnet (#3431)
Browse files Browse the repository at this point in the history
* Rename Floonet to Testnet

* Fix test

* Rename test and docker
  • Loading branch information
quentinlesceller authored Oct 7, 2020
1 parent 4c6d1dd commit cf2a652
Show file tree
Hide file tree
Showing 26 changed files with 111 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/src/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn comments() -> HashMap<String, String> {
#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(),
Expand Down
2 changes: 1 addition & 1 deletion config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions core/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions core/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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"
Expand Down
40 changes: 20 additions & 20 deletions core/src/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}
Expand All @@ -151,7 +151,7 @@ lazy_static! {
}

thread_local! {
/// Mainnet|Floonet|UserTesting|AutomatedTesting
/// Mainnet|Testnet|UserTesting|AutomatedTesting
pub static CHAIN_TYPE: Cell<Option<ChainTypes>> = Cell::new(None);

/// Local feature flag for NRD kernel support.
Expand Down Expand Up @@ -238,18 +238,18 @@ pub fn create_pow_context<T>(
}
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),
Expand Down Expand Up @@ -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,
}
}
Expand All @@ -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,
}
}
Expand All @@ -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,
}
}
Expand Down Expand Up @@ -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,
}
}
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion core/src/libtx/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
44 changes: 22 additions & 22 deletions core/tests/consensus_floonet.rs → core/tests/consensus_testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
));

Expand Down
2 changes: 1 addition & 1 deletion doc/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion doc/translations/build_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ grin client --help
```sh
docker build -t grin -f etc/Dockerfile .
```
floonetを使用する場合、代わりに`etc/Dockerfile.floonet`を指定。
testnetを使用する場合、代わりに`etc/Dockerfile.testnet`を指定。

コンテナ内で実行する場合、grinのキャッシュをバインドマウントすることも可能。

Expand Down
2 changes: 1 addition & 1 deletion doc/translations/build_KR.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/translations/build_ZH-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ grin client --help
```sh
docker build -t grin -f etc/Dockerfile .
```
对于 floonet, 使用 `etc/Dockerfile.floonet` 代替
对于 testnet, 使用 `etc/Dockerfile.testnet` 代替

您可以绑定安装您的 grin 缓存以在容器中运行。

Expand Down
Loading

0 comments on commit cf2a652

Please sign in to comment.