-
Notifications
You must be signed in to change notification settings - Fork 13
v0.4 dev to master #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
67f8e61
7a28317
68cdd20
d45990d
8d452aa
d6cc46a
f7d6bb2
c9cc4e7
6c8bc08
2874410
5c2628d
b23f121
f6ad81f
06bc890
77759be
679340a
9b36bf9
62d13d1
07ffa35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,12 +6,18 @@ edition = "2021" | |
| default-run = "dash-evo-tool" | ||
| rust-version = "1.81" | ||
|
|
||
| [build] | ||
| rustflags = [ | ||
| "-C", "target-feature=+avx,-avx2,-avx512f,-avx512cd,-avx512er,-avx512pf,-avx512bw,-avx512dq,-avx512vl" | ||
| ] | ||
|
|
||
| [dependencies] | ||
| bip39 = { version = "2.1.0", features = ["all-languages", "rand"] } | ||
| derive_more = "1.0.0" | ||
| accesskit = "=0.16.1" | ||
| egui = { version = "0.29.1" } | ||
| egui_extras = "0.29.1" | ||
| rfd = "0.15.1" | ||
| qrcode = "0.14.1" | ||
| eframe = { version = "0.29.1", features = ["persistence"] } | ||
| strum = { version = "0.26.1", features = ["derive"] } | ||
|
|
@@ -59,4 +65,8 @@ regex = "1.11" | |
| zmq = "0.10" | ||
|
|
||
| [target.'cfg(target_os = "windows")'.dependencies] | ||
| zeromq = "0.4.1" | ||
| zeromq = "0.4.1" | ||
|
|
||
| [target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies] | ||
| native-dialog = "0.7.0" | ||
| raw-cpuid = "11.2.0" | ||
|
Comment on lines
+70
to
+72
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Architecture-specific implementation needs error handling for non-x86 platforms The code properly implements x86/x86_64-specific CPU compatibility checks using conditional compilation, but lacks explicit handling for other architectures. The current implementation:
However, there's no explicit handling for non-x86 architectures, which could lead to silent failures.
🔗 Analysis chainVerify architecture-specific implementations The new x86/x86_64-specific dependencies suggest platform-specific handling. Let's ensure proper implementation across architectures. Run the following to check the implementation: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify proper architecture-specific implementations
# Check for proper conditional compilation
rg "#\[cfg\(any\(target_arch = \"x86\"" -A 5
# Look for potential platform-specific code paths
rg "native_dialog::|raw_cpuid::" -A 5
# Verify error handling for unsupported architectures
ast-grep --pattern 'cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
$$$
} else {
$$$
}
}'
Length of output: 3129 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,7 +123,7 @@ impl AppState { | |
|
|
||
| let password_info = settings | ||
| .clone() | ||
| .map(|(_, _, password_info)| password_info) | ||
| .map(|(_, _, password_info, _, _)| password_info) | ||
| .flatten(); | ||
|
|
||
| let mainnet_app_context = | ||
|
|
@@ -150,10 +150,23 @@ impl AppState { | |
| let mut proof_log_screen = ProofLogScreen::new(&mainnet_app_context); | ||
| let mut document_query_screen = DocumentQueryScreen::new(&mainnet_app_context); | ||
| let mut withdraws_status_screen = WithdrawsStatusScreen::new(&mainnet_app_context); | ||
|
|
||
| let (custom_dash_qt_path, overwrite_dash_conf) = match settings.clone() { | ||
| Some((.., db_custom_dash_qt_path, db_overwrite_dash_qt)) => { | ||
| (db_custom_dash_qt_path, db_overwrite_dash_qt) | ||
| } | ||
| _ => { | ||
| // Default values: Use system default path and overwrite conf | ||
| (None, true) | ||
| } | ||
| }; | ||
|
|
||
| let mut network_chooser_screen = NetworkChooserScreen::new( | ||
| &mainnet_app_context, | ||
| testnet_app_context.as_ref(), | ||
| Network::Dash, | ||
| custom_dash_qt_path, | ||
| overwrite_dash_conf, | ||
|
Comment on lines
+168
to
+169
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification NetworkChooserScreen initialization is inconsistent The verification reveals a mismatch between the implementation and usage. The
However, the actual call in
🔗 Analysis chainVerify NetworkChooserScreen parameter usage New parameters have been added to NetworkChooserScreen initialization. Let's verify their usage across the codebase. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check NetworkChooserScreen::new usage patterns
# Expected: All calls should include the new parameters
# Search for NetworkChooserScreen::new usage
ast-grep --pattern 'NetworkChooserScreen::new($_)'
# Search for struct definition to verify parameter order
ast-grep --pattern 'impl NetworkChooserScreen {
$$$
fn new($_) {
$$$
}
$$$
}'
Length of output: 144 Script: #!/bin/bash
# Let's try a different approach using ripgrep to find NetworkChooserScreen usage and implementation
# Search for NetworkChooserScreen::new calls
rg "NetworkChooserScreen::new" -A 3
# Search for NetworkChooserScreen implementation
rg "impl NetworkChooserScreen" -A 20
Length of output: 1684 |
||
| ); | ||
|
|
||
| let mut wallets_balances_screen = WalletsBalancesScreen::new(&mainnet_app_context); | ||
|
|
@@ -162,7 +175,7 @@ impl AppState { | |
|
|
||
| let mut chosen_network = Network::Dash; | ||
|
|
||
| if let Some((network, screen_type, password_info)) = settings { | ||
| if let Some((network, screen_type, password_info, _, _)) = settings { | ||
| selected_main_screen = screen_type; | ||
| chosen_network = network; | ||
| if chosen_network == Network::Testnet && testnet_app_context.is_some() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,16 +45,14 @@ pub fn copy_env_file_if_not_exists() { | |
| let app_data_dir = | ||
| app_user_data_dir_path().expect("Failed to determine application data directory"); | ||
| let env_file_in_app_dir = app_data_dir.join(".env".to_string()); | ||
| if env_file_in_app_dir.exists() && env_file_in_app_dir.is_file() { | ||
| } else { | ||
| if !env_file_in_app_dir.exists() || !env_file_in_app_dir.is_file() { | ||
| let env_example_file_in_exe_dir = PathBuf::from(".env.example"); | ||
| if env_example_file_in_exe_dir.exists() && env_example_file_in_exe_dir.is_file() { | ||
| fs::copy(&env_example_file_in_exe_dir, env_file_in_app_dir) | ||
| .expect("Failed to copy main net env file"); | ||
| .expect("Failed to copy env file"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace Using Consider this approach: - .expect("Failed to copy env file");
+ .map_err(|e| log::error!("Failed to copy env file: {}", e))?;Also, consider adding different error messages for different scenarios (source missing vs. copy failure). Also applies to: 55-55 |
||
| } else { | ||
| let env_file_in_exe_dir = PathBuf::from(".env"); | ||
| fs::copy(&env_file_in_exe_dir, env_file_in_app_dir) | ||
| .expect("Failed to copy main net env file"); | ||
| fs::copy(&env_file_in_exe_dir, env_file_in_app_dir).expect("Failed to copy env file"); | ||
| } | ||
| } | ||
|
Comment on lines
+48
to
57
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance function robustness and documentation The function could benefit from several improvements to make it more reliable and maintainable. Consider these enhancements:
-pub fn copy_env_file_if_not_exists() {
+pub fn copy_env_file_if_not_exists() -> std::io::Result<()> {
pub fn copy_env_file_if_not_exists() -> std::io::Result<()> {
let app_data_dir = app_user_data_dir_path()?;
let env_file_in_app_dir = app_data_dir.join(".env");
log::debug!("Checking .env file at: {:?}", env_file_in_app_dir);
match fs::metadata(&env_file_in_app_dir) {
Ok(metadata) if metadata.is_file() => {
log::debug!(".env file already exists");
Ok(())
}
_ => {
let env_example_file = PathBuf::from(".env.example");
let source_file = if env_example_file.is_file() {
env_example_file
} else {
PathBuf::from(".env")
};
log::info!("Copying {:?} to {:?}", source_file, env_file_in_app_dir);
fs::copy(&source_file, &env_file_in_app_dir)
.map(|_| log::info!("Successfully copied env file"))
.map_err(|e| {
log::error!("Failed to copy env file: {}", e);
e
})?;
Ok(())
}
}
}
/// Copies the environment configuration file to the application data directory.
///
/// # Source Files
/// Looks for source files in the following order:
/// 1. `.env.example` in the current directory
/// 2. `.env` in the current directory
///
/// # Errors
/// Returns an error if:
/// - Application data directory cannot be accessed
/// - Source file cannot be found
/// - Copy operation fails
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,6 @@ impl AppContext { | |
| sdk: &Sdk, | ||
| sender: mpsc::Sender<TaskResult>, | ||
| ) -> Result<BackendTaskSuccessResult, String> { | ||
| let sdk = sdk.clone(); | ||
| match &task { | ||
| ContestedResourceTask::QueryDPNSContestedResources => self | ||
| .query_dpns_contested_resources(sdk, sender) | ||
|
|
@@ -39,89 +38,7 @@ impl AppContext { | |
| ContestedResourceTask::VoteOnDPNSName(name, vote_choice, voters) => { | ||
| self.vote_on_dpns_name(name, *vote_choice, voters, sdk, sender) | ||
| .await | ||
| } // ContestedResourceTask::VoteOnContestedResource(vote_poll, vote_choice) => { | ||
| // let mut vote = Vote::default(); | ||
| // let identity_private_keys_lock = self.known_identities_private_keys.lock().await; | ||
| // let loaded_identity_lock = match self.loaded_identity.lock().await.clone() { | ||
| // Some(identity) => identity, | ||
| // None => { | ||
| // return BackendEvent::TaskCompleted { | ||
| // task: Task::Document(task), | ||
| // execution_result: Err( | ||
| // "No loaded identity for signing vote transaction".to_string(), | ||
| // ), | ||
| // }; | ||
| // } | ||
| // }; | ||
| // | ||
| // let mut signer = SimpleSigner::default(); | ||
| // let Identity::V0(identity_v0) = &loaded_identity_lock; | ||
| // for (key_id, public_key) in &identity_v0.public_keys { | ||
| // let identity_key_tuple = (identity_v0.id, *key_id); | ||
| // if let Some(private_key_bytes) = | ||
| // identity_private_keys_lock.get(&identity_key_tuple) | ||
| // { | ||
| // signer | ||
| // .private_keys | ||
| // .insert(public_key.clone(), private_key_bytes.clone()); | ||
| // } | ||
| // } | ||
| // | ||
| // let voting_public_key = match loaded_identity_lock.get_first_public_key_matching( | ||
| // Purpose::VOTING, | ||
| // HashSet::from(SecurityLevel::full_range()), | ||
| // HashSet::from(KeyType::all_key_types()), | ||
| // false, | ||
| // ) { | ||
| // Some(voting_key) => voting_key, | ||
| // None => { | ||
| // return BackendEvent::TaskCompleted { | ||
| // task: Task::Document(task), | ||
| // execution_result: Err( | ||
| // "No voting key in the loaded identity. Are you sure it's a masternode identity?".to_string() | ||
| // ), | ||
| // }; | ||
| // } | ||
| // }; | ||
| // | ||
| // match vote { | ||
| // Vote::ResourceVote(ref mut resource_vote) => match resource_vote { | ||
| // ResourceVote::V0(ref mut resource_vote_v0) => { | ||
| // resource_vote_v0.vote_poll = vote_poll.clone(); | ||
| // resource_vote_v0.resource_vote_choice = *vote_choice; | ||
| // let pro_tx_hash = self | ||
| // .loaded_identity_pro_tx_hash | ||
| // .lock() | ||
| // .await | ||
| // .expect("Expected a proTxHash in AppState"); | ||
| // match vote | ||
| // .put_to_platform_and_wait_for_response( | ||
| // pro_tx_hash, | ||
| // voting_public_key, | ||
| // sdk, | ||
| // &signer, | ||
| // None, | ||
| // ) | ||
| // .await | ||
| // { | ||
| // Ok(_) => { | ||
| // // TODO: Insert vote result into the database | ||
| // BackendEvent::TaskCompleted { | ||
| // task: Task::Document(task), | ||
| // execution_result: Ok(CompletedTaskPayload::String( | ||
| // "Vote cast successfully".to_string(), | ||
| // )), | ||
| // } | ||
| // } | ||
| // Err(e) => BackendEvent::TaskCompleted { | ||
| // task: Task::Document(task), | ||
| // execution_result: Err(e.to_string()), | ||
| // }, | ||
| // } | ||
| // } | ||
| // }, | ||
| // } | ||
| // } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification SDK parameter consistency needs attention in query_ending_times.rs The verification reveals an inconsistency in SDK parameter types across the contested names modules:
This inconsistency should be addressed to maintain uniform parameter types across the module. 🔗 Analysis chainVerify SDK reference changes across related modules The AI summary indicates that SDK parameter types were changed from 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check SDK parameter types in related contested name handlers
# Search for function signatures in related modules
echo "Checking SDK parameter types in contested name handlers..."
rg -A 1 "fn.*sdk.*Sdk" src/backend_task/contested_names/
Length of output: 185 Script: #!/bin/bash
# Let's try a broader search for SDK usage patterns
echo "Searching for SDK parameter patterns..."
rg -p "sdk: (&)?Sdk" src/backend_task/contested_names/
# Also search for function definitions that might use SDK
echo -e "\nSearching for function definitions with SDK..."
ast-grep --pattern 'fn $_($$$) -> $$ {
$$$
}' src/backend_task/contested_names/
Length of output: 730 |
||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider updating zeromq version for Windows
The Windows-specific zeromq dependency (v0.4.1) is significantly older than the non-Windows zmq dependency (v0.10). This version disparity could lead to:
Consider upgrading to a newer version or using the same zmq crate for Windows.