Code Monkey home page Code Monkey logo

cw-template's Introduction

CosmWasm Starter Pack

This is a template to build smart contracts in Rust to run inside a Cosmos SDK module on all chains that enable it. To understand the framework better, please read the overview in the cosmwasm repo, and dig into the cosmwasm docs. This assumes you understand the theory and just want to get coding.

Creating a new repo from template

Assuming you have a recent version of Rust and Cargo installed (via rustup), then the following should get you a new repo to start a contract:

Install cargo-generate and cargo-run-script. Unless you did that before, run this line now:

cargo install cargo-generate --features vendored-openssl
cargo install cargo-run-script

Now, use it to create your new contract. Go to the folder in which you want to place it and run:

Latest

cargo generate --git https://github.com/CosmWasm/cw-template.git --name PROJECT_NAME

For cloning minimal code repo:

cargo generate --git https://github.com/CosmWasm/cw-template.git --name PROJECT_NAME -d minimal=true

You will now have a new folder called PROJECT_NAME (I hope you changed that to something else) containing a simple working contract and build system that you can customize.

Create a Repo

After generating, you have a initialized local git repo, but no commits, and no remote. Go to a server (eg. github) and create a new upstream repo (called YOUR-GIT-URL below). Then run the following:

# this is needed to create a valid Cargo.lock file (see below)
cargo check
git branch -M main
git add .
git commit -m 'Initial Commit'
git remote add origin YOUR-GIT-URL
git push -u origin main

CI Support

We have template configurations for both GitHub Actions and Circle CI in the generated project, so you can get up and running with CI right away.

One note is that the CI runs all cargo commands with --locked to ensure it uses the exact same versions as you have locally. This also means you must have an up-to-date Cargo.lock file, which is not auto-generated. The first time you set up the project (or after adding any dep), you should ensure the Cargo.lock file is updated, so the CI will test properly. This can be done simply by running cargo check or cargo unit-test.

Using your project

Once you have your custom repo, you should check out Developing to explain more on how to run tests and develop code. Or go through the online tutorial to get a better feel of how to develop.

Publishing contains useful information on how to publish your contract to the world, once you are ready to deploy it on a running blockchain. And Importing contains information about pulling in other contracts or crates that have been published.

Please replace this README file with information about your specific project. You can keep the Developing.md and Publishing.md files as useful references, but please set some proper description in the README.

cw-template's People

Contributors

0xjame5 avatar callum-a avatar chipshort avatar clevinson avatar crnch avatar dariuszdepta avatar ethanfrey avatar gachouchani1999 avatar iboss-ptk avatar itshaseebsaeed avatar jeremyfee avatar maurolacy avatar mbbrainz avatar mikedotexe avatar mnkhod avatar nseguias avatar orkunkl avatar puneet2019 avatar rtviii avatar samgozman avatar scalalang2 avatar tac0turtle avatar tacolopo avatar ueco-jb avatar uint avatar webmaster128 avatar

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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cw-template's Issues

Leaner template

Hey folks, we've been writing a lot of smart contracts with this template over the last week, and we've really noticed that there's a lot going on in the template that we are removing every time.

It would be good to make a much leaner version that is only exposing the entrypoints and basic file structure with errors and whatnot.

Opening this as a starting point for discussion ๐Ÿ™‚ hopefully other devs can chime in with what a minimal template would look like to them.

Update template to 0.6

Make sure this works well with cosmwasm 0.6 as a proper starting point. Also check out cosmwasm-opt integration

Add Integration Package tests

One pattern I think would benefit new cosmwasm developers would be to have a scaffold for integration tests by creating a new package called test in the main directory.

Having a seperate folder package for integration tests might provide more clarity toward the functionality of each unit tests in the src package. More complex testing that requires instantiation and sequences of executing and query could then be pulled out to integration tests. Thoughts?

One con is that this might be defining too much of the behavior to users (and forces them into following this pattern).

Use a sample app with enum in HandleMsg

This is the standard workflow and we should demonstate it.

We can also simplify the logic and just have a counter app with an initial count, and:

enum HandleMsg {
  Increment{num: i64},
  Decrement{num: i64},
}

It just demonstrates a more fully-fledged skeleton with less app logic

