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

replacing the wasmer runtime with a wasmi runtime running inside an SGX enclave #122

Merged
merged 231 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
231 commits
Select commit Hold shift + click to select a range
906846d
copied most of lib/vm to lib/sgx-vm
reuvenpo Mar 15, 2020
2e82088
addde the cosmwasm/lib/enclave-ffi crate to define the enclave-ffi in…
reuvenpo Mar 23, 2020
46d5bf4
added cbindgen as build dependency of cosmwasm/lib/enclave-ffi
reuvenpo Mar 23, 2020
4cfd435
made some changes to cbindgen.toml in cosmwasm/lib/enclave-ffi, and a…
reuvenpo Mar 23, 2020
9cbed5a
renamed enclave-ffi to enclave-ffi-types
reuvenpo Mar 24, 2020
f3293a3
changed the way we generate the header file in enclave-ffi-types
reuvenpo Mar 24, 2020
8ac998d
patched go-cosmwasm to use local versions of cosmwasm and cosmwasm-vm
reuvenpo Mar 24, 2020
16b9851
added some FFI types to enclave-ffi-types
reuvenpo Mar 24, 2020
1fa5f72
added some excludes to cosmwasm workspace
reuvenpo Mar 24, 2020
76fb854
added wasmi-runtime crate, which represents the code in the enclave
reuvenpo Mar 24, 2020
696c630
specified rust-toolchain in sgx-vm
reuvenpo Mar 24, 2020
aa4a17f
added the sgx-vm::wasmi module which wraps the interaction with the e…
reuvenpo Mar 24, 2020
c1bb70c
in wasmi-runtime.edl, replaced size_t with the standart uintptr_t
reuvenpo Mar 25, 2020
0dd7b05
added some missing imports in cosmwasm/lib/wasmi-runtime
reuvenpo Mar 25, 2020
737f6b8
marked some of the functions in the edl as public
reuvenpo Mar 25, 2020
bee215e
import makefile, git submodule for rust sdk
assafmo Mar 25, 2020
b4a93d5
fix some paths in makefiles
assafmo Mar 25, 2020
6810387
import cargo.toml from sample project, fix some more rust stuff
assafmo Mar 25, 2020
203e076
now wasmi-runtime compiles
assafmo Mar 25, 2020
dbce0bd
fix some more paths
assafmo Mar 25, 2020
af195b0
Enclave_private.pem
assafmo Mar 25, 2020
04fa5f0
Updated gitignore and removed Cargo.lock
toml01 Mar 26, 2020
1cc367e
Fixed some mistakes in the .edl (consts and redundant commas)
toml01 Mar 26, 2020
36ddd63
Fixed a few more consts
toml01 Mar 26, 2020
9e0a873
Fixed another typo
toml01 Mar 26, 2020
04bdf38
ignore generated enclave c code
assafmo Mar 26, 2020
f754da5
Modified Makefile
toml01 Mar 26, 2020
2287527
Makefile now builds enclave-ffi-types
toml01 Mar 26, 2020
3e30808
git ignore o files
assafmo Mar 26, 2020
01118ce
Fixed Makefile sort of
toml01 Mar 26, 2020
9f4675a
Merge branch 'wasmi-enclave' of github.com:enigmampc/EnigmaBlockchain…
toml01 Mar 26, 2020
340c34f
remove enclave-ffi-types rule
assafmo Mar 26, 2020
ac95544
foo
assafmo Mar 26, 2020
40d241b
fix some enclave configs
assafmo Mar 26, 2020
6ef5c31
cleanup toml
assafmo Mar 26, 2020
096445d
cargo cleanup
assafmo Mar 26, 2020
6e8b397
some reuven mojo
assafmo Mar 26, 2020
dbd47bf
...
assafmo Mar 26, 2020
9a8ea06
fix dup std
assafmo Mar 26, 2020
747c11c
:tada:
assafmo Mar 26, 2020
b777045
cleanup cargo
assafmo Mar 26, 2020
b163815
made some changes to the FFI between the enclave and cosmwsam-sgx-vm
reuvenpo Mar 26, 2020
0c57fd3
Merge remote-tracking branch 'origin/cosmwasm-sgx-vm' into wasmi-enclave
assafmo Mar 26, 2020
ee9b99f
added missing semicolon
reuvenpo Mar 26, 2020
f216178
added Ctx to the list of types in enclave-ffi-types.h
reuvenpo Mar 26, 2020
2cbc631
added handling for failure of functions in enclave + some small FFI i…
reuvenpo Mar 26, 2020
9dcdeb1
Merge remote-tracking branch 'origin/cosmwasm-sgx-vm' into wasmi-enclave
assafmo Mar 29, 2020
6ca95f7
edl formatting
assafmo Mar 30, 2020
f025097
contract_operations.rs comments
assafmo Mar 30, 2020
6a81564
tons of comments
assafmo Mar 30, 2020
be45d11
removed not needed comments
toml01 Mar 30, 2020
1ba1d52
allocated pointers to env and msg
toml01 Mar 30, 2020
2ff454d
Fixed types
toml01 Mar 30, 2020
7dfc009
Improved error handling
toml01 Mar 30, 2020
d77fc58
sending pointers to init func (not working)
toml01 Mar 30, 2020
9288a11
added todo comments
toml01 Mar 30, 2020
8840a1b
add comments about `init`, `handle` and `query`
assafmo Mar 30, 2020
38b7311
rename ResolveAll to EnigmaImportResolver
assafmo Mar 30, 2020
c9504c4
fix double-warpping with RuntimeValue::I32
assafmo Mar 30, 2020
312beb6
some more comments about "allocate" for "msg" and "env"
assafmo Mar 30, 2020
d36772d
Fixed parameters sent to init()
toml01 Mar 30, 2020
a9e5572
Merge branch 'wasmi-enclave' of github.com:enigmampc/EnigmaBlockchain…
toml01 Mar 30, 2020
85f03fb
changed all Cargo.toml files to use local crates, and removed unneede…
reuvenpo Mar 30, 2020
853885a
added changes to Cargo.lock files
reuvenpo Mar 30, 2020
93a1624
added cosmwasm/lib/vm/.gitignore
reuvenpo Mar 30, 2020
23c3d32
changed sgx-vm to work with the enclave, and adjusted go-cosmwasm to …
reuvenpo Mar 30, 2020
858066f
Merge remote-tracking branch 'origin/changes-to-sgx-vm' into wasmi-en…
assafmo Mar 31, 2020
c17162d
update cargo.lock
assafmo Mar 31, 2020
140222d
fixing std deps
toml01 Mar 31, 2020
07b9ea2
updated sgx-sdk version
toml01 Mar 31, 2020
0e97722
update rust sgx sdk submodule to v1.1.1
assafmo Mar 31, 2020
5870f6c
Added needed annotation
toml01 Mar 31, 2020
23df52e
cleanup
toml01 Mar 31, 2020
faba39c
Merge branch 'wasmi-enclave' of github.com:enigmampc/EnigmaBlockchain…
toml01 Mar 31, 2020
ec8f9ea
added dependency for wasmi interfaces
toml01 Mar 31, 2020
a95ee5a
code comment
assafmo Mar 31, 2020
84b6e8b
no point in not compiling to sgx
assafmo Mar 31, 2020
d8a3cbf
rm unnecessary extern carte
assafmo Mar 31, 2020
c2ec49c
update cargo.lock
assafmo Mar 31, 2020
2c9decb
use Reuven's fix for wasmi
assafmo Apr 1, 2020
81b4b5a
current state
assafmo Apr 1, 2020
a87068d
compressed the Xargo.toml file to a more compact representation
reuvenpo Apr 1, 2020
0d33fc5
added wasmi-runtime/Cargo.lock
reuvenpo Apr 1, 2020
46b89f0
...
assafmo Apr 2, 2020
efea0cb
init compiles
assafmo Apr 2, 2020
c29465d
refactored wasmi-runtime
reuvenpo Apr 2, 2020
b9ace3c
removed unneeded dependency
reuvenpo Apr 2, 2020
c52be16
format cosmwasm/lib/wasmi-runtime/src/runtime.rs
assafmo Apr 2, 2020
9832e96
implement handle & query in our wasmi wraper
assafmo Apr 2, 2020
b5975e7
lib/wasmi-runtime/src/contract_operations.rs implement handle & query
assafmo Apr 2, 2020
f7a2f1f
start to fix the enclave signatures
assafmo Apr 2, 2020
96eafae
some more fixes around ecalling
assafmo Apr 5, 2020
d10b198
ecall_init pass cargo check but still need to init `init_result`
assafmo Apr 5, 2020
360a215
fix some more stuff
assafmo Apr 5, 2020
7a9bfe6
move read_db and write_db wrappers into runtime.rs
assafmo Apr 5, 2020
f2f109b
added a todo
toml01 Apr 5, 2020
5526f20
discarded last commit - mistake
toml01 Apr 5, 2020
0e43d28
pass ctx and memory to Runtime, start to implement read_db
assafmo Apr 5, 2020
8059aad
read_db code comments
assafmo Apr 5, 2020
67872ff
fix types issues
assafmo Apr 5, 2020
174d3b9
comments
assafmo Apr 5, 2020
13f5159
fixed the ecall and ocall extern decl's and adjusted related code
reuvenpo Apr 5, 2020
2c45ff5
fix read/write import signatures to wasm
assafmo Apr 6, 2020
3c61da5
implement write_db glue between wasm and ocall
assafmo Apr 6, 2020
5de271c
Merge branch 'wasmi-enclave' of github.com:enigmampc/EnigmaBlockchain…
assafmo Apr 6, 2020
ee676bd
use safe write_db func with the fixed signatures (error handling)
assafmo Apr 6, 2020
dcdfe39
write_db fix reading 2nd arg from wasm
assafmo Apr 6, 2020
9236947
Updated signatures and comments
toml01 Apr 6, 2020
d1819b0
Added bech32 dep
toml01 Apr 6, 2020
d436f05
implemented some
toml01 Apr 6, 2020
90e66fe
formatted
toml01 Apr 6, 2020
02e9054
implement CANONICALIZE_ADDRESS_INDEX
assafmo Apr 6, 2020
27a61a7
implement HUMANIZE_ADDRESS_INDEX
assafmo Apr 6, 2020
9e02e4e
When an ocalls fails during wasm execution, we return the right error…
reuvenpo Apr 6, 2020
daf3daf
small reformat
reuvenpo Apr 6, 2020
849f9f9
fix code comment
assafmo Apr 6, 2020
327675d
...
assafmo Apr 6, 2020
98a7906
deleted unnecessary comments
toml01 Apr 6, 2020
269344f
removed deleting cargo.lock from Makefile
toml01 Apr 6, 2020
e7cc04b
fix rust sgx sdk version
assafmo Apr 6, 2020
e724b84
Enclave.edl fix path of enclave-ffi-types.h
assafmo Apr 6, 2020
e6c565b
makefile fix sgx-vm target path
assafmo Apr 6, 2020
4e6e806
fix wasm memory access, cleanup code, remove unused code
assafmo Apr 7, 2020
64ae4b8
small error readability fix
assafmo Apr 7, 2020
21920a8
use bech32 with no_std
assafmo Apr 7, 2020
6cd448d
update cargo.lock
assafmo Apr 7, 2020
b4596b9
Merge pull request #123 from enigmampc/wasmi-enclave
assafmo Apr 8, 2020
96e2485
change to Cargo.lock
reuvenpo Apr 8, 2020
e295ffa
Added needed create deps for gas injection
toml01 Apr 8, 2020
6105eb4
Added basic injection metering logic
toml01 Apr 8, 2020
0a07de3
changd the build process of go-cosmwasm to use all the new sgx stuff
reuvenpo Apr 8, 2020
f5fe8b2
Merge remote-tracking branch 'origin/cosmwasm-sgx-vm' into foo
reuvenpo Apr 8, 2020
f32e60a
typo
toml01 Apr 12, 2020
9115b6f
minor changes to Makefile
reuvenpo Apr 12, 2020
80d22f3
Merge branch 'cosmwasm-sgx-vm' of github.com:enigmampc/EnigmaBlockcha…
toml01 Apr 12, 2020
3ed1f42
fix something
toml01 Apr 12, 2020
6336b12
Added a resolver signature
toml01 Apr 12, 2020
897673b
Added errors for gas
toml01 Apr 12, 2020
ed0a95f
Added function for gas usage in Runtime
toml01 Apr 12, 2020
cfc3255
Added missing arguments to .edl file, implemented gas limit checks
toml01 Apr 12, 2020
26c0c5f
Returning gas_used from enclave after execution
toml01 Apr 12, 2020
07b7078
small change to workspace
reuvenpo Apr 12, 2020
c471068
renamed the enclave.so to librust_cosmwasm_enclave.so
reuvenpo Apr 12, 2020
f50371c
set HeapMaxSize to 4GiB
assafmo Apr 12, 2020
58923d7
Merge branch 'cosmwasm-sgx-vm' of github.com:enigmampc/EnigmaBlockcha…
assafmo Apr 12, 2020
23ddf32
set StackMaxSize to 8MiB
assafmo Apr 12, 2020
0ec0308
makefile build only cli for win&mac, rename linux rule
assafmo Apr 12, 2020
7b1be52
make sure the enclave is only created once
reuvenpo Apr 12, 2020
6f5079c
git ignore librust_cosmwasm_enclave.signed.so
assafmo Apr 12, 2020
0d9b623
code comment
assafmo Apr 13, 2020
e6e0559
fix engine.write_to_memory to work with wasm regions
assafmo Apr 13, 2020
b743a11
fix type mismatch issue
assafmo Apr 13, 2020
d930172
fixed declaration and use of ecall_allocate in sgx-vm
reuvenpo Apr 13, 2020
2901108
edl allow ocal_read_db to call ecall_allocate
assafmo Apr 13, 2020
65ebf87
some rustfmt
assafmo Apr 13, 2020
b771d56
read_db refactor
assafmo Apr 13, 2020
e1acc74
fix borrowing
assafmo Apr 13, 2020
3a7ea88
applied rustfmt to all rust modules
reuvenpo Apr 14, 2020
e51c8f4
make deb take last tag
assafmo Apr 14, 2020
ce86d45
fix build in SGX_MODE=SW
assafmo Apr 16, 2020
c331851
ci for sanity tests
assafmo Apr 16, 2020
a7125f0
reformat readme
assafmo Apr 19, 2020
e75c81b
golnag build strip the DWARF symbol table, the symbol table and debug…
assafmo Apr 19, 2020
9ea837c
makefile also compile cli to linux/arm64
assafmo Apr 19, 2020
781f4f5
sanity test comments
assafmo Apr 19, 2020
c33cea9
Some fixes to integration tests, not working yet
toml01 Apr 19, 2020
aa7fb1b
fix test borrow error
assafmo Apr 19, 2020
e213c71
test comments
assafmo Apr 19, 2020
6a5f3db
stop forcing small log in postinst
assafmo Apr 19, 2020
173f0c0
clean .gitignore
assafmo Apr 20, 2020
592eb0b
Updated so wget won't fail if wasm file already exists
toml01 Apr 20, 2020
c24b5a5
Merge branch 'cosmwasm-sgx-vm' of github.com:enigmampc/EnigmaBlockcha…
toml01 Apr 20, 2020
230cf40
Added a logger module to the enclave
toml01 Apr 20, 2020
68d6c1e
fix sanity test print execute tx to screen
assafmo Apr 20, 2020
357e2d7
Merge branch 'cosmwasm-sgx-vm' of github.com:enigmampc/EnigmaBlockcha…
assafmo Apr 20, 2020
ad28ecf
no need to `yes | enigmacli keys add` when keyring-backend is test
assafmo Apr 21, 2020
bb06d06
ci cache the cargo registry
assafmo Apr 21, 2020
ee3c86e
xargo print version
assafmo Apr 21, 2020
8323532
ci try to use sccache to speed up builds
assafmo Apr 21, 2020
1217a1c
Added logging functionality in go-cosmwasm and logs for some ocalls
toml01 Apr 21, 2020
9507be9
cosmwasm/lib/wasmi-sgx-test.sh set -v instead of set -x
assafmo Apr 21, 2020
6463f53
ci use precompiled sccache
assafmo Apr 21, 2020
0342302
ci better step names
assafmo Apr 21, 2020
b5e3604
ci sccache don't mv to /bin because no perms
assafmo Apr 21, 2020
5ed5e5f
ci sccache fix location
assafmo Apr 21, 2020
3549504
logging for untrusted ecalls+ocalls
toml01 Apr 21, 2020
16b2d4c
rename test coin to RPRC
assafmo Apr 22, 2020
d1595c9
fix addresses in wasmd tests
assafmo Apr 22, 2020
3dccac5
upgrade cosmos
assafmo Apr 22, 2020
0c5d221
init x/compute tests with the right bech32 prefix
assafmo Apr 22, 2020
ab4bdbe
log calls from wasm code
assafmo Apr 22, 2020
aa6b129
read_db fix return error to wasm code if cannot read key from wasm me…
assafmo Apr 22, 2020
fcfb6ba
write_db fix return error if cannot read args from wasm memory
assafmo Apr 22, 2020
0690477
refactor logging calls
assafmo Apr 22, 2020
64de463
read_db log errors the returns to wasm code
assafmo Apr 22, 2020
7378a65
wasm read+write_db log errors
assafmo Apr 22, 2020
d60673b
canonicalize_address log error that return to wasm
assafmo Apr 22, 2020
f41b7ff
humanize_address log error that return to wasm
assafmo Apr 22, 2020
86f2dc4
rustfmt
assafmo Apr 22, 2020
a0d0109
Merge branch 'master' into cosmwasm-sgx-vm
assafmo Apr 22, 2020
273adcb
fix some rust weirdness
assafmo Apr 22, 2020
8cd38fc
restore x/compute module after merge from master
assafmo Apr 22, 2020
296936b
wasm write_db clarify log msg
assafmo Apr 22, 2020
519c875
removed not needed print from test script
toml01 Apr 23, 2020
1c56775
removed unneeded checks for log level, set log level to `trace`
toml01 Apr 23, 2020
fea7fa4
changed logs to crate instead of log functions
toml01 Apr 23, 2020
b45a0ee
added, fixed and fromatted enclave logs
toml01 Apr 23, 2020
a7598dc
update make clean
assafmo Apr 23, 2020
c4975e6
update make clean
assafmo Apr 23, 2020
4f2ea0b
ci rename jobs
assafmo Apr 23, 2020
cf09a44
ci rename jobs
assafmo Apr 23, 2020
2c43ed4
ci rename jobs
assafmo Apr 23, 2020
9804f6e
ci add x/compute tests
assafmo Apr 23, 2020
57d9389
ci rename steps
assafmo Apr 23, 2020
a2b3305
fix some x/compute tests
assafmo Apr 23, 2020
6929988
log gas usage
assafmo Apr 23, 2020
8a4dfbd
x/consume fix expected gas used in test
assafmo Apr 23, 2020
0227aca
fix gas expectation in test
assafmo Apr 23, 2020
06d4930
ci go test -v
assafmo Apr 23, 2020
b635b0a
Skipping problematic loop test
toml01 Apr 23, 2020
4284ef0
ci source "$HOME/.sgxsdk/sgxsdk/environment" so they'd have libsgx_ur…
assafmo Apr 23, 2020
01afe79
Merge branch 'cosmwasm-sgx-vm' of github.com:enigmampc/EnigmaBlockcha…
assafmo Apr 23, 2020
d7fb60f
fmt
assafmo Apr 23, 2020
94fd38b
make clean fix rm of librust_cosmwasm_enclave.signed.so
assafmo Apr 26, 2020
d0ab36b
rearrange links
toml01 Apr 26, 2020
9c6b430
fix rustc_private error with RUSTFLAGS="-Z force-unstable-if-unmarked…
assafmo Apr 30, 2020
ecd7418
Added option to specify directory using environment variables
May 1, 2020
bd93807
Added option to specify directory using environment variables
May 3, 2020
acaf0d8
Merge pull request #158 from enigmampc/enclave_dir
toml01 May 3, 2020
037edac
Changed ENCLAVE_DIR to SCRT_ENCLAVE_DIR
toml01 May 3, 2020
c347aba
Merge branch 'develop' into cosmwasm-sgx-vm
assafmo May 11, 2020
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
55 changes: 55 additions & 0 deletions .github/workflows/wasmi-in-sgx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Tests

