From 26ab2d4c0640794366679b20d743c8ae76318720 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Thu, 21 Nov 2019 00:00:27 +0100 Subject: [PATCH 1/5] Splits out compilation only phase for external tests. --- .circleci/config.yml | 64 ++++++++++++++++++++++++++++++++---- test/externalTests/common.sh | 9 +++-- 2 files changed, 65 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cdd6edeab..9904ec70a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -597,7 +597,22 @@ jobs: npm --version test/solcjsTests.sh /tmp/workspace/soljson.js $(cat /tmp/workspace/version.txt) - t_ems_external_gnosis: + t_ems_compile_ext_gnosis: + docker: + - image: circleci/node:10 + environment: + TERM: xterm + steps: + - checkout + - attach_workspace: + at: /tmp/workspace + - run: + name: External GnosisSafe compilation + command: | + export COMPILE_ONLY=1 + test/externalTests/gnosis.sh /tmp/workspace/soljson.js || test/externalTests/gnosis.sh /tmp/workspace/soljson.js + + t_ems_test_ext_gnosis: docker: - image: circleci/node:10 environment: @@ -613,7 +628,22 @@ jobs: - run: *gitter_notify_failure - run: *gitter_notify_success - t_ems_external_zeppelin: + t_ems_compile_ext_zeppelin: + docker: + - image: circleci/node:10 + environment: + TERM: xterm + steps: + - checkout + - attach_workspace: + at: /tmp/workspace + - run: + name: External Zeppelin compilation + command: | + export COMPILE_ONLY=1 + test/externalTests/zeppelin.sh /tmp/workspace/soljson.js || test/externalTests/zeppelin.sh /tmp/workspace/soljson.js + + t_ems_test_ext_zeppelin: docker: - image: circleci/node:10 environment: @@ -629,7 +659,26 @@ jobs: - run: *gitter_notify_failure - run: *gitter_notify_success - t_ems_external_colony: + t_ems_compile_ext_colony: + docker: + - image: circleci/node:10 + environment: + TERM: xterm + steps: + - checkout + - attach_workspace: + at: /tmp/workspace + - run: + name: Install test dependencies + command: | + sudo apt-get -qy install lsof + - run: + name: External ColonyNetworks compilation + command: | + export COMPILE_ONLY=1 + test/externalTests/colony.sh /tmp/workspace/soljson.js || test/externalTests/colony.sh /tmp/workspace/soljson.js + + t_ems_test_ext_colony: docker: - image: circleci/node:10 environment: @@ -693,6 +742,9 @@ workflows: # Emscripten build and selected tests - b_ems: *workflow_trigger_on_tags - t_ems_solcjs: *workflow_emscripten + - t_ems_compile_ext_colony: *workflow_emscripten + - t_ems_compile_ext_gnosis: *workflow_emscripten + - t_ems_compile_ext_zeppelin: *workflow_emscripten nightly: @@ -708,9 +760,9 @@ workflows: jobs: # Emscripten builds and external tests - b_ems: *workflow_trigger_on_tags - - t_ems_external_zeppelin: *workflow_emscripten - - t_ems_external_gnosis: *workflow_emscripten - - t_ems_external_colony: *workflow_emscripten + - t_ems_test_ext_zeppelin: *workflow_emscripten + - t_ems_test_ext_gnosis: *workflow_emscripten + - t_ems_test_ext_colony: *workflow_emscripten # OSSFUZZ builds and (regression) tests - b_ubu_ossfuzz: *workflow_trigger_on_tags diff --git a/test/externalTests/common.sh b/test/externalTests/common.sh index a94b62dc4..dd9aa77aa 100644 --- a/test/externalTests/common.sh +++ b/test/externalTests/common.sh @@ -216,8 +216,13 @@ function run_test printLog "Running compile function..." $compile_fn verify_compiler_version "$SOLCVERSION" - printLog "Running test function..." - $test_fn + + if [[ "$COMPILE_ONLY" == 1 ]]; then + printLog "Skipping test function..." + else + printLog "Running test function..." + $test_fn + fi done } From 9ed706290b0fc9e043ee6debb2390146cbafbf4b Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Tue, 19 Nov 2019 17:09:44 +0100 Subject: [PATCH 2/5] Use pipeline parameters to store/reference current docker image revision --- .circleci/README.md | 2 +- .circleci/config.yml | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.circleci/README.md b/.circleci/README.md index c8bcd45f5..c754b5df0 100644 --- a/.circleci/README.md +++ b/.circleci/README.md @@ -11,7 +11,7 @@ docker build -t ethereum/solidity-buildpack-deps:ubuntu1904- -f Docker docker push ethereum/solidity-buildpack-deps:ubuntu1904- ``` -The current revision is `2`. +The current revision is stored in a [circle ci pipeline parameter](https://github.com/CircleCI-Public/api-preview-docs/blob/master/docs/pipeline-parameters.md#pipeline-parameters) called `docker-image-rev`. Please update the value assigned to this parameter at the time of a docker image update. Please verify that the value assigned to the parameter matches the revision part of the docker image tag (`` in the docker build/push snippet shown above). Otherwise, the docker image used by circle ci and the one actually pushed to docker hub will differ. Once the docker image has been built and pushed to Dockerhub, you can find it at: diff --git a/.circleci/config.yml b/.circleci/config.yml index cdd6edeab..e61ec16fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,11 @@ # - t: test # - ubu: ubuntu # - ems: Emscripten -version: 2 +version: 2.1 +parameters: + docker-image-rev: + type: string + default: "2" defaults: @@ -106,7 +110,7 @@ defaults: - test_ubuntu1904_clang: &test_ubuntu1904_clang docker: - - image: ethereum/solidity-buildpack-deps:ubuntu1904-clang-2 + - image: ethereum/solidity-buildpack-deps:ubuntu1904-clang-<< pipeline.parameters.docker-image-rev >> steps: - checkout - attach_workspace: @@ -117,7 +121,7 @@ defaults: - test_ubuntu1904: &test_ubuntu1904 docker: - - image: ethereum/solidity-buildpack-deps:ubuntu1904-2 + - image: ethereum/solidity-buildpack-deps:ubuntu1904-<< pipeline.parameters.docker-image-rev >> steps: - checkout - attach_workspace: @@ -287,7 +291,7 @@ jobs: b_ubu_clang: &build_ubuntu1904_clang docker: - - image: ethereum/solidity-buildpack-deps:ubuntu1904-clang-2 + - image: ethereum/solidity-buildpack-deps:ubuntu1904-clang-<< pipeline.parameters.docker-image-rev >> environment: CC: clang CXX: clang++ @@ -299,7 +303,7 @@ jobs: b_ubu: &build_ubuntu1904 docker: - - image: ethereum/solidity-buildpack-deps:ubuntu1904-2 + - image: ethereum/solidity-buildpack-deps:ubuntu1904-<< pipeline.parameters.docker-image-rev >> steps: - checkout - run: *run_build @@ -313,7 +317,7 @@ jobs: b_ubu18: &build_ubuntu1804 docker: - - image: ethereum/solidity-buildpack-deps:ubuntu1804-2 + - image: ethereum/solidity-buildpack-deps:ubuntu1804-<< pipeline.parameters.docker-image-rev >> environment: CMAKE_OPTIONS: -DCMAKE_CXX_FLAGS=-O2 CMAKE_BUILD_TYPE: RelWithDebugInfo @@ -519,7 +523,7 @@ jobs: b_docs: docker: - - image: ethereum/solidity-buildpack-deps:ubuntu1904-2 + - image: ethereum/solidity-buildpack-deps:ubuntu1904-<< pipeline.parameters.docker-image-rev >> steps: - checkout - run: *setup_prerelease_commit_hash @@ -544,7 +548,7 @@ jobs: t_ubu_cli: &t_ubu_cli docker: - - image: ethereum/solidity-buildpack-deps:ubuntu1904-2 + - image: ethereum/solidity-buildpack-deps:ubuntu1904-<< pipeline.parameters.docker-image-rev >> environment: TERM: xterm steps: From ae428dc2a03733d51332b1c785f8e9a1e14f4829 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 20 Nov 2019 21:34:39 +0000 Subject: [PATCH 3/5] Clarify some notes in LinkerObject and assert that linkReferences are always correct --- libevmasm/Assembly.cpp | 3 +++ libevmasm/LinkerObject.h | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index ae8d001d7..88bddd7f7 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -519,8 +519,11 @@ map Assembly::optimiseInternal( LinkerObject const& Assembly::assemble() const { + // Return the already assembled object, if present. if (!m_assembledObject.bytecode.empty()) return m_assembledObject; + // Otherwise ensure the object is actually clear. + assertThrow(m_assembledObject.linkReferences.empty(), AssemblyException, "Unexpected link references."); size_t subTagSize = 1; for (auto const& sub: m_subs) diff --git a/libevmasm/LinkerObject.h b/libevmasm/LinkerObject.h index 928908032..3630365e0 100644 --- a/libevmasm/LinkerObject.h +++ b/libevmasm/LinkerObject.h @@ -35,7 +35,9 @@ namespace eth */ struct LinkerObject { + /// The bytecode. bytes bytecode; + /// Map from offsets in bytecode to library identifiers. The addresses starting at those offsets /// need to be replaced by the actual addresses by the linker. std::map linkReferences; @@ -47,7 +49,7 @@ struct LinkerObject void link(std::map const& _libraryAddresses); /// @returns a hex representation of the bytecode of the given object, replacing unlinked - /// addresses by placeholders. + /// addresses by placeholders. This output is lowercase. std::string toHex() const; /// @returns a 36 character string that is used as a placeholder for the library From bf1c07cef02fcbe43292c6e5187be27201fdb5b2 Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Mon, 25 Nov 2019 16:24:39 +0100 Subject: [PATCH 4/5] Removes ext. tests from nightly CircleCI runs, --- .circleci/config.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9904ec70a..1c97b0e43 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -758,12 +758,6 @@ workflows: - develop_060 jobs: - # Emscripten builds and external tests - - b_ems: *workflow_trigger_on_tags - - t_ems_test_ext_zeppelin: *workflow_emscripten - - t_ems_test_ext_gnosis: *workflow_emscripten - - t_ems_test_ext_colony: *workflow_emscripten - # OSSFUZZ builds and (regression) tests - b_ubu_ossfuzz: *workflow_trigger_on_tags - t_ubu_ossfuzz: *workflow_ubuntu1904_ossfuzz From ae16ad88844b60dedc6c2601dc733e4f2336e6fd Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 25 Nov 2019 17:23:16 +0100 Subject: [PATCH 5/5] Link to latest examples. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a8c04da2a..0af8dd905 100644 --- a/README.md +++ b/README.md @@ -44,10 +44,10 @@ contract HelloWorld { To get started with Solidity, you can use [Remix](https://remix.ethereum.org/), which is an browser-based IDE. Here are some example contracts: -1. [Voting](https://solidity.readthedocs.io/en/v0.4.24/solidity-by-example.html#voting) -2. [Blind Auction](https://solidity.readthedocs.io/en/v0.4.24/solidity-by-example.html#blind-auction) -3. [Safe remote purchase](https://solidity.readthedocs.io/en/v0.4.24/solidity-by-example.html#safe-remote-purchase) -4. [Micropayment Channel](https://solidity.readthedocs.io/en/v0.4.24/solidity-by-example.html#micropayment-channel) +1. [Voting](https://solidity.readthedocs.io/en/latest/solidity-by-example.html#voting) +2. [Blind Auction](https://solidity.readthedocs.io/en/latest/solidity-by-example.html#blind-auction) +3. [Safe remote purchase](https://solidity.readthedocs.io/en/latest/solidity-by-example.html#safe-remote-purchase) +4. [Micropayment Channel](https://solidity.readthedocs.io/en/latest/solidity-by-example.html#micropayment-channel) ## Documentation