Coder Social home page Coder Social logo

concordium-contracts-common's People

Contributors

abizjak avatar amaurremi avatar annenkov avatar bargsteen avatar doben avatar gilescope avatar limemloh avatar lottekh avatar olexander-movchan avatar rasmus-kirk avatar simonkamp avatar soerenbf avatar target-san avatar vikt0r0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

concordium-contracts-common's Issues

Add schema type for byte arrays in hex format

Add a schema type for byte arrays in hex format. They should be represented with a JSON string.

This is especially useful with the new cryptographic primitives: Concordium/concordium-rust-smart-contracts#101

Will also require matching changes in cargo-concordium and concordium-client.

This will introduce a new contract schema version and require updating

  • Update in concordium-contracts-common
  • Support in cargo-concordium
  • Support in concordium-client
  • Update contract schema documentation.
  • Support in concordium-node-sdk-js

Inefficient serialization of String and &str.

Bug Description

&str should be serialized without allocating an intermediate vector.

We should implement a Serial for &[u8] and use that instead of using to_vec in serializing &str.

Event schema

Task description

Update concordium-contract-common to support event schema creation/serialization/deserialization.

Falied to deploy smart contract

Hi there,

Bug Description
I am trying deploy one of the smart contracts which is piggy_bank_part1. I can able to successfully build smart contracts. But when I try to deploy a smart contract it is throwing an error as shown below:

Using default energy amount of 3081316 NRG.
Deploy the module './target/wasm32-unknown-unknown/debug/piggy_bank_part1.wasm'.
Allowing up to 3081316 NRG to be spent as transaction fee.
Confirm [yN]: y
y
Deploying module...
concordium-client: user error (Cannot connect to GRPC server.)

Can any help me out the reason for deployment failure?

Thanks

Implement `Display` Trait for `SchemaTypes`

Task description

Adding the Display Trait and a function to display the schema in a human-readable manner. This is a prerequisite for adding a feature to cargo-concordium to decode and display schemas in a human-readable manner. We also intend to expose this functionality in the concordium-web-sdk so that front ends can decode/display schemas.

Implement the Error for errors

Currently the errors in this crate does not implement the Error trait, which is expected when using the types outside of smart contracts (like the Rust SDK).

We have to ensure that implementing Error does not impact smart contract code, when building using no_std and if so, it should be moved behind a feature flag.

Improve error reporting when serializing JSON using schema

Description

We could improve the error reporting when converting JSON parameters to binary using a schema in concordium-contracts-common. By improve, I mean that we could include a "stacktrace" to show where the incorrect value belongs. This is especially useful when the parameter is a struct or enum comprised of many fields.

So instead of giving the error Expected AccountAddress.
It should tell you this, but also include information about where it expects an account address. Similar to what concordium-client does:

Error: Could not decode parameters from file 'param.json' as JSON:
       Expected value of type "<AccountAddress>", but got: 123.
       In [
           123
       ].
       In enum variant '"Account"'.
       In field 'operator'.
       In {
           "operator": {
               "Account": [
                   123
               ]
           },
           "update": {
               "Remove": []
           }
       }.
       In [
           {
               "operator": {
                   "Account": [
                       123
                   ]
               },
               "update": {
                   "Remove": []
               }
           }
       ].

Since the JavaScript SDKs recently started using concordium-contracts-common for handling the JSON to binary conversion, this issue has become more important.

Implement `Deref` for `Owned*` to non-owned types (when Rust 1.65+)

Description

We have a few different types that have an owned and a reference version, fx OwnedContractName/ContractName, OwnedEntrypointName/EntrypointName.
Most of the useful methods are on the reference versions, and you can convert from the owned to the reference version via a method, fx owned_contract_name.as_contract_name(), and then use the useful methods there.

But it would be more ergonomic if we implemented Deref from the Owned to the reference version, so that you wouldn't need the conversion method.

However, we cannot implement Deref until we upgrade to Rust version 1.65+ which introduces Generic Associated Types (GATs). The issue is that we need to set the associated type Target to a type with a generic lifetime parameter: type Target = ContractName<'a>.

TransferFrom in SmartContracts

Smart contract approval allowance mechanism (Approving Allowances means authorizing the smart contract, in advance, to spend the tokens, without needing the private key to do that). ERC-20 has the TransferFrom method which does this. Source: Tacans

User stories

  • (4) Add a description for "Ethereum Developers" on the documentation site

`concordium-contracts-common`'s main has gone out of sync with `concordium-rust-smart-contracts` one

Description

concordium-contracts-common and concordium-rust-smart-contracts seem out of sync in terms of development flow.

  • CRSC's main references CCC's commit b65a456, while CCC's main is at 16e4521
  • CCC is being upgraded in CRSC to its main only in branch 258-use-public-keys, which seems to be long from being merged into CRSC's main

This prevents other PRs which perform synced changes to both repos being correctly developed.

Suggested fix

  • Create similar branch 258-use-public-keys in CCC, set to 16e4521
  • Make CRSC's 258-use-public-keys branch reference similarly named branch in CCC
  • Revert CCC's main to b65a456, making it in-sync with CRSC again

Steps to Reproduce

Check what CCC's commit is used as submodule in CRSC's main, and where's the actual CCC's main at

Expected Result

CCC's and CRSC's main branches are in sync

Actual Result

CCC's and CRSC's main branches are out of sync

Versions
N/A, concerns repository submodules

Replace `read_n_bytes` and `repeat_macro` macros with functions

Task description

This was not previously possible since we did not have const-generics, but since we now support 1.51+ only this is possible.

This should be straightforward, but we do need to make sure to inline things properly so that the generated wasm is the same.

Sub-tasks

  • Replace the use of macros.
  • Test compiling example smart contracts and ensure that the generated code is either the same, or at least no larger.

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.