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

penumbra - pclientd integration #480

Merged
merged 41 commits into from
Sep 22, 2023
Merged

penumbra - pclientd integration #480

merged 41 commits into from
Sep 22, 2023

Conversation

agouin
Copy link
Member

@agouin agouin commented Apr 5, 2023

This PR introduces a basic integration with pclientd, which is a standalone client daemon for interacting with private user data on Penumbra. We have ported over a network integration test from the Penumbra repo to assert that basic functionality via pclientd is working as intended.

jtieri and others added 17 commits April 24, 2023 16:42
we can rather naively convert address strings to byte slices, and not
have to worry about bech32m encoding: the protos will accept the raw
byte slice as sufficient to reconstitute the address.

sprinkled around some debug logging to make sense of what's breaking.
pd was *silently failing* to process the weirdly constructed csv file.
the golang code was inserting liternal `\n`s rather than newlines.
pd should definitely error on this.

A previous debugging commit touched up the allocations indexing logic,
which wasn't necessary to fix the bug, but sure made things more
comprehensible. This commit restores the original allocations to the
pre-debugging values, aiui.
Updates the GetBalanceByAddress request to handle a gRPC streaming
request. Sadly the Penumbra docs aren't very clear that this method
returns a stream; we'll work on that! For now, the
for-loop-and-break-on-EOF seems a sufficiently idiomatic pattern for our
needs. Still to come is making the balance info intelligble.
@jtieri jtieri marked this pull request as ready for review September 13, 2023 22:09
@jtieri jtieri requested a review from a team as a code owner September 13, 2023 22:09
@jtieri jtieri self-requested a review September 13, 2023 22:09
Copy link
Member

@Reecepbcups Reecepbcups left a comment

Choose a reason for hiding this comment

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

Looks good! A few minor comments, solid work! 🔥

chain/penumbra/penumbra_client_node.go Outdated Show resolved Hide resolved
}

fmt.Printf("STDOUT BAL: '%s'\n", string(stdout))
return 0, nil
Copy link
Member

Choose a reason for hiding this comment

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

Can this be resolved with the implementation of (p *PenumbraClientNode) GetBalance(ctx context.Context, denom string)?

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 not 100% sure, they do technically return the same information the only difference being which piece of software is used to retrieve the balance (pclientd vs. pcli).

This PR moves away from making queries and broadcasting txs from the PenumbraAppNode in favor of the PenumbraClientNode when possible, so technically this method is unused now within interchaintest but it's not immediately clear to me if it will be used moving forward or if it's beneficial to expose methods on both objects.

I could remove this for now, change the method signature to accept a denom string and actually process the output properly so we can remove the todo, or open up an issue to come back to this later in a follow up PR. Thoughts?

chain/penumbra/penumbra_chain.go Outdated Show resolved Hide resolved
chain/penumbra/penumbra_chain.go Outdated Show resolved Hide resolved
without this sleep statement we see intermittent failures where we will observe the tokens taken from alice's balance
but not added to bob's balance. after debugging it seems like this is because alice's client is in sync but bob's is not.
we may need a way to check if each client is in sync before making any assertions about chain state after some state transition.
alternatively, we may want to wrap penumbra related queries in a retry.
Copy link
Member

Choose a reason for hiding this comment

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

The newly added testutil.WaitForBlocksUtil method likely helps here

Copy link
Member

Choose a reason for hiding this comment

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

great call out, this looks like it could be helpful. perhaps there is a way to check if a pclientd instance is in sync via a cmd that we can wrap in a function and pass into testutil.WaitForBlocksUtil

chain/penumbra/penumbra_app_node.go Outdated Show resolved Hide resolved
@jtieri jtieri enabled auto-merge (squash) September 22, 2023 18:42
@jtieri jtieri merged commit fa08aa0 into main Sep 22, 2023
7 checks passed
@jtieri jtieri deleted the andrew/penumbra_pclientd branch September 22, 2023 18:55
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.

4 participants