Skip to content

Commit

Permalink
refrator:rewrite test, and actor logic
Browse files Browse the repository at this point in the history
  • Loading branch information
hunjixin committed Oct 21, 2022
1 parent 5d21018 commit c52ce84
Show file tree
Hide file tree
Showing 61 changed files with 971 additions and 829 deletions.
56 changes: 30 additions & 26 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@ Convert go contract to wasm and help wasm code run on fvm
2. implement fvm system call interface
3. pure modify library for running on fvm

## dependency

### Install wasm tools

download the latest release version from [wasm tools](https://github.com/WebAssembly/binaryen), and configure the corresponding bin path in the $PATH


### install modified tinygo

modify fmt to remove os refrence

```
git clone git@github.com:ipfs-force-community/tinygo.git
git checkout fvm
```

[build doc](https://tinygo.org/docs/guides/build/)

### dependency analyze

```
go list -json -deps > deps.json
```

### build and run hello-world contract
## Install

1. download the latest release version from [wasm tools](https://github.com/WebAssembly/binaryen), and configure the corresponding bin path in the $PATH
2. install [go](https://go.dev/doc/install) require v1.17+
3. install [tinygo](https://tinygo.org/getting-started/install/) require v0.26+
4. build go-fvm-sdk tool, tool will in path ``` target/release/go-fvm-sdk-tools```
```
git clone git@github.com:ipfs-force-community/go-fvm-sdk.git
make
```
5. use go-fvm-sdk-tools tool to patch your environment(go/tinygo)
```
go-fvm-sdk patch
```

this log meaning operate successfully
```log
patching file src/reflect/value.go
Hunk #1 succeeded at 754 (offset 3 lines).
patching file targets/wasi.json
patch unexpectedly ends in middle of line
Hunk #2 succeeded at 10 with fuzz 1.
```

### quick start this hello world actor
* Compile hellocontract to Wasm
```
git clone git@github.com:ipfs-force-community/go-fvm-sdk.git
Expand All @@ -50,4 +50,8 @@ go list -json -deps > deps.json
## Suggestion

1. Do not use asm code
2. Try not to use the reflect library, if you must use it, make sure that tinygo supports it.
2. Try not to use the reflect library, if you must use it, make sure that tinygo supports it.
3. use go list command to check actor dependency graph, check which package
```
go list -json -deps > deps.json
```
2 changes: 2 additions & 0 deletions examples/erc20/client_example/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ require (
github.com/filecoin-project/go-bitfield v0.2.4 // indirect
github.com/filecoin-project/go-commp-utils v0.1.3 // indirect
github.com/filecoin-project/go-commp-utils/nonffi v0.0.0-20220905160352-62059082a837 // indirect
github.com/filecoin-project/go-crypto v0.0.1 // indirect
github.com/filecoin-project/go-fil-commcid v0.1.0 // indirect
github.com/filecoin-project/go-hamt-ipld v0.1.5 // indirect
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 // indirect
Expand All @@ -48,6 +49,7 @@ require (
github.com/ipfs/go-ipld-format v0.4.0 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 // indirect
github.com/klauspost/cpuid/v2 v2.0.12 // indirect
github.com/libp2p/go-buffer-pool v0.0.2 // indirect
github.com/libp2p/go-flow-metrics v0.0.3 // indirect
Expand Down
85 changes: 12 additions & 73 deletions examples/erc20/contract/cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c52ce84

Please sign in to comment.