Giter VIP home page Giter VIP logo

wasmd's Introduction

Finschia

codecov license LoC Go Report Card GolangCI

This repository hosts Finschia. This repository is forked from gaia at 2021-03-15. Finschia is a mainnet app implementation using finschia-sdk, ostracon, wasmd and ibc-go.

Node: Requires Go 1.20+

Warnings: Initial development is in progress, but there has not yet been a stable.

Quick Start

Docker

Build Docker Image

make docker-build                # build docker image

or

make docker-build WITH_CLEVELDB=yes GITHUB_TOKEN=${YOUR_GITHUB_TOKEN}  # build docker image with cleveldb

Note1

If you are using M1 mac, you need to specify build args like this:

make docker-build ARCH=arm64

Configure

sh init_single.sh docker          # prepare keys, validators, initial state, etc.

or

sh init_single.sh docker testnet  # prepare keys, validators, initial state, etc. for testnet

Run

docker run -i -p 26656:26656 -p 26657:26657 -v ${HOME}/.finschia:/root/.finschia finschia/finschianode fnsad start

Local

Build

make build
make install 

Configure

sh init_single.sh

or

sh init_single.sh testnet  # for testnet

Run

fnsad start                # Run a node

visit with your browser

Localnet with 4 nodes

Run

make localnet-start

Stop

make localnet-stop

How to contribute

check out CONTRIBUTING.md for our guidelines & policies for how we develop Finschia. Thank you to all those who have contributed!

wasmd's People

Contributors

alessio avatar alexanderbez avatar alpe avatar anilcse avatar assafmo avatar colin-axner avatar dependabot-preview[bot] avatar dependabot[bot] avatar ethanfrey avatar faddat avatar fedekunze avatar fkneeland-figure avatar gamarin2 avatar jhernandezb avatar loloicci avatar maurolacy avatar orkunkl avatar pinosu avatar puneet2019 avatar reuvenpo avatar rigelrozanski avatar sabau avatar sahith-narahari avatar shiki-tak avatar sunnya97 avatar tac0turtle avatar the-frey avatar vuong177 avatar webmaster128 avatar zemyblue avatar

Stargazers

 avatar

wasmd's Issues

bump up wasmd v0.31

bump up to cosmwasm/wasmd v0.31

dependency

  • cosmwasm/wasmvm: v1.2.0
  • cosmwasm/cosmwasm-std: v1.0-1.2

Redesign `callablePointSDKEventAttributes` function

This function came from #26.

It's a bit weird that the callstack comes first, so move it to the tail.

func callablePointSDKEventAttributes(customAttributes []wasmvmtypes.EventAttribute, contractAddr sdk.AccAddress, callstack []byte) ([]sdk.Attribute, error) {
attrs, err := wasmkeeper.ContractSDKEventAttributes(customAttributes, contractAddr)
if err != nil {
return nil, err
}
// attrs[0] is addr
attrs = append([]sdk.Attribute{attrs[0], sdk.NewAttribute(wasmplustypes.AttributeKeyCallstack, string(callstack))}, attrs[1:]...)
return attrs, nil
}

Not good condition to handle MsgStoreCodeAndInstantiateContract

