Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Update dependency: deps/wasm-semantics #26

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
75b6289
deps/wasm-semantics: 2c4f62c - Update dependency: deps/k (#348)
rv-jenkins May 29, 2020
a9b8bee
deps/wasm-semantics: 6941fb6 - Unfold definitions (#345)
rv-jenkins May 30, 2020
3660fd1
Preprocess modules in driver
hjorthjort Jun 13, 2020
b104194
success-llvm: remove nextFreshId
hjorthjort Jun 13, 2020
3af1247
proofs: remove nextFreshId
hjorthjort Jun 13, 2020
60826de
deps/wasm-semantics: 60895c3 - kwasm-lemmas: use upstreamed integer s…
rv-jenkins Jun 1, 2020
5ad1a2c
deps/wasm-semantics: 05d42eb - Standardize Makefile (#351)
rv-jenkins Jun 4, 2020
9f101d3
deps/wasm-semantics: ea521a7 - Sort text module (#349)
rv-jenkins Jun 5, 2020
fec3c63
deps/wasm-semantics: 9d7bb2c - Remove contextlookup for functions (#355)
rv-jenkins Jun 6, 2020
4cdf82e
deps/wasm-semantics: d944601 - Remove named valtypes (#356)
rv-jenkins Jun 9, 2020
40abea8
deps/wasm-semantics: 435e43f - Module metadata (#357)
rv-jenkins Jun 10, 2020
7e2ac62
deps/wasm-semantics: 08042d9 - Use native md file support from K (#358)
rv-jenkins Jun 11, 2020
8e0355f
deps/wasm-semantics: 8794dd4 - Fix typo (`eq` instead of `ne`) (#359)
rv-jenkins Jun 12, 2020
e7e4c3c
Update Makefile for native Markdown support
hjorthjort Jun 13, 2020
9eb40fb
ewasm: bugfix: correct file import
hjorthjort Jun 13, 2020
e3609a0
Use new core func type
hjorthjort Jun 13, 2020
de5f4da
Only import WASM-TEXT in DRIVER, not in EWASM
hjorthjort Jun 13, 2020
5eb2413
Makefile cleanup
hjorthjort Jun 13, 2020
c3fad9a
Jenkinsfile: remove tangling target
hjorthjort Jun 13, 2020
3870f98
Makefile: only rebuild definitions when source files change
hjorthjort Jun 14, 2020
b82de8c
Makefile: cleanups
hjorthjort Jun 14, 2020
c341f96
Makefile: remove phony targets
hjorthjort Jun 14, 2020
bde0840
Makefile: build_dir => BUILD_DIR
hjorthjort Jun 14, 2020
aa3c1bc
Makefile: add build-\% as .PHONY target
hjorthjort Jun 14, 2020
315c6c0
Makefile: proofs should depend on presence of lemmas file
hjorthjort Jun 14, 2020
306ab72
Makefile: remove unused target
hjorthjort Jun 14, 2020
0cd1975
fix: typo
hjorthjort Jun 14, 2020
fb1bd13
Makefile: Remove build-% PHONY target
hjorthjort Jun 14, 2020
1b46079
deps/wasm-semantics: 1dca85e - Explicit instruction sequencing (#360)
rv-jenkins Jun 14, 2020
3ec56f5
deps/wasm-semantics: 51bb2ab - Embedded Wasm (#362)
rv-jenkins Jun 17, 2020
b9f91c2
deps/wasm-semantics: af4e537 - Update dependency: deps/k (#352)
rv-jenkins Jun 17, 2020
20015a5
deps/wasm-semantics: 470f34e - Update dependency: deps/k (#364)
rv-jenkins Jun 24, 2020
c4bb796
deps/wasm-semantics: 1b18811 - Use WASM-TEXT as main cell for Haskell…
rv-jenkins Jun 25, 2020
510d64b
deps/wasm-semantics: 117eeb0 - Add underscore to unsed variables (#366)
rv-jenkins Jun 26, 2020
9d7606e
deps/wasm-semantics: 54eb26f - Type desugaring during text -> core ph…
rv-jenkins Jul 8, 2020
9cd4185
deps/wasm-semantics: 221a9d9 - deps/k: ab078f6d5 - Update issue templ…
rv-jenkins Jul 10, 2020
2e6a3cd
deps/wasm-semantics: 520245d - Remove #ContextLookup for types when a…
rv-jenkins Jul 14, 2020
ae9e930
deps/wasm-semantics: d56298b - Update dependency: deps/k (#370)
rv-jenkins Jul 29, 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
1 change: 0 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ pipeline {
when { changeRequest() }
steps { script { currentBuild.displayName = "PR ${env.CHANGE_ID}: ${env.CHANGE_TITLE}" } }
}
stage('Definition Deps') { steps { sh 'make definition-deps -j4' } }
stage('Build') { steps { sh 'make build -j4' } }
stage('Test') {
options { timeout(time: 15, unit: 'MINUTES') }
Expand Down
149 changes: 47 additions & 102 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Settings
# --------

deps_dir := deps
wasm_submodule := $(deps_dir)/wasm-semantics
eei_submodule := $(deps_dir)/eei-semantics
k_submodule := $(wasm_submodule)/deps/k
BUILD_DIR := .build
DEPS_DIR := deps
DEFN_DIR := $(BUILD_DIR)/defn

KWASM_SUBMODULE := $(DEPS_DIR)/wasm-semantics
EEI_SUBMODULE := $(DEPS_DIR)/eei-semantics
k_submodule := $(KWASM_SUBMODULE)/deps/k

ifneq (,$(wildcard $(k_submodule)/k-distribution/target/release/k/bin/*))
K_RELEASE ?= $(abspath $(k_submodule)/k-distribution/target/release/k)
Expand All @@ -15,123 +18,69 @@ K_BIN := $(K_RELEASE)/bin
K_LIB := $(K_RELEASE)/lib/kframework
export K_RELEASE

PATH:=$(K_BIN):$(abspath $(wasm_submodule)):$(PATH)
PATH:=$(K_BIN):$(abspath $(KWASM_SUBMODULE)):$(PATH)
export PATH

build_dir := .build
defn_dir := $(build_dir)/defn
kompiled_dir_name := ewasm-test

wasm_make := make --directory $(wasm_submodule) DEFN_DIR=../../$(defn_dir)
eei_make := make --directory $(eei_submodule) DEFN_DIR=../../$(defn_dir)

pandoc_tangle_submodule := $(wasm_submodule)/deps/pandoc-tangle
tangler := $(pandoc_tangle_submodule)/tangle.lua
LUA_PATH := $(pandoc_tangle_submodule)/?.lua;;
export LUA_PATH
KWASM_MAKE := make --directory $(KWASM_SUBMODULE) BUILD_DIR=../../$(BUILD_DIR) RELEASE=$(RELEASE)

.PHONY: all clean \
deps haskell-deps \
defn defn-llvm defn-haskell \
definition-deps wasm-definitions eei-definitions \
build build-llvm build-haskell \
test test-execution test-simple test-prove \
.PHONY: all clean deps \
build \
test test-execution test-simple \
test-prove \
media presentations reports

all: build

clean:
rm -rf $(build_dir)
rm -f $(wasm_submodule)/make.timestamp
rm -f $(eei_submodule)/make.timestamp
rm -rf $(BUILD_DIR)
git submodule update --init --recursive
$(MAKE) clean -C $(wasm_submodule)
$(MAKE) clean -C $(eei_submodule)
$(MAKE) clean -C $(KWASM_SUBMODULE)
$(MAKE) clean -C $(EEI_SUBMODULE)

# Build Dependencies (K Submodule)
# --------------------------------

wasm_files=test.k wasm.k data.k kwasm-lemmas.k
wasm_source_files:=$(patsubst %, $(wasm_submodule)/%, $(patsubst %.k, %.md, $(wasm_files)))
eei_files:=eei.k
eei_source_files:=$(patsubst %, $(eei_submodule)/%, $(patsubst %.k, %.md, $(eei_files)))
ewasm_files:=ewasm-test.k driver.k ewasm.k kewasm-lemmas.k
all_k_files:=$(ewasm_files) $(wasm_files) $(eei_files)

deps: $(wasm_submodule)/make.timestamp $(eei_submodule)/make.timestamp definition-deps

definition-deps: wasm-definitions eei-definitions

wasm-definitions:
$(wasm_make) -B defn-llvm
$(wasm_make) -B defn-haskell
EEI_FILES:=eei.md
EEI_SOURCE_FILES:=$(patsubst %, $(EEI_SUBMODULE)/%, $(EEI_FILES))
EWASM_FILES:=ewasm-test.md driver.md ewasm.md kewasm-lemmas.md
EWASM_SOURCE_FILES:=$(EWASM_FILES)
EXTRA_FILES:=$(EEI_FILES) $(EWASM_FILES)
EXTRA_SOURCE_FILES:=$(patsubst %, $(KWASM_SUBMODULE)/%, $(EXTRA_FILES))

eei-definitions: $(eei_source_files)
$(eei_make) -B defn-llvm
$(eei_make) -B defn-haskell

$(wasm_submodule)/make.timestamp: $(wasm_source_files)
git submodule update --init --recursive
$(wasm_make) deps
touch $(wasm_submodule)/make.timestamp

$(eei_submodule)/make.timestamp: $(eei_source_files)
git submodule update --init --recursive
touch $(eei_submodule)/make.timestamp
deps:
$(KWASM_MAKE) deps

# Building Definition
# -------------------

llvm_dir:=$(defn_dir)/llvm
llvm_defn:=$(patsubst %, $(llvm_dir)/%, $(all_k_files))
llvm_kompiled:=$(llvm_dir)/ewasm-test-kompiled/interpreter

haskell_dir:=$(defn_dir)/haskell
haskell_defn:=$(patsubst %, $(haskell_dir)/%, $(all_k_files))
haskell_kompiled:=$(haskell_dir)/ewasm-test-kompiled/definition.kore

main_module=EWASM-TEST
syntax_module=EWASM-TEST-SYNTAX

# Tangle definition from *.md files

defn: defn-llvm defn-haskell
defn-llvm: $(llvm_defn)
defn-haskell: $(haskell_defn)

$(llvm_dir)/%.k: %.md $(tangler)
@echo "== tangle: $@"
mkdir -p $(dir $@)
pandoc --from markdown --to $(tangler) --metadata=code:.k $< > $@

$(haskell_dir)/%.k: %.md $(tangler)
@echo "== tangle: $@"
mkdir -p $(dir $@)
pandoc --from markdown --to $(tangler) --metadata=code:.k $< > $@
MAIN_MODULE=EWASM-TEST
MAIN_SYNTAX_MODULE=EWASM-TEST-SYNTAX
MAIN_DEFN_FILE=ewasm-test

# Build definitions

KOMPILE_OPTS :=

build: build-llvm build-haskell
build-llvm: $(llvm_kompiled)
build-haskell: $(haskell_kompiled)

$(llvm_kompiled): $(llvm_defn)
@echo "== kompile: $@"
kompile --backend llvm \
--directory $(llvm_dir) -I $(llvm_dir) \
--main-module $(main_module) \
--syntax-module $(syntax_module) $< \
$(KOMPILE_OPTS)

$(haskell_kompiled): $(haskell_defn)
@echo "== kompile: $@"
kompile --backend haskell \
--directory $(haskell_dir) -I $(haskell_dir) \
--main-module $(main_module) \
--syntax-module $(syntax_module) $< \
$(KOMPILE_OPTS)

build-%: $(EXTRA_SOURCE_FILES)
$(KWASM_MAKE) build-$* \
DEFN_DIR=../../$(DEFN_DIR) \
llvm_main_module=$(MAIN_MODULE) \
llvm_syntax_module=$(MAIN_SYNTAX_MODULE) \
llvm_main_file=$(MAIN_DEFN_FILE) \
haskell_main_module=$(MAIN_MODULE) \
haskell_syntax_module=$(MAIN_SYNTAX_MODULE) \
haskell_main_file=$(MAIN_DEFN_FILE) \
EXTRA_SOURCE_FILES="$(EXTRA_FILES)" \
KOMPILE_OPTS="$(KOMPILE_OPTS)"

$(KWASM_SUBMODULE)/%.md: %.md
cp $< $@

$(KWASM_SUBMODULE)/%.md: $(EEI_SUBMODULE)/%.md
cp $< $@

# Testing
# -------
Expand All @@ -140,14 +89,10 @@ TEST_CONCRETE_BACKEND:=llvm
TEST_SYMBOLIC_BACKEND:=haskell
TEST:=./kewasm
KPROVE_MODULE:=KEWASM-LEMMAS
KPROVE_MODULE_FILE=kewasm-lemmas.md
KPROVE_OPTS:=
CHECK:=git --no-pager diff --no-index --ignore-all-space

tests/%/make.timestamp:
@echo "== submodule: $@"
git submodule update --init -- tests/$*
touch $@

test: test-execution test-prove

# Generic Test Harnesses
Expand All @@ -165,7 +110,7 @@ tests/%.parse: tests/%
$(CHECK) $@-expected $@-out
rm -rf $@-out

tests/%.prove: tests/%
tests/%.prove: tests/% $(KWASM_SUBMODULE)/$(KPROVE_MODULE_FILE)
$(TEST) prove --backend $(TEST_SYMBOLIC_BACKEND) $(filter --repl, $(KPROVE_OPTS)) $< --format-failures --def-module $(KPROVE_MODULE) $(filter-out --repl, $(KPROVE_OPTS))

### Execution Tests
Expand Down
2 changes: 1 addition & 1 deletion deps/wasm-semantics
10 changes: 6 additions & 4 deletions driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ Ethereum Simulation
===================

```k
require "ewasm.k"
require "data.k"
require "wasm-text.md"
require "ewasm.md"
require "data.md"

module DRIVER-SYNTAX
imports EWASM-SYNTAX
imports WASM-SYNTAX
imports WASM-TEXT-SYNTAX
imports DRIVER
endmodule

module DRIVER
imports EWASM
imports WASM-TEXT
```

An Ewasm program is the invocation of an Ethereum contract containing Ewasm code.
Expand Down Expand Up @@ -111,7 +113,7 @@ Setting up the blockchain state
```k
syntax EthereumCommand ::= "#createContract" CallData ModuleDecl
// ----------------------------------------------------------------
rule <k> #createContract ADDRESS CODE => CODE ~> #storeModuleAt CallData2Int(ADDRESS) ... </k>
rule <k> #createContract ADDRESS CODE => text2abstract(CODE .Stmts) ~> #storeModuleAt CallData2Int(ADDRESS) ... </k>

syntax EthereumCommand ::= "#storeModuleAt" CallData
// ----------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions ewasm-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Testing
We make use of the testing module for Wasm, which will let us make assertions about the Wasm runtime state.

```k
requires "test.k" // WASM-TEST
requires "driver.k"
requires "test.md" // WASM-TEST
requires "driver.md"

module EWASM-TEST-SYNTAX
imports WASM-TEST-SYNTAX
Expand Down
8 changes: 4 additions & 4 deletions ewasm.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ Ewasm Specification
=================

```k
require "wasm.k"
require "eei.k"
require "wasm.md"
require "eei.md"

module EWASM-SYNTAX
imports WASM-TOKEN-SYNTAX
imports WASM-SYNTAX
imports EWASM
endmodule
```
Expand Down Expand Up @@ -72,7 +72,7 @@ Then, when a `HostCall` instruction is encountered, parameters are gathered from

```k
rule <k> ( import MODNAME FNAME (func OID:OptionalId TUSE:TypeUse) )
=> ( func OID TUSE .LocalDecls #eeiFunction(FNAME) .Instrs )
=> #func(... type: TUSE, locals: .LocalDecls, body: #eeiFunction(FNAME) .Instrs, metadata: #meta(... id: OID, localIds: .Map))
...
</k>
requires MODNAME ==K #ethereumModule
Expand Down
3 changes: 1 addition & 2 deletions kewasm-lemmas.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ These lemmas aid in verifying Ewasm programs behavior.
They are part of the *trusted* base, and so should be scrutinized carefully.

```k
requires "kwasm-lemmas.k"
requires "kewasm-lemmas.k"
requires "kwasm-lemmas.md"

module KEWASM-LEMMAS
imports EWASM-TEST
Expand Down
5 changes: 1 addition & 4 deletions tests/proofs/invoke-contract-spec.k
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requires "kewasm-lemmas.k"
requires "kewasm-lemmas.md"

module INVOKE-CONTRACT-SPEC
imports KEWASM-LEMMAS
Expand Down Expand Up @@ -58,8 +58,5 @@ module INVOKE-CONTRACT-SPEC
</nextMemAddr>
...
</mainStore>
<nextFreshId>
0 => ?_
</nextFreshId>

endmodule
3 changes: 0 additions & 3 deletions tests/success-llvm.out
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@
<deterministicMemoryGrowth>
true
</deterministicMemoryGrowth>
<nextFreshId>
0
</nextFreshId>
</wasm>
<paramstack>
.ParamStack
Expand Down