Giter VIP home page Giter VIP logo

cosm-tome's People

Contributors

de-husk avatar ewoolsey avatar seedyrom avatar trevorjtclarke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cosm-tome's Issues

Create batch versions of every Tx endpoint

People will be able to manually do this through the upcoming tx module, but it would be really nice if users could just call bank_send_batch(), wasm_execute_batch(), etc and batch multiple msgs under the same transaction.

For now we are going to allow a single signer / payer of fees for all msgs.

Expose CosmTome public API mock

Right now Im exposing a CosmosClient trait mock, but thats way too much detail for people only needing to mock the top level CosmTome api.

We should also put this in the mocks feature.

Create high level object save trait for all Requests

Something that I find I would like to do often is bundle multiple types of messages together inside a vec and send them off. May want to send a wasm store_code, instantiate, then execute for example. It would be even better if this was inside the same tx. This could be achieved with a trait that look like this:

pub trait Request {
    fn to_any(&self, sender_addr: Address) -> DeployResult<Any>;
}

impl<S> Request for ExecRequest<S>
where
    S: Serialize + Clone + 'static,
{
    fn to_any(&self, sender_addr: Address) -> DeployResult<Any> {
        let proto = self.clone().to_proto(sender_addr)?;
        let any = proto.to_any()?;
        Ok(any)
    }
}

impl<S> Request for StoreCodeRequest<S> {
...
}

Then one could simply pass a vec of these Request objects to an execute function that takes in a Vec<&dyn Request>

Support non-mnemonic SigningKeys

Key::Mnemonic("blah blah blah") really only works for localnet.

We need a way to securely sign transactions for testnet / mainnet use cases.

  • Allow users to use their own existing os Keyring password
  • Add full Keyring password CRUD support through cosm-tome
  • Add ledger support
  • Write documentation on proper Keyring / ledger usage for both other libraries and applications

Create a sign method that is compatible with a ledger style key

First off, this is a cool project! Really appreciate the work you're doing here. I'm working on a ledger cosmos library written in pure rust. I would love to be able to integrate with the Key system you've built into this, but the current implementation doesn't work because it requires that you have direct access to the SigningKey (impossible with ledgers). For what I'm suggesting, each Key variant would have specific logic for how to sign a specific SignDoc. I have a prototype of how this would work if you'd like to see it, it's fairly straightforwards though. The Ledger library still has one last issue that I haven't solved yet, but it's 90% of the way to being functional.

Support multiple msgs in Tx module

The function signature should probably look like this:

async fn broadcast_tx(&self, tx: &impl IntoIterator<Item = Raw>) -> Result<ChainTxResponse, ChainError>

This would be super useful for quickly sending off many txs. @de-husk if you don't have time for this I'd be happy to take a crack at it! My deployment software is regularly sending off 20-30 txs in a row so this would be super useful for me.

Change the api to something that is more conducive to handling clients through dynamic dispatch

Currently there is no easy way to build on top of cosm-tome and generically handle different clients. I think the current method of bundling ChainConfig and a generic client T together inside CosmTome is not the best api. If I don't know which client I want to use at compile time there is no easy way to build on top. My suggestion is to completely do away with the CosmTome type and instead simply use extension traits. For every client that is CosmosClient we get all of the nice cosm_tome methods.

Here is an example of the current api

let client = CosmosgRPC::new(chain_info.grpc_endpoint.clone().unwrap());
let cosm_tome = CosmTome::new(chain_info, client);
let response = cosm_tome.wasm_execute(req, &key, &tx_options).await?;

and here is what it could look like with my suggested change

let client = CosmosgRPC::new(chain_info.grpc_endpoint.clone().unwrap());
let response = client.wasm_execute(chain_info, req, &key, &tx_options).await?;

Add Docs

  • API doc comments
  • Example doc code

Derive Serialize/Deserialize/JsonSchema for all public types

pretty self explanatory. Generally good practice to derive these for your types. Would love to migrate my project over to this (currently using a hacked together fork) but I can't until I'm able to Serialize! I can submit a PR if you like.

Strange parsing error when storing code

    let client = TendermintRPC::new(&chain_info.rpc_endpoint.clone().unwrap()).unwrap();
    let cosm_tome = CosmTome::new(chain_info, client);
    let wasm_data = std::fs::read(path)?;
    let tx_options = TxOptions { timeout_height: None, fee: None, memo: "wasm_deploy".into() };
    let req = StoreCodeRequest { wasm_data, instantiate_perms: None };
    let response = cosm_tome.wasm_store(req, &key, &tx_options).await?; // <== error occurs in this line

full error message

serde parse error

Caused by:
    missing field `id` at line 8 column 1

Location:
    /Users/ewoolsey/.cargo/registry/src/github.com-1ecc6299db9ec823/flex-error-0.4.4/src/tracer_impl/eyre.rs:10:9

and the trace logs

[2022-12-23T22:30:49Z TRACE hyper::proto::h1::conn] maybe_notify; read_from_io blocked
[2022-12-23T22:30:49Z TRACE want] signal: Want
[2022-12-23T22:30:49Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Init, writing: Init, keep_alive: Idle }
[2022-12-23T22:30:49Z TRACE want] signal: Want
[2022-12-23T22:30:49Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Init, writing: Init, keep_alive: Idle }
[2022-12-23T22:30:49Z TRACE hyper::client::pool] put; add idle connection for ("http", 167.99.177.244:26657)
[2022-12-23T22:30:49Z DEBUG hyper::client::pool] pooling idle connection for ("http", 167.99.177.244:26657)
[2022-12-23T22:30:49Z DEBUG tendermint_rpc::client::transport::http::sealed] Incoming response: {
      "jsonrpc": "2.0",
      "error": {
        "code": -32600,
        "message": "Invalid Request",
        "data": "error reading request body: http: request body too large"
      }
    }
serde parse error

Caused by:
    missing field `id` at line 8 column 1

Location:
    /Users/ewoolsey/.cargo/registry/src/github.com-1ecc6299db9ec823/flex-error-0.4.4/src/tracer_impl/eyre.rs:10:9

Everything works fine with small .wasm files < 300kB

Large ones > 530kB cause this error. The exact same message is working on a different build using tendermint_rpc 0.27

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.