RPC error during uploading contract

Error: rpc error: code = NotFound desc = rpc error: code = NotFound desc = account wasm1emfs7gk3jmtcnp2wfnapt2zp6ll6h5fk9mtdrn not found: key not found

I am running this command RES=$(wasmd tx wasm store ./cw_nameservice.wasm --from wallet $TXFLAG -y --output json), I have generated the key using the doc and can see it in my .home/wasmd directory

cargo run-script optimize "spurious network error"

When running
cargo run-script optimize

I get the error

Cache size                            0 bytes
Max cache size                       10 GiB
Building contract in /code ...
    Updating crates.io index
warning: spurious network error (2 tries remaining): failed to resolve address for github.com: Name does not resolve; class=Net (12)
warning: spurious network error (1 tries remaining): failed to resolve address for github.com: Name does not resolve; class=Net (12)
error: failed to get `cosmwasm-std` as a dependency of package `template v0.1.0 (/code)`

I checked in a different docker container, and I can access the internet from within the container... so not sure what's happening here.

Any ideas for how to solve this so I can build my contracts?

New template error for `k256` package for Cosmwasm 2

This issue should also be raised in cosmwasm-std repo but when creating a new template with the cosmwasm-std = 2.0 version we get this error:

error: failed to select a version for `k256`.
    ... required by package `cosmwasm-crypto v2.0.1`
    ... which satisfies dependency `cosmwasm-crypto = "^2.0.1"` of package `cosmwasm-std v2.0.1`
    ... which satisfies dependency `cosmwasm-std = "^2.0.1"` of package X
versions that meet the requirements `^0.13.3` are: 0.13.3

Consider renaming the library feature

Using the word "library" for the feature to determine if the contract is being imported is confusing (especially now that all contracts should be compiled with --lib).

I propose renaming the default feature in this template to "imported". That way new contracts can specify #[cfg_attr(not(feature = "imported"), entry_point)], which I think is much easier to read/understand for newcommers

test error with mock_dependencies

Update wasm-bindgen

I just updated cosmwasm-opt to a newer build system: CosmWasm/optimizer@af34cbb

As soon as this is published to dockerhub under the 0.5.2 tag, we should update the build process.

This requires the following in Cargo.toml:

[dependencies]
# needed for wasm-pack build process
wasm-bindgen = "0.2.55"

We also need to update the Readme. Maybe good to update existing examples as well

Wasm contract requires unavailable capabilities: {"cosmwasm_1_3"}

command:

$ cargo generate --git https://github.com/CosmWasm/cosmwasm-template.git --name my-first-contract -d minimal=false

$ cargo wasm

$ docker run --rm -v "$(pwd)":/code \
  --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
  cosmwasm/rust-optimizer-arm64:0.12.11
  
$ cosmwasm-check artifacts/my_first_contract-aarch64.wasm

log:

Available capabilities: {"iterator", "cosmwasm_1_1", "staking", "cosmwasm_1_2", "stargate"}

artifacts/my_first_contract-aarch64.wasm: failure
Error during static Wasm validation: Wasm contract requires unavailable capabilities: {"cosmwasm_1_3"}

Passes: 0, failures: 1

cosmwasm-check version: 1.2.3

$ cosmwasm-check --version
Contract checking 1.2.3

Install issue - error: failed to run custom build command for `openssl-sys v0.9.80`

This is probably not the place for this but in case someone else also encounters this error I will try to solve it and share the results here. When I run
cargo install cargo-generate --features vendored-openssl
I get:

Caused by:
process didn't exit successfully: C:\Users\PC\AppData\Local\Temp\cargo-installD3wUvn\release\build\openssl-sys-a7c49c2d5741077c\build-script-main (exit code: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rustc-cfg=openssl
cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR
X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR unset
cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
OPENSSL_NO_VENDOR unset
running "perl" "./Configure" "--prefix=C:\Users\PC\AppData\Local\Temp\cargo-installD3wUvn\release\build\openssl-sys-02ecb9bfd246b8a5\out\openssl-build\install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "no-asm" "VC-WIN64A"