on: [push]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install Intel's SGX SDK
run: |
mkdir -p "$HOME/.sgxsdk"
cd "$HOME/.sgxsdk"
SDK_BIN=sgx_linux_x64_sdk_2.9.101.2.bin

wget https://download.01.org/intel-sgx/sgx-linux/2.9.1/distro/ubuntu18.04-server/"$SDK_BIN"

chmod +x "$SDK_BIN"
echo yes | ./"$SDK_BIN"
- run: git submodule update --init --recursive
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache build artifacts
uses: actions/cache@v1
with:
path: ~/.cache/sccache
key: ${{ runner.os }}-sccache
- run: rustup component add rust-src
- name: Install xargo
run: |
cargo +stable install xargo
xargo --version
- name: Download sccache
run: |
wget https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz
tar xf ./sccache-*.tar.gz
mv ./sccache*/sccache "$HOME/sccache"
- name: Build
run: |
source "$HOME/.sgxsdk/sgxsdk/environment"
SGX_MODE=SW RUSTC_WRAPPER="$HOME/sccache" make build_linux
- name: Test SGX Sanity
run: |
source "$HOME/.sgxsdk/sgxsdk/environment"
cp ./cosmwasm/lib/wasmi-runtime/librust_cosmwasm_enclave.signed.so .
./cosmwasm/lib/wasmi-sgx-test.sh
- name: Test Compute Module
run: |
source "$HOME/.sgxsdk/sgxsdk/environment"
cp ./cosmwasm/lib/wasmi-runtime/librust_cosmwasm_enclave.signed.so ./x/compute/internal/keeper
go test -v ./x/compute/internal/...
20 changes: 12 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
*.a
*.deb
/enigmacli*
/enigmad*
SHA256SUMS*
/release
Enclave_u.c
Enclave_u.h
.vscode/
Enclave_t.c
Enclave_t.h
*.a
Enclave_u.c
Enclave_u.h
Enclave_u.o
/enigmacli*
/enigmad*
libenclave.a
libEnclave_u.a
librust_cosmwasm_enclave.signed.so
*.o
/release
SHA256SUMS*
*.so
.vscode/
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "cosmwasm/lib/incubator-teaclave-sgx-sdk"]
path = cosmwasm/lib/incubator-teaclave-sgx-sdk
url = https://github.com/apache/incubator-teaclave-sgx-sdk.git
branch = v1.1.1
60 changes: 31 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true
BINDIR ?= $(GOPATH)/bin