if err != nil && strings.Contains(err.Error(), "MsgStoreCodeAndInstantiateContract") {

This handler case is caused by "x/wasm/handler"'s "ErrorMsg". This condition is true when the message contains "MsgStoreCodeAndInstantiateContract" even if the message kind is not "MsgStoreCodeAndInstantiateContract".

Change it the condition is true iff the message kind is "MsgStoreCodeAndInstantiateContract".

Propose methods to completely separate the functions of dynamic_link into wasmplus

At present #22, only partial separation has been made for dynamic link branch of wasmd, so consider how to do this.


The following methods were used for implementation.

In #36, moved dynamic_link branch functionality to wasmplus.

It is implemented in the following way.

  1. Define the interface of the function defined in x/wasmplus/keeper.go in x/wasm/keeper.go.
  2. In x/wasm, functions and variables to be exposed to the outside world are defined as other variables in exported_*.go, in order to reduce differences from the original.
  3. Access the functions defined in x/wasmplus/api.go via the interface in x/wasm/keeper.go.

TestExecuteManualInactiveContractFailure does not check whether the contract is active or not

func TestExecuteManualInactiveContractFailure(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, AvailableCapabilities)
keeper := keepers.ContractKeeper
deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000))
topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000))
creator := keepers.Faucet.NewFundedRandomAccount(ctx, deposit...)
fred := keepers.Faucet.NewFundedRandomAccount(ctx, topUp...)
wasmCode, err := os.ReadFile("./testdata/hackatom.wasm")
require.NoError(t, err)
contractID, _, err := keeper.Create(ctx, creator, wasmCode, nil)
require.NoError(t, err)
_, _, bob := keyPubAddr()
initMsg := HackatomExampleInitMsg{
Verifier: fred,
Beneficiary: bob,
}
initMsgBz, err := json.Marshal(initMsg)
require.NoError(t, err)
addr, _, err := keeper.Instantiate(ctx, contractID, creator, nil, initMsgBz, "demo contract 3", deposit)
require.NoError(t, err)
require.Equal(t, "link14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sgf2vn8", addr.String())
}

Add `wasmvm.GoAPI` field to the keeper structure

The method #36 cannot be executed in x/wasm alone, because it uses the x/wasmplus functionality within x/wasm.

Then, instead of pluskeeper, which was added in #36, add an interface of wasmvm.GoAPI to the structure of keeper.
This allows the implementation of this interface to freely change the contents of the API.

Enable the use of wasmplus's `IsInactiveContract()` in cosmwasmAPI

In the dynamic_link branch separated process, the following function of wasmplus cannot be used in the #22 separated method due to circular reference problems.

Separation must be done by another method

func (k Keeper) IsInactiveContract(ctx sdk.Context, contractAddress sdk.AccAddress) bool {
store := ctx.KVStore(k.storeKey)
return store.Has(types.GetInactiveContractKey(contractAddress))
}

wasmvm module not exist

When I run wasmd start, wasmvm module not exist error is occurred.

$ ./build/wasmd start
Error: wasmvm module not exist
Usage:
  wasmd start [flags]

commit hash: 577e450 (main branch)

MsgStoreCodeAndInstantiateContract amino signature verify fail

MsgStoreCodeAndInstantiateContract amino signature verify fails because wrong amino codec is being used in MsgStoreCodeAndInstantiateContract::GetSignBytes(). Now wasm's amino codec is being used not wasmplus's amino codec.
https://github.com/line/wasmd/blob/main/x/wasmplus/types/tx.go#L54

And I got one more error.
https://github.com/line/wasmd/blob/main/x/wasmplus/types/codec.go#L19
when registering amino msg in codec, amino message type name is wrong.
currently "wasm/StoreCodeAndInstantiateContract", this should be "wasm/MsgStoreCodeAndInstantiateContract" like other messages.

Research about standard interface detection.

Summary

Research about standard interface detection.

  • Research on function that can replace EVM's function selector.
  • Defining standard interface detection protocol.
  • Suggest a way to use an external library like inheritance from wasm.

Problem Definition

We need to know whether a specific smart contract supports a specific protocol, so that the smart contract can be excute and searched without errors in other smart contracts. For this purpose, in the case of EVM, the function of a function selector is provided. Let's see if there is a function that can replace EVM's function selector function that can distinguish a specific function from the wasm binary even in wasm of lbm-sdk.

If that feature doesn't exist, find out how to replace it.

Inheritance is not supported like EVM throught rustlang, the smart contract development language of cosmwasm. Then, we also suggest how to make a protocol such as ERC-165 a library so that other smart contract developers can use it.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned

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.