Code Monkey home page Code Monkey logo

generator-fabric's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

generator-fabric's Issues

Add in a Java Contract Example

The interfaces and basic implementation are now in the fabric-chaincode-java master branch. So worth following this with a sample contract in the generator.

With the latest 1.4.1 ContractAPI, the context stub needs updating

With the ability in the upcoming 1.4.1 contract api, the context needs updating to support the contract level logging capabiliites.

A tx function can now use a standard logger class to route it's output, as well as control log levels. It allows devs to move away from the 'console.log' style of debugging.

As a developer, I can use service discovery with the local Fabric

Generator work for this VSCode issue:
IBM-Blockchain/blockchain-vscode-extension#776

In order to get service discovery working with the local Fabric, we need to both dynamically assign ports for the local Fabric, then edit the configtx.yaml configuration (to set the correct endpoints for the orderer and the anchor peers), and then regenerate the crypto-config and config transactions/blocks.

This requires a bunch of search/replace in files that would be better placed in the Yeoman generator, rather than within the VSCode codebase.

The plan is to add a fabric:network subgenerator that VSCode can use to generate a 1 organisation, 1 peer local Fabric network which is correctly configured for service discovery.

Generated projects in VS Code should provide debug configuration

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "fabric:node",
            "request": "launch",
            "name": "Debug Smart Contract"
        }
    ]
}

Extend TypeScript debug launch configuration

We need to add the following parameters to a default generated TypeScript smart contract:

"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": [
    "${workspaceFolder}/dist/**/*.js"
]

Generator should automatically install project dependencies

When you run the generator inside a tool like Visual Studio Code, the project will instantly show errors until the dependencies are manually installed using npm install. The Yeoman documentation strongly suggests that you should install the dependencies for the users as part of the generator:
http://yeoman.io/authoring/dependencies.html

Will extend the generator to run npm install automatically for both the chaincode and contract subgenerators.

Add VSCode debug configuration for Go smart contracts

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "fabric:go",
            "request": "launch",
            "name": "Debug Smart Contract"
        }
    ]
}

Add VSCode debug configuration for Java smart contracts

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "fabric:java",
            "request": "launch",
            "name": "Debug Smart Contract"
        }
    ]
}

Improve resiliency of network generation

If the generate.sh script of a network fails midway, for example during configtxgen, or if the user deletes all Docker containers (but not volumes) and file system data - the is_generated.sh script returns 0, but the network cannot possibly start.

We need to update the generate.sh script such that:

  • It performs a teardown at the start to clean up whatever is around
  • It touches a generate.complete file at the end

We need to update the is_generated.sh script such that:

  • It checks for the generate.complete file, and returns 1 if it does not exist

java contract generator tests could be better

the tests are generated like


            String json = "{\"value\":\"TheAsset\"}";

            contract.createPenguin(ctx, "10001", "TheAsset");

could TheAsset be whatever type of asset you create e.g. ThePenguin

Generated projects should recommend programming language extensions

Generated Go projects should recommend the Go extensions, and generated Java projects should recommend the Java extensions - this will help ensure the extensions are available when the user tries to debug the generated project using the IBM Blockchain Platform extension for VS Code.

Use best practice npm techniques (including audit, package-lock, and shrinkwrap)

  • The build should fail if npm audit finds any vulnerabilities

  • We should check in the package-lock.json file as per the official guidance from npm:

https://docs.npmjs.com/files/package-locks#using-locked-packages

It is highly recommended you commit the generated package lock to source control: this will allow anyone else on your team, your deployments, your CI/continuous integration, and anyone else who runs npm install in your package source to get the exact same dependency tree that you were developing on. Additionally, the diffs from these changes are human-readable and will inform you of any changes npm has made to your node_modules, so you can notice if any transitive dependencies were updated, hoisted, etc.

This will stop us being taken out by breaking downstream package changes such as the recent changes to the sinon module.

  • We should run npm shrinkwrap before publishing the code.

Generate either 1.4.x fabric or 2.0

Allow the generated fabric network to be 1.4.x or 2.0

Generator changes needed for 2.0:

  • update docker compose file to change 1.4.1 to 2.0
  • update generator.sh and generator.cmd to change 1.4.1 to 2.0
  • add ordererchannel in orderer genesis block thing in generator.sh and generator.cmd

Add integration tests for Go generator

The integration tests currently only cover the JavaScript and TypeScript chaincode generators, they should also cover the Go chaincode generator as well. I only left it out the first time round because I'm too lazy to add some if blocks.

As a user, input should be validated

At the moment, there is no validation for user input (both running the generator normally and passing arguments to the command). It would be beneficial to validate user input, as it would prevent errors from occurring.

Upgrade generator to Fabric v1.3

The generator needs to be upgraded to Fabric v1.3, so that we can begin work on implementing a smart contract generator for the new smart contracts with transaction functions being delivered under FAB-11246.

I propose that we separate chaincode and contract generator for now, as Go support for contracts will not be delivered until Fabric v1.4 (and people may want to use the old style contracts).

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.