--- stderr
thread 'main' panicked at 'called Result::unwrap() on an Err value: Error { kind: NotFound, message: "program not found" }', C:\Users\PC.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-src-111.25.0+1.1.1t\src\lib.rs:497:39
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile cargo-generate v0.17.6, intermediate artifacts can be found at C:\Users\PC\AppData\Local\Temp\cargo-installD3wUvn

What I tried so far is:
1- Installing strawberry perl. Didn't work.
2- This
3- This
Still trying to solve it.

Add gitpod support

Inspired by cosmos/cosmos-sdk#8090

We can set this up, so after creating a new contract from template, it will have gitpod support to edit it. Ideally, the cargo generate command can be part of that, but that seems a bit more complex.

The final result would be a user could click a button or two to open up a web IDE with a contract skeleton for their newly created contract (with their custom name). This should somehow be connected to a new github repo under their username. When they make the changes on gitpod, they get saved to their github repo.

Switch from circle to Github actions

Github Actions has nice support for rust: https://github.com/actions-rs

Currently, in the circle ci config, a rust version is being set, this may be on purpose but if not then switching to GitHub actions would make sense. Also easier for people who use this repo to get started with ci when its Github actions (they just have to push to a repo and the rest is handled by Github)

If people are up for this change I can knock this out quickly

Osmosis unknown interface version

I encountered the same issue mentioned #94

Error: rpc error: code = InvalidArgument desc = failed to execute message; message index: 0: Error calling the VM: Error during static Wasm validation: Wasm contract has unknown interface_version_* marker export (see https://github.com/CosmWasm/cosmwasm/blob/main/packages/vm/README.md): create wasm contract failed: invalid request

The steps to replicate here:
https://hackmd.io/SJPvNvIzSvq4ppl0vK50Rg

Basically I'm creating a brand new contract using cw-tenplate, compiled it, optimized it then getting that error during the upload process.

I will do additional testing.

Thanks!

Integration tests fail

When running cargo test on a brand new cw-template I get:

Finished test [unoptimized + debuginfo] target(s) in 0.02s
     Running unittests (target/debug/deps/ramon-a83cd65c19a8fc85)

running 4 tests
test contract::tests::proper_initialization ... ok
test contract::tests::increment ... ok
test contract::tests::reset ... ok
test integration_tests::tests::count::count ... FAILED

failures:

---- integration_tests::tests::count::count stdout ----
thread 'integration_tests::tests::count::count' panicked at 'called `Result::unwrap()` on an `Err` value: error executing WasmMsg:
sender: USER
Execute { contract_addr: "Contract #0", msg: Binary(7b22696e6372656d656e74223a7b7d7d), funds: [] }

Caused by:
    Generic error: Invalid input: address not normalized', src/integration_tests.rs:68:60
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Am I missing something?

Dependencies versions:

  • rustc version: rustc 1.60.0
  • cargo-generate v0.13.0
  • cargo-run-script v0.1.0

default CI failing for project using `cargo generate`

Is the CI supposed to be failing, when we create a new project using cargo generate --git https://github.com/CosmWasm/cosmwasm-template.git --name PROJECT_NAME?

Test-suite fail:

Run actions-rs/cargo@v1
  with:
    command: unit-test
    args: --locked
    use-cross: false
  env:
    RUST_BACKTRACE: 1
/usr/share/rust/.cargo/bin/cargo unit-test --locked
    Updating crates.io index
error: the lock file /home/runner/work/tenaroll/tenaroll/Cargo.lock needs to be updated but --locked was passed to prevent this
Error: If you want to try to generate the lock file without accessing the network, use the --offline flag.
Error: The process '/usr/share/rust/.cargo/bin/cargo' failed with exit code 101

Lints fail

Run actions-rs/cargo@v1
/usr/share/rust/.cargo/bin/cargo clippy -- -D warnings
   Compiling proc-macro2 v1.0.26
   Compiling typenum v1.13.0
   Compiling unicode-xid v0.2.2
   Compiling version_check v0.9.3
   Compiling syn v1.0.72
   Compiling libc v0.2.94
    Checking cfg-if v1.0.0
   Compiling getrandom v0.1.16
    Checking subtle v2.4.0
   Compiling serde_derive v1.0.126
   Compiling serde v1.0.126
    Checking funty v1.1.0
    Checking radium v0.3.0
    Checking wyz v0.2.0
    Checking zeroize v1.3.0
    Checking const-oid v0.4.5
error[E0658]: `if` is not allowed in a `const fn`
Error:    --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/lib.rs:126:21
    |
126 | /                     if arcs.len() > $n {
127 | |                         encoder = encoder.encode(arcs[$n]);
128 | |                     }
    | |_____________________^
...
133 |           encode_arc!(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
    |           -------------------------------------------------- in this macro invocation
    |
    = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: `match` is not allowed in a `const fn`
Error:    --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/encoder.rs:102:5
    |
102 | /     match index {
103 | |         4 => 3,
104 | |         3 => 2,
105 | |         2 => 1,
...   |
110 | |         }
111 | |     }
    | |_____^
    |
    = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information

error[E0658]: `match` is not allowed in a `const fn`
Error:    --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/encoder.rs:116:5
    |
116 | /     match arc {
117 | |         0..=0x7f => 0,
118 | |         0x80..=0x3fff => 1,
119 | |         0x4000..=0x1fffff => 2,
120 | |         0x200000..=0x1fffffff => 3,
121 | |         _ => 4,
122 | |     }
    | |_____^
    |
    = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information

error[E0658]: `match` is not allowed in a `const fn`
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/encoder.rs:44:9
   |
44 | /         match self.state {
45 | |             State::Initial => {
46 | |                 const_assert!(arc <= FIRST_ARC_MAX, "invalid first arc (must be 0-2)");
47 | |                 self.state = State::FirstArc(arc);
...  |
70 | |             }
71 | |         }
   | |_________^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information

error[E0658]: `if` is not allowed in a `const fn`
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/encoder.rs:85:20
   |
85 |         let mask = if continued { 0b10000000 } else { 0 };
   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information

error[E0658]: `if` is not allowed in a `const fn`
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/encoder.rs:87:9
   |
87 | /         if n > 0x80 {
88 | |             self.bytes[self.cursor + i] = (n & 0b1111111) as u8 | mask;
89 | |             n >>= 7;
90 | |
...  |
95 | |             self
96 | |         }
   | |_________^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information

error[E0658]: `match` is not allowed in a `const fn`
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/parser.rs:78:5
   |
78 | /     match char {
79 | |         b'0' => 0,
80 | |         b'1' => 1,
81 | |         b'2' => 2,
...  |
92 | |         }
93 | |     }
   | |_____^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information

