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

Neutron client in pure rust #234

Merged
merged 43 commits into from
Oct 3, 2024
Merged

Neutron client in pure rust #234

merged 43 commits into from
Oct 3, 2024

Conversation

hu55a1n1
Copy link
Member

@hu55a1n1 hu55a1n1 commented Oct 1, 2024

This PR is based off of @dusterbloom's #227.

Implements the following ->

  • grpc based cw client (alsmost chain agnostic, but not fully yet)
  • All URL based CLI args now use reqwest::Url type.
  • An almost 'Bin agnostic CliClient'
  • SSL and DNS resolution support in gramine
  • Implement generic attestation support for transfers enclave
  • Misc cleanup

@hu55a1n1 hu55a1n1 marked this pull request as ready for review October 3, 2024 13:32
@hu55a1n1
Copy link
Member Author

hu55a1n1 commented Oct 3, 2024

Testing instructions

Use pre-deployed core contracts

export TCBINFO_CONTRACT=neutron1anj45ushmjntew7zrg5jw2rv0rwfce3nl5d655mzzg8st0qk4wjsds4wps
export DCAP_CONTRACT=neutron18f3xu4yazfqr48wla9dwr7arn8wfm57qfw8ll6y02qsgmftpft6qfec3uf

Setup neutrond locally (optional)

$ cat ~/.neutrond/config/client.toml
# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml

###############################################################################
###                           Client Configuration                            ###
###############################################################################

# The network chain ID
chain-id = "pion-1"
# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory)
keyring-backend = "test"
# CLI output format (text|json)
output = "text"
# <host>:<port> to CometBFT RPC interface for this chain
node = "https://rpc-falcron.pion-1.ntrn.tech"
# Transaction broadcasting mode (sync|async)
broadcast-mode = "sync"

Dev command

# All commands to be run from `crates/cli/`
cargo run -- --app-dir "../../examples/transfers/" dev --unsafe-trust-latest --contract-manifest "../../examples/transfers/contracts/Cargo.toml" --fmspc "00606A000000" --tcbinfo-contract "$TCBINFO_CONTRACT" --dcap-verifier-contract "$DCAP_CONTRACT" --init-msg '{"denom":"untrn"}' --sk-file ../utils/cw-client/data/admin.sk

Individual commands

cargo run -- --app-dir "../../examples/transfers/" enclave start --unsafe-trust-latest --fmspc "00606A000000" --tcbinfo-contract "$TCBINFO_CONTRACT" --dcap-verifier-contract "$DCAP_CONTRACT"  --sk-file ../utils/cw-client/data/admin.sk

cargo run -- --app-dir "../../examples/transfers/" contract build  --contract-manifest "../../examples/transfers/contracts/Cargo.toml" 

cargo run -- --app-dir "../../examples/transfers/" contract deploy --contract-manifest "../../examples/transfers/contracts/Cargo.toml" --init-msg '{"denom":"untrn"}' 

export CONTRACT=<contract-address>
cargo run -- --app-dir "../../examples/transfers/" handshake --unsafe-trust-latest --contract "$CONTRACT" 

Test query from CLI

neutrond keys add ephemeral_user
EPHEMERAL_PUBKEY=$(neutrond keys show ephemeral_user -p | jq -r '.key' | base64 -d | xxd -p -c 1000 | tr -d '\n')
echo $EPHEMERAL_PUBKEY

neutrond tx wasm execute "$CONTRACT" "{\"query_request\": {\"emphemeral_pubkey\": \"$EPHEMERAL_PUBKEY\"}}" --from val1 --chain-id pion-1 --gas 200000  --gas-adjustment 1.2 -y --node https://rpc-falcron.pion-1.ntrn.tech --fees 200000untrn

Copy link
Contributor

@davekaj davekaj left a comment

Choose a reason for hiding this comment

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

i skimmed it earlier today but we are just merging now because it works and we want to try to release this ASAP. shoaib will submit a PR to fix the sk-file issue, and we will figure out the fix for the timing out of the handshake

@davekaj davekaj merged commit 7133ea5 into main Oct 3, 2024
8 of 9 checks passed
@davekaj davekaj deleted the hu55a1n1/wasmd-client-rs branch October 3, 2024 17:50
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.

2 participants