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

Restructure configuration to support referencing multiple contracts #318

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3ce74ab
michelson: add contracts map
sskeirik Jul 6, 2021
fc3c4f0
michelson: prevent rule from generating C++ error
sskeirik Aug 4, 2021
7568094
compat: update other contracts map data structure
sskeirik Aug 4, 2021
1f8e93d
Makefile: build-k builds liquidity-baking too so kompile does not run…
nishantjr Jul 11, 2021
c5467e3
tests: update prove tests to use new contract syntax
sskeirik Jul 7, 2021
9bd3e84
tests: update dexter tests to use new syntax
sskeirik Aug 4, 2021
6c9612c
michelson: update semantics to improve account-accessing proofs
sskeirik Aug 5, 2021
fde6703
WIP update lb proof specs to use new account map
sskeirik Aug 5, 2021
d510059
michelson: SELF: Use map lookup rather than matching to hopefully sim…
nishantjr Aug 5, 2021
a4fbf46
more lb-spec fixes
nishantjr Aug 5, 2021
ec50ce8
michelson: Ditto for the next SELF rule
nishantjr Aug 5, 2021
73bbf38
michelson: add entrypoints macro and test
sskeirik Aug 5, 2021
8806729
dexter: remove entrypoints macro
sskeirik Aug 5, 2021
7e71790
tests/proofs/entrypoints-spec.k: Transcribe unit tests into proofs
nishantjr Aug 10, 2021
31001bc
Proofs for CONTRACT now pass
nishantjr Aug 10, 2021
2b08465
dexter: add bool simplifications
sskeirik Aug 11, 2021
1d1a8e5
lb: add bool simplification
sskeirik Aug 11, 2021
85f4dab
fix DEXTER-ADDLIQUIDITY-NEGATIVE-SPEC test
sskeirik Aug 14, 2021
411379e
Rename contract cells
sskeirik Aug 14, 2021
7ed2eff
lb: update lb proofs
sskeirik Aug 14, 2021
8fd8634
lqt: remove internalized predicate
sskeirik Aug 14, 2021
11b3630
lqt: split out lqt proof cases
sskeirik Aug 14, 2021
5e0fcf8
tests: fix return-spec syntax
sskeirik Aug 14, 2021
a29ef21
lqt: split on value in transfer proxy case
sskeirik Aug 16, 2021
6e0bb76
Jenkinsfile: Up timeout for test-prove to 30 minutes
nishantjr Aug 16, 2021
cefbe7b
update K (old version does not work)
sskeirik Aug 16, 2021
d2d7c3b
!!! Disable lqt-prove target for testing
sskeirik Aug 17, 2021
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
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pipeline {
}
}
stage('Test') {
options { timeout(time: 15, unit: 'MINUTES') }
options { timeout(time: 30, unit: 'MINUTES') }
parallel {
stage('Unit') { steps { sh 'make test-unit -j8' } }
stage('Symbolic') { steps { sh 'make test-symbolic -j2' } }
Expand All @@ -31,7 +31,7 @@ pipeline {
stage('Integration Proofs') {
options { timeout(time: 180, unit: 'MINUTES') }
stages {
stage('Audit Proofs') { steps { sh 'make dexter-prove lqt-prove lb-prove -j4' } }
stage('Audit Proofs') { steps { sh 'make dexter-prove lb-prove -j4' } }
}
}
stage('Cross Test') {
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ defn-k: defn-llvm defn-prove defn-symbolic
defn-compat: defn-contract-expander defn-extractor defn-input-creator defn-output-compare

build: build-k build-compat
build-k: build-llvm build-prove build-symbolic build-dexter build-lqt
build-k: build-llvm build-prove build-symbolic build-dexter build-lb build-lqt
build-compat: build-contract-expander build-extractor build-input-creator build-output-compare

# LLVM
Expand Down
33 changes: 8 additions & 25 deletions common.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,29 +334,7 @@ eleven 'anywhere' rules here.
Michelson Internal Representation Conversion
--------------------------------------------

This function converts the `other_contracts` field into its internal
represetation.

```k
syntax Map ::= #OtherContractsMapToKMap(OtherContractsMapEntryList) [function]
| #OtherContractsMapToKMap(String, Map, OtherContractsMapEntryList) [function]
// ----------------------------------------------------------------------------------------
rule #OtherContractsMapToKMap( .OtherContractsMapEntryList ) => .Map
rule #OtherContractsMapToKMap( Contract A T ; Rs )
=> #OtherContractsMapToKMap(A, #BuildAnnotationMap(.FieldAnnotation, T), Rs)

rule #OtherContractsMapToKMap(A, TypeMap, Rs) =>
#BuildOtherContractsMap(#Address(A), TypeMap) #OtherContractsMapToKMap(Rs)

syntax Map ::= #BuildOtherContractsMap(Address, Map) [function]
// ------------------------------------------------------------
rule #BuildOtherContractsMap(A, FA:FieldAnnotation |-> T:TypeName TypeMap:Map)
=> A . FA |-> T #BuildOtherContractsMap(A, TypeMap)

rule #BuildOtherContractsMap(_, .Map) => .Map
```

This function converts all other datatypes into their internal represenations.
This function converts datatypes into their internal represenations.

```k
syntax DataOrSeq ::= Data | DataList | MapEntryList // Can't subsort DataList to Data, as that would form a cycle.
Expand Down Expand Up @@ -597,16 +575,21 @@ a contract lookup.
=> Transfer_tokens
#MichelineToNative(
P,
#Type({KnownAddrs [ #ParseEntrypoint(A) ]}:>TypeName),
#Type(#LookupEntrypoint(KnownAddrs, #ParseEntrypoint(A))),
KnownAddrs,
BigMaps
)
#Mutez(M)
#ParseEntrypoint(A)
N
requires (isWildcard(N) orBool isInt(N))
andBool #ParseEntrypoint(A) in_keys(KnownAddrs)
andBool #IsLegalMutezValue(M)

syntax TypeName ::= #LookupEntrypoint(Map, Entrypoint) [function]
// --------------------------------------------------------------
rule #LookupEntrypoint(Entrypoints, A . FA) => { { Entrypoints [ A ] }:>Map [ FA ] }:>TypeName
requires A in_keys(Entrypoints)
andBool FA in_keys( { Entrypoints [ A ] }:>Map )
```

We extract a `big_map` by index from the bigmaps map. Note that these have
Expand Down
7 changes: 7 additions & 0 deletions compat.md
Original file line number Diff line number Diff line change
Expand Up @@ -820,5 +820,12 @@ module OUTPUT-COMPARE
<knownaddrs> _ => #OtherContractsMapToKMap(M) </knownaddrs>

rule <k> real_output AOS ; output EOS => #CheckOutput(EOS, AOS) ... </k>

syntax Map ::= #OtherContractsMapToKMap(OtherContractsMapEntryList) [function]
| #OtherContractsMapToKMap(String, Map, OtherContractsMapEntryList) [function]
// ----------------------------------------------------------------------------------------
rule #OtherContractsMapToKMap( .OtherContractsMapEntryList ) => .Map
rule #OtherContractsMapToKMap( Contract A T ; Rs )
=> #Address(A) |-> #BuildAnnotationMap(.FieldAnnotation, T) #OtherContractsMapToKMap(Rs)
endmodule
```
2 changes: 1 addition & 1 deletion ext/k
Submodule k updated from bf17ff to 75dfe3
Loading