build_tags =
build_tags =
ifeq ($(LEDGER_ENABLED),true)
ifeq ($(OS),Windows_NT)
GCCEXE = $(shell where gcc.exe 2> NUL)
ifeq ($(GCCEXE),)
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
$(error "gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false")
else
build_tags += ledger
endif
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
$(warning "OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988)")
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
$(error "gcc not installed for ledger support, please install or set LEDGER_ENABLED=false")
else
build_tags += ledger
endif
Expand Down Expand Up @@ -49,6 +49,7 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=EnigmaBlockchain \
ifeq ($(WITH_CLEVELDB),yes)
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
endif
ldflags += -s -w
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))

Expand All @@ -66,44 +67,41 @@ xgo_build_enigmad: go.sum
xgo_build_enigmacli: go.sum
xgo --go latest --targets $(XGO_TARGET) $(BUILD_FLAGS) github.com/enigmampc/EnigmaBlockchain/cmd/enigmacli

build_local_no_rust:
@ #this pulls out ELF symbols, 80% size reduction!
build_linux:
$(MAKE) -C go-cosmwasm build-rust
cp go-cosmwasm/target/release/libgo_cosmwasm.so go-cosmwasm/api
# this pulls out ELF symbols, 80% size reduction!
go build -mod=readonly $(BUILD_FLAGS) ./cmd/enigmad
go build -mod=readonly $(BUILD_FLAGS) ./cmd/enigmacli

