From ee33a4a6a35e06df8a81c9a2525ea1773a540663 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Mon, 16 Dec 2019 12:51:48 +0100 Subject: [PATCH 1/5] Fixed alignment issue on wider screens --- gitlab-pages/website/static/css/custom.css | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gitlab-pages/website/static/css/custom.css b/gitlab-pages/website/static/css/custom.css index b036ef55b..7f3cbb739 100644 --- a/gitlab-pages/website/static/css/custom.css +++ b/gitlab-pages/website/static/css/custom.css @@ -858,6 +858,13 @@ a:hover { } } +@media (min-width: 1500px) { + .centered { + max-width: 1400px; + } +} + + @media (max-width: 1023px) { .centered { flex-direction: column; @@ -953,4 +960,5 @@ a:hover { } .language-reasonligo .hljs-constructor { color: #a31515; -} \ No newline at end of file +} + From fb8fae05d74087bbd4cf1b68300cb2cc32f0c7ab Mon Sep 17 00:00:00 2001 From: John David Pressman Date: Mon, 16 Dec 2019 12:10:31 -0800 Subject: [PATCH 2/5] Fix IMPLICIT_ACCOUNT, again and this time add regression expect test --- src/bin/expect_tests/contract_tests.ml | 13 +++++++++++++ src/passes/operators/operators.ml | 1 + src/test/contracts/implicit.mligo | 3 +++ 3 files changed, 17 insertions(+) create mode 100644 src/test/contracts/implicit.mligo diff --git a/src/bin/expect_tests/contract_tests.ml b/src/bin/expect_tests/contract_tests.ml index 7492ce39d..1facce834 100644 --- a/src/bin/expect_tests/contract_tests.ml +++ b/src/bin/expect_tests/contract_tests.ml @@ -899,3 +899,16 @@ let%expect_test _ = PAIR ; DIP { DROP 5 } } ; DIP { DROP } } } |}] + +let%expect_test _ = + run_ligo_good [ "compile-contract" ; contract "implicit.mligo" ; "main" ] ; + [%expect {| + { parameter key_hash ; + storage unit ; + code { DUP ; + CAR ; + IMPLICIT_ACCOUNT ; + UNIT ; + NIL operation ; + PAIR ; + DIP { DROP 2 } } } |}] diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 40ee08dd4..3ac7a0959 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -922,6 +922,7 @@ module Compiler = struct | C_AMOUNT -> ok @@ simple_constant @@ prim I_AMOUNT | C_ADDRESS -> ok @@ simple_constant @@ prim I_ADDRESS | C_SELF_ADDRESS -> ok @@ simple_constant @@ seq [prim I_SELF; prim I_ADDRESS] + | C_IMPLICIT_ACCOUNT -> ok @@ simple_unary @@ prim I_IMPLICIT_ACCOUNT | C_NOW -> ok @@ simple_constant @@ prim I_NOW | C_CALL -> ok @@ simple_ternary @@ prim I_TRANSFER_TOKENS | C_SOURCE -> ok @@ simple_constant @@ prim I_SOURCE diff --git a/src/test/contracts/implicit.mligo b/src/test/contracts/implicit.mligo new file mode 100644 index 000000000..c20f45546 --- /dev/null +++ b/src/test/contracts/implicit.mligo @@ -0,0 +1,3 @@ +let main (p : key_hash) (s : unit) = + let c : unit contract = Current.implicit_account p in + (([] : operation list), unit) \ No newline at end of file From c83813456ab71ec59b2f0ba64bd098b7c2e8d544 Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Mon, 16 Dec 2019 14:32:10 -0600 Subject: [PATCH 3/5] Relocate .opam --- docker/distribution/generic/build.Dockerfile | 2 +- src/ligo.opam => ligo.opam | 0 scripts/install_native_dependencies.sh | 6 ++++-- scripts/install_vendors_deps.sh | 2 +- scripts/setup_switch.sh | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) rename src/ligo.opam => ligo.opam (100%) diff --git a/docker/distribution/generic/build.Dockerfile b/docker/distribution/generic/build.Dockerfile index e183fc683..0e072f10c 100644 --- a/docker/distribution/generic/build.Dockerfile +++ b/docker/distribution/generic/build.Dockerfile @@ -26,7 +26,7 @@ RUN opam update # Install ligo RUN sh scripts/install_vendors_deps.sh -RUN opam install -y ./src +RUN opam install -y . # Use the ligo binary as a default command ENTRYPOINT [ "/home/opam/.opam/4.07/bin/ligo" ] diff --git a/src/ligo.opam b/ligo.opam similarity index 100% rename from src/ligo.opam rename to ligo.opam diff --git a/scripts/install_native_dependencies.sh b/scripts/install_native_dependencies.sh index 46e354711..2a0e56903 100755 --- a/scripts/install_native_dependencies.sh +++ b/scripts/install_native_dependencies.sh @@ -14,7 +14,8 @@ then m4 \ libcap \ bubblewrap \ - rsync + rsync \ + git else apt-get update -qq @@ -27,5 +28,6 @@ else m4 \ libcap-dev \ bubblewrap \ - rsync + rsync \ + git fi diff --git a/scripts/install_vendors_deps.sh b/scripts/install_vendors_deps.sh index 3da674636..15f9b47d4 100755 --- a/scripts/install_vendors_deps.sh +++ b/scripts/install_vendors_deps.sh @@ -2,5 +2,5 @@ set -e # Install local dependencies -opam install -y --deps-only --with-test $(find src vendors -name \*.opam) +opam install -y --deps-only --with-test ./ligo.opam $(find vendors -name \*.opam) opam install -y $(find vendors -name \*.opam) diff --git a/scripts/setup_switch.sh b/scripts/setup_switch.sh index ee1179109..8810e4483 100755 --- a/scripts/setup_switch.sh +++ b/scripts/setup_switch.sh @@ -2,5 +2,5 @@ set -e set -x -printf '' | opam switch create . ocaml-base-compiler.4.07.1 # toto ocaml-base-compiler.4.06.1 +printf '' | opam switch create . ocaml-base-compiler.4.07.1 --no-install eval $(opam config env) From 3110ae87e1f9af38a0584298bebac1b494e21196 Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Mon, 16 Dec 2019 14:33:16 -0600 Subject: [PATCH 4/5] Pass CI_JOB_ID to docker container --- docker/distribution/generic/build.Dockerfile | 3 +++ scripts/distribution/generic/build.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/distribution/generic/build.Dockerfile b/docker/distribution/generic/build.Dockerfile index 0e072f10c..f6c9358e9 100644 --- a/docker/distribution/generic/build.Dockerfile +++ b/docker/distribution/generic/build.Dockerfile @@ -1,6 +1,9 @@ ARG target FROM ocaml/opam2:${target} +ARG ci_job_id +ENV CI_JOB_ID=$ci_job_id + RUN opam switch 4.07 && eval $(opam env) USER root diff --git a/scripts/distribution/generic/build.sh b/scripts/distribution/generic/build.sh index 7f4a89e9a..49aba15e1 100755 --- a/scripts/distribution/generic/build.sh +++ b/scripts/distribution/generic/build.sh @@ -8,4 +8,4 @@ dockerfile="./docker/distribution/generic/build.Dockerfile" echo "Building LIGO for $target" echo "Using Dockerfile: $dockerfile" echo "Tagging as: $tag_build\n" -docker build --build-arg target="$target" -t "$tag_build" -f "$dockerfile" . \ No newline at end of file +docker build --build-arg ci_job_id="${CI_JOB_ID}" --build-arg target="$target" -t "$tag_build" -f "$dockerfile" . From ffb225e269278438ec5f7fa7b40e4d5df25e4949 Mon Sep 17 00:00:00 2001 From: Lesenechal Remi Date: Tue, 17 Dec 2019 11:10:29 +0100 Subject: [PATCH 5/5] fix address arity and update test --- src/passes/operators/operators.ml | 2 +- src/test/contracts/address.ligo | 6 +++++- src/test/contracts/address.mligo | 4 +++- src/test/contracts/address.religo | 5 ++++- src/test/integration_tests.ml | 21 +++++++++++++++------ 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 3ac7a0959..abb7a3339 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -920,7 +920,7 @@ module Compiler = struct | C_UNIT -> ok @@ simple_constant @@ prim I_UNIT | C_BALANCE -> ok @@ simple_constant @@ prim I_BALANCE | C_AMOUNT -> ok @@ simple_constant @@ prim I_AMOUNT - | C_ADDRESS -> ok @@ simple_constant @@ prim I_ADDRESS + | C_ADDRESS -> ok @@ simple_unary @@ prim I_ADDRESS | C_SELF_ADDRESS -> ok @@ simple_constant @@ seq [prim I_SELF; prim I_ADDRESS] | C_IMPLICIT_ACCOUNT -> ok @@ simple_unary @@ prim I_IMPLICIT_ACCOUNT | C_NOW -> ok @@ simple_constant @@ prim I_NOW diff --git a/src/test/contracts/address.ligo b/src/test/contracts/address.ligo index 555ab6fe7..2113bc7ac 100644 --- a/src/test/contracts/address.ligo +++ b/src/test/contracts/address.ligo @@ -1 +1,5 @@ -function main (const c: contract(unit)) : address is address(c) +// function main (const c: contract(unit)) : address is address(c) + +function main (const p : key_hash) : address is block { + const c : contract(unit) = implicit_account(p) ; +} with address(c) \ No newline at end of file diff --git a/src/test/contracts/address.mligo b/src/test/contracts/address.mligo index efca3d8b8..3651ea223 100644 --- a/src/test/contracts/address.mligo +++ b/src/test/contracts/address.mligo @@ -1 +1,3 @@ -let main (c: unit contract) : address = Current.address c +let main (p : key_hash) = + let c : unit contract = Current.implicit_account p in + Current.address c \ No newline at end of file diff --git a/src/test/contracts/address.religo b/src/test/contracts/address.religo index 1bab0004b..df1742ce1 100644 --- a/src/test/contracts/address.religo +++ b/src/test/contracts/address.religo @@ -1 +1,4 @@ -let main = (c: contract(unit)): address => Current.address(c); +let main = (p : key_hash) : address => { + let c : contract(unit) = Current.implicit_account(p) ; + Current.address(c) ; +}; diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 921a6a376..14cc41e23 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -1624,17 +1624,26 @@ let balance_constant_religo () : unit result = expect_eq program "main" input expected +let addr_test program = + let open Proto_alpha_utils.Memory_proto_alpha in + let addr = Protocol.Alpha_context.Contract.to_b58check @@ + (List.nth dummy_environment.identities 0).implicit_contract in + let open Tezos_crypto in + let key_hash = Signature.Public_key_hash.to_b58check @@ + (List.nth dummy_environment.identities 0).public_key_hash in + expect_eq program "main" (e_key_hash key_hash) (e_address addr) + let address () : unit result = - let%bind _ = type_file "./contracts/address.ligo" in - ok () + let%bind program = type_file "./contracts/address.ligo" in + addr_test program let address_mligo () : unit result = - let%bind _ = mtype_file "./contracts/address.mligo" in - ok () + let%bind program = mtype_file "./contracts/address.mligo" in + addr_test program let address_religo () : unit result = - let%bind _ = retype_file "./contracts/address.religo" in - ok () + let%bind program = retype_file "./contracts/address.religo" in + addr_test program let self_address () : unit result =