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

Interchaintest should have Penumbra support (via pclientd) #644

Closed
36 tasks done
Tracked by #313 ...
conorsch opened this issue Jun 23, 2023 · 12 comments
Closed
36 tasks done
Tracked by #313 ...

Interchaintest should have Penumbra support (via pclientd) #644

conorsch opened this issue Jun 23, 2023 · 12 comments
Assignees

Comments

@conorsch
Copy link
Contributor

conorsch commented Jun 23, 2023

There's ongoing work to integrate Penumbra into interchaintest. This issue tracks outstanding obstacles, to coordinate changes between interchaintest, upstream penumbra, and potentially the relayer.

We'll continue to update this tracking ticket as we make progress.

@conorsch
Copy link
Contributor Author

Testnet liquid allocations for Penumbra within interchaintest are getting clobbered.

For context, here's a request made from the host context to a Tendermint RPC container:

❯ curl -s http://localhost:39107/genesis | jq " .result.genesis.app_state.allocations | map(.denom)"
[
  "udelegation_penumbravalid1f67tthllqwf0u0xst653wqn7y82ql6z79l6vsap4e0mpn36x05xsf33px9",
  "udelegation_penumbravalid1xmvpjz9gazr0lsu9sfgtl2e7xwlqpqdynvunv0dahe56muns2yyqs5ms3a",
  "udelegation_penumbravalid1neu6aq87a0sllc8xjgjnlkgxkf8kwaa9gh9z9pzempr5dvszf5pqpptmqt",
  "udelegation_penumbravalid1tnfjrud5522kcjwvftz3ngr9upf6ypjmv2v9gpqxp58fmk0eus9s55t235"
]

The validator delegations are expected, but we also expect some upenumbra liquid allocations, which are getting dropped somewhere between generation and chain start. Let's figure out why.

@conorsch
Copy link
Contributor Author

Figure out how to target pd service url via an ephemeral container.

Added in the last round of @jtieri's changes, see for example:

diff --git a/chain/penumbra/penumbra_app_node.go b/chain/penumbra/penumbra_app_node.go
index 792ff46..a54d63a 100644
--- a/chain/penumbra/penumbra_app_node.go
+++ b/chain/penumbra/penumbra_app_node.go
@@ -256,31 +256,18 @@ func (p *PenumbraAppNode) GetAddress(ctx context.Context, keyName string) ([]byt
 }
 
 func (p *PenumbraAppNode) GetBalance(ctx context.Context, keyName string) (int64, error) {
-       fmt.Println("Entering GetBalance function from app perspective...")
        keyPath := filepath.Join(p.HomeDir(), "keys", keyName)
-       // TODO Figure out the container's address, so we can use pcli to look up balance
-       // as a sanity check. "localhost" is not the right network context.
-       // pdUrl := fmt.Sprintf("http://%v", p.hostGRPCPort)
-       pdUrl := fmt.Sprintf("http://localhost:8080")
+       pdUrl := fmt.Sprintf("http://%s:8080", p.HostName())

@conorsch
Copy link
Contributor Author

conorsch commented Jul 7, 2023

Add golang function for translation Hi/Lo 64-bit values from RPC into combined 128-bit BigInt representation

Check it out:

+// translateHiAndLo takes the high and low order bytes and decodes the two uint64 values into the single int128 value
+// they represent. Since Go does not support native uint128 we make use of the big.Int type.
+// see: https://github.com/penumbra-zone/penumbra/blob/4d175986f385e00638328c64d729091d45eb042a/crates/core/crypto/src/asset/amount.rs#L220-L240
+func translateHiAndLo(hi, lo uint64) *big.Int {
+       hiBig := big.NewInt(0).SetUint64(hi)
+       loBig := big.NewInt(0).SetUint64(lo)
+
+       // Shift hi 8 bytes to the left
+       hiBig.Lsh(hiBig, 64)
+
+       // Add the lower order bytes
+       return big.NewInt(0).Add(hiBig, loBig)
+}
+

We haven't actually confirmed this works, due to #658, but we're optimistic.

@conorsch
Copy link
Contributor Author

Support passing of 128-bit Amounts within interchaintest, being respectful of interfaces used by other chains, which are all to date limited at 64-bit amounts. Maybe change to 128-bit support everywhere? Definitely need to involve @agouin in interface changes.

Resolved: the plan is to use the Cosmos SDK BigInt type, and use that throughout Interchaintest. @jtieri is working on a PR to implement, which should be ready to merge in the next few days. On top of that, we'll rebase the existing Penumbra integration work, and update to the latest protos.

@akc2267
Copy link
Contributor

akc2267 commented Jul 31, 2023

Here's the PR for the bigint fix: #679

@conorsch
Copy link
Contributor Author

conorsch commented Aug 14, 2023

We've encountered a blocker in that the existing buf tooling to generate golang code from Penumbra protos does not support optional proto3 fields, due to the use of protoc-gen-gocosmos, from the cosmos/gogoproto repo. Lack of optional field support causes the TransactionPlannerRequest call to fail, because the AccountGroupId can't be encoded properly. Our next steps are in order of preference:

  1. get optional tag support added to the cosmos fork of gogoproto
  2. generate the code from the protos without it and get that to work
  3. remove the optional field and just explicitly pass nil client side

@jtieri
Copy link
Member

jtieri commented Sep 13, 2023

The first phase of pclientd support will be tackled in PR #480, this will get us basic integration with pclientd where we can perform basic tx execution for token transfers and querying balances local to an instance of Penumbra. That PR contains some context on a blocker with regards to our current design when it comes to performing node lookup before executing any sort of query or tx. A follow up PR will be necessary to iron out the design.

tl;dr is that the interfaces used in interchaintest were built with the assumption that each Chain is fully transparent and any node in the network can be used to observe the full chain state. we need a way to lookup the proper node and/or client before executing queries or broadcasting txs.

Edit: we have figured out a workaround within the existing design where we will just scope all test user accounts to one specific PenumbraNode instance so we can assume that all test user accounts exist at PenumbraChain.PenumbraNodes[0], which lets us use the existing getFullNode method whenever we need to retrieve an instance of pclientd for broadcasting a tx or performing a query.

@akc2267
Copy link
Contributor

akc2267 commented Jan 29, 2024

waiting for a new release from their team

@jonathanpberger jonathanpberger changed the title Penumbra support, via pclientd Interchaintest should have Penumbra support (via pclientd) Mar 25, 2024
@jonathanpberger
Copy link
Contributor

Got changes back; there's a LOT there. @jtieri is wrapping up the changes. Merge is gonna suuuuuck. Stay tuned. @Reecepbcups generously volunteered to review it.

@jonathanpberger
Copy link
Contributor

We're blocked on a timeout issue. Applied the latest update hoping that would solve it...but no. Waiting for Penumbra team to investigate. Once that's sorted, @Reecepbcups will take a look (as mentioned upthread).

@jonathanpberger
Copy link
Contributor

Iceboxing.

@Reecepbcups
Copy link
Member

Completed!

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

No branches or pull requests

5 participants