Skip to content
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

feat(wallet): using correct network #1249

Merged

Conversation

ksrichard
Copy link
Collaborator

@ksrichard ksrichard commented Jan 17, 2025

Description

For now we use the correct network configured and also validating on the validator node side in mempool.

Motivation and Context

Closes #1241

How Has This Been Tested?

Start a fresh swarm locally and send any transaction through wallet daemon. It is expected to still work.

What process can a PR reviewer use to test or verify this change?

Breaking Changes

  • None
  • Requires data directory to be deleted
  • Other - Please specify

@ksrichard ksrichard requested a review from sdbondi January 17, 2025 14:08
Copy link

github-actions bot commented Jan 17, 2025

Test Results (CI)

610 tests  +3   595 ✅  - 12   3h 16m 40s ⏱️ - 20m 47s
 67 suites +1     0 💤 ± 0 
  2 files   ±0    15 ❌ +15 

For more details on these failures, see this check.

Results for commit d88fcb6. ± Comparison against base commit 25921fa.

♻️ This comment has been updated with latest results.

sdbondi
sdbondi previously approved these changes Jan 20, 2025
Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sdbondi
Copy link
Member

sdbondi commented Jan 20, 2025

Think the integration tests need to be updated - looks like the validators are on Esmeralda and wallet is on localnet in cucumber. Localnet should be used for cucumbers.

Also need to update the wallet swarm command to pass in the --network {network} arg

@ksrichard
Copy link
Collaborator Author

ksrichard commented Jan 20, 2025

Think the integration tests need to be updated - looks like the validators are on Esmeralda and wallet is on localnet in cucumber. Localnet should be used for cucumbers.

Also need to update the wallet swarm command to pass in the --network {network} arg

Okay will check the integration tests and the command passing, just forgot about that thanks!

@ksrichard ksrichard self-assigned this Jan 20, 2025
sdbondi
sdbondi previously approved these changes Jan 20, 2025
@sdbondi sdbondi added this pull request to the merge queue Jan 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jan 21, 2025
@@ -122,7 +122,7 @@ pub async fn handle_create(
);

let max_fee = req.max_fee.unwrap_or(DEFAULT_FEE);
let transaction = Transaction::builder()
let transaction = transaction_builder(context)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, just in case, idiomatic Rust use of functions assumes the following syntax: module_name::function_name, so I think it will be more idiomatic to use types::transaction_builder(context)

@@ -150,3 +151,8 @@ pub(super) fn invalid_params<T: Display>(field: &str, details: Option<T>) -> any
)
.into()
}

/// Returns a TransactionBuilder with the current network configured.
pub fn transaction_builder(context: &HandlerContext) -> TransactionBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my humble opinion it would be nice to make the name more verbose to what it's really do and maybe associate the method with TransactionBuilder type. For example TransactionBuilder::with_context(context).

Copy link
Member

@sdbondi sdbondi Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a convinence method for the JSON-RPC handlers so not related to the transaction builder.

Please make the visibility of the function pub(super) to prevent it being used outside of the handlers module.

@@ -323,6 +323,7 @@ pub async fn handle_reveal_funds(

// If the caller aborts the request early, this async block would be aborted at any await point. To avoid this, we
// spawn a task that will continue running.
let ctx = context.clone();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of cloning the whole context we can instantiate builder here and move it into task's scope? Like let builder_for_task = TransactionBuilder::with_contex(context);?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest let builder = transaction_builder(context); outside the spawn to avoid the clone (not really fussed about it though 😉) .

…twork-to-wallet

# Conflicts:
#	applications/tari_dan_wallet_daemon/src/handlers/accounts.rs
#	applications/tari_dan_wallet_daemon/src/handlers/helpers.rs
#	applications/tari_dan_wallet_daemon/src/handlers/nfts.rs
@@ -323,6 +323,7 @@ pub async fn handle_reveal_funds(

// If the caller aborts the request early, this async block would be aborted at any await point. To avoid this, we
// spawn a task that will continue running.
let ctx = context.clone();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest let builder = transaction_builder(context); outside the spawn to avoid the clone (not really fussed about it though 😉) .

@sdbondi sdbondi enabled auto-merge January 23, 2025 11:21
@sdbondi sdbondi added this pull request to the merge queue Jan 23, 2025
Merged via the queue into tari-project:development with commit 6ed3e38 Jan 23, 2025
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add network to wallet
4 participants