error[E0658]: `match` is not allowed in a `const fn`
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/parser.rs:90:27
   |
90 |             const_assert!(matches!(other, b'0'..=b'9'), "invalid ASCII digit");
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: `match` is not allowed in a `const fn`
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/parser.rs:22:13
   |
22 |             matches!(bytes[0], b'0'..=b'9'),
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: `match` is not allowed in a `const fn`
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/parser.rs:42:9
   |
42 | /         match bytes {
43 | |             [] => {
44 | |                 self.encoder = self.encoder.encode(self.current_arc);
45 | |                 self
...  |
70 | |             }
71 | |         }
   | |_________^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information

error[E0658]: `match` is not allowed in a `const fn`
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/parser.rs:63:21
   |
63 |                     matches!(byte, b'0'..=b'9' | b'.'),
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: or-pattern is not allowed in a `const fn`
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/const-oid-0.4.5/src/parser.rs:63:21
   |
63 |                     matches!(byte, b'0'..=b'9' | b'.'),
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #49146 <https://github.com/rust-lang/rust/issues/49146> for more information
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 12 previous errors
Error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0658`.
error: could not compile `const-oid`.
Error: could not compile `const-oid`.
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
Warning: error: build failed
Error: The process '/usr/share/rust/.cargo/bin/cargo' failed with exit code 101

Deploying smart contract from template fails due to an unknown interface version

Following the deployment example from the documentation deploying the smart contract generated by this template fails:

Error: rpc error: code = InvalidArgument desc = failed to execute message; message index: 0: Error calling the VM: Error during static Wasm validation: Wasm contract has unknown interface_version_* marker export (see https://github.com/CosmWasm/cosmwasm/blob/main/packages/vm/README.md): create wasm contract failed: invalid request

It seems like this starts with this commit which upgrades the cosmwasm-std version to 1.0.0-beta. Rolling the dependencies back to:

cosmwasm-std = { version = "0.16" }
cosmwasm-storage = { version = "0.16" }
cw-storage-plus = "0.9"
cw2 = "0.9"

Appears to resolve the issue.

Rust optimizer doesn't work in Mac

  • OS: OS X M1

I had been struggling to study cosmwasm smart contracts.
And I found that cargo run-script optimize doesn't work as I expected.

You can reproduce this issue through below.

$ cargo generate --git https://github.com/CosmWasm/cw-template.git --branch 0.8 --name test
$ cargo wasm
$ cargo schema
$ cargo run-script optimize

Running script 'optimize': 'docker run --rm -v "$(pwd)":/code --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry cosmwasm/rust-optimizer:0.12.4
'
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Info: RUSTC_WRAPPER=sccache
Info: sccache stats before build
Compile requests                      0
Compile requests executed             0
Cache hits                            0
Cache misses                          0
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                   0
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average cache read miss           0.000 s
Average cache read hit            0.000 s
Failed distributed compilations       0
Cache location                  Local disk: "/root/.cache/sccache"
Cache size                            0 bytes
Max cache size                       10 GiB
Building contract in /code ...
    Updating crates.io index
Killed
Finished, status of exit status: 13

And there is one thing I'm curious.
Does the below message mean that I should execute cargo run-script. optimize command on linux os only?

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Update template to CosmWasm 0.14.0

You could make a PR based on v0.14.0-beta1 now, and then just update and merge once v0.14.0 is out.
Not a high priority, but it would be good to have this repo ready as soon as v0.14.0 is cut.

Add cw-storage, cleaner structure

With cosmwasm 0.6.1, let's enhance the template.

  1. Use cw-storage to handle the data persistence layer, to give a good example of how that works
  2. Break contract.rs into a few files. msg.rs will hold all data structures for the api, state.rs will hold all internal state structs, as well as cw-storage wrappers (Singleton, Typed/PrefixedStorage). contract.rs can then just hold the high-level business logic, which is nice for larger contracts so they are no unweildy.

my_first_contract.wasm interraction error

Hi everyone,

At this step of the main tutorial: https://docs.terra.money/contracts/tutorial/interacting.html#uploading-code

We have a file in the 'artifacts' folder named 'my_first_contract.wasm'.
We are supposed to run this command: terracli tx wasm store my-first-contract.wasm --from test1 --chain-id=localterra --gas=auto --fees=100000uluna --broadcast-mode=block

This command fails (at least in Ubuntu 20.x.x LTS).
The "_" character isn't recognised correctly by the command AND the command is searching for a file in the root of the working directory.
That's why you need to rename the file, removing every "_" AND specify the path in the command.

This is the correct command to run terracli tx wasm store artifacts/myfirstcontract.wasm --from test1 --chain-id=localterra --gas=auto --fees=100000uluna --broadcast-mode=block.

Special thank's to davidkohcw#4184

gitpod template comments

Hello!
I'm relatively new to ComsWasm and Gitpod, but I found a number of inconsistencies between the template and gitpod documentation, so I'd like to comment on them and may be I am wrong somewhere, please ignore me then.

.gitpod.Dockerfile and .gitpod.yml are inconsistent

.gitpod.yml says that as a base image cosmwasm/cw-gitpod-base:v0.16, so it is not using .gitpod.Dockerfile. I think the file should be dropped for consistency.

Extension rust-lang.rust is outdated

VSCode recommends to replace it with rust-lang.rust-analyzer

I'm happy to send a pull request if what I'm saying makes sense

Thank you!

Installation issues

Readme install instructions dont seem to work

cargo install cargo-generate cargo-run-script --features vendored-openssl 
    Updating crates.io index
  Downloaded cargo-generate v0.10.1
  Downloaded 1 crate (72.8 KB) in 1.26s
  Installing cargo-generate v0.10.1
  Downloaded liquid v0.23.0
  Downloaded kstring v1.0.5
  Downloaded indicatif v0.16.2
  Downloaded smartstring v0.2.9
  Downloaded thiserror-impl v1.0.30
  Downloaded unicode-width v0.1.9
  Downloaded sanitize-filename v0.3.0
  Downloaded git2 v0.13.21
  Downloaded rhai_codegen v1.0.0
  Downloaded thiserror v1.0.30
  Downloaded rhai v1.0.6
  Downloaded liquid-lib v0.23.0
  Downloaded proc-quote v0.4.0
  Downloaded globset v0.4.8
  Downloaded bstr v0.2.17
  Downloaded path-absolutize v3.0.11
  Downloaded libgit2-sys v0.12.22+1.1.0
  Downloaded number_prefix v0.4.0
  Downloaded dirs v4.0.0
  Downloaded path-dedot v3.0.14
  Downloaded anymap2 v0.13.0
  Downloaded liquid-derive v0.23.0
  Downloaded liquid-core v0.23.0
  Downloaded openssl-src v111.16.0+1.1.1l
  Downloaded 24 crates (7.7 MB) in 1.87s (largest was `openssl-src` at 5.1 MB)
   Compiling libc v0.2.103
   Compiling proc-macro2 v1.0.29
   Compiling unicode-xid v0.2.2
   Compiling autocfg v1.0.1
   Compiling syn v1.0.80
   Compiling pkg-config v0.3.20
   Compiling cfg-if v1.0.0
   Compiling memchr v2.4.1
   Compiling version_check v0.9.3
   Compiling serde_derive v1.0.130
   Compiling once_cell v1.8.0
   Compiling regex-syntax v0.6.25
   Compiling proc-macro-hack v0.5.19
   Compiling serde v1.0.130
   Compiling ucd-trie v0.1.3
   Compiling lazy_static v1.4.0
   Compiling maplit v1.0.2
   Compiling unicode-width v0.1.9
   Compiling percent-encoding v2.1.0
   Compiling tinyvec_macros v0.1.0
   Compiling log v0.4.14
   Compiling matches v0.1.9
   Compiling either v1.6.1
   Compiling bitflags v1.3.2
   Compiling ppv-lite86 v0.2.10
   Compiling unicode-segmentation v1.8.0
   Compiling anymap2 v0.13.0
   Compiling unicode-bidi v0.3.7
   Compiling crossbeam-utils v0.8.5
   Compiling doc-comment v0.3.3
   Compiling static_assertions v1.1.0
   Compiling anyhow v1.0.44
   Compiling ansi_term v0.11.0
   Compiling semver v1.0.4
   Compiling foreign-types-shared v0.1.1
   Compiling strsim v0.8.0
   Compiling openssl v0.10.36
   Compiling fnv v1.0.7
   Compiling remove_dir_all v0.5.3
   Compiling vec_map v0.8.2
   Compiling same-file v1.0.6
   Compiling openssl-probe v0.1.4
   Compiling smallvec v1.7.0
   Compiling number_prefix v0.4.0
   Compiling zeroize v1.4.2
   Compiling home v0.5.3
   Compiling num-traits v0.2.14
   Compiling num-integer v0.1.44
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling ahash v0.7.4
   Compiling path-dedot v3.0.14
   Compiling thread_local v1.1.3
   Compiling pest v2.1.3
   Compiling tinyvec v1.5.0
   Compiling textwrap v0.11.0
   Compiling form_urlencoded v1.0.1
   Compiling itertools v0.10.1
   Compiling heck v0.3.3
   Compiling smartstring v0.2.9
   Compiling foreign-types v0.3.2
   Compiling walkdir v2.3.2
   Compiling path-absolutize v3.0.11
   Compiling unicode-normalization v0.1.19
   Compiling pest_meta v2.1.3
   Compiling aho-corasick v0.7.18
   Compiling bstr v0.2.17
   Compiling quote v1.0.10
   Compiling getrandom v0.2.3
   Compiling time v0.1.43
   Compiling terminal_size v0.1.17
   Compiling atty v0.2.14
   Compiling dirs-sys v0.3.6
   Compiling remove_dir_all v0.7.0
   Compiling jobserver v0.1.24
   Compiling regex v1.5.4
   Compiling rand_core v0.6.3
   Compiling idna v0.2.3
   Compiling proc-quote-impl v0.3.2
   Compiling clap v2.33.3
   Compiling dirs v4.0.0
   Compiling cc v1.0.71
   Compiling rand_chacha v0.3.1
   Compiling url v2.2.2
   Compiling console v0.14.1
   Compiling globset v0.4.8
   Compiling sanitize-filename v0.3.0
   Compiling rand v0.8.4
   Compiling openssl-src v111.16.0+1.1.1l
   Compiling chrono v0.4.19
   Compiling ignore v0.4.18
   Compiling indicatif v0.16.2
   Compiling libz-sys v1.1.3
   Compiling libssh2-sys v0.2.21
   Compiling libgit2-sys v0.12.22+1.1.0
   Compiling proc-quote v0.4.0
   Compiling pest_generator v2.1.3
   Compiling openssl-sys v0.9.67
   Compiling tempfile v3.2.0
   Compiling dialoguer v0.8.0
   Compiling liquid-derive v0.23.0
   Compiling pest_derive v2.1.0
   Compiling rhai_codegen v1.0.0
   Compiling structopt-derive v0.4.16
   Compiling thiserror-impl v1.0.30
   Compiling rhai v1.0.6
   Compiling structopt v0.3.23
   Compiling thiserror v1.0.30
   Compiling kstring v1.0.5
   Compiling toml v0.5.8
   Compiling liquid-core v0.23.0
   Compiling liquid-lib v0.23.0
   Compiling liquid v0.23.0
   Compiling git2 v0.13.21
   Compiling cargo-generate v0.10.1
    Finished release [optimized] target(s) in 2m 58s
   Replacing /home/anon/.cargo/bin/cargo-generate
    Replaced package `cargo-generate v0.6.1` with `cargo-generate v0.10.1` (executable `cargo-generate`)
  Downloaded cargo-run-script v0.1.0
  Downloaded 1 crate (6.7 KB) in 1.81s
  Installing cargo-run-script v0.1.0
error: failed to compile `cargo-run-script v0.1.0`, intermediate artifacts can be found at `/tmp/cargo-install02B0OY`

Caused by:
  Package `cargo-run-script v0.1.0` does not have the feature `vendored-openssl`
     Summary Successfully installed cargo-generate! Failed to install cargo-run-script (see error(s) above).
error: some crates failed to install
โžœ  backer cargo install cargo-generate cargo-run-script --features vendored-openssl
    Updating crates.io index
     Ignored package `cargo-generate v0.10.1` is already installed, use --force to override
  Installing cargo-run-script v0.1.0
error: failed to compile `cargo-run-script v0.1.0`, intermediate artifacts can be found at `/tmp/cargo-installngcqPT`

Caused by:
  Package `cargo-run-script v0.1.0` does not have the feature `vendored-openssl`
     Summary Successfully installed cargo-generate! Failed to install cargo-run-script (see error(s) above).
error: some crates failed to install
โžœ  backer cargo --version                                                          
cargo 1.55.0 (32da73ab1 2021-08-23)

Unit test not working

When running Unit Test, without any modification to the template i get these error

rustc --version        
rustc 1.59.0 (9d1b2106e 2022-02-23)

cargo --version
cargo 1.59.0 (49d8809dc 2022-02-10)
% RUST_BACKTRACE=1 cargo unit-test

error[E0308]: mismatched types
   --> /Users/dimi/.cargo/registry/src/github.com-1ecc6299db9ec823/cw-multi-test-0.12.1/src/wasm.rs:439:29
    |
439 |                       result: ContractResult::Ok(SubMsgExecutionResponse {
    |  _____________________________^
440 | |                         events: r.events.clone(),
441 | |                         data: r.data,
442 | |                     }),
    | |______________________^ expected enum `SubMsgResult`, found enum `ContractResult`
    |
    = note: expected enum `SubMsgResult`
               found enum `ContractResult<SubMsgExecutionResponse>`

error[E0308]: mismatched types
   --> /Users/dimi/.cargo/registry/src/github.com-1ecc6299db9ec823/cw-multi-test-0.12.1/src/wasm.rs:460:29
    |
460 |                     result: ContractResult::Err(e.to_string()),
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `SubMsgResult`, found enum `ContractResult`
    |
    = note: expected enum `SubMsgResult`
               found enum `ContractResult<_>`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `cw-multi-test` due to 2 previous errors

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.