-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add simualtion test for oracle module
- Loading branch information
Showing
25 changed files
with
1,512 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## To test locally: | ||
# docker build --pull --rm -f "contrib/devtools/Dockerfile" -t cosmossdk-proto:latest "contrib/devtools" | ||
# docker run --rm -v $(pwd):/workspace --workdir /workspace cosmossdk-proto sh ./scripts/protocgen.sh | ||
|
||
FROM bufbuild/buf:1.9.0 as BUILDER | ||
FROM golang:1.19-alpine | ||
|
||
RUN apk add --no-cache \ | ||
nodejs \ | ||
npm \ | ||
git \ | ||
make \ | ||
clang-extra-tools | ||
|
||
RUN npm install -g swagger-combine | ||
|
||
ARG UNAME=protobuild | ||
ARG UID=1000 | ||
RUN adduser -u $UID -s /bin/sh $UNAME -D | ||
USER $UNAME | ||
|
||
ENV GOLANG_PROTOBUF_VERSION=1.28.1 \ | ||
GRPC_GATEWAY_VERSION=1.16.0 | ||
|
||
RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest && \ | ||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION} && \ | ||
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \ | ||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION} | ||
|
||
# install all gogo protobuf binaries | ||
RUN git clone https://github.com/cosmos/gogoproto.git; \ | ||
cd gogoproto; \ | ||
go mod download; \ | ||
make install | ||
|
||
COPY --from=BUILDER /usr/local/bin /usr/local/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
### | ||
# Find OS and Go environment | ||
# GO contains the Go binary | ||
# FS contains the OS file separator | ||
### | ||
ifeq ($(OS),Windows_NT) | ||
GO := $(shell where go.exe 2> NUL) | ||
FS := "\\" | ||
else | ||
GO := $(shell command -v go 2> /dev/null) | ||
FS := "/" | ||
endif | ||
|
||
ifeq ($(GO),) | ||
$(error could not find go. Is it in PATH? $(GO)) | ||
endif | ||
|
||
############################################################################### | ||
### Functions ### | ||
############################################################################### | ||
|
||
go_get = $(if $(findstring Windows_NT,$(OS)),\ | ||
IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS) ( mkdir $(GITHUBDIR)$(FS)$(1) ) else (cd .) &\ | ||
IF NOT EXIST $(GITHUBDIR)$(FS)$(1)$(FS)$(2)$(FS) ( cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2) ) else (cd .) &\ | ||
,\ | ||
mkdir -p $(GITHUBDIR)$(FS)$(1) &&\ | ||
(test ! -d $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && cd $(GITHUBDIR)$(FS)$(1) && git clone https://github.com/$(1)/$(2)) || true &&\ | ||
)\ | ||
cd $(GITHUBDIR)$(FS)$(1)$(FS)$(2) && git fetch origin && git checkout -q $(3) | ||
|
||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd) | ||
|
||
|
||
############################################################################### | ||
### Tools ### | ||
############################################################################### | ||
|
||
PREFIX ?= /usr/local | ||
BIN ?= $(PREFIX)/bin | ||
UNAME_S ?= $(shell uname -s) | ||
UNAME_M ?= $(shell uname -m) | ||
|
||
GOPATH ?= $(shell $(GO) env GOPATH) | ||
GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com | ||
|
||
BUF_VERSION ?= 0.11.0 | ||
|
||
TOOLS_DESTDIR ?= $(GOPATH)/bin | ||
STATIK = $(TOOLS_DESTDIR)/statik | ||
RUNSIM = $(TOOLS_DESTDIR)/runsim | ||
|
||
tools: tools-stamp | ||
tools-stamp: statik runsim | ||
# Create dummy file to satisfy dependency and avoid | ||
# rebuilding when this Makefile target is hit twice | ||
# in a row. | ||
touch $@ | ||
|
||
# Install the runsim binary | ||
statik: $(STATIK) | ||
$(STATIK): | ||
@echo "Installing statik..." | ||
@go install github.com/rakyll/statik@v0.1.6 | ||
|
||
# Install the runsim binary | ||
runsim: $(RUNSIM) | ||
$(RUNSIM): | ||
@echo "Installing runsim..." | ||
@go install github.com/cosmos/tools/cmd/runsim@v1.0.0 | ||
|
||
tools-clean: | ||
rm -f $(STATIK) $(GOLANGCI_LINT) $(RUNSIM) | ||
rm -f tools-stamp | ||
|
||
.PHONY: tools-clean statik runsim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Contributors | ||
|
||
Thanks to the entire Cosmos SDK team and the contributors who put their efforts into making simulation testing | ||
easier to implement. 🤗 | ||
|
||
<https://github.com/cosmos/cosmos-sdk/blob/master/contrib/devtools/Makefile> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
testing/testapp/wasm_1_simple.go → testing/testdata/wasm_1_simple.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package testapp | ||
package testdata | ||
|
||
// A simple Owasm script with the following specification: | ||
// | ||
|
2 changes: 1 addition & 1 deletion
2
testing/testapp/wasm_2_return_in_prepare.go → testing/testdata/wasm_2_return_in_prepare.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package testapp | ||
package testdata | ||
|
||
// A bad Owasm script with the following specification: | ||
// | ||
|
2 changes: 1 addition & 1 deletion
2
testing/testapp/wasm_3_do_nothing.go → testing/testdata/wasm_3_do_nothing.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
testing/testapp/wasm_4_complex.go → testing/testdata/wasm_4_complex.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package testapp | ||
package testdata | ||
|
||
import ( | ||
"encoding/hex" | ||
|
2 changes: 1 addition & 1 deletion
2
testing/testapp/wasm_56_computation.go → testing/testdata/wasm_56_computation.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package testapp | ||
package testdata | ||
|
||
import ( | ||
"fmt" | ||
|
2 changes: 1 addition & 1 deletion
2
testing/testapp/wasm_78_large_calldata.go → testing/testdata/wasm_78_large_calldata.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package testapp | ||
package testdata | ||
|
||
import ( | ||
"fmt" | ||
|
2 changes: 1 addition & 1 deletion
2
.../testapp/wasm_9_set_data_several_times.go → ...testdata/wasm_9_set_data_several_times.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package testapp | ||
package testdata | ||
|
||
var Wasm9 []byte = wat2wasm([]byte(` | ||
(module | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 10 additions & 3 deletions
13
testing/testapp/wasm_util.go → testing/testdata/wasm_util.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.