build_local:
# cd go-cosmwasm && rustup run nightly cargo build --release --features backtraces
# cp go-cosmwasm/target/release/libgo_cosmwasm.so go-cosmwasm/api
@ #this pulls out ELF symbols, 80% size reduction!
go build -mod=readonly $(BUILD_FLAGS) ./cmd/enigmad
go build -mod=readonly $(BUILD_FLAGS) ./cmd/enigmacli

build_linux: build_local

build_windows:
$(MAKE) xgo_build_enigmad XGO_TARGET=windows/amd64
# CLI only
$(MAKE) xgo_build_enigmacli XGO_TARGET=windows/amd64

build_macos:
$(MAKE) xgo_build_enigmad XGO_TARGET=darwin/amd64
# CLI only
$(MAKE) xgo_build_enigmacli XGO_TARGET=darwin/amd64

build_all: build_linux build_windows build_macos
build_arm_linux:
# CLI only
$(MAKE) xgo_build_enigmacli XGO_TARGET=linux/arm64

deb: build_local
build_all: build_linux build_windows build_macos build_arm_linux

deb: build_linux
ifneq ($(UNAME_S),Linux)
exit 1
endif
rm -rf /tmp/EnigmaBlockchain

mkdir -p /tmp/EnigmaBlockchain/deb/bin
mv -f ./enigmacli /tmp/EnigmaBlockchain/deb/bin/enigmacli
mv -f ./enigmad /tmp/EnigmaBlockchain/deb/bin/enigmad
chmod +x /tmp/EnigmaBlockchain/deb/bin/enigmad /tmp/EnigmaBlockchain/deb/bin/enigmacli
# mkdir -p /tmp/EnigmaBlockchain/deb/usr/lib
# mv -f ./go-cosmwasm/api/libgo_cosmwasm.so /tmp/EnigmaBlockchain/deb/usr/lib/libgo_cosmwasm.so
# chmod +x /tmp/EnigmaBlockchain/deb/usr/lib/libgo_cosmwasm.so

