diff --git a/config/management/genesis/src/ol_node_files.rs b/config/management/genesis/src/ol_node_files.rs index 12a6cd3778..aae70aeb49 100644 --- a/config/management/genesis/src/ol_node_files.rs +++ b/config/management/genesis/src/ol_node_files.rs @@ -368,17 +368,19 @@ fn make_validator_cfg(output_dir: PathBuf, namespace: &str, seed_addresses: Opti vfn_net.listen_address = format!("/ip4/0.0.0.0/tcp/{}", DEFAULT_VFN_PORT).parse()?; let mut pub_net = NetworkConfig::network_with_id(NetworkId::Public); - pub_net.listen_address = format!("/ip4/0.0.0.0/tcp/{}", DEFAULT_PUB_PORT).parse()?; + + pub_net.listen_address = format!("/ip4/127.0.0.1/tcp/{}", DEFAULT_PUB_PORT).parse()?; // Don't fullnode sync requests // This ID is how the Validator node identifies themselves on their private VFN network. // same ID as being used in the validator network. - vfn_net.identity = network_id.clone(); - pub_net.identity = network_id; + // Note that the the public network has no setting, so that it is randomly generated. + vfn_net.identity = network_id; if let Some(s) = seed_addresses { - vfn_net.seed_addrs = s.clone(); pub_net.seed_addrs = s; } + + pub_net.discovery_method = DiscoveryMethod::Onchain; c.full_node_networks = vec![vfn_net.to_owned(), pub_net.to_owned()]; diff --git a/language/diem-framework/modules/0L/Jail.move b/language/diem-framework/modules/0L/Jail.move index 64d9e1fba9..8b98ddf9e1 100644 --- a/language/diem-framework/modules/0L/Jail.move +++ b/language/diem-framework/modules/0L/Jail.move @@ -80,6 +80,16 @@ address 0x1 { } } + public fun self_unjail(sender: &signer) acquires Jail { + // only a validator can un-jail themselves. + let self = Signer::address_of(sender); + + // check the node has been mining before unjailing. + assert(TowerState::node_above_thresh(self), 100104); + unjail(self); + } + + public fun vouch_unjail(sender: &signer, addr: address) acquires Jail { // only a validator can un-jail themselves. let voucher = Signer::address_of(sender); @@ -94,7 +104,7 @@ address 0x1 { unjail(addr); } - // private function. User should not be able to unjail self. + fun unjail(addr: address) acquires Jail { if (exists(addr)) { borrow_global_mut(addr).is_jailed = false; diff --git a/language/diem-framework/modules/0L_transaction_scripts/ol_validator.move b/language/diem-framework/modules/0L_transaction_scripts/ol_validator.move index d7be25f49d..2f10fd9bfa 100644 --- a/language/diem-framework/modules/0L_transaction_scripts/ol_validator.move +++ b/language/diem-framework/modules/0L_transaction_scripts/ol_validator.move @@ -7,9 +7,12 @@ module ValidatorScripts { use 0x1::Signer; use 0x1::ValidatorUniverse; use 0x1::Vector; + use 0x1::Jail; const NOT_ABOVE_THRESH_JOIN: u64 = 220101; const NOT_ABOVE_THRESH_ADD : u64 = 220102; + const VAL_NOT_FOUND : u64 = 220103; + const VAL_NOT_JAILED : u64 = 220104; // FOR E2E testing public(script) fun ol_reconfig_bulk_update_setup( @@ -37,7 +40,7 @@ module ValidatorScripts { assert(DiemSystem::is_validator(alice) == true, 4); } - public(script) fun join(validator: signer) { + public(script) fun self_unjail(validator: signer) { let addr = Signer::address_of(&validator); // if is above threshold continue, or raise error. assert( @@ -54,17 +57,36 @@ module ValidatorScripts { }; // if is jailed, try to unjail - if (ValidatorUniverse::is_jailed(addr)) { - ValidatorUniverse::unjail_self(&validator); + if (Jail::is_jailed(addr)) { + Jail::self_unjail(&validator); }; } - // public(script) fun leave(validator: signer) { - // let addr = Signer::address_of(&validator); - // if (ValidatorUniverse::is_in_universe(addr)) { - // ValidatorUniverse::remove_self(&validator); - // }; - // } + public(script) fun voucher_unjail(voucher: signer, addr: address) { + // if is above threshold continue, or raise error. + assert( + TowerState::node_above_thresh(addr), + Errors::invalid_state(NOT_ABOVE_THRESH_JOIN) + ); + // if is not in universe, add back + assert( + TowerState::node_above_thresh(addr), + Errors::invalid_state(VAL_NOT_FOUND) + ); + + assert( + TowerState::node_above_thresh(addr), + Errors::invalid_state(VAL_NOT_FOUND) + ); + + assert( + Jail::is_jailed(addr), + Errors::invalid_state(VAL_NOT_JAILED) + ); + // if is jailed, try to unjail + Jail::vouch_unjail(&voucher, addr); + } + public(script) fun val_add_self(validator: signer) { let validator = &validator; diff --git a/language/diem-framework/modules/doc/Jail.md b/language/diem-framework/modules/doc/Jail.md index f5263ed8cf..6c38c21f0f 100644 --- a/language/diem-framework/modules/doc/Jail.md +++ b/language/diem-framework/modules/doc/Jail.md @@ -10,6 +10,7 @@ - [Function `is_jailed`](#0x1_Jail_is_jailed) - [Function `jail`](#0x1_Jail_jail) - [Function `remove_consecutive_fail`](#0x1_Jail_remove_consecutive_fail) +- [Function `self_unjail`](#0x1_Jail_self_unjail) - [Function `vouch_unjail`](#0x1_Jail_vouch_unjail) - [Function `unjail`](#0x1_Jail_unjail) - [Function `sort_by_jail`](#0x1_Jail_sort_by_jail) @@ -192,6 +193,35 @@ + + + + +## Function `self_unjail` + + + +
public fun self_unjail(sender: &signer)
+
+ + + +
+Implementation + + +
public fun self_unjail(sender: &signer) acquires Jail {
+  // only a validator can un-jail themselves.
+  let self = Signer::address_of(sender);
+
+  // check the node has been mining before unjailing.
+  assert(TowerState::node_above_thresh(self), 100104);
+  unjail(self);
+}
+
+ + +
diff --git a/language/diem-framework/modules/doc/ol_validator.md b/language/diem-framework/modules/doc/ol_validator.md index 0248d27687..3aa3c69ba3 100644 --- a/language/diem-framework/modules/doc/ol_validator.md +++ b/language/diem-framework/modules/doc/ol_validator.md @@ -7,12 +7,14 @@ - [Constants](#@Constants_0) - [Function `ol_reconfig_bulk_update_setup`](#0x1_ValidatorScripts_ol_reconfig_bulk_update_setup) -- [Function `join`](#0x1_ValidatorScripts_join) +- [Function `self_unjail`](#0x1_ValidatorScripts_self_unjail) +- [Function `voucher_unjail`](#0x1_ValidatorScripts_voucher_unjail) - [Function `val_add_self`](#0x1_ValidatorScripts_val_add_self)
use 0x1::DiemSystem;
 use 0x1::Errors;
+use 0x1::Jail;
 use 0x1::Signer;
 use 0x1::TowerState;
 use 0x1::ValidatorUniverse;
@@ -44,6 +46,24 @@
 
 
 
+
+
+
+
+
const VAL_NOT_FOUND: u64 = 220103;
+
+ + + + + + + +
const VAL_NOT_JAILED: u64 = 220104;
+
+ + + ## Function `ol_reconfig_bulk_update_setup` @@ -89,13 +109,13 @@ - + -## Function `join` +## Function `self_unjail` -
public(script) fun join(validator: signer)
+
public(script) fun self_unjail(validator: signer)
 
@@ -104,7 +124,7 @@ Implementation -
public(script) fun join(validator: signer) {
+
public(script) fun self_unjail(validator: signer) {
     let addr = Signer::address_of(&validator);
     // if is above threshold continue, or raise error.
     assert(
@@ -121,14 +141,59 @@
     };
 
     // if is jailed, try to unjail
-    if (ValidatorUniverse::is_jailed(addr)) {
-        ValidatorUniverse::unjail_self(&validator);
+    if (Jail::is_jailed(addr)) {
+        Jail::self_unjail(&validator);
     };
 }
 
+ + + + +## Function `voucher_unjail` + + + +
public(script) fun voucher_unjail(voucher: signer, addr: address)
+
+ + + +
+Implementation + + +
public(script) fun voucher_unjail(voucher: signer, addr: address) {
+    // if is above threshold continue, or raise error.
+    assert(
+        TowerState::node_above_thresh(addr),
+        Errors::invalid_state(NOT_ABOVE_THRESH_JOIN)
+    );
+    // if is not in universe, add back
+    assert(
+        TowerState::node_above_thresh(addr),
+        Errors::invalid_state(VAL_NOT_FOUND)
+    );
+
+    assert(
+        TowerState::node_above_thresh(addr),
+        Errors::invalid_state(VAL_NOT_FOUND)
+    );
+
+    assert(
+        Jail::is_jailed(addr),
+        Errors::invalid_state(VAL_NOT_JAILED)
+    );
+    // if is jailed, try to unjail
+    Jail::vouch_unjail(&voucher, addr);
+}
+
+ + +
diff --git a/language/diem-framework/releases/artifacts/current/docs/modules/Jail.md b/language/diem-framework/releases/artifacts/current/docs/modules/Jail.md index f5263ed8cf..6c38c21f0f 100644 --- a/language/diem-framework/releases/artifacts/current/docs/modules/Jail.md +++ b/language/diem-framework/releases/artifacts/current/docs/modules/Jail.md @@ -10,6 +10,7 @@ - [Function `is_jailed`](#0x1_Jail_is_jailed) - [Function `jail`](#0x1_Jail_jail) - [Function `remove_consecutive_fail`](#0x1_Jail_remove_consecutive_fail) +- [Function `self_unjail`](#0x1_Jail_self_unjail) - [Function `vouch_unjail`](#0x1_Jail_vouch_unjail) - [Function `unjail`](#0x1_Jail_unjail) - [Function `sort_by_jail`](#0x1_Jail_sort_by_jail) @@ -192,6 +193,35 @@ + + + + +## Function `self_unjail` + + + +
public fun self_unjail(sender: &signer)
+
+ + + +
+Implementation + + +
public fun self_unjail(sender: &signer) acquires Jail {
+  // only a validator can un-jail themselves.
+  let self = Signer::address_of(sender);
+
+  // check the node has been mining before unjailing.
+  assert(TowerState::node_above_thresh(self), 100104);
+  unjail(self);
+}
+
+ + +
diff --git a/language/diem-framework/releases/artifacts/current/docs/modules/ol_validator.md b/language/diem-framework/releases/artifacts/current/docs/modules/ol_validator.md index 0248d27687..3aa3c69ba3 100644 --- a/language/diem-framework/releases/artifacts/current/docs/modules/ol_validator.md +++ b/language/diem-framework/releases/artifacts/current/docs/modules/ol_validator.md @@ -7,12 +7,14 @@ - [Constants](#@Constants_0) - [Function `ol_reconfig_bulk_update_setup`](#0x1_ValidatorScripts_ol_reconfig_bulk_update_setup) -- [Function `join`](#0x1_ValidatorScripts_join) +- [Function `self_unjail`](#0x1_ValidatorScripts_self_unjail) +- [Function `voucher_unjail`](#0x1_ValidatorScripts_voucher_unjail) - [Function `val_add_self`](#0x1_ValidatorScripts_val_add_self)
use 0x1::DiemSystem;
 use 0x1::Errors;
+use 0x1::Jail;
 use 0x1::Signer;
 use 0x1::TowerState;
 use 0x1::ValidatorUniverse;
@@ -44,6 +46,24 @@
 
 
 
+
+
+
+
+
const VAL_NOT_FOUND: u64 = 220103;
+
+ + + + + + + +
const VAL_NOT_JAILED: u64 = 220104;
+
+ + + ## Function `ol_reconfig_bulk_update_setup` @@ -89,13 +109,13 @@ - + -## Function `join` +## Function `self_unjail` -
public(script) fun join(validator: signer)
+
public(script) fun self_unjail(validator: signer)
 
@@ -104,7 +124,7 @@ Implementation -
public(script) fun join(validator: signer) {
+
public(script) fun self_unjail(validator: signer) {
     let addr = Signer::address_of(&validator);
     // if is above threshold continue, or raise error.
     assert(
@@ -121,14 +141,59 @@
     };
 
     // if is jailed, try to unjail
-    if (ValidatorUniverse::is_jailed(addr)) {
-        ValidatorUniverse::unjail_self(&validator);
+    if (Jail::is_jailed(addr)) {
+        Jail::self_unjail(&validator);
     };
 }
 
+ + + + +## Function `voucher_unjail` + + + +
public(script) fun voucher_unjail(voucher: signer, addr: address)
+
+ + + +
+Implementation + + +
public(script) fun voucher_unjail(voucher: signer, addr: address) {
+    // if is above threshold continue, or raise error.
+    assert(
+        TowerState::node_above_thresh(addr),
+        Errors::invalid_state(NOT_ABOVE_THRESH_JOIN)
+    );
+    // if is not in universe, add back
+    assert(
+        TowerState::node_above_thresh(addr),
+        Errors::invalid_state(VAL_NOT_FOUND)
+    );
+
+    assert(
+        TowerState::node_above_thresh(addr),
+        Errors::invalid_state(VAL_NOT_FOUND)
+    );
+
+    assert(
+        Jail::is_jailed(addr),
+        Errors::invalid_state(VAL_NOT_JAILED)
+    );
+    // if is jailed, try to unjail
+    Jail::vouch_unjail(&voucher, addr);
+}
+
+ + +
diff --git a/language/diem-framework/releases/artifacts/current/script_abis/ol_validator/join.abi b/language/diem-framework/releases/artifacts/current/script_abis/ol_validator/join.abi deleted file mode 100644 index 4a4d5911f3..0000000000 Binary files a/language/diem-framework/releases/artifacts/current/script_abis/ol_validator/join.abi and /dev/null differ diff --git a/language/diem-framework/releases/artifacts/current/script_abis/ol_validator/self_unjail.abi b/language/diem-framework/releases/artifacts/current/script_abis/ol_validator/self_unjail.abi new file mode 100644 index 0000000000..5656c11d66 Binary files /dev/null and b/language/diem-framework/releases/artifacts/current/script_abis/ol_validator/self_unjail.abi differ diff --git a/language/diem-framework/releases/artifacts/current/script_abis/ol_validator/voucher_unjail.abi b/language/diem-framework/releases/artifacts/current/script_abis/ol_validator/voucher_unjail.abi new file mode 100644 index 0000000000..9e12f740e0 Binary files /dev/null and b/language/diem-framework/releases/artifacts/current/script_abis/ol_validator/voucher_unjail.abi differ diff --git a/language/diem-framework/releases/artifacts/current/transaction_script_builder.rs b/language/diem-framework/releases/artifacts/current/transaction_script_builder.rs index a5753f3605..0d178afe98 100644 --- a/language/diem-framework/releases/artifacts/current/transaction_script_builder.rs +++ b/language/diem-framework/releases/artifacts/current/transaction_script_builder.rs @@ -2232,8 +2232,6 @@ pub enum ScriptFunctionCall { sliding_nonce: u64, }, - Join {}, - MinerstateCommit { challenge: Bytes, solution: Bytes, @@ -2753,6 +2751,8 @@ pub enum ScriptFunctionCall { public_key: Bytes, }, + SelfUnjail {}, + SetBurnPref { to_community: bool, }, @@ -3217,6 +3217,10 @@ pub enum ScriptFunctionCall { VouchFor { val: AccountAddress, }, + + VoucherUnjail { + addr: AccountAddress, + }, } impl ScriptCall { @@ -3675,7 +3679,6 @@ impl ScriptFunctionCall { InitializeDiemConsensusConfig { sliding_nonce } => { encode_initialize_diem_consensus_config_script_function(sliding_nonce) } - Join {} => encode_join_script_function(), MinerstateCommit { challenge, solution, @@ -3781,6 +3784,7 @@ impl ScriptFunctionCall { RotateSharedEd25519PublicKey { public_key } => { encode_rotate_shared_ed25519_public_key_script_function(public_key) } + SelfUnjail {} => encode_self_unjail_script_function(), SetBurnPref { to_community } => encode_set_burn_pref_script_function(to_community), SetGasConstants { sliding_nonce, @@ -3883,6 +3887,7 @@ impl ScriptFunctionCall { } => encode_update_minting_ability_script_function(currency, allow_minting), ValAddSelf {} => encode_val_add_self_script_function(), VouchFor { val } => encode_vouch_for_script_function(val), + VoucherUnjail { addr } => encode_voucher_unjail_script_function(addr), } } @@ -5036,18 +5041,6 @@ pub fn encode_initialize_diem_consensus_config_script_function( )) } -pub fn encode_join_script_function() -> TransactionPayload { - TransactionPayload::ScriptFunction(ScriptFunction::new( - ModuleId::new( - AccountAddress::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]), - ident_str!("ValidatorScripts").to_owned(), - ), - ident_str!("join").to_owned(), - vec![], - vec![], - )) -} - pub fn encode_minerstate_commit_script_function( challenge: Vec, solution: Vec, @@ -5812,6 +5805,18 @@ pub fn encode_rotate_shared_ed25519_public_key_script_function( )) } +pub fn encode_self_unjail_script_function() -> TransactionPayload { + TransactionPayload::ScriptFunction(ScriptFunction::new( + ModuleId::new( + AccountAddress::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]), + ident_str!("ValidatorScripts").to_owned(), + ), + ident_str!("self_unjail").to_owned(), + vec![], + vec![], + )) +} + pub fn encode_set_burn_pref_script_function(to_community: bool) -> TransactionPayload { TransactionPayload::ScriptFunction(ScriptFunction::new( ModuleId::new( @@ -6467,6 +6472,18 @@ pub fn encode_vouch_for_script_function(val: AccountAddress) -> TransactionPaylo )) } +pub fn encode_voucher_unjail_script_function(addr: AccountAddress) -> TransactionPayload { + TransactionPayload::ScriptFunction(ScriptFunction::new( + ModuleId::new( + AccountAddress::new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]), + ident_str!("ValidatorScripts").to_owned(), + ), + ident_str!("voucher_unjail").to_owned(), + vec![], + vec![bcs::to_bytes(&addr).unwrap()], + )) +} + /// # Summary /// Adds a zero `Currency` balance to the sending `account`. This will enable `account` to /// send, receive, and hold `Diem::Diem` coins. This transaction can be @@ -8504,14 +8521,6 @@ fn decode_initialize_diem_consensus_config_script_function( } } -fn decode_join_script_function(payload: &TransactionPayload) -> Option { - if let TransactionPayload::ScriptFunction(_script) = payload { - Some(ScriptFunctionCall::Join {}) - } else { - None - } -} - fn decode_minerstate_commit_script_function( payload: &TransactionPayload, ) -> Option { @@ -8782,6 +8791,14 @@ fn decode_rotate_shared_ed25519_public_key_script_function( } } +fn decode_self_unjail_script_function(payload: &TransactionPayload) -> Option { + if let TransactionPayload::ScriptFunction(_script) = payload { + Some(ScriptFunctionCall::SelfUnjail {}) + } else { + None + } +} + fn decode_set_burn_pref_script_function( payload: &TransactionPayload, ) -> Option { @@ -8983,6 +9000,18 @@ fn decode_vouch_for_script_function(payload: &TransactionPayload) -> Option Option { + if let TransactionPayload::ScriptFunction(script) = payload { + Some(ScriptFunctionCall::VoucherUnjail { + addr: bcs::from_bytes(script.args().get(0)?).ok()?, + }) + } else { + None + } +} + fn decode_add_currency_to_account_script(script: &Script) -> Option { Some(ScriptCall::AddCurrencyToAccount { currency: script.ty_args().get(0)?.clone(), @@ -9496,10 +9525,6 @@ static SCRIPT_FUNCTION_DECODER_MAP: once_cell::sync::Lazy &mut Node { } // is node started? - if node.vitals.items.node_running { - if verbose { - println!("Node: node is running"); - } - node.vitals.host_state.node_state = maybe_switch_mode(&mut node, is_in_val_set, verbose); - } else { - let start_mode = if is_in_val_set { Validator } else { Fullnode }; + if !node.vitals.items.node_running { + // if verbose { + // println!("Node: node is running"); + // } + // node.vitals.host_state.node_state = maybe_switch_mode(&mut node, is_in_val_set, verbose); + // } else { + // let start_mode = if is_in_val_set { Validator } else { Fullnode }; if verbose { println!( - "Node: WARN: node is NOT running, starting in {:?} mode", - &start_mode - ); + "Node: WARN: node is NOT running, starting node"); } - node.vitals.host_state.node_state = match node.start_node(start_mode.clone(), verbose) { - Ok(_) => match &start_mode { - Validator => NodeState::ValidatorMode, - Fullnode => NodeState::FullnodeMode, - }, + node.vitals.host_state.node_state = match node.start_node(verbose) { + Ok(_) => NodeState::ValidatorOutOfSet, Err(_) => { - if verbose { - println!(".. Node: WARN: could not start node in: {:?}", &start_mode); - } - NodeState::Stopped + println!(".. Node: WARN: could not start node"); + NodeState::Stopped } } } @@ -131,56 +123,56 @@ pub fn run_once(mut node: &mut Node, verbose: bool) -> &mut Node { node } -fn maybe_switch_mode(node: &mut Node, is_in_val_set: bool, verbose: bool) -> NodeState { - let running_mode = match Node::what_node_mode() { - Ok(t) => t, - Err(_) => return NodeState::Stopped, - }; - - if verbose { - println!(".. Mode: node running in mode: {:?}", running_mode); - } - - let running_in_val_mode = running_mode == Validator; - // Running correctly as a FULLNODE - if !running_in_val_mode && !is_in_val_set { - if verbose { - println!(".... Mode: running the correct mode",); - } - return NodeState::FullnodeMode; - } - // Running correctly as a VALIDATOR - // Do nothing, the account is in validator set, and we are running as a validator - if running_in_val_mode && is_in_val_set { - if verbose { - println!(".... Mode: running the correct mode"); - } - return NodeState::ValidatorMode; - } - - // INCORRECT CASE 1: Need to change mode from Fullnode to Validator mode - if !running_in_val_mode && is_in_val_set { - if verbose { - println!(".... Mode: WARN: running the INCORRECT mode, switching to VALIDATOR mode"); - } - node.stop_node(); - node.start_node(Validator, verbose) - .expect("could not start node"); - - return NodeState::ValidatorMode; - } - - // INCORRECT CASE 2: Need to change mode from Validator to Fullnode mode - if running_in_val_mode && !is_in_val_set { - if verbose { - println!(".... Mode: WARN: running the INCORRECT mode, switching to FULLNODE mode"); - } - node.stop_node(); - node.start_node(Validator, verbose) - .expect("could not start node"); - - return NodeState::FullnodeMode; - } - - NodeState::Stopped -} +// fn maybe_switch_mode(node: &mut Node, is_in_val_set: bool, verbose: bool) -> NodeState { +// let running_mode = match Node::what_node_mode() { +// Ok(t) => t, +// Err(_) => return NodeState::Stopped, +// }; + +// if verbose { +// println!(".. Mode: node running in mode: {:?}", running_mode); +// } + +// let running_in_val_mode = running_mode == Validator; +// // Running correctly as a FULLNODE +// if !running_in_val_mode && !is_in_val_set { +// if verbose { +// println!(".... Mode: running the correct mode",); +// } +// return NodeState::FullnodeMode; +// } +// // Running correctly as a VALIDATOR +// // Do nothing, the account is in validator set, and we are running as a validator +// if running_in_val_mode && is_in_val_set { +// if verbose { +// println!(".... Mode: running the correct mode"); +// } +// return NodeState::ValidatorMode; +// } + +// // INCORRECT CASE 1: Need to change mode from Fullnode to Validator mode +// if !running_in_val_mode && is_in_val_set { +// if verbose { +// println!(".... Mode: WARN: running the INCORRECT mode, switching to VALIDATOR mode"); +// } +// node.stop_node(); +// node.start_node(verbose) +// .expect("could not start node"); + +// return NodeState::ValidatorMode; +// } + +// // INCORRECT CASE 2: Need to change mode from Validator to Fullnode mode +// if running_in_val_mode && !is_in_val_set { +// if verbose { +// println!(".... Mode: WARN: running the INCORRECT mode, switching to FULLNODE mode"); +// } +// node.stop_node(); +// node.start_node(Validator, verbose) +// .expect("could not start node"); + +// return NodeState::FullnodeMode; +// } + +// NodeState::Stopped +// } diff --git a/ol/cli/src/commands/init_cmd.rs b/ol/cli/src/commands/init_cmd.rs index 7d5f89d71a..e5b6b1bd1a 100644 --- a/ol/cli/src/commands/init_cmd.rs +++ b/ol/cli/src/commands/init_cmd.rs @@ -111,6 +111,7 @@ impl Runnable for InitCmd { // start with a default value, or read from file if already initialized let mut app_cfg = app_config().to_owned(); let entry_args = entrypoint::get_args(); + // let is_swarm = *&entry_args.swarm_path.is_some(); if self.update_waypoint { match update_waypoint( @@ -204,8 +205,9 @@ impl Runnable for InitCmd { let namespace = app_cfg.format_oper_namespace(); let output_dir = app_cfg.workspace.node_home.clone(); - let seeds = pick_seed_peer(&mut app_cfg, entry_args.swarm_path.clone()); - match ol_node_files::make_val_file(output_dir, seeds.ok(), None, &namespace) { + let seeds = if self.seed_peer { pick_seed_peer(&mut app_cfg, entry_args.swarm_path.clone()).ok() } else { None }; + + match ol_node_files::make_val_file(output_dir, seeds,None, &namespace) { Ok(_) => {} Err(e) => { println!("Could not create file, exiting. Message: {:?}", e); diff --git a/ol/cli/src/commands/mgmt_cmd.rs b/ol/cli/src/commands/mgmt_cmd.rs index 1246f87dfa..52293076fa 100644 --- a/ol/cli/src/commands/mgmt_cmd.rs +++ b/ol/cli/src/commands/mgmt_cmd.rs @@ -1,6 +1,6 @@ //! `mgmt` subcommand -use crate::{application::app_config, entrypoint, mgmt::management::NodeMode, node::{client, node::Node}}; +use crate::{application::app_config, entrypoint, node::{client, node::Node}}; use abscissa_core::{Command, Options, Runnable}; /// management subcommands @@ -31,7 +31,7 @@ impl Runnable for MgmtCmd { let mut node = Node::new(client, &cfg, is_swarm); if self.start_node { - node.start_node(NodeMode::Fullnode, true).expect("could not start fullnode"); + node.start_node(true).expect("could not start fullnode"); } else if self.stop_node { node.stop_node(); } else if self.start_miner { diff --git a/ol/cli/src/commands/query_cmd.rs b/ol/cli/src/commands/query_cmd.rs index d20dacad21..a270eb87ac 100644 --- a/ol/cli/src/commands/query_cmd.rs +++ b/ol/cli/src/commands/query_cmd.rs @@ -166,7 +166,7 @@ impl Runnable for QueryCmd { } /// get wallet type -pub fn get_wallet_type(account: AccountAddress, mut node: Node) -> WalletType { +pub fn get_wallet_type(account: AccountAddress, node: Node) -> WalletType { match node.get_annotate_account_blob(account) { Ok((Some(r), _)) => { if is_slow_wallet(&r) { diff --git a/ol/cli/src/commands/restore_cmd.rs b/ol/cli/src/commands/restore_cmd.rs index cb1b8c28b8..7c7feb2dbc 100644 --- a/ol/cli/src/commands/restore_cmd.rs +++ b/ol/cli/src/commands/restore_cmd.rs @@ -21,14 +21,14 @@ pub struct RestoreCmd { #[options(short="v", help = "specify a version or height if there is more than one per archive")] version: Option, - #[options(short="h", help = "fetch the highest version available, of the latest epoch.")] - highest_version: bool, + #[options(short="l", help = "fetch the highest version available, of the latest epoch.")] + latest_version: bool, } impl Runnable for RestoreCmd { /// Start the application. fn run(&self) { - match mgmt::restore::fast_forward_db(self.verbose, self.epoch, self.version, self.highest_version) { + match mgmt::restore::fast_forward_db(self.verbose, self.epoch, self.version, self.latest_version) { Ok(_) => {println!("SUCCESS")}, Err(e) => println!("ERROR: could not complete db restore, message: {:?}", e), }; diff --git a/ol/cli/src/commands/start_cmd.rs b/ol/cli/src/commands/start_cmd.rs index 290aa5f688..610c98ace6 100644 --- a/ol/cli/src/commands/start_cmd.rs +++ b/ol/cli/src/commands/start_cmd.rs @@ -26,7 +26,7 @@ impl Runnable for StartCmd { let client = match client::pick_client(args.swarm_path, &mut cfg) { Ok(c) => c, Err(e) => { - println!("ERROR: Could not create a client to connect to network, exiting. Message: {:?}", e ); + println!("ERROR: Could not create a client to connect to network. Will not be able to send txs. Exiting. Message: {:?}", e ); exit(1); }, }; diff --git a/ol/cli/src/mgmt/management.rs b/ol/cli/src/mgmt/management.rs index f446f1e115..f6479d6312 100644 --- a/ol/cli/src/mgmt/management.rs +++ b/ol/cli/src/mgmt/management.rs @@ -58,7 +58,7 @@ fn spawn_process( impl Node { /// Start Node, as fullnode - pub fn start_node(&mut self, config_type: NodeMode, verbose: bool) -> Result<(), Error> { + pub fn start_node(&mut self, verbose: bool) -> Result<(), Error> { use BINARY_NODE as NODE; // if is running do nothing // TODO: Get another check of node running @@ -72,10 +72,7 @@ impl Node { // Start as validator or fullnode let conf = app_config(); let node_home = conf.workspace.node_home.to_str().unwrap(); - let config_file_name = match config_type { - NodeMode::Validator => format!("{}validator.node.yaml", node_home), - NodeMode::Fullnode => format!("{}fullnode.node.yaml", node_home), - }; + let config_file_name = format!("{}validator.node.yaml", node_home); let child = if *IS_PROD { let args = vec!["--config", &config_file_name]; diff --git a/ol/cli/src/node/account.rs b/ol/cli/src/node/account.rs index 0a468b1d75..28d2d60d58 100644 --- a/ol/cli/src/node/account.rs +++ b/ol/cli/src/node/account.rs @@ -174,7 +174,7 @@ impl Node { /// Return a full Move-annotated account resource struct pub fn get_annotate_account_blob( - &mut self, + &self, account: AccountAddress, ) -> Result<(Option, Version)> { let (blob, ver) = self.client.get_account_state_blob(&account)?; @@ -248,7 +248,7 @@ impl Node { seq_start.unwrap_or(0), event_handle.count() ) - } + } } /// get balance from AccountView diff --git a/ol/cli/src/node/autopay_view.rs b/ol/cli/src/node/autopay_view.rs index 18618c8305..24fea34d72 100644 --- a/ol/cli/src/node/autopay_view.rs +++ b/ol/cli/src/node/autopay_view.rs @@ -34,7 +34,7 @@ pub struct PayeeStats { impl Node { /// Get all percentage recurring payees stats - pub fn get_autopay_watch_list(&mut self, vals: Vec) -> Option> { + pub fn get_autopay_watch_list(&self, vals: Vec) -> Option> { let mut payees: HashMap = HashMap::new(); let mut total: u64 = 0; diff --git a/ol/cli/src/node/chain_view.rs b/ol/cli/src/node/chain_view.rs index e8a7c49f93..eca69f1b98 100644 --- a/ol/cli/src/node/chain_view.rs +++ b/ol/cli/src/node/chain_view.rs @@ -9,14 +9,14 @@ use diem_types::{ }; use ol_types::{autopay::AutoPayView, validator_config::ValidatorConfigView}; -use super::{node::Node, dictionary::AccountDictionary, autopay_view::PayeeStats}; +use super::{autopay_view::PayeeStats, dictionary::AccountDictionary, node::Node, query}; use serde::{Deserialize, Serialize}; use std::{ - convert::TryFrom, collections::HashMap, + convert::TryFrom, net::{IpAddr, SocketAddr, TcpStream}, + str::FromStr, time::Duration, - str::FromStr }; /// name of chain info key for db @@ -92,6 +92,8 @@ pub struct ValidatorView { pub validator_config: Option, /// autopay instructions pub autopay: Option, + /// burn preferences + pub burn_to_community: bool, /// note pub note: String, } @@ -125,7 +127,7 @@ impl Node { }; let mut cs = ChainView::default(); - // TODO: Uncomment this if the tools are not fetch up to date info + // TODO: Uncomment this if the tools are not fetch up to date info // self.client.update_and_verify_state_proof()?; cs.waypoint = self.client.waypoint().ok(); @@ -192,7 +194,7 @@ impl Node { cs.validator_view = Some(validators.clone()); cs.validators_stats = Some(validators_stats); cs.vals_config_stats = calc_config_stats(validators.clone()).ok(); - cs.autopay_watch_list = self.get_autopay_watch_list(validators.clone()); + cs.autopay_watch_list = self.get_autopay_watch_list(validators.clone()); cs.upgrade = self.client.get_oracle_upgrade_state()?; self.vitals.chain_view = Some(cs.clone()); @@ -204,10 +206,10 @@ impl Node { } fn format_validator_info( - &self, + &mut self, v: &ValidatorInfo, dict: &AccountDictionary, - stats: &ValidatorsStatsResource + stats: &ValidatorsStatsResource, ) -> Result { let vfn_full_ip = match v.config().fullnode_network_addresses() { Ok(ips) => { @@ -223,27 +225,29 @@ impl Node { let vfn_ip = extract_ip(&vfn_full_ip); let validator_full_ip = match v.config().validator_network_addresses() { - Ok(ips) => { - ips.first() - .unwrap() - .clone() - .decrypt( - &diem_types::network_address::encrypted::TEST_SHARED_VAL_NETADDR_KEY, - &v.account_address().clone(), - 0 - )? - .to_string() - }, + Ok(ips) => ips + .first() + .unwrap() + .clone() + .decrypt( + &diem_types::network_address::encrypted::TEST_SHARED_VAL_NETADDR_KEY, + &v.account_address().clone(), + 0, + )? + .to_string(), Err(_) => "--".to_string(), }; let validator_ip = extract_ip(&validator_full_ip); - let ms = self.client.get_miner_state(&v.account_address().clone())?.unwrap(); + let ms = self + .client + .get_miner_state(&v.account_address().clone())? + .unwrap(); let one_val_stat = stats.get_validator_current_stats(v.account_address().clone())?; - let val_config_opt = match self.get_validator_config(v.account_address().clone()){ + let val_config_opt = match self.get_validator_config(v.account_address().clone()) { Ok(v) => Some(v), Err(_) => None, }; @@ -253,6 +257,22 @@ impl Node { Err(_) => None, }; + let burn_to_community = match self.get_annotate_account_blob(v.account_address().clone()) { + Ok((Some(r), _)) => { + match query::find_value_from_state( + &r, + "Burn".to_string(), + "BurnPreference".to_string(), + "send_community".to_string(), + ) { + Some(resource_viewer::AnnotatedMoveValue::Bool(b)) => *b, + _ => false + } + + } + _ => false, + }; + let ports = get_ports_status(&validator_ip); Ok(ValidatorView { @@ -271,15 +291,15 @@ impl Node { epochs_validating_and_mining: ms.epochs_validating_and_mining, contiguous_epochs_validating_and_mining: ms.contiguous_epochs_validating_and_mining, epochs_since_last_account_creation: ms.epochs_since_last_account_creation, - + vote_count_in_epoch: one_val_stat.vote_count, prop_count_in_epoch: one_val_stat.prop_count, validator_config: val_config_opt, autopay: autopay_opt, + burn_to_community, note: dict.get_note_for_address(*v.account_address()), }) } - } fn calc_config_stats(vals: Vec) -> Result { @@ -316,7 +336,7 @@ fn calc_config_stats(vals: Vec) -> Result fn get_ports_status(ip: &String) -> HashMap { let mut result: HashMap = HashMap::new(); - let ports = get_ports_to_test(); + let ports = get_ports_to_test(); for port in ports.iter() { result.insert(port.to_string(), scan_port(&ip, port)); } @@ -330,10 +350,10 @@ fn scan_port(ip: &String, port: &u16) -> bool { let socket_address = SocketAddr::new(address, port.clone()); match TcpStream::connect_timeout(&socket_address, timeout) { Ok(_) => true, - _ => false + _ => false, } - }, - Err(_) => false + } + Err(_) => false, } } @@ -346,6 +366,6 @@ fn extract_ip(full_ip: &String) -> String { let split_str: Vec<&str> = full_ip.split('/').collect(); match split_str.get(2) { Some(ip) => ip.to_string(), - None => full_ip.to_string() + None => full_ip.to_string(), } -} \ No newline at end of file +} diff --git a/ol/cli/src/node/client.rs b/ol/cli/src/node/client.rs index f185061580..e81325ae95 100644 --- a/ol/cli/src/node/client.rs +++ b/ol/cli/src/node/client.rs @@ -116,7 +116,15 @@ pub fn pick_client(swarm_path: Option, config: &mut AppCfg) -> Result r, + // If we can't connect to any remotes, return the local client. + Err(e) => { + println!("{:?}", e); + return Ok(local_client) + }, + }; // compares to an upstream random remote client. If it is synced, use the local client as the default let mut node = Node::new(local_client, config, is_swarm); match node.check_sync(){ diff --git a/ol/cli/web-monitor/public/build/bundle.css b/ol/cli/web-monitor/public/build/bundle.css index 6860b51fa3..20e7dddddc 100644 --- a/ol/cli/web-monitor/public/build/bundle.css +++ b/ol/cli/web-monitor/public/build/bundle.css @@ -1 +1 @@ -.owner.svelte-n6q91t{background:#E6E6E6}#validator-modal-body.svelte-zc3fmg{width:auto !important;max-width:1200px !important}.audit-container.svelte-vi7vi7{margin:auto;max-width:500px}.autopay-summary-container.svelte-1js4my7{margin:auto;max-width:400px}.disable-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} \ No newline at end of file +.owner.svelte-n6q91t{background:#E6E6E6}.autopay-summary-container.svelte-1js4my7{margin:auto;max-width:400px}#validator-modal-body.svelte-zc3fmg{width:auto !important;max-width:1200px !important}.audit-container.svelte-vi7vi7{margin:auto;max-width:500px}.disable-select{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} \ No newline at end of file diff --git a/ol/cli/web-monitor/public/build/bundle.js b/ol/cli/web-monitor/public/build/bundle.js index c0a3514a60..c7b8a78e62 100644 --- a/ol/cli/web-monitor/public/build/bundle.js +++ b/ol/cli/web-monitor/public/build/bundle.js @@ -1,786 +1,5 @@ -var app = (function () { - 'use strict'; - - function noop() { } - function add_location(element, file, line, column, char) { - element.__svelte_meta = { - loc: { file, line, column, char } - }; - } - function run(fn) { - return fn(); - } - function blank_object() { - return Object.create(null); - } - function run_all(fns) { - fns.forEach(run); - } - function is_function(thing) { - return typeof thing === 'function'; - } - function safe_not_equal(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); - } - function is_empty(obj) { - return Object.keys(obj).length === 0; - } - function null_to_empty(value) { - return value == null ? '' : value; - } - function append(target, node) { - target.appendChild(node); - } - function insert(target, node, anchor) { - target.insertBefore(node, anchor || null); - } - function detach(node) { - node.parentNode.removeChild(node); - } - function destroy_each(iterations, detaching) { - for (let i = 0; i < iterations.length; i += 1) { - if (iterations[i]) - iterations[i].d(detaching); - } - } - function element(name) { - return document.createElement(name); - } - function text(data) { - return document.createTextNode(data); - } - function space() { - return text(' '); - } - function empty() { - return text(''); - } - function listen(node, event, handler, options) { - node.addEventListener(event, handler, options); - return () => node.removeEventListener(event, handler, options); - } - function attr(node, attribute, value) { - if (value == null) - node.removeAttribute(attribute); - else if (node.getAttribute(attribute) !== value) - node.setAttribute(attribute, value); - } - function children(element) { - return Array.from(element.childNodes); - } - function custom_event(type, detail, bubbles = false) { - const e = document.createEvent('CustomEvent'); - e.initCustomEvent(type, bubbles, false, detail); - return e; - } - - let current_component; - function set_current_component(component) { - current_component = component; - } - function get_current_component() { - if (!current_component) - throw new Error('Function called outside component initialization'); - return current_component; - } - function onDestroy(fn) { - get_current_component().$$.on_destroy.push(fn); - } - - const dirty_components = []; - const binding_callbacks = []; - const render_callbacks = []; - const flush_callbacks = []; - const resolved_promise = Promise.resolve(); - let update_scheduled = false; - function schedule_update() { - if (!update_scheduled) { - update_scheduled = true; - resolved_promise.then(flush); - } - } - function add_render_callback(fn) { - render_callbacks.push(fn); - } - let flushing = false; - const seen_callbacks = new Set(); - function flush() { - if (flushing) - return; - flushing = true; - do { - // first, call beforeUpdate functions - // and update components - for (let i = 0; i < dirty_components.length; i += 1) { - const component = dirty_components[i]; - set_current_component(component); - update(component.$$); - } - set_current_component(null); - dirty_components.length = 0; - while (binding_callbacks.length) - binding_callbacks.pop()(); - // then, once components are updated, call - // afterUpdate functions. This may cause - // subsequent updates... - for (let i = 0; i < render_callbacks.length; i += 1) { - const callback = render_callbacks[i]; - if (!seen_callbacks.has(callback)) { - // ...so guard against infinite loops - seen_callbacks.add(callback); - callback(); - } - } - render_callbacks.length = 0; - } while (dirty_components.length); - while (flush_callbacks.length) { - flush_callbacks.pop()(); - } - update_scheduled = false; - flushing = false; - seen_callbacks.clear(); - } - function update($$) { - if ($$.fragment !== null) { - $$.update(); - run_all($$.before_update); - const dirty = $$.dirty; - $$.dirty = [-1]; - $$.fragment && $$.fragment.p($$.ctx, dirty); - $$.after_update.forEach(add_render_callback); - } - } - const outroing = new Set(); - let outros; - function group_outros() { - outros = { - r: 0, - c: [], - p: outros // parent group - }; - } - function check_outros() { - if (!outros.r) { - run_all(outros.c); - } - outros = outros.p; - } - function transition_in(block, local) { - if (block && block.i) { - outroing.delete(block); - block.i(local); - } - } - function transition_out(block, local, detach, callback) { - if (block && block.o) { - if (outroing.has(block)) - return; - outroing.add(block); - outros.c.push(() => { - outroing.delete(block); - if (callback) { - if (detach) - block.d(1); - callback(); - } - }); - block.o(local); - } - } - - const globals = (typeof window !== 'undefined' - ? window - : typeof globalThis !== 'undefined' - ? globalThis - : global); - function create_component(block) { - block && block.c(); - } - function mount_component(component, target, anchor, customElement) { - const { fragment, on_mount, on_destroy, after_update } = component.$$; - fragment && fragment.m(target, anchor); - if (!customElement) { - // onMount happens before the initial afterUpdate - add_render_callback(() => { - const new_on_destroy = on_mount.map(run).filter(is_function); - if (on_destroy) { - on_destroy.push(...new_on_destroy); - } - else { - // Edge case - component was destroyed immediately, - // most likely as a result of a binding initialising - run_all(new_on_destroy); - } - component.$$.on_mount = []; - }); - } - after_update.forEach(add_render_callback); - } - function destroy_component(component, detaching) { - const $$ = component.$$; - if ($$.fragment !== null) { - run_all($$.on_destroy); - $$.fragment && $$.fragment.d(detaching); - // TODO null out other refs, including component.$$ (but need to - // preserve final state?) - $$.on_destroy = $$.fragment = null; - $$.ctx = []; - } - } - function make_dirty(component, i) { - if (component.$$.dirty[0] === -1) { - dirty_components.push(component); - schedule_update(); - component.$$.dirty.fill(0); - } - component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31)); - } - function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) { - const parent_component = current_component; - set_current_component(component); - const $$ = component.$$ = { - fragment: null, - ctx: null, - // state - props, - update: noop, - not_equal, - bound: blank_object(), - // lifecycle - on_mount: [], - on_destroy: [], - on_disconnect: [], - before_update: [], - after_update: [], - context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), - // everything else - callbacks: blank_object(), - dirty, - skip_bound: false, - root: options.target || parent_component.$$.root - }; - append_styles && append_styles($$.root); - let ready = false; - $$.ctx = instance - ? instance(component, options.props || {}, (i, ret, ...rest) => { - const value = rest.length ? rest[0] : ret; - if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { - if (!$$.skip_bound && $$.bound[i]) - $$.bound[i](value); - if (ready) - make_dirty(component, i); - } - return ret; - }) - : []; - $$.update(); - ready = true; - run_all($$.before_update); - // `false` as a special case of no DOM component - $$.fragment = create_fragment ? create_fragment($$.ctx) : false; - if (options.target) { - if (options.hydrate) { - const nodes = children(options.target); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - $$.fragment && $$.fragment.l(nodes); - nodes.forEach(detach); - } - else { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - $$.fragment && $$.fragment.c(); - } - if (options.intro) - transition_in(component.$$.fragment); - mount_component(component, options.target, options.anchor, options.customElement); - flush(); - } - set_current_component(parent_component); - } - /** - * Base class for Svelte components. Used when dev=false. - */ - class SvelteComponent { - $destroy() { - destroy_component(this, 1); - this.$destroy = noop; - } - $on(type, callback) { - const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = [])); - callbacks.push(callback); - return () => { - const index = callbacks.indexOf(callback); - if (index !== -1) - callbacks.splice(index, 1); - }; - } - $set($$props) { - if (this.$$set && !is_empty($$props)) { - this.$$.skip_bound = true; - this.$$set($$props); - this.$$.skip_bound = false; - } - } - } - - function dispatch_dev(type, detail) { - document.dispatchEvent(custom_event(type, Object.assign({ version: '3.44.2' }, detail), true)); - } - function append_dev(target, node) { - dispatch_dev('SvelteDOMInsert', { target, node }); - append(target, node); - } - function insert_dev(target, node, anchor) { - dispatch_dev('SvelteDOMInsert', { target, node, anchor }); - insert(target, node, anchor); - } - function detach_dev(node) { - dispatch_dev('SvelteDOMRemove', { node }); - detach(node); - } - function listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) { - const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : []; - if (has_prevent_default) - modifiers.push('preventDefault'); - if (has_stop_propagation) - modifiers.push('stopPropagation'); - dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers }); - const dispose = listen(node, event, handler, options); - return () => { - dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers }); - dispose(); - }; - } - function attr_dev(node, attribute, value) { - attr(node, attribute, value); - if (value == null) - dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute }); - else - dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value }); - } - function set_data_dev(text, data) { - data = '' + data; - if (text.wholeText === data) - return; - dispatch_dev('SvelteDOMSetData', { node: text, data }); - text.data = data; - } - function validate_each_argument(arg) { - if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) { - let msg = '{#each} only iterates over array-like objects.'; - if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) { - msg += ' You can use a spread to convert this iterable into an array.'; - } - throw new Error(msg); - } - } - function validate_slots(name, slot, keys) { - for (const slot_key of Object.keys(slot)) { - if (!~keys.indexOf(slot_key)) { - console.warn(`<${name}> received an unexpected slot "${slot_key}".`); - } - } - } - /** - * Base class for Svelte components with some minor dev-enhancements. Used when dev=true. - */ - class SvelteComponentDev extends SvelteComponent { - constructor(options) { - if (!options || (!options.target && !options.$$inline)) { - throw new Error("'target' is a required option"); - } - super(); - } - $destroy() { - super.$destroy(); - this.$destroy = () => { - console.warn('Component was already destroyed'); // eslint-disable-line no-console - }; - } - $capture_state() { } - $inject_state() { } - } - - /* src/components/layout/Nav.svelte generated by Svelte v3.44.2 */ - - const file$i = "src/components/layout/Nav.svelte"; - - function create_fragment$i(ctx) { - let main; - let nav; - let div; - let ul; - let li0; - let a0; - let t1; - let li1; - let a1; - let t3; - let li2; - let a2; - let t5; - let li3; - let a3; - let t7; - let li4; - let a4; - let t9; - let li5; - let a5; - - const block = { - c: function create() { - main = element("main"); - nav = element("nav"); - div = element("div"); - ul = element("ul"); - li0 = element("li"); - a0 = element("a"); - a0.textContent = "Dash"; - t1 = space(); - li1 = element("li"); - a1 = element("a"); - a1.textContent = "Validators"; - t3 = space(); - li2 = element("li"); - a2 = element("a"); - a2.textContent = "Autopay"; - t5 = space(); - li3 = element("li"); - a3 = element("a"); - a3.textContent = "Watch List"; - t7 = space(); - li4 = element("li"); - a4 = element("a"); - a4.textContent = "Audit"; - t9 = space(); - li5 = element("li"); - a5 = element("a"); - a5.textContent = "Upgrades"; - attr_dev(a0, "href", "#"); - add_location(a0, file$i, 4, 30, 226); - attr_dev(li0, "class", "uk-active"); - add_location(li0, file$i, 4, 8, 204); - attr_dev(a1, "href", "#"); - add_location(a1, file$i, 5, 12, 264); - add_location(li1, file$i, 5, 8, 260); - attr_dev(a2, "href", "#"); - add_location(a2, file$i, 6, 12, 308); - add_location(li2, file$i, 6, 8, 304); - attr_dev(a3, "href", "#"); - add_location(a3, file$i, 7, 12, 349); - add_location(li3, file$i, 7, 8, 345); - attr_dev(a4, "href", "#"); - add_location(a4, file$i, 8, 12, 393); - add_location(li4, file$i, 8, 8, 389); - attr_dev(a5, "href", "#"); - add_location(a5, file$i, 9, 12, 432); - add_location(li5, file$i, 9, 8, 428); - attr_dev(ul, "class", "uk-navbar-nav uk-text-center"); - attr_dev(ul, "uk-switcher", "connect: .switcher-container"); - add_location(ul, file$i, 3, 6, 111); - attr_dev(div, "class", "uk-navbar-center uk-overflow-auto"); - add_location(div, file$i, 2, 4, 57); - attr_dev(nav, "class", "uk-navbar-container"); - attr_dev(nav, "uk-navbar", ""); - add_location(nav, file$i, 1, 2, 9); - add_location(main, file$i, 0, 0, 0); - }, - l: function claim(nodes) { - throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option"); - }, - m: function mount(target, anchor) { - insert_dev(target, main, anchor); - append_dev(main, nav); - append_dev(nav, div); - append_dev(div, ul); - append_dev(ul, li0); - append_dev(li0, a0); - append_dev(ul, t1); - append_dev(ul, li1); - append_dev(li1, a1); - append_dev(ul, t3); - append_dev(ul, li2); - append_dev(li2, a2); - append_dev(ul, t5); - append_dev(ul, li3); - append_dev(li3, a3); - append_dev(ul, t7); - append_dev(ul, li4); - append_dev(li4, a4); - append_dev(ul, t9); - append_dev(ul, li5); - append_dev(li5, a5); - }, - p: noop, - i: noop, - o: noop, - d: function destroy(detaching) { - if (detaching) detach_dev(main); - } - }; - - dispatch_dev("SvelteRegisterBlock", { - block, - id: create_fragment$i.name, - type: "component", - source: "", - ctx - }); - - return block; - } - - function instance$i($$self, $$props) { - let { $$slots: slots = {}, $$scope } = $$props; - validate_slots('Nav', slots, []); - const writable_props = []; - - Object.keys($$props).forEach(key => { - if (!~writable_props.indexOf(key) && key.slice(0, 2) !== '$$' && key !== 'slot') console.warn(`