Skip to content

Conversation

@fluidvanadium
Copy link
Contributor

@fluidvanadium fluidvanadium commented Oct 9, 2025

Why:

The interface to zingolib is scattered over many modules. I wanted to re-imagine what the interface could look like.

What:

The sum of assumptions necessary to create a wallet with zingolib is contained in code here.
The only change made to the zingolib package so far is the correction of a chain_from_str function.

Tests:

So far, this creates a ZingoWallet.
And tests that it reports syncking a chain.
Notably, this test does not involve customized test behavior. It only uses the interface methods presented in zcash_wallet_interface.

@fluidvanadium fluidvanadium requested a review from dorianvp October 9, 2025 07:23
@fluidvanadium fluidvanadium changed the title Migrate test framework to zingo_wallet interface Migrate scenarios framework to zingo_wallet interface Oct 9, 2025
impl zcash_wallet_interface::Wallet for ZingoWallet {
fn user_agent_id() -> zcash_wallet_interface::UserAgentId {
const AGENT_NAME: &str = "zingo_wallet";
const VERSION: &str = "0.0.1";
Copy link
Member

Choose a reason for hiding this comment

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

I advocated the removal of the foo.0 accessor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Done!


let mut client = {
// global configuration must be manually set *somewhere*
rustls::crypto::ring::default_provider().install_default();
Copy link
Member

Choose a reason for hiding this comment

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

Where should this be called? Why?

Is this called on the last possible line before use?

Copy link
Member

Choose a reason for hiding this comment

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

I'm referring to the previous line of code.

};

let lightd_info = client
.get_lightd_info(tonic::Request::new(
Copy link
Member

Choose a reason for hiding this comment

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

What's a lightd anyway?

let birthday: zcash_primitives::consensus::BlockHeight =
lightd_info.block_height.try_into()?;
(chain_type, birthday)
};
Copy link
Member

@zancas zancas Oct 30, 2025

Choose a reason for hiding this comment

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

Why not make the RHS of this let statement be a Single Use Helper Fn or "SUHFn".

This would suck code out of the body of this biggie fn, force an explicit type signature, inspire a name for the helper itself, and generally be elegant IMHO.

Copy link
Member

Choose a reason for hiding this comment

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

Also helper fns (as named items) are relatively easy to reference, and e.g. test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will. But its another step.

(chain_type, birthday)
};

// this seems like a lot of set up. Do we really need all this right here??
Copy link
Member

@zancas zancas Oct 30, 2025

Choose a reason for hiding this comment

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

It seems to me that the wallet-related functionality defined from here to the end of this fn might be useful outside the context of server addition.

So why not factor this out as another fn?

@fluidvanadium fluidvanadium changed the title Migrate scenarios framework to zingo_wallet interface Default wallet creation interface test. Nov 9, 2025
@fluidvanadium fluidvanadium changed the title Default wallet creation interface test. WALLET_INTERFACE: live testnet syncs Nov 10, 2025
@fluidvanadium fluidvanadium marked this pull request as ready for review November 10, 2025 00:35
#[error("Wallet creation failed with >{0}<.")]
CreateLightClient(#[from] zingolib::lightclient::error::LightClientError),
#[error("Wallet creation failed with >{0}<.")]
StartSync(zingolib::lightclient::error::LightClientError),
Copy link
Member

Choose a reason for hiding this comment

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

How can adding a server result in a sync error? Are we implying that it automatically starts a sync process?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants