Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge upstream 0.16.3 #54

Merged
merged 134 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
dbbc84a
Move Rust project to libwasmvm folder
webmaster128 Jun 22, 2021
8ee9616
Format markdown
webmaster128 Jun 22, 2021
fcb3f91
Let builders not worry about final destination of shared libs
webmaster128 Jun 22, 2021
1eca6ce
Fix testing directory
webmaster128 Jun 22, 2021
0679b0e
Update Rust version to 1.53.0
webmaster128 Jun 22, 2021
4bedd7d
Update list of Alpine versions to test on
webmaster128 Jun 22, 2021
fb2951b
Fix testing directories
webmaster128 Jun 22, 2021
4cb9c9f
Fix paths to Cargo.lock
webmaster128 Jun 22, 2021
8a9b735
Upgrade sha2 to 0.9.5
webmaster128 Jun 22, 2021
50e0ce3
Merge pull request #217 from CosmWasm/move-rust-in-subfolder
webmaster128 Jun 22, 2021
06107e3
Remove dependency on libwasmvm_audit
webmaster128 Jun 22, 2021
8e89099
[skip ci] Built release libraries
Jun 22, 2021
dc58a4d
Update deps
uint Jun 22, 2021
bc170dc
Update tests
uint Jun 22, 2021
ed3a175
typo
uint Jun 22, 2021
bc84982
Update more tests
uint Jun 22, 2021
0935935
Go: add events to smart contract exec results
uint Jun 22, 2021
12725ad
Update cosmwasm to v0.15.0-alpha2
uint Jun 23, 2021
a595629
Update test contracts
uint Jun 23, 2021
9c222c1
Merge messages and submessages
uint Jun 23, 2021
b95717f
Fix some tests
uint Jun 23, 2021
fba2a89
Rename `send` to `funds`
uint Jun 23, 2021
7c3538b
Update gas costs in tests
uint Jun 23, 2021
e33a65b
Rename sub_call to sub_msg in tests
uint Jun 23, 2021
8c19040
Update memory cache size in rust unit test
uint Jun 23, 2021
5ded22f
Rename Send to Funds
uint Jun 23, 2021
0d2e81b
Add message type for voting on governance proposal
uint Jun 23, 2021
cfb6ac7
go fmt
uint Jun 23, 2021
fdb0565
Add a test for custom events
uint Jun 23, 2021
ba3a394
Fix remaining tests
uint Jun 23, 2021
1dcf78b
Apply suggestions from code review
uint Jun 23, 2021
a48b048
VoteOption - fail deserialization on invalid value
uint Jun 23, 2021
c6487fa
go fmt
uint Jun 23, 2021
78055c0
Better error message when deserializing voteOption
uint Jun 23, 2021
eaf4a2a
Update to cosmwasm 0.15.0-alpha3
uint Jun 23, 2021
3de95bb
Point to places where JSON deserialisation gas should be charged
webmaster128 Jun 24, 2021
01153f8
Merge pull request #225 from CosmWasm/cosmwasm-0.15
webmaster128 Jun 24, 2021
8672e2c
[skip ci] Built release libraries
Jun 24, 2021
01ff0ac
Go: reimplement reply_on using iota
uint Jun 24, 2021
c50ad14
If Golang only had a ? operator...
uint Jun 24, 2021
6397994
Refactor last commit
uint Jun 24, 2021
48dfa55
Implement stringer for `replyOn`
uint Jun 24, 2021
aa7d869
refactor
uint Jun 24, 2021
b942441
Merge pull request #230 from CosmWasm/reply-on-refactor
webmaster128 Jun 24, 2021
f546a4b
[skip ci] Built release libraries
Jun 24, 2021
dea4d5d
Charge gas for deserialization
uint Jun 24, 2021
ba4ff8d
Custom Marshal and Stringer impl for VoteOption
uint Jun 24, 2021
e8dc847
Update cosmwasm to 0.15.0
uint Jun 24, 2021
92b95ac
Make voteOption private
uint Jun 24, 2021
d43b6db
Merge pull request #233 from CosmWasm/vote-option-marshal
webmaster128 Jun 24, 2021
4f519d7
Update contracts
uint Jun 24, 2021
bde09a2
Merge pull request #234 from CosmWasm/cosmwasm-update
webmaster128 Jun 24, 2021
2c0fc11
Pass deserCost by value, not pointer
uint Jun 24, 2021
c020724
Doc update
uint Jun 24, 2021
0dfdeaf
[skip ci] Built release libraries
Jun 24, 2021
4c3453f
Don't stop execution on insufficient gas for deser
uint Jun 24, 2021
34c3bb8
Use UFraction for deserialization costs
uint Jun 24, 2021
49813ca
Rename Fraction.Int() to Fraction.Floor()
uint Jun 24, 2021
8232a41
refactor + error messages
uint Jun 24, 2021
70f34e3
Merge pull request #227 from CosmWasm/charge-deserialization-gas
webmaster128 Jun 24, 2021
0b87d32
[skip ci] Built release libraries
Jun 24, 2021
4eb5fff
Automatically copy libwasmvm headers to /api
uint Jul 5, 2021
b6a89e9
Copy bindings.h for any Rust build
uint Jul 5, 2021
d89d28a
Makefile refactor
uint Jul 5, 2021
86c9400
Update Makefile
uint Jul 5, 2021
a426275
Merge pull request #241 from CosmWasm/copy-bindingsh
webmaster128 Jul 5, 2021
c0f43dd
[skip ci] Built release libraries
Jul 5, 2021
155ff81
Update IBCReceiveResponse
uint Jul 6, 2021
3429f4d
go fmt
uint Jul 6, 2021
a5f7e9d
Change GovMsg.Vote to a pointer type
uint Jul 6, 2021
2d5bc92
Remove IBCReceiveResponse.Events
uint Jul 6, 2021
7ae46fa
Update doc comments for IBCReceiveResponse
uint Jul 6, 2021
98ddef9
Merge pull request #242 from CosmWasm/update-ibcreceiveresponse
webmaster128 Jul 6, 2021
345b3ed
Merge pull request #243 from CosmWasm/extendable-govmsg
webmaster128 Jul 6, 2021
ee530ae
[skip ci] Built release libraries
Jul 6, 2021
ad3534a
Rename muslc to something more appropriate
uint Jul 13, 2021
07eaa9d
Merge pull request #244 from CosmWasm/rename-muslc-exe
webmaster128 Jul 13, 2021
67c5f50
[skip ci] Built release libraries
Jul 13, 2021
ff3ef0c
Update comments regarding binary stripping
webmaster128 Jul 15, 2021
7578a91
Rename DLL_EXT -> SHARED_LIB_EXT
webmaster128 Jul 15, 2021
1a18672
Merge pull request #245 from CosmWasm/makefile-cleanups
webmaster128 Jul 15, 2021
219a27d
[skip ci] Built release libraries
Jul 15, 2021
da85b24
Update to cosmwasm 0.16
uint Jul 19, 2021
7a9e6a6
Update test contracts to 0.16
uint Jul 19, 2021
19b1440
Update NOTICE file [skip ci]
webmaster128 Jul 20, 2021
30485c3
Merge pull request #248 from CosmWasm/update-license
ethanfrey Jul 20, 2021
0c245cf
[skip ci] Built release libraries
Jul 20, 2021
cb45049
Update cosmwasm to 0.16.0-rc2
uint Jul 20, 2021
efdc705
Add the `events` field to IBC response types
uint Jul 20, 2021
09444dd
Add tests for custom events
uint Jul 20, 2021
2631cc0
style
uint Jul 20, 2021
d767103
Merge pull request #247 from CosmWasm/cosmwasm-0.16
webmaster128 Jul 20, 2021
bb8ec34
[skip ci] Built release libraries
Jul 20, 2021
c34b82a
cosmwasm 0.16.0-rc4
uint Jul 22, 2021
873de17
Merge pull request #251 from CosmWasm/cosmwasm-0.16.0-rc4
webmaster128 Jul 22, 2021
7f3ef6c
Add IBC Msg helpers for getting channels
uint Jul 22, 2021
e753bb8
[skip ci] Built release libraries
Jul 22, 2021
0ce0ce2
Add IBC Msg helpers for getting counterversion
uint Jul 22, 2021
378e533
Add helpers for IBC helpers
uint Jul 22, 2021
1996ed1
go fmt
uint Jul 22, 2021
f96ca08
Style and doc comments
uint Jul 22, 2021
4d428e4
Merge pull request #252 from CosmWasm/ibc-msg-helpers
webmaster128 Jul 22, 2021
7b44034
[skip ci] Built release libraries
Jul 22, 2021
aca8c2e
Update to cosmwasm 0.16.0-rc5
uint Jul 27, 2021
40b0c67
Merge pull request #253 from CosmWasm/cosmwasm-0.16.0-rc5
webmaster128 Jul 27, 2021
e00b1d9
[skip ci] Built release libraries
Jul 27, 2021
82b0475
Add helpers to wrap ibc message variants
ethanfrey Jul 28, 2021
9e08842
Merge pull request #254 from CosmWasm/ibc-msg-helpers
ethanfrey Jul 28, 2021
84a06b6
[skip ci] Built release libraries
Jul 28, 2021
c26dbfb
Update to cosmwasm to f3a3f7bfa1a and add required_features to Analys…
webmaster128 Aug 4, 2021
bc3f81e
Fix typo in TestCreateAndDestroyUnmanagedVector
webmaster128 Aug 4, 2021
ffd4323
Fix typo in "unmanages vector"
webmaster128 Aug 4, 2021
424bcd7
Upgrade to v0.16.0-rc6
webmaster128 Aug 4, 2021
cb1747a
Merge pull request #255 from CosmWasm/update-to-rc6
webmaster128 Aug 4, 2021
fd6b26f
[skip ci] Built release libraries
Aug 4, 2021
b29005d
Upgrade CosmWasm to 0.16.0
webmaster128 Aug 5, 2021
ca0891c
Merge pull request #256 from CosmWasm/update-to-0.16.0
webmaster128 Aug 5, 2021
12c3366
[skip ci] Built release libraries
Aug 5, 2021
1d1dac8
Combine recover() and nil check
webmaster128 Sep 9, 2021
4cb796d
Print stack of the panic
webmaster128 Sep 9, 2021
4632723
Upgrade crossbeam-deque to 0.8.1
webmaster128 Sep 9, 2021
3eabafc
Upgrade cosmwasm to 0.16.2
webmaster128 Sep 9, 2021
663ecd3
Merge pull request #258 from CosmWasm/debug-panic
webmaster128 Sep 9, 2021
3cf64c2
[skip ci] Built release libraries
Sep 9, 2021
e9b2792
Upgrade shfmt and pin version (backport to 0.16 branch)
webmaster128 Nov 2, 2021
31f8302
Merge pull request #267 from CosmWasm/fix-shfmt
webmaster128 Nov 2, 2021
790cafa
Fix none handling in copyAndDestroyUnmanagedVector
webmaster128 Oct 27, 2021
bcb820c
Run deploy_to_git on 0.16 branch
webmaster128 Nov 10, 2021
57870ca
[skip ci] Built release libraries
Nov 10, 2021
c82a153
Update to patched CosmWasm version
webmaster128 Dec 23, 2021
5bdb314
Merge pull request #280 from CosmWasm/rm-stacktrace-0.16
webmaster128 Dec 23, 2021
458e983
[skip ci] Built release libraries
Dec 23, 2021
412a793
Merge tag 'v0.16.3' of github.com:CosmWasm/wasmvm
loloicci Feb 3, 2022
f804f73
fix: fix rust dir in github workflow
loloicci Feb 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/builds_and_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.51.0
toolchain: 1.55.0
target: wasm32-unknown-unknown
profile: minimal
override: true
Expand All @@ -19,22 +19,27 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cargo
key: cargocache-v2-libwasmvm_sanity-rust:1.51.0-${{ hashFiles('Cargo.lock') }}
key: cargocache-v2-libwasmvm_sanity-rust:1.55.0-${{ hashFiles('Cargo.lock') }}
- name: Install shellcheck
run: sudo apt install shellcheck
- name: Show version information
run: rustc --version; cargo --version; rustup --version
- name: Add Rust components
run: rustup component add clippy rustfmt
- name: Check formatting
working-directory: ./libwasmvm
run: cargo fmt -- --check
- name: Run linter
working-directory: ./libwasmvm
run: cargo clippy -- -D warnings
- name: Run unit tests
working-directory: ./libwasmvm
run: cargo test
- name: Build docs
working-directory: ./libwasmvm
run: cargo doc --no-deps
- name: Test docs
working-directory: ./libwasmvm
run: |
sed -i '/^crate-type = \["cdylib"\]/d' Cargo.toml
cargo test --doc
Expand Down Expand Up @@ -86,7 +91,7 @@ jobs:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.51.0
toolchain: 1.55.0
target: wasm32-unknown-unknown
profile: minimal
override: true
Expand All @@ -96,7 +101,7 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.cargo
key: cargocache-v2-build_shared_library-rust:1.51.0-${{ hashFiles('Cargo.lock') }}
key: cargocache-v2-build_shared_library-rust:1.55.0-${{ hashFiles('Cargo.lock') }}
- name: Show version information
run: rustc --version; cargo --version; rustup --version
- name: Create release build of libwasmvm
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
package-version: # emit package version using `cargo tree -i`
name: Get Package Version
runs-on: ubuntu-latest
container: rust:1.53.0-slim
container: rust:1.55.0-slim
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
Expand All @@ -31,6 +31,7 @@ jobs:
key: ${{ runner.os }}-cargo-home-${{ hashFiles('**/Cargo.lock') }}
- name: Get package version
id: get-version
working-directory: ./libwasmvm
run: |
VERSION=$(cargo tree -i wasmvm | grep -oE "[0-9]+(\.[0-9]+){2}-[0-9]+(\.[0-9]+){2}")
echo ::set-output name=version::${VERSION}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/target
target/
**/*.rs.bk
*.iml
.idea
Expand All @@ -10,5 +10,6 @@ lib*.a
artifacts/
muslc.exe
static.exe
/demo
tmp
a.out
81 changes: 45 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,42 @@ BUILDERS_PREFIX := line/wasmvm-builder
USER_ID := $(shell id -u)
USER_GROUP = $(shell id -g)

DLL_EXT = ""
SHARED_LIB_EXT = "" # File extension of the shared library
ifeq ($(OS),Windows_NT)
DLL_EXT = dll
SHARED_LIB_EXT = dll
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
DLL_EXT = so
SHARED_LIB_EXT = so
endif
ifeq ($(UNAME_S),Darwin)
DLL_EXT = dylib
SHARED_LIB_EXT = dylib
endif
endif

all: build test

build: build-rust build-go

# don't strip for now, for better error reporting
# build-rust: build-rust-release strip
build-rust: build-rust-release

# Use debug build for quick testing.
# In order to use "--features backtraces" here we need a Rust nightly toolchain, which we don't have by default
build-rust-debug:
cargo build
cp target/debug/libwasmvm.$(DLL_EXT) api
(cd libwasmvm && cargo build)
cp libwasmvm/target/debug/libwasmvm.$(SHARED_LIB_EXT) api
make update-bindings

# use release build to actually ship - smaller and much faster
#
# See https://github.com/CosmWasm/wasmvm/issues/222#issuecomment-880616953 for two approaches to
# enable stripping through cargo (if that is desired).
build-rust-release:
cargo build --release
cp target/release/libwasmvm.$(DLL_EXT) api
(cd libwasmvm && cargo build --release)
cp libwasmvm/target/release/libwasmvm.$(SHARED_LIB_EXT) api
make update-bindings
@ #this pulls out ELF symbols, 80% size reduction!

# implement stripping based on os
ifeq ($(DLL_EXT),so)
strip:
strip api/libwasmvm.so
else
# TODO: add for windows and osx
strip:
endif

build-go:
go build ./...

Expand All @@ -57,46 +51,61 @@ test-safety:

# Creates a release build in a containerized build environment of the static library for Alpine Linux (.a)
release-build-alpine:
rm -rf target/release
rm -rf libwasmvm/target/release
# build the muslc *.a file
docker run --rm -v $(shell pwd):/code $(BUILDERS_PREFIX):alpine
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX):alpine
cp libwasmvm/target/release/examples/libstaticlib.a api/libwasmvm_static.a
make update-bindings
# try running go tests using this lib with muslc
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code -w /code $(BUILDERS_PREFIX):alpine go build -tags static .
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code -w /code $(BUILDERS_PREFIX):alpine go test -tags='static mocks' ./api ./types
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/testing -w /testing $(BUILDERS_PREFIX):alpine go build -tags static .
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/testing -w /testing $(BUILDERS_PREFIX):alpine go test -tags 'static mocks' ./api ./types

# Creates a release build in a containerized build environment of the static library for glibc Linux (.a)
release-build-linux-static:
rm -rf target/release
rm -rf libwasmvm/target/release
# build the glibc *.a file
docker run --rm -v $(shell pwd):/code $(BUILDERS_PREFIX):static
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX):static
cp libwasmvm/target/release/examples/libstaticlib.a api/libwasmvm_static.a
make update-bindings
# try running go tests using this lib with glibc
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code -w /code $(BUILDERS_PREFIX):static go build -tags static .
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code -w /code $(BUILDERS_PREFIX):static go test -tags='static mocks' ./api ./types
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/testing -w /testing $(BUILDERS_PREFIX):static go build -tags static .
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/testing -w /testing $(BUILDERS_PREFIX):static go test -tags='static mocks' ./api ./types

# Creates a release build in a containerized build environment of the shared library for glibc Linux (.so)
release-build-linux:
rm -rf target/release
docker run --rm -v $(shell pwd):/code $(BUILDERS_PREFIX):centos7
rm -rf libwasmvm/target/release
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX):centos7
cp libwasmvm/target/release/deps/libwasmvm.so api
make update-bindings

# Creates a release build in a containerized build environment of the shared library for macOS (.dylib)
release-build-macos:
rm -rf target/release
docker run --rm -v $(shell pwd):/code $(BUILDERS_PREFIX):cross
rm -rf libwasmvm/target/release
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd)/libwasmvm:/code $(BUILDERS_PREFIX):cross
cp libwasmvm/target/x86_64-apple-darwin/release/deps/libwasmvm.dylib api
cp libwasmvm/bindings.h api
make update-bindings

update-bindings:
# After we build libwasmvm, we have to copy the generated bindings for Go code to use.
# We cannot use symlinks as those are not reliably resolved by `go get` (https://github.com/CosmWasm/wasmvm/pull/235).
cp libwasmvm/bindings.h api

release-build:
# Write like this because those must not run in parallal
# Write like this because those must not run in parallel
make release-build-alpine
make release-build-linux
make release-build-linux-static
make release-build-macos

test-alpine: release-build-alpine
# build a go binary
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/code -w /code $(BUILDERS_PREFIX):alpine go build -tags='static mocks' -o muslc.exe ./cmd
docker run --rm -u $(USER_ID):$(USER_GROUP) -v $(shell pwd):/testing -w /testing $(BUILDERS_PREFIX):alpine go build -tags 'static mocks' -o demo ./cmd
# run static binary in an alpine machines (not dlls)
docker run --rm --read-only -v $(shell pwd):/code -w /code alpine:3.12 ./muslc.exe ./api/testdata/hackatom.wasm
docker run --rm --read-only -v $(shell pwd):/code -w /code alpine:3.11 ./muslc.exe ./api/testdata/hackatom.wasm
docker run --rm --read-only -v $(shell pwd):/code -w /code alpine:3.10 ./muslc.exe ./api/testdata/hackatom.wasm
docker run --rm --read-only -v $(shell pwd):/testing -w /testing alpine:3.14 ./demo ./api/testdata/hackatom.wasm
docker run --rm --read-only -v $(shell pwd):/testing -w /testing alpine:3.13 ./demo ./api/testdata/hackatom.wasm
docker run --rm --read-only -v $(shell pwd):/testing -w /testing alpine:3.12 ./demo ./api/testdata/hackatom.wasm
docker run --rm --read-only -v $(shell pwd):/testing -w /testing alpine:3.11 ./demo ./api/testdata/hackatom.wasm
# run static binary locally if you are on Linux
# ./muslc.exe ./api/testdata/hackatom.wasm

Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2019-2020 Confio OÜ
Copyright 2019-2021 Confio OÜ
Copyright 2021 LINE Plus Corporation

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
12 changes: 12 additions & 0 deletions api/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,20 @@ typedef struct UnmanagedVector {
uintptr_t cap;
} UnmanagedVector;

/**
brew0722 marked this conversation as resolved.
Show resolved Hide resolved
* The result type of the FFI function analyze_code.
*
* Please note that the unmanaged vector in `required_features`
* has to be destroyed exactly once. When calling `analyze_code`
* from Go this is done via `C.destroy_unmanaged_vector`.
*/
typedef struct AnalysisReport {
bool has_ibc_entry_points;
/**
* An UTF-8 encoded comma separated list of reqired features.
* This is never None/nil.
*/
struct UnmanagedVector required_features;
} AnalysisReport;

typedef struct Metrics {
Expand Down
2 changes: 2 additions & 0 deletions api/callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
"fmt"
"log"
"reflect"
"runtime/debug"
"unsafe"

"github.com/line/wasmvm/types"
Expand Down Expand Up @@ -72,6 +73,7 @@ func recoverPanic(ret *C.GoResult) {
// case "ErrorGasOverflow":
default:
log.Printf("Panic in Go callback: %#v\n", rec)
debug.PrintStack()
*ret = C.GoResult_Panic
}
}
Expand Down
25 changes: 13 additions & 12 deletions api/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func AnalyzeCode(cache Cache, checksum []byte) (*types.AnalysisReport, error) {
}
res := types.AnalysisReport{
HasIBCEntryPoints: bool(report.has_ibc_entry_points),
RequiredFeatures: string(copyAndDestroyUnmanagedVector(report.required_features)),
}
return &res, nil
}
Expand Down Expand Up @@ -369,7 +370,7 @@ func IBCChannelOpen(
cache Cache,
checksum []byte,
env []byte,
channel []byte,
msg []byte,
gasMeter *GasMeter,
store KVStore,
api *GoAPI,
Expand All @@ -381,8 +382,8 @@ func IBCChannelOpen(
defer runtime.KeepAlive(checksum)
e := makeView(env)
defer runtime.KeepAlive(env)
ch := makeView(channel)
defer runtime.KeepAlive(channel)
m := makeView(msg)
defer runtime.KeepAlive(msg)

// set up a new stack frame to handle iterators
counter := startContract()
Expand All @@ -395,7 +396,7 @@ func IBCChannelOpen(
var gasUsed cu64
errmsg := newUnmanagedVector(nil)

res, err := C.ibc_channel_open(cache.ptr, cs, e, ch, db, a, q, cu64(gasLimit), cbool(printDebug), &gasUsed, &errmsg)
res, err := C.ibc_channel_open(cache.ptr, cs, e, m, db, a, q, cu64(gasLimit), cbool(printDebug), &gasUsed, &errmsg)
if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success {
// Depending on the nature of the error, `gasUsed` will either have a meaningful value, or just 0.
return nil, uint64(gasUsed), errorWithMessage(err, errmsg)
Expand All @@ -407,7 +408,7 @@ func IBCChannelConnect(
cache Cache,
checksum []byte,
env []byte,
channel []byte,
msg []byte,
gasMeter *GasMeter,
store KVStore,
api *GoAPI,
Expand All @@ -419,8 +420,8 @@ func IBCChannelConnect(
defer runtime.KeepAlive(checksum)
e := makeView(env)
defer runtime.KeepAlive(env)
ch := makeView(channel)
defer runtime.KeepAlive(channel)
m := makeView(msg)
defer runtime.KeepAlive(msg)

// set up a new stack frame to handle iterators
counter := startContract()
Expand All @@ -433,7 +434,7 @@ func IBCChannelConnect(
var gasUsed cu64
errmsg := newUnmanagedVector(nil)

res, err := C.ibc_channel_connect(cache.ptr, cs, e, ch, db, a, q, cu64(gasLimit), cbool(printDebug), &gasUsed, &errmsg)
res, err := C.ibc_channel_connect(cache.ptr, cs, e, m, db, a, q, cu64(gasLimit), cbool(printDebug), &gasUsed, &errmsg)
if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success {
// Depending on the nature of the error, `gasUsed` will either have a meaningful value, or just 0.
return nil, uint64(gasUsed), errorWithMessage(err, errmsg)
Expand All @@ -445,7 +446,7 @@ func IBCChannelClose(
cache Cache,
checksum []byte,
env []byte,
channel []byte,
msg []byte,
gasMeter *GasMeter,
store KVStore,
api *GoAPI,
Expand All @@ -457,8 +458,8 @@ func IBCChannelClose(
defer runtime.KeepAlive(checksum)
e := makeView(env)
defer runtime.KeepAlive(env)
ch := makeView(channel)
defer runtime.KeepAlive(channel)
m := makeView(msg)
defer runtime.KeepAlive(msg)

// set up a new stack frame to handle iterators
counter := startContract()
Expand All @@ -471,7 +472,7 @@ func IBCChannelClose(
var gasUsed cu64
errmsg := newUnmanagedVector(nil)

res, err := C.ibc_channel_close(cache.ptr, cs, e, ch, db, a, q, cu64(gasLimit), cbool(printDebug), &gasUsed, &errmsg)
res, err := C.ibc_channel_close(cache.ptr, cs, e, m, db, a, q, cu64(gasLimit), cbool(printDebug), &gasUsed, &errmsg)
if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success {
// Depending on the nature of the error, `gasUsed` will either have a meaningful value, or just 0.
return nil, uint64(gasUsed), errorWithMessage(err, errmsg)
Expand Down
Loading