Giter VIP home page Giter VIP logo

hyperledgendary / fabric-contract-api-rust Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 6.0 1.44 MB

A Technology Preview of using Rust Smart Contracts running in a Webassembly Chaincode for Hyperledger Fabric

Home Page: https://hyperledgendary.github.io/fabric-contract-api-rust/

License: Apache License 2.0

Rust 97.20% Shell 2.80%
blockchain fabric hyperledger hyperledger-fabric rust wasm webassembly

fabric-contract-api-rust's People

Contributors

anweiss avatar jt-nti avatar mbwhite avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fabric-contract-api-rust's Issues

Should the DataType trait methods return a result?

When implementing DataType for a particular type, none of the methods support returning a Result. This means that any type (asset) implementing DataType won't necessarily work with generic fields if the methods implemented in those fields require a Result.

For example:

pub struct MyAsset<T: SomeTrait> {
    uid: String,
    value: T,
}

impl<T: SomeTrait> DataType for MyAsset<T> {
    fn to_state(&self) -> State {
      State::from((self.uid.clone(), self.value.do_something()?))
    }
}

In this example, do_something() returns a result which isn't supported by the method on the DataType trait.

This may be by design to require anything that implements DataType to match State as closely as possible. Otherwise, it's unclear what kind of flexibility one has here.

Refactor runtime/wapc.rs to separate crate

When a innvocation comes in from the peer, waPC is called with the 'invokeTransaction' command; the payload is a protobuf that is decoded. It's then passed directly onto the ContractAPI for final routing and processing.

To make it easier to interact with different implementations it's worth looking into how to separate out this into it's own crate.

Support Default Contract

If a namespace is not supplied with the name of the transaction function we need a default.
(eg myTransaction rather than myContract:myTransaction

This should be the first one in the list of registered contracts.

version miss match

I am following the instructions on
https://hyperledgendary.github.io/fabric-contract-api-rust/guides/getting-started.html

I get to the part
docker exec humboldt.cli mknet.sh

2023-01-04 12:51:27.253 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- error applying config update to existing channel 'smallchannel': error authorizing update: error validating ReadSet: proposed update requires that key [Group] /Channel/Application be at version 0, but it is currently at version 1

Rust Contract/Ledger API: Disucssion

This issue is for noting queries/questions regarding the shape and details of the Rust API
Please add your views.

  • ClientIdentity: what fns does this really need? X509 certificate for example
  • String or &String or str or &str in the fns?
  • Iterators: confirm that these are idiomatic
  • Timestamp: best rust type for a point in time
  • Ensure visibility of fns is correct, don't expose internals.

Story: Logging

Current chaincodes can enable this by APIs available in contract functions, hence could be controlled by access control.. i.e. can't attempt denial-of-service attack by random person enabling trace.

wasm instantiation errors

I recently starting getting a number of errors when attempting to execute wasm chaincode built with Rust v1.46.0. Not sure what is causing these import errors.

12 link errors: (1 of 12) Import not found, namespace: __wbindgen_placeholder__, name: __wbindgen_describe (2 of 12) Import not found, namespace: __wbindgen_placeholder__, name: __wbg_self_1b7a39e3a92c949c (3 of 12) Import not found, namespace: __wbindgen_placeholder__, name: __wbg_crypto_968f1772287e2df0 (4 of 12) Import not found, namespace: __wbindgen_placeholder__, name: __wbg_getRandomValues_a3d34b4fee3c2869 (5 of 12) Import not found, namespace: __wbindgen_placeholder__, name: __wbg_getRandomValues_f5e14ab7ac8e995d (6 of 12) Import not found, namespace: __wbindgen_placeholder__, name: __wbg_require_604837428532a733 (7 of 12) Import not found, namespace: __wbindgen_placeholder__, name: __wbg_randomFillSync_d5bd2d655fdf256a (8 of 12) Import not found, namespace: __wbindgen_placeholder__, name: __wbindgen_is_undefined (9 of 12) Import not found, namespace: __wbindgen_placeholder__, name: __wbindgen_object_drop_ref (10 of 12) Import not found, namespace: __wbindgen_externref_xform__, name: __wbindgen_externref_table_grow (11 of 12) Import not found, namespace: __wbindgen_externref_xform__, name: __wbindgen_externref_table_set_null (12 of 12) Import not found, namespace: __wbindgen_placeholder__, name: __wbindgen_throw

Error when invoking update_state

When attempting to call Collection::update_state(key, data) against the World state, I get the following error:

Error: endorsement failure during query. response: status:500 message:"error invoking guest: Failed to call the `__guest_call` exported function."

Not sure if the implementation for this function is incomplete or if this is a legitimate bug. Looks to be generated from the wapc-guest crate.

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.