mkdir -p /tmp/EnigmaBlockchain/deb/usr/lib
cp -f ./go-cosmwasm/api/libgo_cosmwasm.so ./go-cosmwasm/librust_cosmwasm_enclave.signed.so /tmp/EnigmaBlockchain/deb/usr/lib/
chmod +x /tmp/EnigmaBlockchain/deb/usr/lib/lib*.so

mkdir -p /tmp/EnigmaBlockchain/deb/DEBIAN
cp ./packaging_ubuntu/control /tmp/EnigmaBlockchain/deb/DEBIAN/control
Expand All @@ -126,18 +124,22 @@ sign_for_release: rename_for_release
-sha256sum enigmad-* enigmacli-* >> SHA256SUMS
gpg -u 91831DE812C6415123AFAA7B420BF1CB005FBCE6 --digest-algo sha256 --clearsign --yes SHA256SUMS
rm -f SHA256SUMS

release: sign_for_release
rm -rf ./release/
mkdir -p ./release/
cp enigma-blockchain_*.deb ./release/
cp enigmacli-* ./release/
cp enigma-blockchain_*.deb ./release/
cp enigmacli-* ./release/
cp enigmad-* ./release/
cp SHA256SUMS.asc ./release/

clean:
-rm -rf /tmp/EnigmaBlockchain
-rm -f ./enigmacli-*
-rm -f ./enigmad-*
-rm -f ./enigmacli*
-rm -f ./enigmad*
-rm -f ./librust_cosmwasm_enclave.signed.so
-rm -f ./x/compute/internal/keeper/librust_cosmwasm_enclave.signed.so
-rm -f ./enigma-blockchain*.deb
-rm -f ./SHA256SUMS*
$(MAKE) -C go-cosmwasm clean-all
$(MAKE) -C cosmwasm/lib/wasmi-runtime clean
44 changes: 24 additions & 20 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import (
"encoding/json"
"io"
"os"
"path/filepath"

"github.com/enigmampc/EnigmaBlockchain/x/compute"
"github.com/spf13/viper"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
tmtypes "github.com/tendermint/tendermint/types"
Expand Down Expand Up @@ -56,7 +60,7 @@ var (
distr.AppModuleBasic{},
gov.NewAppModuleBasic(paramsclient.ProposalHandler, distr.ProposalHandler, upgradeclient.ProposalHandler),
params.AppModuleBasic{},
// compute.AppModuleBasic{},
compute.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
supply.AppModuleBasic{},
Expand Down Expand Up @@ -116,7 +120,7 @@ type EnigmaChainApp struct {
paramsKeeper params.Keeper
upgradeKeeper upgrade.Keeper
evidenceKeeper evidence.Keeper
// computeKeeper compute.Keeper
computeKeeper compute.Keeper

// the module manager
mm *module.Manager
Expand All @@ -127,9 +131,9 @@ type EnigmaChainApp struct {

// WasmWrapper allows us to use namespacing in the config file
// This is only used for parsing in the app, x/compute expects WasmConfig
// type WasmWrapper struct {
// Wasm compute.WasmConfig `mapstructure:"wasm"`
// }
type WasmWrapper struct {
Wasm compute.WasmConfig `mapstructure:"wasm"`
}

// NewEnigmaChainApp is a constructor function for enigmaChainApp
func NewEnigmaChainApp(
Expand Down Expand Up @@ -161,7 +165,7 @@ func NewEnigmaChainApp(
params.StoreKey,
upgrade.StoreKey,
evidence.StoreKey,
// compute.StoreKey,
compute.StoreKey,
)

tKeys := sdk.NewTransientStoreKeys(staking.TStoreKey, params.TStoreKey)
Expand Down Expand Up @@ -256,20 +260,20 @@ func NewEnigmaChainApp(

app.evidenceKeeper = *evidenceKeeper

// // just re-use the full router - do we want to limit this more?
// var computeRouter = bApp.Router()
// // better way to get this dir???
// homeDir := viper.GetString(cli.HomeFlag)
// computeDir := filepath.Join(homeDir, ".compute")
// just re-use the full router - do we want to limit this more?
var computeRouter = bApp.Router()
// better way to get this dir???
homeDir := viper.GetString(cli.HomeFlag)
computeDir := filepath.Join(homeDir, ".compute")

// wasmWrap := WasmWrapper{Wasm: compute.DefaultWasmConfig()}
// err := viper.Unmarshal(&wasmWrap)
// if err != nil {
// panic("error while reading wasm config: " + err.Error())
// }
// wasmConfig := wasmWrap.Wasm
wasmWrap := WasmWrapper{Wasm: compute.DefaultWasmConfig()}
err := viper.Unmarshal(&wasmWrap)
if err != nil {
panic("error while reading wasm config: " + err.Error())
}
wasmConfig := wasmWrap.Wasm

// app.computeKeeper = compute.NewKeeper(app.cdc, keys[compute.StoreKey], app.accountKeeper, app.bankKeeper, computeRouter, computeDir, wasmConfig)
app.computeKeeper = compute.NewKeeper(app.cdc, keys[compute.StoreKey], app.accountKeeper, app.bankKeeper, computeRouter, computeDir, wasmConfig)

// register the proposal types
govRouter := gov.NewRouter()
Expand Down Expand Up @@ -305,7 +309,7 @@ func NewEnigmaChainApp(
staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper),
upgrade.NewAppModule(app.upgradeKeeper),
evidence.NewAppModule(app.evidenceKeeper),
// compute.NewAppModule(app.computeKeeper),
compute.NewAppModule(app.computeKeeper),
)
// During begin block slashing happens after distr.BeginBlocker so that
// there is nothing left over in the validator fee pool, so as to keep the
Expand All @@ -329,7 +333,7 @@ func NewEnigmaChainApp(
crisis.ModuleName,
genutil.ModuleName,
evidence.ModuleName,
// compute.ModuleName,
compute.ModuleName,
)

// register all module routes and module queriers
Expand Down
Loading