From 1e2bfbd6b203b62ceb990c2b595e372ea108f139 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 11 Nov 2020 21:55:38 +0000 Subject: [PATCH 01/14] Enable the -Wextra-semi warning --- cmake/EthCompilerSettings.cmake | 7 +++++++ libsolidity/analysis/ControlFlowGraph.h | 2 +- libsolidity/codegen/ir/IRGenerationContext.h | 2 +- libyul/optimiser/OptimiserStep.h | 2 +- test/Common.h | 2 +- tools/yulPhaser/ProgramCache.h | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 653c5fdc3..be569ad17 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -52,6 +52,13 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA add_compile_options(-Wimplicit-fallthrough) add_compile_options(-Wsign-conversion) + # While this should work on CMake 3.3+, it fails on Ubuntu 18 + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.16) + eth_add_cxx_compiler_flag_if_supported( + $<$:-Wextra-semi> + ) + endif() + # Configuration-specific compiler settings. set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -DETH_DEBUG") set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") diff --git a/libsolidity/analysis/ControlFlowGraph.h b/libsolidity/analysis/ControlFlowGraph.h index 7d51f2196..6bdf01c09 100644 --- a/libsolidity/analysis/ControlFlowGraph.h +++ b/libsolidity/analysis/ControlFlowGraph.h @@ -76,7 +76,7 @@ public: } VariableDeclaration const& declaration() const { return m_declaration; } - Kind kind() const { return m_occurrenceKind; }; + Kind kind() const { return m_occurrenceKind; } std::optional const& occurrence() const { return m_occurrence; } private: /// Declaration of the occurring variable. diff --git a/libsolidity/codegen/ir/IRGenerationContext.h b/libsolidity/codegen/ir/IRGenerationContext.h index 3e9e96a54..78c7c8be7 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.h +++ b/libsolidity/codegen/ir/IRGenerationContext.h @@ -135,7 +135,7 @@ public: /// @returns a new copy of the utility function generator (but using the same function set). YulUtilFunctions utils(); - langutil::EVMVersion evmVersion() const { return m_evmVersion; }; + langutil::EVMVersion evmVersion() const { return m_evmVersion; } ABIFunctions abiFunctions(); diff --git a/libyul/optimiser/OptimiserStep.h b/libyul/optimiser/OptimiserStep.h index 70ed098a8..7dc2d3ea2 100644 --- a/libyul/optimiser/OptimiserStep.h +++ b/libyul/optimiser/OptimiserStep.h @@ -84,7 +84,7 @@ public: return Step::invalidInCurrentEnvironment(); else return std::nullopt; - }; + } }; diff --git a/test/Common.h b/test/Common.h index e745ac6ac..d83ee166d 100644 --- a/test/Common.h +++ b/test/Common.h @@ -71,7 +71,7 @@ struct CommonOptions: boost::noncopyable static void setSingleton(std::unique_ptr&& _instance); CommonOptions(std::string caption = ""); - virtual ~CommonOptions() {}; + virtual ~CommonOptions() {} protected: boost::program_options::options_description options; diff --git a/tools/yulPhaser/ProgramCache.h b/tools/yulPhaser/ProgramCache.h index d0e51a37e..4c145d537 100644 --- a/tools/yulPhaser/ProgramCache.h +++ b/tools/yulPhaser/ProgramCache.h @@ -121,7 +121,7 @@ public: CacheStats gatherStats() const; - std::map const& entries() const { return m_entries; }; + std::map const& entries() const { return m_entries; } Program const& program() const { return m_program; } size_t currentRound() const { return m_currentRound; } From 4d76e22439bd4f16b91d8b70107a488ecf0b93f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 7 Dec 2020 13:55:57 +0100 Subject: [PATCH 02/14] Remove the option for forcing ABIv2 from external tests --- test/externalTests/colony.sh | 2 +- test/externalTests/common.sh | 21 --------------------- test/externalTests/ens.sh | 2 +- test/externalTests/gnosis.sh | 2 +- test/externalTests/zeppelin.sh | 2 +- 5 files changed, 4 insertions(+), 25 deletions(-) diff --git a/test/externalTests/colony.sh b/test/externalTests/colony.sh index 349cabf2a..b5a58af1b 100755 --- a/test/externalTests/colony.sh +++ b/test/externalTests/colony.sh @@ -41,7 +41,7 @@ function colony_test git clone https://github.com/solidity-external-tests/dappsys-monolithic.git -b master_060 dappsys cd .. - truffle_run_test "$SOLJSON" compile_fn test_fn "NO-FORCE-ABI-V2" + truffle_run_test "$SOLJSON" compile_fn test_fn } external_test ColonyNetworks colony_test diff --git a/test/externalTests/common.sh b/test/externalTests/common.sh index ad36a5ff4..a0321afac 100644 --- a/test/externalTests/common.sh +++ b/test/externalTests/common.sh @@ -180,20 +180,6 @@ function force_solc_settings echo "module.exports['compilers']['solc']['settings'] = { optimizer: $settings, evmVersion: \"$evmVersion\" };" >> "$config_file" } -function force_abi_v2 -{ - # Add "pragma abi coder v2" to all files. - printLog "Forcibly enabling abi coder v2..." - find contracts test -name '*.sol' -type f -print0 | \ - while IFS= read -r -d '' file - do - # Only add the pragma if it is not already there. - if grep -q -v 'pragma abicoder v2' "$file"; then - sed -i -e '1 i pragma abicoder v2;' "$file" - fi - done -} - function verify_compiler_version { local solc_version="$1" @@ -238,9 +224,6 @@ function truffle_run_test local soljson="$1" local compile_fn="$2" local test_fn="$3" - local force_abi_v2_flag="$4" - - test "$force_abi_v2_flag" = "FORCE-ABI-V2" || test "$force_abi_v2_flag" = "NO-FORCE-ABI-V2" replace_version_pragmas force_solc "$CONFIG" "$DIR" "$soljson" @@ -264,10 +247,6 @@ function truffle_run_test do clean force_solc_settings "$CONFIG" "$optimize" "istanbul" - # Force abi coder v2 in the last step. Has to be the last because code is modified. - if [ "$force_abi_v2_flag" = "FORCE-ABI-V2" ]; then - [[ "$optimize" =~ yul ]] && force_abi_v2 - fi printLog "Running compile function..." $compile_fn diff --git a/test/externalTests/ens.sh b/test/externalTests/ens.sh index 99f4b8971..480d59eab 100755 --- a/test/externalTests/ens.sh +++ b/test/externalTests/ens.sh @@ -40,7 +40,7 @@ function ens_test run_install "$SOLJSON" install_fn - truffle_run_test "$SOLJSON" compile_fn test_fn "NO-FORCE-ABI-V2" + truffle_run_test "$SOLJSON" compile_fn test_fn } external_test Ens ens_test diff --git a/test/externalTests/gnosis.sh b/test/externalTests/gnosis.sh index 73870f8db..92c18016f 100755 --- a/test/externalTests/gnosis.sh +++ b/test/externalTests/gnosis.sh @@ -43,7 +43,7 @@ function gnosis_safe_test run_install "$SOLJSON" install_fn replace_libsolc_call - truffle_run_test "$SOLJSON" compile_fn test_fn "NO-FORCE-ABI-V2" + truffle_run_test "$SOLJSON" compile_fn test_fn } external_test Gnosis-Safe gnosis_safe_test diff --git a/test/externalTests/zeppelin.sh b/test/externalTests/zeppelin.sh index e71e974d6..9862585d3 100755 --- a/test/externalTests/zeppelin.sh +++ b/test/externalTests/zeppelin.sh @@ -36,7 +36,7 @@ function zeppelin_test truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/openzeppelin-contracts.git upgrade-0.7.0 run_install "$SOLJSON" install_fn - truffle_run_test "$SOLJSON" compile_fn test_fn "NO-FORCE-ABI-V2" + truffle_run_test "$SOLJSON" compile_fn test_fn } external_test Zeppelin zeppelin_test From b86c91d1a3db4a137095086a34f29d1678e234b6 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 7 Dec 2020 12:10:35 +0100 Subject: [PATCH 03/14] Make super unavailable in libraries. --- Changelog.md | 1 + libsolidity/analysis/NameAndTypeResolver.cpp | 3 ++- test/libsolidity/syntaxTests/super/super_in_function.sol | 7 +++++++ test/libsolidity/syntaxTests/super/super_in_library.sol | 7 +++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/syntaxTests/super/super_in_function.sol create mode 100644 test/libsolidity/syntaxTests/super/super_in_library.sol diff --git a/Changelog.md b/Changelog.md index de89f7aca..cb9e8673a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -17,6 +17,7 @@ Bugfixes: * SMTChecker: Fix internal compiler error when doing bitwise compound assignment with string literals. * SMTChecker: Fix internal error when trying to generate counterexamples with old z3. * SMTChecker: Fix segmentation fault that could occur on certain SMT-enabled sources when no SMT solver was available. + * Type Checker: ``super`` is not available in libraries. * Yul Optimizer: Fix a bug in NameSimplifier where a new name created by NameSimplifier could also be created by NameDispenser. * Yul Optimizer: Removed NameSimplifier from optimization steps available to users. diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 7b0fa111b..458b566cf 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -285,7 +285,8 @@ bool NameAndTypeResolver::resolveNamesAndTypesInternal(ASTNode& _node, bool _res solAssert(_resolveInsideCode, ""); m_globalContext.setCurrentContract(*contract); - updateDeclaration(*m_globalContext.currentSuper()); + if (!contract->isLibrary()) + updateDeclaration(*m_globalContext.currentSuper()); updateDeclaration(*m_globalContext.currentThis()); for (ASTPointer const& baseContract: contract->baseContracts()) diff --git a/test/libsolidity/syntaxTests/super/super_in_function.sol b/test/libsolidity/syntaxTests/super/super_in_function.sol new file mode 100644 index 000000000..5156ddd35 --- /dev/null +++ b/test/libsolidity/syntaxTests/super/super_in_function.sol @@ -0,0 +1,7 @@ +contract C { +} +function f() pure { + super; +} +// ---- +// DeclarationError 7576: (39-44): Undeclared identifier. "super" is not (or not yet) visible at this point. diff --git a/test/libsolidity/syntaxTests/super/super_in_library.sol b/test/libsolidity/syntaxTests/super/super_in_library.sol new file mode 100644 index 000000000..299df290c --- /dev/null +++ b/test/libsolidity/syntaxTests/super/super_in_library.sol @@ -0,0 +1,7 @@ +library L { + function f() public { + (super); + } +} +// ---- +// DeclarationError 7576: (41-46): Undeclared identifier. "super" is not (or not yet) visible at this point. From 5b6e1560b3d869408deba38c542c343d1f04b096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 27 Nov 2020 18:11:18 +0100 Subject: [PATCH 04/14] Enable Colony, Gnosis and OpenZeppelin external tests in the main CI workflow --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a7a03a61..f554c134b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1123,6 +1123,9 @@ workflows: - t_ems_compile_ext_gnosis: *workflow_emscripten - t_ems_compile_ext_zeppelin: *workflow_emscripten - t_ems_compile_ext_ens: *workflow_emscripten + - t_ems_test_ext_colony: *workflow_emscripten + - t_ems_test_ext_gnosis: *workflow_emscripten + - t_ems_test_ext_zeppelin: *workflow_emscripten # Windows build and tests - b_win: *workflow_trigger_on_tags From f737f66196f0bcc957b5b3f2a289d90d18ef2b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 27 Nov 2020 18:27:37 +0100 Subject: [PATCH 05/14] Temporarily disable gitter notifications for external tests --- .circleci/config.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f554c134b..a448550b6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -846,8 +846,9 @@ jobs: name: External GnosisSafe tests command: | test/externalTests/gnosis.sh /tmp/workspace/soljson.js || test/externalTests/gnosis.sh /tmp/workspace/soljson.js - - run: *gitter_notify_failure - - run: *gitter_notify_success + # TODO: Re-enable notifications once this is running nightly rather than as a PR check + #- run: *gitter_notify_failure + #- run: *gitter_notify_success t_ems_compile_ext_zeppelin: docker: @@ -877,8 +878,9 @@ jobs: name: External Zeppelin tests command: | test/externalTests/zeppelin.sh /tmp/workspace/soljson.js || test/externalTests/zeppelin.sh /tmp/workspace/soljson.js - - run: *gitter_notify_failure - - run: *gitter_notify_success + # TODO: Re-enable notifications once this is running nightly rather than as a PR check + #- run: *gitter_notify_failure + #- run: *gitter_notify_success t_ems_compile_ext_colony: docker: @@ -916,8 +918,9 @@ jobs: name: External ColonyNetworks tests command: | test/externalTests/colony.sh /tmp/workspace/soljson.js || test/externalTests/colony.sh /tmp/workspace/soljson.js - - run: *gitter_notify_failure - - run: *gitter_notify_success + # TODO: Re-enable notifications once this is running nightly rather than as a PR check + #- run: *gitter_notify_failure + #- run: *gitter_notify_success t_ems_compile_ext_ens: docker: From 45c506a4ffae6ada0d315c2957cb7e864b61ffaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 1 Dec 2020 23:53:00 +0100 Subject: [PATCH 06/14] Stop running external tests twice in CI --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a448550b6..39a6cac34 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -845,7 +845,7 @@ jobs: - run: name: External GnosisSafe tests command: | - test/externalTests/gnosis.sh /tmp/workspace/soljson.js || test/externalTests/gnosis.sh /tmp/workspace/soljson.js + test/externalTests/gnosis.sh /tmp/workspace/soljson.js # TODO: Re-enable notifications once this is running nightly rather than as a PR check #- run: *gitter_notify_failure #- run: *gitter_notify_success @@ -877,7 +877,7 @@ jobs: - run: name: External Zeppelin tests command: | - test/externalTests/zeppelin.sh /tmp/workspace/soljson.js || test/externalTests/zeppelin.sh /tmp/workspace/soljson.js + test/externalTests/zeppelin.sh /tmp/workspace/soljson.js # TODO: Re-enable notifications once this is running nightly rather than as a PR check #- run: *gitter_notify_failure #- run: *gitter_notify_success @@ -917,7 +917,7 @@ jobs: - run: name: External ColonyNetworks tests command: | - test/externalTests/colony.sh /tmp/workspace/soljson.js || test/externalTests/colony.sh /tmp/workspace/soljson.js + test/externalTests/colony.sh /tmp/workspace/soljson.js # TODO: Re-enable notifications once this is running nightly rather than as a PR check #- run: *gitter_notify_failure #- run: *gitter_notify_success From e05241adfc6b8a9f1eedd6517f6cfe811bfa49b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 27 Nov 2020 18:12:08 +0100 Subject: [PATCH 07/14] Update Colony, Gnosis and OpenZeppelin external tests to run on updated 0.7.x branches from solidity-external-tests --- .circleci/config.yml | 4 ++-- test/externalTests/colony.sh | 4 ++-- test/externalTests/common.sh | 7 ------- test/externalTests/ens.sh | 3 +++ test/externalTests/gnosis.sh | 11 +++++------ test/externalTests/zeppelin.sh | 2 +- 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 39a6cac34..fae54b292 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -884,7 +884,7 @@ jobs: t_ems_compile_ext_colony: docker: - - image: circleci/node:10 + - image: circleci/node:12 environment: TERM: xterm steps: @@ -903,7 +903,7 @@ jobs: t_ems_test_ext_colony: docker: - - image: circleci/node:10 + - image: circleci/node:12 environment: TERM: xterm steps: diff --git a/test/externalTests/colony.sh b/test/externalTests/colony.sh index b5a58af1b..87d96b463 100755 --- a/test/externalTests/colony.sh +++ b/test/externalTests/colony.sh @@ -33,12 +33,12 @@ function colony_test OPTIMIZER_LEVEL=3 CONFIG="truffle.js" - truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/colonyNetwork.git develop_070 + truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/colonyNetwork.git develop_070_new run_install "$SOLJSON" install_fn cd lib rm -Rf dappsys - git clone https://github.com/solidity-external-tests/dappsys-monolithic.git -b master_060 dappsys + git clone https://github.com/solidity-external-tests/dappsys-monolithic.git -b master_070 dappsys cd .. truffle_run_test "$SOLJSON" compile_fn test_fn diff --git a/test/externalTests/common.sh b/test/externalTests/common.sh index a0321afac..37c3f8109 100644 --- a/test/externalTests/common.sh +++ b/test/externalTests/common.sh @@ -109,13 +109,6 @@ function replace_version_pragmas find . test -name '*.sol' -type f -print0 | xargs -0 sed -i -E -e 's/pragma solidity [^;]+;/pragma solidity >=0.0;/' } -function replace_libsolc_call -{ - # Change "compileStandard" to "compile" (needed for pre-5.x Truffle) - printLog "Replacing libsolc compile call in Truffle..." - sed -i s/solc.compileStandard/solc.compile/ "node_modules/truffle/build/cli.bundled.js" -} - function find_truffle_config { local config_file="truffle.js" diff --git a/test/externalTests/ens.sh b/test/externalTests/ens.sh index 480d59eab..907411b6d 100755 --- a/test/externalTests/ens.sh +++ b/test/externalTests/ens.sh @@ -38,6 +38,9 @@ function ens_test # Use latest Truffle. Older versions crash on the output from 0.8.0. force_truffle_version ^5.1.55 + # Remove the lock file (if it exists) to prevent it from overriding our changes in package.json + rm -f package-lock.json + run_install "$SOLJSON" install_fn truffle_run_test "$SOLJSON" compile_fn test_fn diff --git a/test/externalTests/gnosis.sh b/test/externalTests/gnosis.sh index 92c18016f..7ea76c067 100755 --- a/test/externalTests/gnosis.sh +++ b/test/externalTests/gnosis.sh @@ -31,17 +31,16 @@ function test_fn { npm test; } function gnosis_safe_test { OPTIMIZER_LEVEL=1 - CONFIG="truffle.js" + CONFIG="truffle-config.js" - truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/safe-contracts.git development_070 + truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/safe-contracts.git development_070_new - force_truffle_version ^5.0.42 - sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_070|g' package.json + sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_070_new|g' package.json + + # Remove the lock file (if it exists) to prevent it from overriding our changes in package.json rm -f package-lock.json - rm -rf node_modules/ run_install "$SOLJSON" install_fn - replace_libsolc_call truffle_run_test "$SOLJSON" compile_fn test_fn } diff --git a/test/externalTests/zeppelin.sh b/test/externalTests/zeppelin.sh index 9862585d3..05a240c2a 100755 --- a/test/externalTests/zeppelin.sh +++ b/test/externalTests/zeppelin.sh @@ -33,7 +33,7 @@ function zeppelin_test OPTIMIZER_LEVEL=1 CONFIG="truffle-config.js" - truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/openzeppelin-contracts.git upgrade-0.7.0 + truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/openzeppelin-contracts.git master_070 run_install "$SOLJSON" install_fn truffle_run_test "$SOLJSON" compile_fn test_fn From 70a2fc58b0d998bcf87eabe506e7763f6449df23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 1 Dec 2020 19:59:54 +0100 Subject: [PATCH 08/14] Add jobs and scripts running external tests for Gnosis v2 --- .circleci/config.yml | 34 +++++++++++++++++++++++ test/externalTests.sh | 1 + test/externalTests/gnosis-v2.sh | 49 +++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100755 test/externalTests/gnosis-v2.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index fae54b292..31aa09100 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -850,6 +850,38 @@ jobs: #- run: *gitter_notify_failure #- run: *gitter_notify_success + t_ems_compile_ext_gnosis_v2: + docker: + - image: circleci/node:10 + environment: + TERM: xterm + steps: + - checkout + - attach_workspace: + at: /tmp/workspace + - run: + name: External GnosisSafe v2 compilation + command: | + export COMPILE_ONLY=1 + test/externalTests/gnosis-v2.sh /tmp/workspace/soljson.js + + t_ems_test_ext_gnosis_v2: + docker: + - image: circleci/node:10 + environment: + TERM: xterm + steps: + - checkout + - attach_workspace: + at: /tmp/workspace + - run: + name: External GnosisSafe v2 tests + command: | + test/externalTests/gnosis-v2.sh /tmp/workspace/soljson.js + # TODO: Re-enable notifications once this is running nightly rather than as a PR check + #- run: *gitter_notify_failure + #- run: *gitter_notify_success + t_ems_compile_ext_zeppelin: docker: - image: circleci/node:10 @@ -1124,10 +1156,12 @@ workflows: - t_ems_solcjs: *workflow_emscripten - t_ems_compile_ext_colony: *workflow_emscripten - t_ems_compile_ext_gnosis: *workflow_emscripten + - t_ems_compile_ext_gnosis_v2: *workflow_emscripten - t_ems_compile_ext_zeppelin: *workflow_emscripten - t_ems_compile_ext_ens: *workflow_emscripten - t_ems_test_ext_colony: *workflow_emscripten - t_ems_test_ext_gnosis: *workflow_emscripten + - t_ems_test_ext_gnosis_v2: *workflow_emscripten - t_ems_test_ext_zeppelin: *workflow_emscripten # Windows build and tests diff --git a/test/externalTests.sh b/test/externalTests.sh index e53f9925a..28af6f835 100755 --- a/test/externalTests.sh +++ b/test/externalTests.sh @@ -44,6 +44,7 @@ printTask "Running external tests..." "$REPO_ROOT/externalTests/zeppelin.sh" "$SOLJSON" "$REPO_ROOT/externalTests/gnosis.sh" "$SOLJSON" +"$REPO_ROOT/externalTests/gnosis-v2.sh" "$SOLJSON" "$REPO_ROOT/externalTests/colony.sh" "$SOLJSON" "$REPO_ROOT/externalTests/ens.sh" "$SOLJSON" diff --git a/test/externalTests/gnosis-v2.sh b/test/externalTests/gnosis-v2.sh new file mode 100755 index 000000000..6f3563ca3 --- /dev/null +++ b/test/externalTests/gnosis-v2.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# ------------------------------------------------------------------------------ +# This file is part of solidity. +# +# solidity is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# solidity is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with solidity. If not, see +# +# (c) 2020 solidity contributors. +#------------------------------------------------------------------------------ +source scripts/common.sh +source test/externalTests/common.sh + +verify_input "$1" +SOLJSON="$1" + +function install_fn { npm install --package-lock; } +function compile_fn { npx truffle compile; } +function test_fn { npm test; } + +function gnosis_safe_test +{ + OPTIMIZER_LEVEL=1 + CONFIG="truffle-config.js" + + truffle_setup "$SOLJSON" https://github.com/solidity-external-tests/safe-contracts.git v2_070 + + sed -i 's|github:gnosis/mock-contract#sol_0_5_0|github:solidity-external-tests/mock-contract#master_070_new|g' package.json + sed -i -E 's|"@gnosis.pm/util-contracts": "[^"]+"|"@gnosis.pm/util-contracts": "github:solidity-external-tests/util-contracts#solc-7"|g' package.json + + # Remove the lock file (if it exists) to prevent it from overriding our changes in package.json + rm -f package-lock.json + + run_install "$SOLJSON" install_fn + + truffle_run_test "$SOLJSON" compile_fn test_fn +} + +external_test Gnosis-Safe gnosis_safe_test From 0c5d3c0cdfbe7e9f794f59efb67ab4fca4c91597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 2 Dec 2020 01:39:07 +0100 Subject: [PATCH 09/14] Add a job for executing external tests for ENS --- .circleci/config.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 31aa09100..30452f5ae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -973,6 +973,27 @@ jobs: export COMPILE_ONLY=1 test/externalTests/ens.sh /tmp/workspace/soljson.js + t_ems_test_ext_ens: + 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 Ens compilation + command: | + test/externalTests/ens.sh /tmp/workspace/soljson.js + # TODO: Re-enable notifications once this is running nightly rather than as a PR check + #- run: *gitter_notify_failure + #- run: *gitter_notify_success + b_win: &b_win executor: name: win/default @@ -1163,6 +1184,7 @@ workflows: - t_ems_test_ext_gnosis: *workflow_emscripten - t_ems_test_ext_gnosis_v2: *workflow_emscripten - t_ems_test_ext_zeppelin: *workflow_emscripten + - t_ems_test_ext_ens: *workflow_emscripten # Windows build and tests - b_win: *workflow_trigger_on_tags From c7b95e385f563c0df1d963069152942250983a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 1 Dec 2020 21:20:22 +0100 Subject: [PATCH 10/14] external tests: Update solc-js dependencies after forcefully replacing it - Otherwise it fails if the external project uses a version that is too old and does not have some newly added dependencies --- test/externalTests/common.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/externalTests/common.sh b/test/externalTests/common.sh index 37c3f8109..a9f7bf2c8 100644 --- a/test/externalTests/common.sh +++ b/test/externalTests/common.sh @@ -135,6 +135,9 @@ function force_solc_truffle_modules rm -rf solc git clone --depth 1 -b master https://github.com/ethereum/solc-js.git solc cp "$1" solc/soljson.js + + cd solc + npm install fi ) done From 9d1e0270cde9f7e32c213ca2efb874db4de10196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 4 Dec 2020 14:20:55 +0100 Subject: [PATCH 11/14] Bump node.js version to 12 or 14 on external test jobs where possible --- .circleci/config.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 30452f5ae..1c6e19728 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -820,7 +820,7 @@ jobs: t_ems_compile_ext_gnosis: docker: - - image: circleci/node:10 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -835,7 +835,8 @@ jobs: t_ems_test_ext_gnosis: docker: - - image: circleci/node:10 + # NOTE: Tests do not start on node.js 14 ("ganache-cli exited early with code 1"). + - image: circleci/node:12 environment: TERM: xterm steps: @@ -852,7 +853,7 @@ jobs: t_ems_compile_ext_gnosis_v2: docker: - - image: circleci/node:10 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -867,7 +868,8 @@ jobs: t_ems_test_ext_gnosis_v2: docker: - - image: circleci/node:10 + # NOTE: Tests do not start on node.js 14 ("ganache-cli exited early with code 1"). + - image: circleci/node:12 environment: TERM: xterm steps: @@ -884,7 +886,7 @@ jobs: t_ems_compile_ext_zeppelin: docker: - - image: circleci/node:10 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -899,7 +901,7 @@ jobs: t_ems_test_ext_zeppelin: docker: - - image: circleci/node:10 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -916,7 +918,7 @@ jobs: t_ems_compile_ext_colony: docker: - - image: circleci/node:12 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -935,7 +937,7 @@ jobs: t_ems_test_ext_colony: docker: - - image: circleci/node:12 + - image: circleci/node:14 environment: TERM: xterm steps: @@ -956,6 +958,7 @@ jobs: t_ems_compile_ext_ens: docker: + # NOTE: One of the dependencies (fsevents) fails to build its native extension on node.js 12+. - image: circleci/node:10 environment: TERM: xterm @@ -975,6 +978,7 @@ jobs: t_ems_test_ext_ens: docker: + # NOTE: One of the dependencies (fsevents) fails to build its native extension on node.js 12+. - image: circleci/node:10 environment: TERM: xterm From 1f55e9213b63cc695ae14bcfe21693d7242bf7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 4 Dec 2020 18:42:27 +0100 Subject: [PATCH 12/14] Disable flaky Gnosis v1 tests --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1c6e19728..83022f919 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1185,7 +1185,9 @@ workflows: - t_ems_compile_ext_zeppelin: *workflow_emscripten - t_ems_compile_ext_ens: *workflow_emscripten - t_ems_test_ext_colony: *workflow_emscripten - - t_ems_test_ext_gnosis: *workflow_emscripten + # FIXME: Gnosis tests are pretty flaky right now. They often fail on CircleCI due to random ProviderError + # and there are also other less frequent problems. See https://github.com/gnosis/safe-contracts/issues/216. + #- t_ems_test_ext_gnosis: *workflow_emscripten - t_ems_test_ext_gnosis_v2: *workflow_emscripten - t_ems_test_ext_zeppelin: *workflow_emscripten - t_ems_test_ext_ens: *workflow_emscripten From 251f722919fb4eb5beae752fe9854fe92e941e73 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 7 Dec 2020 14:14:19 +0100 Subject: [PATCH 13/14] Group decoding function cases. --- libsolidity/codegen/ABIFunctions.cpp | 40 +++++------ .../combined_json_generated_sources/output | 68 +++++++++---------- test/cmdlineTests/exp_base_literal/output | 8 +++ .../standard_generatedSources/output.json | 6 +- 4 files changed, 62 insertions(+), 60 deletions(-) diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp index 76eccc98e..49af45be8 100644 --- a/libsolidity/codegen/ABIFunctions.cpp +++ b/libsolidity/codegen/ABIFunctions.cpp @@ -219,23 +219,18 @@ string ABIFunctions::tupleDecoder(TypePointers const& _types, bool _fromMemory) valueReturnParams.emplace_back("value" + to_string(stackPos)); stackPos++; } - bool dynamic = decodingTypes[i]->isDynamicallyEncoded(); - Whiskers elementTempl( - dynamic ? - R"( + Whiskers elementTempl(R"( { - let offset := (add(headStart, )) - if gt(offset, 0xffffffffffffffff) { } + + let offset := (add(headStart, )) + if gt(offset, 0xffffffffffffffff) { } + + let offset := + := (add(headStart, offset), dataEnd) } - )" : - R"( - { - let offset := - := (add(headStart, offset), dataEnd) - } - )" - ); + )"); + elementTempl("dynamic", decodingTypes[i]->isDynamicallyEncoded()); // TODO add test elementTempl("revertString", revertReasonIfDebug("ABI decoding: invalid tuple offset")); elementTempl("load", _fromMemory ? "mload" : "calldataload"); @@ -1357,19 +1352,16 @@ string ABIFunctions::abiDecodingFunctionStruct(StructType const& _type, bool _fr solAssert(!member.type->containsNestedMapping(), ""); auto decodingType = member.type->decodingType(); solAssert(decodingType, ""); - bool dynamic = decodingType->isDynamicallyEncoded(); - Whiskers memberTempl( - dynamic ? - R"( + Whiskers memberTempl(R"( + let offset := (add(headStart, )) if gt(offset, 0xffffffffffffffff) { } - mstore(add(value, ), (add(headStart, offset), end)) - )" : - R"( + let offset := - mstore(add(value, ), (add(headStart, offset), end)) - )" - ); + + mstore(add(value, ), (add(headStart, offset), end)) + )"); + memberTempl("dynamic", decodingType->isDynamicallyEncoded()); // TODO add test memberTempl("revertString", revertReasonIfDebug("ABI decoding: invalid struct offset")); memberTempl("load", _fromMemory ? "mload" : "calldataload"); diff --git a/test/cmdlineTests/combined_json_generated_sources/output b/test/cmdlineTests/combined_json_generated_sources/output index dfe910c12..cd8272f8e 100644 --- a/test/cmdlineTests/combined_json_generated_sources/output +++ b/test/cmdlineTests/combined_json_generated_sources/output @@ -10,7 +10,7 @@ "ast": { "nodeType": "YulBlock", - "src": "0:823:1", + "src": "0:825:1", "statements": [ { @@ -406,7 +406,7 @@ "body": { "nodeType": "YulBlock", - "src": "498:322:1", + "src": "498:324:1", "statements": [ { @@ -499,12 +499,12 @@ }, { "nodeType": "YulBlock", - "src": "570:243:1", + "src": "570:245:1", "statements": [ { "nodeType": "YulVariableDeclaration", - "src": "584:45:1", + "src": "585:45:1", "value": { "arguments": @@ -515,12 +515,12 @@ { "name": "headStart", "nodeType": "YulIdentifier", - "src": "615:9:1" + "src": "616:9:1" }, { "kind": "number", "nodeType": "YulLiteral", - "src": "626:1:1", + "src": "627:1:1", "type": "", "value": "0" } @@ -529,27 +529,27 @@ { "name": "add", "nodeType": "YulIdentifier", - "src": "611:3:1" + "src": "612:3:1" }, "nodeType": "YulFunctionCall", - "src": "611:17:1" + "src": "612:17:1" } ], "functionName": { "name": "calldataload", "nodeType": "YulIdentifier", - "src": "598:12:1" + "src": "599:12:1" }, "nodeType": "YulFunctionCall", - "src": "598:31:1" + "src": "599:31:1" }, "variables": [ { "name": "offset", "nodeType": "YulTypedName", - "src": "588:6:1", + "src": "589:6:1", "type": "" } ] @@ -558,7 +558,7 @@ "body": { "nodeType": "YulBlock", - "src": "676:16:1", + "src": "677:16:1", "statements": [ { @@ -569,14 +569,14 @@ { "kind": "number", "nodeType": "YulLiteral", - "src": "685:1:1", + "src": "686:1:1", "type": "", "value": "0" }, { "kind": "number", "nodeType": "YulLiteral", - "src": "688:1:1", + "src": "689:1:1", "type": "", "value": "0" } @@ -585,13 +585,13 @@ { "name": "revert", "nodeType": "YulIdentifier", - "src": "678:6:1" + "src": "679:6:1" }, "nodeType": "YulFunctionCall", - "src": "678:12:1" + "src": "679:12:1" }, "nodeType": "YulExpressionStatement", - "src": "678:12:1" + "src": "679:12:1" } ] }, @@ -602,12 +602,12 @@ { "name": "offset", "nodeType": "YulIdentifier", - "src": "648:6:1" + "src": "649:6:1" }, { "kind": "number", "nodeType": "YulLiteral", - "src": "656:18:1", + "src": "657:18:1", "type": "", "value": "0xffffffffffffffff" } @@ -616,17 +616,17 @@ { "name": "gt", "nodeType": "YulIdentifier", - "src": "645:2:1" + "src": "646:2:1" }, "nodeType": "YulFunctionCall", - "src": "645:30:1" + "src": "646:30:1" }, "nodeType": "YulIf", - "src": "642:2:1" + "src": "643:2:1" }, { "nodeType": "YulAssignment", - "src": "705:98:1", + "src": "707:98:1", "value": { "arguments": @@ -637,49 +637,49 @@ { "name": "headStart", "nodeType": "YulIdentifier", - "src": "775:9:1" + "src": "777:9:1" }, { "name": "offset", "nodeType": "YulIdentifier", - "src": "786:6:1" + "src": "788:6:1" } ], "functionName": { "name": "add", "nodeType": "YulIdentifier", - "src": "771:3:1" + "src": "773:3:1" }, "nodeType": "YulFunctionCall", - "src": "771:22:1" + "src": "773:22:1" }, { "name": "dataEnd", "nodeType": "YulIdentifier", - "src": "795:7:1" + "src": "797:7:1" } ], "functionName": { "name": "abi_decode_t_array$_t_uint256_$dyn_calldata_ptr", "nodeType": "YulIdentifier", - "src": "723:47:1" + "src": "725:47:1" }, "nodeType": "YulFunctionCall", - "src": "723:80:1" + "src": "725:80:1" }, "variableNames": [ { "name": "value0", "nodeType": "YulIdentifier", - "src": "705:6:1" + "src": "707:6:1" }, { "name": "value1", "nodeType": "YulIdentifier", - "src": "713:6:1" + "src": "715:6:1" } ] } @@ -719,11 +719,11 @@ "type": "" } ], - "src": "397:423:1" + "src": "397:425:1" } ] }, - "contents": "{\n\n // uint256[]\n function abi_decode_t_array$_t_uint256_$dyn_calldata_ptr(offset, end) -> arrayPos, length {\n if iszero(slt(add(offset, 0x1f), end)) { revert(0, 0) }\n length := calldataload(offset)\n if gt(length, 0xffffffffffffffff) { revert(0, 0) }\n arrayPos := add(offset, 0x20)\n if gt(add(arrayPos, mul(length, 0x20)), end) { revert(0, 0) }\n }\n\n function abi_decode_tuple_t_array$_t_uint256_$dyn_calldata_ptr(headStart, dataEnd) -> value0, value1 {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n\n {\n let offset := calldataload(add(headStart, 0))\n if gt(offset, 0xffffffffffffffff) { revert(0, 0) }\n value0, value1 := abi_decode_t_array$_t_uint256_$dyn_calldata_ptr(add(headStart, offset), dataEnd)\n }\n\n }\n\n}\n", + "contents": "{\n\n // uint256[]\n function abi_decode_t_array$_t_uint256_$dyn_calldata_ptr(offset, end) -> arrayPos, length {\n if iszero(slt(add(offset, 0x1f), end)) { revert(0, 0) }\n length := calldataload(offset)\n if gt(length, 0xffffffffffffffff) { revert(0, 0) }\n arrayPos := add(offset, 0x20)\n if gt(add(arrayPos, mul(length, 0x20)), end) { revert(0, 0) }\n }\n\n function abi_decode_tuple_t_array$_t_uint256_$dyn_calldata_ptr(headStart, dataEnd) -> value0, value1 {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n\n {\n\n let offset := calldataload(add(headStart, 0))\n if gt(offset, 0xffffffffffffffff) { revert(0, 0) }\n\n value0, value1 := abi_decode_t_array$_t_uint256_$dyn_calldata_ptr(add(headStart, offset), dataEnd)\n }\n\n }\n\n}\n", "id": 1, "language": "Yul", "name": "#utility.yul" diff --git a/test/cmdlineTests/exp_base_literal/output b/test/cmdlineTests/exp_base_literal/output index f27c69439..89815e804 100644 --- a/test/cmdlineTests/exp_base_literal/output +++ b/test/cmdlineTests/exp_base_literal/output @@ -57,22 +57,30 @@ object "C_80" { if slt(sub(dataEnd, headStart), 128) { revert(0, 0) } { + let offset := 0 + value0 := abi_decode_t_uint256(add(headStart, offset), dataEnd) } { + let offset := 32 + value1 := abi_decode_t_uint256(add(headStart, offset), dataEnd) } { + let offset := 64 + value2 := abi_decode_t_uint256(add(headStart, offset), dataEnd) } { + let offset := 96 + value3 := abi_decode_t_uint256(add(headStart, offset), dataEnd) } diff --git a/test/cmdlineTests/standard_generatedSources/output.json b/test/cmdlineTests/standard_generatedSources/output.json index 68ce41c71..614db9e0c 100644 --- a/test/cmdlineTests/standard_generatedSources/output.json +++ b/test/cmdlineTests/standard_generatedSources/output.json @@ -1,4 +1,4 @@ -{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:2742:1","statements":[{"body":{"nodeType":"YulBlock","src":"126:520:1","statements":[{"nodeType":"YulAssignment","src":"136:89:1","value":{"arguments":[{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"217:6:1"}],"functionName":{"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"160:56:1"},"nodeType":"YulFunctionCall","src":"160:64:1"}],"functionName":{"name":"allocateMemory","nodeType":"YulIdentifier","src":"145:14:1"},"nodeType":"YulFunctionCall","src":"145:80:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"136:5:1"}]},{"nodeType":"YulVariableDeclaration","src":"234:16:1","value":{"name":"array","nodeType":"YulIdentifier","src":"245:5:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"238:3:1","type":""}]},{"expression":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"266:5:1"},{"name":"length","nodeType":"YulIdentifier","src":"273:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"259:6:1"},"nodeType":"YulFunctionCall","src":"259:21:1"},"nodeType":"YulExpressionStatement","src":"259:21:1"},{"nodeType":"YulAssignment","src":"281:23:1","value":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"292:5:1"},{"kind":"number","nodeType":"YulLiteral","src":"299:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"288:3:1"},"nodeType":"YulFunctionCall","src":"288:16:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"281:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"313:17:1","value":{"name":"offset","nodeType":"YulIdentifier","src":"324:6:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"317:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"379:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"388:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"391:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"381:6:1"},"nodeType":"YulFunctionCall","src":"381:12:1"},"nodeType":"YulExpressionStatement","src":"381:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"349:3:1"},{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"358:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"366:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"354:3:1"},"nodeType":"YulFunctionCall","src":"354:17:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"345:3:1"},"nodeType":"YulFunctionCall","src":"345:27:1"},{"name":"end","nodeType":"YulIdentifier","src":"374:3:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"342:2:1"},"nodeType":"YulFunctionCall","src":"342:36:1"},"nodeType":"YulIf","src":"339:2:1"},{"body":{"nodeType":"YulBlock","src":"464:176:1","statements":[{"nodeType":"YulVariableDeclaration","src":"478:21:1","value":{"name":"src","nodeType":"YulIdentifier","src":"496:3:1"},"variables":[{"name":"elementPos","nodeType":"YulTypedName","src":"482:10:1","type":""}]},{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"519:3:1"},{"arguments":[{"name":"elementPos","nodeType":"YulIdentifier","src":"545:10:1"},{"name":"end","nodeType":"YulIdentifier","src":"557:3:1"}],"functionName":{"name":"abi_decode_t_uint256","nodeType":"YulIdentifier","src":"524:20:1"},"nodeType":"YulFunctionCall","src":"524:37:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"512:6:1"},"nodeType":"YulFunctionCall","src":"512:50:1"},"nodeType":"YulExpressionStatement","src":"512:50:1"},{"nodeType":"YulAssignment","src":"575:21:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"586:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"591:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"582:3:1"},"nodeType":"YulFunctionCall","src":"582:14:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"575:3:1"}]},{"nodeType":"YulAssignment","src":"609:21:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"620:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"625:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"616:3:1"},"nodeType":"YulFunctionCall","src":"616:14:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"609:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"426:1:1"},{"name":"length","nodeType":"YulIdentifier","src":"429:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"423:2:1"},"nodeType":"YulFunctionCall","src":"423:13:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"437:18:1","statements":[{"nodeType":"YulAssignment","src":"439:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"448:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"451:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"444:3:1"},"nodeType":"YulFunctionCall","src":"444:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"439:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"408:14:1","statements":[{"nodeType":"YulVariableDeclaration","src":"410:10:1","value":{"kind":"number","nodeType":"YulLiteral","src":"419:1:1","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"414:1:1","type":""}]}]},"src":"404:236:1"}]},"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"96:6:1","type":""},{"name":"length","nodeType":"YulTypedName","src":"104:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"112:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"120:5:1","type":""}],"src":"24:622:1"},{"body":{"nodeType":"YulBlock","src":"746:226:1","statements":[{"body":{"nodeType":"YulBlock","src":"795:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"804:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"807:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"797:6:1"},"nodeType":"YulFunctionCall","src":"797:12:1"},"nodeType":"YulExpressionStatement","src":"797:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"774:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"782:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"770:3:1"},"nodeType":"YulFunctionCall","src":"770:17:1"},{"name":"end","nodeType":"YulIdentifier","src":"789:3:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"766:3:1"},"nodeType":"YulFunctionCall","src":"766:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"759:6:1"},"nodeType":"YulFunctionCall","src":"759:35:1"},"nodeType":"YulIf","src":"756:2:1"},{"nodeType":"YulVariableDeclaration","src":"820:34:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"847:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"834:12:1"},"nodeType":"YulFunctionCall","src":"834:20:1"},"variables":[{"name":"length","nodeType":"YulTypedName","src":"824:6:1","type":""}]},{"nodeType":"YulAssignment","src":"863:103:1","value":{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"939:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"947:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"935:3:1"},"nodeType":"YulFunctionCall","src":"935:17:1"},{"name":"length","nodeType":"YulIdentifier","src":"954:6:1"},{"name":"end","nodeType":"YulIdentifier","src":"962:3:1"}],"functionName":{"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"872:62:1"},"nodeType":"YulFunctionCall","src":"872:94:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"863:5:1"}]}]},"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"724:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"732:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"740:5:1","type":""}],"src":"669:303:1"},{"body":{"nodeType":"YulBlock","src":"1030:87:1","statements":[{"nodeType":"YulAssignment","src":"1040:29:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1062:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1049:12:1"},"nodeType":"YulFunctionCall","src":"1049:20:1"},"variableNames":[{"name":"value","nodeType":"YulIdentifier","src":"1040:5:1"}]},{"expression":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1105:5:1"}],"functionName":{"name":"validator_revert_t_uint256","nodeType":"YulIdentifier","src":"1078:26:1"},"nodeType":"YulFunctionCall","src":"1078:33:1"},"nodeType":"YulExpressionStatement","src":"1078:33:1"}]},"name":"abi_decode_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"1008:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"1016:3:1","type":""}],"returnVariables":[{"name":"value","nodeType":"YulTypedName","src":"1024:5:1","type":""}],"src":"978:139:1"},{"body":{"nodeType":"YulBlock","src":"1214:312:1","statements":[{"body":{"nodeType":"YulBlock","src":"1260:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1269:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1272:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1262:6:1"},"nodeType":"YulFunctionCall","src":"1262:12:1"},"nodeType":"YulExpressionStatement","src":"1262:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"1235:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"1244:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"1231:3:1"},"nodeType":"YulFunctionCall","src":"1231:23:1"},{"kind":"number","nodeType":"YulLiteral","src":"1256:2:1","type":"","value":"32"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"1227:3:1"},"nodeType":"YulFunctionCall","src":"1227:32:1"},"nodeType":"YulIf","src":"1224:2:1"},{"nodeType":"YulBlock","src":"1286:233:1","statements":[{"nodeType":"YulVariableDeclaration","src":"1300:45:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1331:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1342:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1327:3:1"},"nodeType":"YulFunctionCall","src":"1327:17:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1314:12:1"},"nodeType":"YulFunctionCall","src":"1314:31:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"1304:6:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1392:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1401:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1404:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1394:6:1"},"nodeType":"YulFunctionCall","src":"1394:12:1"},"nodeType":"YulExpressionStatement","src":"1394:12:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1364:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"1372:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"1361:2:1"},"nodeType":"YulFunctionCall","src":"1361:30:1"},"nodeType":"YulIf","src":"1358:2:1"},{"nodeType":"YulAssignment","src":"1421:88:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1481:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"1492:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1477:3:1"},"nodeType":"YulFunctionCall","src":"1477:22:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"1501:7:1"}],"functionName":{"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"1431:45:1"},"nodeType":"YulFunctionCall","src":"1431:78:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"1421:6:1"}]}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1184:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"1195:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"1207:6:1","type":""}],"src":"1123:403:1"},{"body":{"nodeType":"YulBlock","src":"1597:53:1","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1614:3:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1637:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"1619:17:1"},"nodeType":"YulFunctionCall","src":"1619:24:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1607:6:1"},"nodeType":"YulFunctionCall","src":"1607:37:1"},"nodeType":"YulExpressionStatement","src":"1607:37:1"}]},"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1585:5:1","type":""},{"name":"pos","nodeType":"YulTypedName","src":"1592:3:1","type":""}],"src":"1532:118:1"},{"body":{"nodeType":"YulBlock","src":"1754:124:1","statements":[{"nodeType":"YulAssignment","src":"1764:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1776:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1787:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1772:3:1"},"nodeType":"YulFunctionCall","src":"1772:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1764:4:1"}]},{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"1844:6:1"},{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1857:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1868:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1853:3:1"},"nodeType":"YulFunctionCall","src":"1853:17:1"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulIdentifier","src":"1800:43:1"},"nodeType":"YulFunctionCall","src":"1800:71:1"},"nodeType":"YulExpressionStatement","src":"1800:71:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1726:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"1738:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"1749:4:1","type":""}],"src":"1656:222:1"},{"body":{"nodeType":"YulBlock","src":"1924:238:1","statements":[{"nodeType":"YulAssignment","src":"1934:19:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1950:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"1944:5:1"},"nodeType":"YulFunctionCall","src":"1944:9:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1934:6:1"}]},{"nodeType":"YulVariableDeclaration","src":"1962:35:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1984:6:1"},{"name":"size","nodeType":"YulIdentifier","src":"1992:4:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1980:3:1"},"nodeType":"YulFunctionCall","src":"1980:17:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"1966:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"2108:17:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error","nodeType":"YulIdentifier","src":"2110:11:1"},"nodeType":"YulFunctionCall","src":"2110:13:1"},"nodeType":"YulExpressionStatement","src":"2110:13:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2051:10:1"},{"kind":"number","nodeType":"YulLiteral","src":"2063:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2048:2:1"},"nodeType":"YulFunctionCall","src":"2048:34:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2087:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"2099:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"2084:2:1"},"nodeType":"YulFunctionCall","src":"2084:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"2045:2:1"},"nodeType":"YulFunctionCall","src":"2045:62:1"},"nodeType":"YulIf","src":"2042:2:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2141:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2145:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2134:6:1"},"nodeType":"YulFunctionCall","src":"2134:22:1"},"nodeType":"YulExpressionStatement","src":"2134:22:1"}]},"name":"allocateMemory","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nodeType":"YulTypedName","src":"1908:4:1","type":""}],"returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"1917:6:1","type":""}],"src":"1884:278:1"},{"body":{"nodeType":"YulBlock","src":"2250:224:1","statements":[{"body":{"nodeType":"YulBlock","src":"2355:17:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error","nodeType":"YulIdentifier","src":"2357:11:1"},"nodeType":"YulFunctionCall","src":"2357:13:1"},"nodeType":"YulExpressionStatement","src":"2357:13:1"}]},"condition":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2327:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2335:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2324:2:1"},"nodeType":"YulFunctionCall","src":"2324:30:1"},"nodeType":"YulIf","src":"2321:2:1"},{"nodeType":"YulAssignment","src":"2382:25:1","value":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2394:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2402:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"2390:3:1"},"nodeType":"YulFunctionCall","src":"2390:17:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2382:4:1"}]},{"nodeType":"YulAssignment","src":"2444:23:1","value":{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"2456:4:1"},{"kind":"number","nodeType":"YulLiteral","src":"2462:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2452:3:1"},"nodeType":"YulFunctionCall","src":"2452:15:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2444:4:1"}]}]},"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"length","nodeType":"YulTypedName","src":"2234:6:1","type":""}],"returnVariables":[{"name":"size","nodeType":"YulTypedName","src":"2245:4:1","type":""}],"src":"2168:306:1"},{"body":{"nodeType":"YulBlock","src":"2525:32:1","statements":[{"nodeType":"YulAssignment","src":"2535:16:1","value":{"name":"value","nodeType":"YulIdentifier","src":"2546:5:1"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"2535:7:1"}]}]},"name":"cleanup_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"2507:5:1","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"2517:7:1","type":""}],"src":"2480:77:1"},{"body":{"nodeType":"YulBlock","src":"2586:25:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"invalid","nodeType":"YulIdentifier","src":"2596:7:1"},"nodeType":"YulFunctionCall","src":"2596:9:1"},"nodeType":"YulExpressionStatement","src":"2596:9:1"}]},"name":"panic_error","nodeType":"YulFunctionDefinition","src":"2563:48:1"},{"body":{"nodeType":"YulBlock","src":"2660:79:1","statements":[{"body":{"nodeType":"YulBlock","src":"2717:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2726:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"2729:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"2719:6:1"},"nodeType":"YulFunctionCall","src":"2719:12:1"},"nodeType":"YulExpressionStatement","src":"2719:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"2683:5:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"2708:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"2690:17:1"},"nodeType":"YulFunctionCall","src":"2690:24:1"}],"functionName":{"name":"eq","nodeType":"YulIdentifier","src":"2680:2:1"},"nodeType":"YulFunctionCall","src":"2680:35:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"2673:6:1"},"nodeType":"YulFunctionCall","src":"2673:43:1"},"nodeType":"YulIf","src":"2670:2:1"}]},"name":"validator_revert_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"2653:5:1","type":""}],"src":"2617:122:1"}]},"contents":"{ +{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:2744:1","statements":[{"body":{"nodeType":"YulBlock","src":"126:520:1","statements":[{"nodeType":"YulAssignment","src":"136:89:1","value":{"arguments":[{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"217:6:1"}],"functionName":{"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"160:56:1"},"nodeType":"YulFunctionCall","src":"160:64:1"}],"functionName":{"name":"allocateMemory","nodeType":"YulIdentifier","src":"145:14:1"},"nodeType":"YulFunctionCall","src":"145:80:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"136:5:1"}]},{"nodeType":"YulVariableDeclaration","src":"234:16:1","value":{"name":"array","nodeType":"YulIdentifier","src":"245:5:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"238:3:1","type":""}]},{"expression":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"266:5:1"},{"name":"length","nodeType":"YulIdentifier","src":"273:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"259:6:1"},"nodeType":"YulFunctionCall","src":"259:21:1"},"nodeType":"YulExpressionStatement","src":"259:21:1"},{"nodeType":"YulAssignment","src":"281:23:1","value":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"292:5:1"},{"kind":"number","nodeType":"YulLiteral","src":"299:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"288:3:1"},"nodeType":"YulFunctionCall","src":"288:16:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"281:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"313:17:1","value":{"name":"offset","nodeType":"YulIdentifier","src":"324:6:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"317:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"379:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"388:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"391:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"381:6:1"},"nodeType":"YulFunctionCall","src":"381:12:1"},"nodeType":"YulExpressionStatement","src":"381:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"349:3:1"},{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"358:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"366:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"354:3:1"},"nodeType":"YulFunctionCall","src":"354:17:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"345:3:1"},"nodeType":"YulFunctionCall","src":"345:27:1"},{"name":"end","nodeType":"YulIdentifier","src":"374:3:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"342:2:1"},"nodeType":"YulFunctionCall","src":"342:36:1"},"nodeType":"YulIf","src":"339:2:1"},{"body":{"nodeType":"YulBlock","src":"464:176:1","statements":[{"nodeType":"YulVariableDeclaration","src":"478:21:1","value":{"name":"src","nodeType":"YulIdentifier","src":"496:3:1"},"variables":[{"name":"elementPos","nodeType":"YulTypedName","src":"482:10:1","type":""}]},{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"519:3:1"},{"arguments":[{"name":"elementPos","nodeType":"YulIdentifier","src":"545:10:1"},{"name":"end","nodeType":"YulIdentifier","src":"557:3:1"}],"functionName":{"name":"abi_decode_t_uint256","nodeType":"YulIdentifier","src":"524:20:1"},"nodeType":"YulFunctionCall","src":"524:37:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"512:6:1"},"nodeType":"YulFunctionCall","src":"512:50:1"},"nodeType":"YulExpressionStatement","src":"512:50:1"},{"nodeType":"YulAssignment","src":"575:21:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"586:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"591:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"582:3:1"},"nodeType":"YulFunctionCall","src":"582:14:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"575:3:1"}]},{"nodeType":"YulAssignment","src":"609:21:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"620:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"625:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"616:3:1"},"nodeType":"YulFunctionCall","src":"616:14:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"609:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"426:1:1"},{"name":"length","nodeType":"YulIdentifier","src":"429:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"423:2:1"},"nodeType":"YulFunctionCall","src":"423:13:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"437:18:1","statements":[{"nodeType":"YulAssignment","src":"439:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"448:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"451:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"444:3:1"},"nodeType":"YulFunctionCall","src":"444:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"439:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"408:14:1","statements":[{"nodeType":"YulVariableDeclaration","src":"410:10:1","value":{"kind":"number","nodeType":"YulLiteral","src":"419:1:1","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"414:1:1","type":""}]}]},"src":"404:236:1"}]},"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"96:6:1","type":""},{"name":"length","nodeType":"YulTypedName","src":"104:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"112:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"120:5:1","type":""}],"src":"24:622:1"},{"body":{"nodeType":"YulBlock","src":"746:226:1","statements":[{"body":{"nodeType":"YulBlock","src":"795:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"804:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"807:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"797:6:1"},"nodeType":"YulFunctionCall","src":"797:12:1"},"nodeType":"YulExpressionStatement","src":"797:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"774:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"782:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"770:3:1"},"nodeType":"YulFunctionCall","src":"770:17:1"},{"name":"end","nodeType":"YulIdentifier","src":"789:3:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"766:3:1"},"nodeType":"YulFunctionCall","src":"766:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"759:6:1"},"nodeType":"YulFunctionCall","src":"759:35:1"},"nodeType":"YulIf","src":"756:2:1"},{"nodeType":"YulVariableDeclaration","src":"820:34:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"847:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"834:12:1"},"nodeType":"YulFunctionCall","src":"834:20:1"},"variables":[{"name":"length","nodeType":"YulTypedName","src":"824:6:1","type":""}]},{"nodeType":"YulAssignment","src":"863:103:1","value":{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"939:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"947:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"935:3:1"},"nodeType":"YulFunctionCall","src":"935:17:1"},{"name":"length","nodeType":"YulIdentifier","src":"954:6:1"},{"name":"end","nodeType":"YulIdentifier","src":"962:3:1"}],"functionName":{"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"872:62:1"},"nodeType":"YulFunctionCall","src":"872:94:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"863:5:1"}]}]},"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"724:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"732:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"740:5:1","type":""}],"src":"669:303:1"},{"body":{"nodeType":"YulBlock","src":"1030:87:1","statements":[{"nodeType":"YulAssignment","src":"1040:29:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1062:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1049:12:1"},"nodeType":"YulFunctionCall","src":"1049:20:1"},"variableNames":[{"name":"value","nodeType":"YulIdentifier","src":"1040:5:1"}]},{"expression":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1105:5:1"}],"functionName":{"name":"validator_revert_t_uint256","nodeType":"YulIdentifier","src":"1078:26:1"},"nodeType":"YulFunctionCall","src":"1078:33:1"},"nodeType":"YulExpressionStatement","src":"1078:33:1"}]},"name":"abi_decode_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"1008:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"1016:3:1","type":""}],"returnVariables":[{"name":"value","nodeType":"YulTypedName","src":"1024:5:1","type":""}],"src":"978:139:1"},{"body":{"nodeType":"YulBlock","src":"1214:314:1","statements":[{"body":{"nodeType":"YulBlock","src":"1260:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1269:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1272:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1262:6:1"},"nodeType":"YulFunctionCall","src":"1262:12:1"},"nodeType":"YulExpressionStatement","src":"1262:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"1235:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"1244:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"1231:3:1"},"nodeType":"YulFunctionCall","src":"1231:23:1"},{"kind":"number","nodeType":"YulLiteral","src":"1256:2:1","type":"","value":"32"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"1227:3:1"},"nodeType":"YulFunctionCall","src":"1227:32:1"},"nodeType":"YulIf","src":"1224:2:1"},{"nodeType":"YulBlock","src":"1286:235:1","statements":[{"nodeType":"YulVariableDeclaration","src":"1301:45:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1332:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1343:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1328:3:1"},"nodeType":"YulFunctionCall","src":"1328:17:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1315:12:1"},"nodeType":"YulFunctionCall","src":"1315:31:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"1305:6:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1393:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1402:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1405:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1395:6:1"},"nodeType":"YulFunctionCall","src":"1395:12:1"},"nodeType":"YulExpressionStatement","src":"1395:12:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1365:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"1373:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"1362:2:1"},"nodeType":"YulFunctionCall","src":"1362:30:1"},"nodeType":"YulIf","src":"1359:2:1"},{"nodeType":"YulAssignment","src":"1423:88:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1483:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"1494:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1479:3:1"},"nodeType":"YulFunctionCall","src":"1479:22:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"1503:7:1"}],"functionName":{"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"1433:45:1"},"nodeType":"YulFunctionCall","src":"1433:78:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"1423:6:1"}]}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1184:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"1195:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"1207:6:1","type":""}],"src":"1123:405:1"},{"body":{"nodeType":"YulBlock","src":"1599:53:1","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1616:3:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1639:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"1621:17:1"},"nodeType":"YulFunctionCall","src":"1621:24:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1609:6:1"},"nodeType":"YulFunctionCall","src":"1609:37:1"},"nodeType":"YulExpressionStatement","src":"1609:37:1"}]},"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1587:5:1","type":""},{"name":"pos","nodeType":"YulTypedName","src":"1594:3:1","type":""}],"src":"1534:118:1"},{"body":{"nodeType":"YulBlock","src":"1756:124:1","statements":[{"nodeType":"YulAssignment","src":"1766:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1778:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1789:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1774:3:1"},"nodeType":"YulFunctionCall","src":"1774:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1766:4:1"}]},{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"1846:6:1"},{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1859:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1870:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1855:3:1"},"nodeType":"YulFunctionCall","src":"1855:17:1"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulIdentifier","src":"1802:43:1"},"nodeType":"YulFunctionCall","src":"1802:71:1"},"nodeType":"YulExpressionStatement","src":"1802:71:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1728:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"1740:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"1751:4:1","type":""}],"src":"1658:222:1"},{"body":{"nodeType":"YulBlock","src":"1926:238:1","statements":[{"nodeType":"YulAssignment","src":"1936:19:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1952:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"1946:5:1"},"nodeType":"YulFunctionCall","src":"1946:9:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1936:6:1"}]},{"nodeType":"YulVariableDeclaration","src":"1964:35:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1986:6:1"},{"name":"size","nodeType":"YulIdentifier","src":"1994:4:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1982:3:1"},"nodeType":"YulFunctionCall","src":"1982:17:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"1968:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"2110:17:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error","nodeType":"YulIdentifier","src":"2112:11:1"},"nodeType":"YulFunctionCall","src":"2112:13:1"},"nodeType":"YulExpressionStatement","src":"2112:13:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2053:10:1"},{"kind":"number","nodeType":"YulLiteral","src":"2065:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2050:2:1"},"nodeType":"YulFunctionCall","src":"2050:34:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2089:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"2101:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"2086:2:1"},"nodeType":"YulFunctionCall","src":"2086:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"2047:2:1"},"nodeType":"YulFunctionCall","src":"2047:62:1"},"nodeType":"YulIf","src":"2044:2:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2143:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2147:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2136:6:1"},"nodeType":"YulFunctionCall","src":"2136:22:1"},"nodeType":"YulExpressionStatement","src":"2136:22:1"}]},"name":"allocateMemory","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nodeType":"YulTypedName","src":"1910:4:1","type":""}],"returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"1919:6:1","type":""}],"src":"1886:278:1"},{"body":{"nodeType":"YulBlock","src":"2252:224:1","statements":[{"body":{"nodeType":"YulBlock","src":"2357:17:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error","nodeType":"YulIdentifier","src":"2359:11:1"},"nodeType":"YulFunctionCall","src":"2359:13:1"},"nodeType":"YulExpressionStatement","src":"2359:13:1"}]},"condition":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2329:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2337:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2326:2:1"},"nodeType":"YulFunctionCall","src":"2326:30:1"},"nodeType":"YulIf","src":"2323:2:1"},{"nodeType":"YulAssignment","src":"2384:25:1","value":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2396:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2404:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"2392:3:1"},"nodeType":"YulFunctionCall","src":"2392:17:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2384:4:1"}]},{"nodeType":"YulAssignment","src":"2446:23:1","value":{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"2458:4:1"},{"kind":"number","nodeType":"YulLiteral","src":"2464:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2454:3:1"},"nodeType":"YulFunctionCall","src":"2454:15:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2446:4:1"}]}]},"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"length","nodeType":"YulTypedName","src":"2236:6:1","type":""}],"returnVariables":[{"name":"size","nodeType":"YulTypedName","src":"2247:4:1","type":""}],"src":"2170:306:1"},{"body":{"nodeType":"YulBlock","src":"2527:32:1","statements":[{"nodeType":"YulAssignment","src":"2537:16:1","value":{"name":"value","nodeType":"YulIdentifier","src":"2548:5:1"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"2537:7:1"}]}]},"name":"cleanup_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"2509:5:1","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"2519:7:1","type":""}],"src":"2482:77:1"},{"body":{"nodeType":"YulBlock","src":"2588:25:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"invalid","nodeType":"YulIdentifier","src":"2598:7:1"},"nodeType":"YulFunctionCall","src":"2598:9:1"},"nodeType":"YulExpressionStatement","src":"2598:9:1"}]},"name":"panic_error","nodeType":"YulFunctionDefinition","src":"2565:48:1"},{"body":{"nodeType":"YulBlock","src":"2662:79:1","statements":[{"body":{"nodeType":"YulBlock","src":"2719:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2728:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"2731:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"2721:6:1"},"nodeType":"YulFunctionCall","src":"2721:12:1"},"nodeType":"YulExpressionStatement","src":"2721:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"2685:5:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"2710:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"2692:17:1"},"nodeType":"YulFunctionCall","src":"2692:24:1"}],"functionName":{"name":"eq","nodeType":"YulIdentifier","src":"2682:2:1"},"nodeType":"YulFunctionCall","src":"2682:35:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"2675:6:1"},"nodeType":"YulFunctionCall","src":"2675:43:1"},"nodeType":"YulIf","src":"2672:2:1"}]},"name":"validator_revert_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"2655:5:1","type":""}],"src":"2619:122:1"}]},"contents":"{ // uint256[] function abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr(offset, length, end) -> array { @@ -32,8 +32,10 @@ if slt(sub(dataEnd, headStart), 32) { revert(0, 0) } { + let offset := calldataload(add(headStart, 0)) if gt(offset, 0xffffffffffffffff) { revert(0, 0) } + value0 := abi_decode_t_array$_t_uint256_$dyn_memory_ptr(add(headStart, offset), dataEnd) } @@ -82,5 +84,5 @@ } } -","id":1,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":"56:74:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;69:59;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;116:7;69:59;;;:::o;24:622:1:-;;145:80;160:64;217:6;160:64;:::i;:::-;145:80;:::i;:::-;136:89;;245:5;273:6;266:5;259:21;299:4;292:5;288:16;281:23;;324:6;374:3;366:4;358:6;354:17;349:3;345:27;342:36;339:2;;;391:1;388;381:12;339:2;419:1;404:236;429:6;426:1;423:13;404:236;;;496:3;524:37;557:3;545:10;524:37;:::i;:::-;519:3;512:50;591:4;586:3;582:14;575:21;;625:4;620:3;616:14;609:21;;464:176;451:1;448;444:9;439:14;;404:236;;;408:14;126:520;;;;;;;:::o;669:303::-;;789:3;782:4;774:6;770:17;766:27;756:2;;807:1;804;797:12;756:2;847:6;834:20;872:94;962:3;954:6;947:4;939:6;935:17;872:94;:::i;:::-;863:103;;746:226;;;;;:::o;978:139::-;;1062:6;1049:20;1040:29;;1078:33;1105:5;1078:33;:::i;:::-;1030:87;;;;:::o;1123:403::-;;1256:2;1244:9;1235:7;1231:23;1227:32;1224:2;;;1272:1;1269;1262:12;1224:2;1342:1;1331:9;1327:17;1314:31;1372:18;1364:6;1361:30;1358:2;;;1404:1;1401;1394:12;1358:2;1431:78;1501:7;1492:6;1481:9;1477:22;1431:78;:::i;:::-;1421:88;;1286:233;1214:312;;;;:::o;1532:118::-;1619:24;1637:5;1619:24;:::i;:::-;1614:3;1607:37;1597:53;;:::o;1656:222::-;;1787:2;1776:9;1772:18;1764:26;;1800:71;1868:1;1857:9;1853:17;1844:6;1800:71;:::i;:::-;1754:124;;;;:::o;1884:278::-;;1950:2;1944:9;1934:19;;1992:4;1984:6;1980:17;2099:6;2087:10;2084:22;2063:18;2051:10;2048:34;2045:62;2042:2;;;2110:13;;:::i;:::-;2042:2;2145:10;2141:2;2134:22;1924:238;;;;:::o;2168:306::-;;2335:18;2327:6;2324:30;2321:2;;;2357:13;;:::i;:::-;2321:2;2402:4;2394:6;2390:17;2382:25;;2462:4;2456;2452:15;2444:23;;2250:224;;;:::o;2480:77::-;;2546:5;2535:16;;2525:32;;;:::o;2563:48::-;2596:9;2617:122;2690:24;2708:5;2690:24;:::i;:::-;2683:5;2680:35;2670:2;;2729:1;2726;2719:12;2670:2;2660:79;:::o"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! +","id":1,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":"56:74:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;69:59;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;116:7;69:59;;;:::o;24:622:1:-;;145:80;160:64;217:6;160:64;:::i;:::-;145:80;:::i;:::-;136:89;;245:5;273:6;266:5;259:21;299:4;292:5;288:16;281:23;;324:6;374:3;366:4;358:6;354:17;349:3;345:27;342:36;339:2;;;391:1;388;381:12;339:2;419:1;404:236;429:6;426:1;423:13;404:236;;;496:3;524:37;557:3;545:10;524:37;:::i;:::-;519:3;512:50;591:4;586:3;582:14;575:21;;625:4;620:3;616:14;609:21;;464:176;451:1;448;444:9;439:14;;404:236;;;408:14;126:520;;;;;;;:::o;669:303::-;;789:3;782:4;774:6;770:17;766:27;756:2;;807:1;804;797:12;756:2;847:6;834:20;872:94;962:3;954:6;947:4;939:6;935:17;872:94;:::i;:::-;863:103;;746:226;;;;;:::o;978:139::-;;1062:6;1049:20;1040:29;;1078:33;1105:5;1078:33;:::i;:::-;1030:87;;;;:::o;1123:405::-;;1256:2;1244:9;1235:7;1231:23;1227:32;1224:2;;;1272:1;1269;1262:12;1224:2;1343:1;1332:9;1328:17;1315:31;1373:18;1365:6;1362:30;1359:2;;;1405:1;1402;1395:12;1359:2;1433:78;1503:7;1494:6;1483:9;1479:22;1433:78;:::i;:::-;1423:88;;1286:235;1214:314;;;;:::o;1534:118::-;1621:24;1639:5;1621:24;:::i;:::-;1616:3;1609:37;1599:53;;:::o;1658:222::-;;1789:2;1778:9;1774:18;1766:26;;1802:71;1870:1;1859:9;1855:17;1846:6;1802:71;:::i;:::-;1756:124;;;;:::o;1886:278::-;;1952:2;1946:9;1936:19;;1994:4;1986:6;1982:17;2101:6;2089:10;2086:22;2065:18;2053:10;2050:34;2047:62;2044:2;;;2112:13;;:::i;:::-;2044:2;2147:10;2143:2;2136:22;1926:238;;;;:::o;2170:306::-;;2337:18;2329:6;2326:30;2323:2;;;2359:13;;:::i;:::-;2323:2;2404:4;2396:6;2392:17;2384:25;;2464:4;2458;2454:15;2446:23;;2252:224;;;:::o;2482:77::-;;2548:5;2537:16;;2527:32;;;:::o;2565:48::-;2598:9;2619:122;2692:24;2710:5;2692:24;:::i;:::-;2685:5;2682:35;2672:2;;2731:1;2728;2721:12;2672:2;2662:79;:::o"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0}}} From a8197788d05a77d293985c677ee4e53ccd969213 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 13 Nov 2020 16:03:49 +0000 Subject: [PATCH 14/14] Replace the inconsistent use of u160/Address/h160 with h160 only --- .../codegen/ir/IRGeneratorForStatements.cpp | 2 +- test/EVMHost.cpp | 10 +- test/ExecutionFramework.cpp | 16 +-- test/ExecutionFramework.h | 24 ++-- test/contracts/AuctionRegistrar.cpp | 58 ++++---- test/contracts/ContractInterface.h | 11 +- test/contracts/FixedFeeRegistrar.cpp | 26 ++-- test/contracts/Wallet.cpp | 132 +++++++++--------- test/libsolidity/ABIDecoderTests.cpp | 6 +- test/libsolidity/ABIEncoderTests.cpp | 18 ++- test/libsolidity/SolidityEndToEndTest.cpp | 112 +++++++-------- test/libsolidity/SolidityOptimizer.cpp | 4 +- 12 files changed, 214 insertions(+), 205 deletions(-) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 9c091ec9e..46d9880d9 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -1471,7 +1471,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) solAssert(!functionType->gasSet(), ""); solAssert(!functionType->bound(), ""); - static map> precompiles = { + static map> precompiles = { {FunctionType::Kind::ECRecover, std::make_tuple(1, 0)}, {FunctionType::Kind::SHA256, std::make_tuple(2, 0)}, {FunctionType::Kind::RIPEMD160, std::make_tuple(3, 12)}, diff --git a/test/EVMHost.cpp b/test/EVMHost.cpp index 3b4ea2117..64fd7b077 100644 --- a/test/EVMHost.cpp +++ b/test/EVMHost.cpp @@ -209,7 +209,7 @@ evmc::result EVMHost::call(evmc_message const& _message) noexcept { // TODO this is not the right formula // TODO is the nonce incremented on failure, too? - Address createAddress(keccak256( + h160 createAddress(keccak256( bytes(begin(message.sender.bytes), end(message.sender.bytes)) + asBytes(to_string(sender.nonce++)) )); @@ -218,7 +218,7 @@ evmc::result EVMHost::call(evmc_message const& _message) noexcept } else if (message.kind == EVMC_CREATE2) { - Address createAddress(keccak256( + h160 createAddress(keccak256( bytes(1, 0xff) + bytes(begin(message.sender.bytes), end(message.sender.bytes)) + bytes(begin(message.create2_salt.bytes), end(message.create2_salt.bytes)) + @@ -292,12 +292,12 @@ evmc::bytes32 EVMHost::get_block_hash(int64_t _number) const noexcept return convertToEVMC(u256("0x3737373737373737373737373737373737373737373737373737373737373737") + _number); } -Address EVMHost::convertFromEVMC(evmc::address const& _addr) +h160 EVMHost::convertFromEVMC(evmc::address const& _addr) { - return Address(bytes(begin(_addr.bytes), end(_addr.bytes))); + return h160(bytes(begin(_addr.bytes), end(_addr.bytes))); } -evmc::address EVMHost::convertToEVMC(Address const& _addr) +evmc::address EVMHost::convertToEVMC(h160 const& _addr) { evmc::address a; for (size_t i = 0; i < 20; ++i) diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp index a17f65f3c..f0466f158 100644 --- a/test/ExecutionFramework.cpp +++ b/test/ExecutionFramework.cpp @@ -160,7 +160,7 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256 if (_isCreation) { message.kind = EVMC_CREATE; - message.destination = EVMHost::convertToEVMC(Address{}); + message.destination = EVMHost::convertToEVMC(h160{}); } else { @@ -186,7 +186,7 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256 } } -void ExecutionFramework::sendEther(Address const& _addr, u256 const& _amount) +void ExecutionFramework::sendEther(h160 const& _addr, u256 const& _amount) { m_evmcHost->newBlock(); @@ -219,12 +219,12 @@ size_t ExecutionFramework::blockTimestamp(u256 _block) return static_cast((currentTimestamp() / blockNumber()) * _block); } -Address ExecutionFramework::account(size_t _idx) +h160 ExecutionFramework::account(size_t _idx) { - return Address(h256(u256{"0x1212121212121212121212121212120000000012"} + _idx * 0x1000), Address::AlignRight); + return h160(h256(u256{"0x1212121212121212121212121212120000000012"} + _idx * 0x1000), h160::AlignRight); } -bool ExecutionFramework::addressHasCode(Address const& _addr) +bool ExecutionFramework::addressHasCode(h160 const& _addr) { return m_evmcHost->get_code_size(EVMHost::convertToEVMC(_addr)) != 0; } @@ -244,7 +244,7 @@ h256 ExecutionFramework::logTopic(size_t _logIdx, size_t _topicIdx) const return EVMHost::convertFromEVMC(m_evmcHost->recorded_logs.at(_logIdx).topics.at(_topicIdx)); } -Address ExecutionFramework::logAddress(size_t _logIdx) const +h160 ExecutionFramework::logAddress(size_t _logIdx) const { return EVMHost::convertFromEVMC(m_evmcHost->recorded_logs.at(_logIdx).creator); } @@ -257,12 +257,12 @@ bytes ExecutionFramework::logData(size_t _logIdx) const return {data.begin(), data.end()}; } -u256 ExecutionFramework::balanceAt(Address const& _addr) +u256 ExecutionFramework::balanceAt(h160 const& _addr) { return u256(EVMHost::convertFromEVMC(m_evmcHost->get_balance(EVMHost::convertToEVMC(_addr)))); } -bool ExecutionFramework::storageEmpty(Address const& _addr) +bool ExecutionFramework::storageEmpty(h160 const& _addr) { const auto it = m_evmcHost->accounts.find(EVMHost::convertToEVMC(_addr)); if (it != m_evmcHost->accounts.end()) diff --git a/test/ExecutionFramework.h b/test/ExecutionFramework.h index 9b01d9a91..026044b53 100644 --- a/test/ExecutionFramework.h +++ b/test/ExecutionFramework.h @@ -41,9 +41,6 @@ namespace solidity::test { using rational = boost::rational; -/// An Ethereum address: 20 bytes. -/// @NOTE This is not endian-specific; it's just a bunch of bytes. -using Address = util::h160; // The ether and gwei denominations; here for ease of use where needed within code. static const u256 gwei = u256(1) << 9; @@ -62,7 +59,7 @@ public: u256 const& _value = 0, std::string const& _contractName = "", bytes const& _arguments = {}, - std::map const& _libraryAddresses = {} + std::map const& _libraryAddresses = {} ) = 0; bytes const& compileAndRun( @@ -70,7 +67,7 @@ public: u256 const& _value = 0, std::string const& _contractName = "", bytes const& _arguments = {}, - std::map const& _libraryAddresses = {} + std::map const& _libraryAddresses = {} ) { compileAndRunWithoutCheck( @@ -176,6 +173,7 @@ public: return encode(u256((value.numerator() << fractionalBits) / value.denominator())); } static bytes encode(util::h256 const& _value) { return _value.asBytes(); } + static bytes encode(util::h160 const& _value) { return encode(util::h256(_value, util::h256::AlignRight)); } static bytes encode(bytes const& _value, bool _padLeft = true) { bytes padding = bytes((32 - _value.size() % 32) % 32, 0); @@ -258,21 +256,21 @@ protected: void reset(); void sendMessage(bytes const& _data, bool _isCreation, u256 const& _value = 0); - void sendEther(Address const& _to, u256 const& _value); + void sendEther(util::h160 const& _to, u256 const& _value); size_t currentTimestamp(); size_t blockTimestamp(u256 _number); /// @returns the (potentially newly created) _ith address. - Address account(size_t _i); + util::h160 account(size_t _i); - u256 balanceAt(Address const& _addr); - bool storageEmpty(Address const& _addr); - bool addressHasCode(Address const& _addr); + u256 balanceAt(util::h160 const& _addr); + bool storageEmpty(util::h160 const& _addr); + bool addressHasCode(util::h160 const& _addr); size_t numLogs() const; size_t numLogTopics(size_t _logIdx) const; util::h256 logTopic(size_t _logIdx, size_t _topicIdx) const; - Address logAddress(size_t _logIdx) const; + util::h160 logAddress(size_t _logIdx) const; bytes logData(size_t _logIdx) const; langutil::EVMVersion m_evmVersion; @@ -285,8 +283,8 @@ protected: std::vector m_vmPaths; bool m_transactionSuccessful = true; - Address m_sender = account(0); - Address m_contractAddress; + util::h160 m_sender = account(0); + util::h160 m_contractAddress; u256 const m_gasPrice = 10 * gwei; u256 const m_gas = 100000000; bytes m_output; diff --git a/test/contracts/AuctionRegistrar.cpp b/test/contracts/AuctionRegistrar.cpp index 8f25f9437..c4940e981 100644 --- a/test/contracts/AuctionRegistrar.cpp +++ b/test/contracts/AuctionRegistrar.cpp @@ -239,27 +239,27 @@ protected: { callString("reserve", _name); } - u160 owner(string const& _name) + h160 owner(string const& _name) { return callStringReturnsAddress("owner", _name); } - void setAddress(string const& _name, u160 const& _address, bool _primary) + void setAddress(string const& _name, h160 const& _address, bool _primary) { callStringAddressBool("setAddress", _name, _address, _primary); } - u160 addr(string const& _name) + h160 addr(string const& _name) { return callStringReturnsAddress("addr", _name); } - string name(u160 const& _addr) + string name(h160 const& _addr) { return callAddressReturnsString("name", _addr); } - void setSubRegistrar(string const& _name, u160 const& _address) + void setSubRegistrar(string const& _name, h160 const& _address) { callStringAddress("setSubRegistrar", _name, _address); } - u160 subRegistrar(string const& _name) + h160 subRegistrar(string const& _name) { return callStringReturnsAddress("subRegistrar", _name); } @@ -271,7 +271,7 @@ protected: { return callStringReturnsBytes32("content", _name); } - void transfer(string const& _name, u160 const& _target) + void transfer(string const& _name, h160 const& _target) { return callStringAddress("transfer", _name, _target); } @@ -304,12 +304,12 @@ BOOST_AUTO_TEST_CASE(reserve) // should not work registrar.reserve(""); - BOOST_CHECK_EQUAL(registrar.owner(""), u160(0)); + BOOST_CHECK_EQUAL(registrar.owner(""), h160{}); for (auto const& name: names) { registrar.reserve(name); - BOOST_CHECK_EQUAL(registrar.owner(name), u160(m_sender)); + BOOST_CHECK_EQUAL(registrar.owner(name), m_sender); } } @@ -346,20 +346,20 @@ BOOST_AUTO_TEST_CASE(properties) // setting by sender works registrar.reserve(name); BOOST_CHECK_EQUAL(registrar.owner(name), sender); - registrar.setAddress(name, addr, true); - BOOST_CHECK_EQUAL(registrar.addr(name), u160(addr)); - registrar.setSubRegistrar(name, addr + 20); - BOOST_CHECK_EQUAL(registrar.subRegistrar(name), u160(addr + 20)); + registrar.setAddress(name, h160(addr), true); + BOOST_CHECK_EQUAL(registrar.addr(name), h160(addr)); + registrar.setSubRegistrar(name, h160(addr + 20)); + BOOST_CHECK_EQUAL(registrar.subRegistrar(name), h160(addr + 20)); registrar.setContent(name, h256(u256(addr + 90))); BOOST_CHECK_EQUAL(registrar.content(name), h256(u256(addr + 90))); // but not by someone else m_sender = account(count - 1); BOOST_CHECK_EQUAL(registrar.owner(name), sender); - registrar.setAddress(name, addr + 1, true); - BOOST_CHECK_EQUAL(registrar.addr(name), u160(addr)); - registrar.setSubRegistrar(name, addr + 20 + 1); - BOOST_CHECK_EQUAL(registrar.subRegistrar(name), u160(addr + 20)); + registrar.setAddress(name, h160(addr + 1), true); + BOOST_CHECK_EQUAL(registrar.addr(name), h160(addr)); + registrar.setSubRegistrar(name, h160(addr + 20 + 1)); + BOOST_CHECK_EQUAL(registrar.subRegistrar(name), h160(addr + 20)); registrar.setContent(name, h256(u256(addr + 90 + 1))); BOOST_CHECK_EQUAL(registrar.content(name), h256(u256(addr + 90))); count++; @@ -373,8 +373,8 @@ BOOST_AUTO_TEST_CASE(transfer) RegistrarInterface registrar(*this); registrar.reserve(name); registrar.setContent(name, h256(u256(123))); - registrar.transfer(name, u160(555)); - BOOST_CHECK_EQUAL(registrar.owner(name), u160(555)); + registrar.transfer(name, h160(555)); + BOOST_CHECK_EQUAL(registrar.owner(name), h160(555)); BOOST_CHECK_EQUAL(registrar.content(name), h256(u256(123))); } @@ -386,9 +386,9 @@ BOOST_AUTO_TEST_CASE(disown) RegistrarInterface registrar(*this); registrar.reserve(name); registrar.setContent(name, h256(u256(123))); - registrar.setAddress(name, u160(124), true); - registrar.setSubRegistrar(name, u160(125)); - BOOST_CHECK_EQUAL(registrar.name(u160(124)), name); + registrar.setAddress(name, h160(124), true); + registrar.setSubRegistrar(name, h160(125)); + BOOST_CHECK_EQUAL(registrar.name(h160(124)), name); // someone else tries disowning sendEther(account(1), u256(10) * ether); @@ -398,11 +398,11 @@ BOOST_AUTO_TEST_CASE(disown) m_sender = account(0); registrar.disown(name); - BOOST_CHECK_EQUAL(registrar.owner(name), 0); - BOOST_CHECK_EQUAL(registrar.addr(name), 0); - BOOST_CHECK_EQUAL(registrar.subRegistrar(name), 0); + BOOST_CHECK_EQUAL(registrar.owner(name), h160()); + BOOST_CHECK_EQUAL(registrar.addr(name), h160()); + BOOST_CHECK_EQUAL(registrar.subRegistrar(name), h160()); BOOST_CHECK_EQUAL(registrar.content(name), h256()); - BOOST_CHECK_EQUAL(registrar.name(u160(124)), ""); + BOOST_CHECK_EQUAL(registrar.name(h160(124)), ""); } BOOST_AUTO_TEST_CASE(auction_simple) @@ -414,7 +414,7 @@ BOOST_AUTO_TEST_CASE(auction_simple) // initiate auction registrar.setNextValue(8); registrar.reserve(name); - BOOST_CHECK_EQUAL(registrar.owner(name), 0); + BOOST_CHECK_EQUAL(registrar.owner(name), h160()); // "wait" until auction end m_evmcHost->tx_context.block_timestamp += m_biddingTime + 10; @@ -435,7 +435,7 @@ BOOST_AUTO_TEST_CASE(auction_bidding) // initiate auction registrar.setNextValue(8); registrar.reserve(name); - BOOST_CHECK_EQUAL(registrar.owner(name), 0); + BOOST_CHECK_EQUAL(registrar.owner(name), h160()); // overbid self m_evmcHost->tx_context.block_timestamp = startTime + m_biddingTime - 10; registrar.setNextValue(12); @@ -446,7 +446,7 @@ BOOST_AUTO_TEST_CASE(auction_bidding) m_evmcHost->tx_context.block_timestamp = startTime + 2 * m_biddingTime - 50; registrar.setNextValue(13); registrar.reserve(name); - BOOST_CHECK_EQUAL(registrar.owner(name), 0); + BOOST_CHECK_EQUAL(registrar.owner(name), h160()); // end auction by first bidder (which is not highest) trying to overbid again (too late) m_sender = account(0); m_evmcHost->tx_context.block_timestamp = startTime + 4 * m_biddingTime; diff --git a/test/contracts/ContractInterface.h b/test/contracts/ContractInterface.h index 1bc1d9e39..e50227670 100644 --- a/test/contracts/ContractInterface.h +++ b/test/contracts/ContractInterface.h @@ -47,12 +47,12 @@ protected: BOOST_CHECK(call(_name + "(string)", u256(0x20), _arg.length(), _arg).empty()); } - void callStringAddress(std::string const& _name, std::string const& _arg1, u160 const& _arg2) + void callStringAddress(std::string const& _name, std::string const& _arg1, util::h160 const& _arg2) { BOOST_CHECK(call(_name + "(string,address)", u256(0x40), _arg2, _arg1.length(), _arg1).empty()); } - void callStringAddressBool(std::string const& _name, std::string const& _arg1, u160 const& _arg2, bool _arg3) + void callStringAddressBool(std::string const& _name, std::string const& _arg1, util::h160 const& _arg2, bool _arg3) { BOOST_CHECK(call(_name + "(string,address,bool)", u256(0x60), _arg2, _arg3, _arg1.length(), _arg1).empty()); } @@ -62,15 +62,16 @@ protected: BOOST_CHECK(call(_name + "(string,bytes32)", u256(0x40), _arg2, _arg1.length(), _arg1).empty()); } - u160 callStringReturnsAddress(std::string const& _name, std::string const& _arg) + util::h160 callStringReturnsAddress(std::string const& _name, std::string const& _arg) { bytes const& ret = call(_name + "(string)", u256(0x20), _arg.length(), _arg); BOOST_REQUIRE(ret.size() == 0x20); BOOST_CHECK(std::count(ret.begin(), ret.begin() + 12, 0) == 12); - return u160(u256(util::h256(ret))); + bytes const addr{ret.begin() + 12, ret.end()}; + return util::h160(addr); } - std::string callAddressReturnsString(std::string const& _name, u160 const& _arg) + std::string callAddressReturnsString(std::string const& _name, util::h160 const& _arg) { bytesConstRef const ret(&call(_name + "(address)", _arg)); BOOST_REQUIRE(ret.size() >= 0x40); diff --git a/test/contracts/FixedFeeRegistrar.cpp b/test/contracts/FixedFeeRegistrar.cpp index f88bb0b6f..3131a6528 100644 --- a/test/contracts/FixedFeeRegistrar.cpp +++ b/test/contracts/FixedFeeRegistrar.cpp @@ -160,11 +160,11 @@ BOOST_AUTO_TEST_CASE(reserve) deployRegistrar(); string name[] = {"abc", "def", "ghi"}; BOOST_REQUIRE(callContractFunctionWithValue("reserve(string)", m_fee, encodeDyn(name[0])) == encodeArgs()); - BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name[0])) == encodeArgs(h256(account(0), h256::AlignRight))); + BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name[0])) == encodeArgs(account(0))); BOOST_REQUIRE(callContractFunctionWithValue("reserve(string)", m_fee + 1, encodeDyn(name[1])) == encodeArgs()); - BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name[1])) == encodeArgs(h256(account(0), h256::AlignRight))); + BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name[1])) == encodeArgs(account(0))); BOOST_REQUIRE(callContractFunctionWithValue("reserve(string)", m_fee - 1, encodeDyn(name[2])) == encodeArgs()); - BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name[2])) == encodeArgs(h256{})); + BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name[2])) == encodeArgs(h160{})); } BOOST_AUTO_TEST_CASE(double_reserve) @@ -173,12 +173,12 @@ BOOST_AUTO_TEST_CASE(double_reserve) deployRegistrar(); string name = "abc"; BOOST_REQUIRE(callContractFunctionWithValue("reserve(string)", m_fee, encodeDyn(name)) == encodeArgs()); - BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name)) == encodeArgs(h256(account(0), h256::AlignRight))); + BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name)) == encodeArgs(account(0))); sendEther(account(1), 100 * ether); m_sender = account(1); BOOST_REQUIRE(callContractFunctionWithValue("reserve(string)", m_fee, encodeDyn(name)) == encodeArgs()); - BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name)) == encodeArgs(h256(account(0), h256::AlignRight))); + BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name)) == encodeArgs(account(0))); } BOOST_AUTO_TEST_CASE(properties) @@ -194,10 +194,10 @@ BOOST_AUTO_TEST_CASE(properties) m_sender = account(0); sendEther(account(count), 100 * ether); m_sender = account(count); - Address owner = m_sender; + h160 owner = m_sender; // setting by sender works BOOST_REQUIRE(callContractFunctionWithValue("reserve(string)", m_fee, encodeDyn(name)) == encodeArgs()); - BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name)) == encodeArgs(h256(owner, h256::AlignRight))); + BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name)) == encodeArgs(owner)); BOOST_CHECK(callContractFunction("setAddr(string,address)", u256(0x40), u256(addr), u256(name.length()), name) == encodeArgs()); BOOST_CHECK(callContractFunction("addr(string)", encodeDyn(name)) == encodeArgs(addr)); BOOST_CHECK(callContractFunction("setSubRegistrar(string,address)", u256(0x40), addr + 20, u256(name.length()), name) == encodeArgs()); @@ -209,7 +209,7 @@ BOOST_AUTO_TEST_CASE(properties) m_sender = account(0); sendEther(account(count), 100 * ether); m_sender = account(count); - BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name)) == encodeArgs(h256(owner, h256::AlignRight))); + BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name)) == encodeArgs(owner)); BOOST_CHECK(callContractFunction("setAddr(string,address)", u256(0x40), addr + 1, u256(name.length()), name) == encodeArgs()); BOOST_CHECK(callContractFunction("addr(string)", encodeDyn(name)) == encodeArgs(addr)); BOOST_CHECK(callContractFunction("setSubRegistrar(string,address)", u256(0x40), addr + 20 + 1, u256(name.length()), name) == encodeArgs()); @@ -225,10 +225,10 @@ BOOST_AUTO_TEST_CASE(transfer) deployRegistrar(); string name = "abc"; BOOST_REQUIRE(callContractFunctionWithValue("reserve(string)", m_fee, encodeDyn(name)) == encodeArgs()); - BOOST_CHECK(callContractFunction("setContent(string,bytes32)", u256(0x40), h256(account(0), h256::AlignRight), u256(name.length()), name) == encodeArgs()); + BOOST_CHECK(callContractFunction("setContent(string,bytes32)", u256(0x40), account(0), u256(name.length()), name) == encodeArgs()); BOOST_CHECK(callContractFunction("transfer(string,address)", u256(0x40), u256(555), u256(name.length()), name) == encodeArgs()); BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name)) == encodeArgs(u256(555))); - BOOST_CHECK(callContractFunction("content(string)", encodeDyn(name)) == encodeArgs(h256(account(0), h256::AlignRight))); + BOOST_CHECK(callContractFunction("content(string)", encodeDyn(name)) == encodeArgs(account(0))); } BOOST_AUTO_TEST_CASE(disown) @@ -236,13 +236,13 @@ BOOST_AUTO_TEST_CASE(disown) deployRegistrar(); string name = "abc"; BOOST_REQUIRE(callContractFunctionWithValue("reserve(string)", m_fee, encodeDyn(name)) == encodeArgs()); - BOOST_CHECK(callContractFunction("setContent(string,bytes32)", u256(0x40), h256(account(0), h256::AlignRight), u256(name.length()), name) == encodeArgs()); + BOOST_CHECK(callContractFunction("setContent(string,bytes32)", u256(0x40), account(0), u256(name.length()), name) == encodeArgs()); BOOST_CHECK(callContractFunction("setAddr(string,address)", u256(0x40), u256(124), u256(name.length()), name) == encodeArgs()); BOOST_CHECK(callContractFunction("setSubRegistrar(string,address)", u256(0x40), u256(125), u256(name.length()), name) == encodeArgs()); - BOOST_CHECK_EQUAL(balanceAt(Address(0x124)), 0); + BOOST_CHECK_EQUAL(balanceAt(h160(0x124)), 0); BOOST_CHECK(callContractFunction("disown(string,address)", u256(0x40), u256(0x124), name.size(), name) == encodeArgs()); - BOOST_CHECK_EQUAL(balanceAt(Address(0x124)), m_fee); + BOOST_CHECK_EQUAL(balanceAt(h160(0x124)), m_fee); BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name)) == encodeArgs(u256(0))); BOOST_CHECK(callContractFunction("content(string)", encodeDyn(name)) == encodeArgs(u256(0))); diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index e3352ac0b..3f92a0534 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -445,7 +445,7 @@ class WalletTestFramework: public SolidityExecutionFramework protected: void deployWallet( u256 const& _value = 0, - vector const& _owners = vector{}, + vector const& _owners = vector{}, u256 _required = 1, u256 _dailyLimit = 0 ) @@ -467,7 +467,7 @@ BOOST_FIXTURE_TEST_SUITE(SolidityWallet, WalletTestFramework) BOOST_AUTO_TEST_CASE(creation) { deployWallet(200); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(m_sender, h256::AlignRight)) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("isOwner(address)", m_sender) == encodeArgs(true)); bool v2 = solidity::test::CommonOptions::get().useABIEncoderV2; BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(~0)) == (v2 ? encodeArgs() : encodeArgs(false))); } @@ -475,34 +475,34 @@ BOOST_AUTO_TEST_CASE(creation) BOOST_AUTO_TEST_CASE(add_owners) { deployWallet(200); - Address originalOwner = m_sender; - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(1), h256::AlignRight)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(account(1), h256::AlignRight)) == encodeArgs(true)); + h160 originalOwner = m_sender; + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(1)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("isOwner(address)", account(1)) == encodeArgs(true)); // now let the new owner add someone sendEther(account(1), 10 * ether); m_sender = account(1); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x13)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x13)) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("addOwner(address)", h160(0x13)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x13)) == encodeArgs(true)); // and check that a non-owner cannot add a new owner m_sender = account(0); sendEther(account(2), 10 * ether); m_sender = account(2); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x20)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x20)) == encodeArgs(false)); + BOOST_REQUIRE(callContractFunction("addOwner(address)", h160(0x20)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x20)) == encodeArgs(false)); // finally check that all the owners are there - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(originalOwner, h256::AlignRight)) == encodeArgs(true)); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(account(1), h256::AlignRight)) == encodeArgs(true)); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x13)) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("isOwner(address)", originalOwner) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("isOwner(address)", account(1)) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x13)) == encodeArgs(true)); } BOOST_AUTO_TEST_CASE(change_owners) { deployWallet(200); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x12)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x12)) == encodeArgs(true)); - BOOST_REQUIRE(callContractFunction("changeOwner(address,address)", h256(0x12), h256(0x13)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x12)) == encodeArgs(false)); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x13)) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("addOwner(address)", h160(0x12)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x12)) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("changeOwner(address,address)", h160(0x12), h160(0x13)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x12)) == encodeArgs(false)); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x13)) == encodeArgs(true)); } BOOST_AUTO_TEST_CASE(remove_owner) @@ -511,43 +511,43 @@ BOOST_AUTO_TEST_CASE(remove_owner) // add 10 owners for (unsigned i = 0; i < 10; ++i) { - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x12 + i)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x12 + i)) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("addOwner(address)", h160(0x12 + i)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x12 + i)) == encodeArgs(true)); } // check they are there again for (unsigned i = 0; i < 10; ++i) - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x12 + i)) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x12 + i)) == encodeArgs(true)); // remove the odd owners for (unsigned i = 0; i < 10; ++i) if (i % 2 == 1) - BOOST_REQUIRE(callContractFunction("removeOwner(address)", h256(0x12 + i)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("removeOwner(address)", h160(0x12 + i)) == encodeArgs()); // check the result for (unsigned i = 0; i < 10; ++i) - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x12 + i)) == encodeArgs(i % 2 == 0)); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x12 + i)) == encodeArgs(i % 2 == 0)); // add them again for (unsigned i = 0; i < 10; ++i) if (i % 2 == 1) - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x12 + i)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", h160(0x12 + i)) == encodeArgs()); // check everyone is there for (unsigned i = 0; i < 10; ++i) - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x12 + i)) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x12 + i)) == encodeArgs(true)); } BOOST_AUTO_TEST_CASE(initial_owners) { - vector owners{ - u256("0x00000000000000000000000042c56279432962a17176998a4747d1b4d6ed4367"), - u256("0x000000000000000000000000d4d4669f5ba9f4c27d38ef02a358c339b5560c47"), - u256("0x000000000000000000000000e6716f9544a56c530d868e4bfbacb172315bdead"), - u256("0x000000000000000000000000775e18be7a50a0abb8a4e82b1bd697d79f31fe04"), - u256("0x000000000000000000000000f4dd5c3794f1fd0cdc0327a83aa472609c806e99"), - u256("0x0000000000000000000000004c9113886af165b2de069d6e99430647e94a9fff"), - u256("0x0000000000000000000000003fb1cd2cd96c6d5c0b5eb3322d807b34482481d4") + vector owners{ + h160("0x42c56279432962a17176998a4747d1b4d6ed4367"), + h160("0xd4d4669f5ba9f4c27d38ef02a358c339b5560c47"), + h160("0xe6716f9544a56c530d868e4bfbacb172315bdead"), + h160("0x775e18be7a50a0abb8a4e82b1bd697d79f31fe04"), + h160("0xf4dd5c3794f1fd0cdc0327a83aa472609c806e99"), + h160("0x4c9113886af165b2de069d6e99430647e94a9fff"), + h160("0x3fb1cd2cd96c6d5c0b5eb3322d807b34482481d4") }; deployWallet(0, owners, 4, 2); BOOST_CHECK(callContractFunction("m_numOwners()") == encodeArgs(u256(8))); - BOOST_CHECK(callContractFunction("isOwner(address)", h256(m_sender, h256::AlignRight)) == encodeArgs(true)); - for (u256 const& owner: owners) + BOOST_CHECK(callContractFunction("isOwner(address)", m_sender) == encodeArgs(true)); + for (h160 const& owner: owners) { BOOST_CHECK(callContractFunction("isOwner(address)", owner) == encodeArgs(true)); } @@ -556,17 +556,17 @@ BOOST_AUTO_TEST_CASE(initial_owners) BOOST_AUTO_TEST_CASE(multisig_value_transfer) { deployWallet(200); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(1), h256::AlignRight)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(2), h256::AlignRight)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(3), h256::AlignRight)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(1)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(2)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(3)) == encodeArgs()); // 4 owners, set required to 3 BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs()); - Address destination = Address("0x5c6d6026d3fb35cd7175fd0054ae8df50d8f8b41"); + h160 destination = h160("0x5c6d6026d3fb35cd7175fd0054ae8df50d8f8b41"); BOOST_CHECK_EQUAL(balanceAt(destination), 0); m_sender = account(0); sendEther(account(1), 10 * ether); m_sender = account(1); - auto ophash = callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 100, 0x60, 0x00); + auto ophash = callContractFunction("execute(address,uint256,bytes)", destination, 100, 0x60, 0x00); BOOST_CHECK_EQUAL(balanceAt(destination), 0); m_sender = account(0); sendEther(account(2), 10 * ether); @@ -584,52 +584,52 @@ BOOST_AUTO_TEST_CASE(multisig_value_transfer) BOOST_AUTO_TEST_CASE(revoke_addOwner) { deployWallet(); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(1), h256::AlignRight)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(2), h256::AlignRight)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(3), h256::AlignRight)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(1)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(2)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(3)) == encodeArgs()); // 4 owners, set required to 3 BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs()); // add a new owner - Address deployer = m_sender; + h160 deployer = m_sender; h256 opHash = util::keccak256(FixedHash<4>(util::keccak256("addOwner(address)")).asBytes() + h256(0x33).asBytes()); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x33)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x33)) == encodeArgs(false)); + BOOST_REQUIRE(callContractFunction("addOwner(address)", h160(0x33)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x33)) == encodeArgs(false)); m_sender = account(0); sendEther(account(1), 10 * ether); m_sender = account(1); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x33)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x33)) == encodeArgs(false)); + BOOST_REQUIRE(callContractFunction("addOwner(address)", h160(0x33)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x33)) == encodeArgs(false)); // revoke one confirmation m_sender = deployer; BOOST_REQUIRE(callContractFunction("revoke(bytes32)", opHash) == encodeArgs()); m_sender = account(0); sendEther(account(2), 10 * ether); m_sender = account(2); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x33)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x33)) == encodeArgs(false)); + BOOST_REQUIRE(callContractFunction("addOwner(address)", h160(0x33)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x33)) == encodeArgs(false)); m_sender = account(0); sendEther(account(3), 10 * ether); m_sender = account(3); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x33)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x33)) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("addOwner(address)", h160(0x33)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("isOwner(address)", h160(0x33)) == encodeArgs(true)); } BOOST_AUTO_TEST_CASE(revoke_transaction) { deployWallet(200); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(1), h256::AlignRight)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(2), h256::AlignRight)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(3), h256::AlignRight)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(1)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(2)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(3)) == encodeArgs()); // 4 owners, set required to 3 BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs()); // create a transaction - Address deployer = m_sender; - Address destination = Address("0x5c6d6026d3fb35cd7175fd0054ae8df50d8f8b41"); + h160 deployer = m_sender; + h160 destination = h160("0x5c6d6026d3fb35cd7175fd0054ae8df50d8f8b41"); BOOST_CHECK_EQUAL(balanceAt(destination), 0); m_sender = account(0); sendEther(account(1), 10 * ether); m_sender = account(1); - auto opHash = callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 100, 0x60, 0x00); + auto opHash = callContractFunction("execute(address,uint256,bytes)", destination, 100, 0x60, 0x00); BOOST_CHECK_EQUAL(balanceAt(destination), 0); m_sender = account(0); sendEther(account(2), 10 * ether); @@ -655,21 +655,21 @@ BOOST_AUTO_TEST_CASE(daylimit) { deployWallet(200); BOOST_REQUIRE(callContractFunction("m_dailyLimit()") == encodeArgs(u256(0))); - BOOST_REQUIRE(callContractFunction("setDailyLimit(uint256)", h256(100)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("setDailyLimit(uint256)", u256(100)) == encodeArgs()); BOOST_REQUIRE(callContractFunction("m_dailyLimit()") == encodeArgs(u256(100))); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(1), h256::AlignRight)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(2), h256::AlignRight)) == encodeArgs()); - BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(account(3), h256::AlignRight)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(1)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(2)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("addOwner(address)", account(3)) == encodeArgs()); // 4 owners, set required to 3 BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs()); // try to send tx over daylimit - Address destination = Address("0x5c6d6026d3fb35cd7175fd0054ae8df50d8f8b41"); + h160 destination = h160("0x5c6d6026d3fb35cd7175fd0054ae8df50d8f8b41"); BOOST_CHECK_EQUAL(balanceAt(destination), 0); sendEther(account(1), 10 * ether); m_sender = account(1); BOOST_REQUIRE( - callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 150, 0x60, 0x00) != + callContractFunction("execute(address,uint256,bytes)", destination, 150, 0x60, 0x00) != encodeArgs(u256(0)) ); BOOST_CHECK_EQUAL(balanceAt(destination), 0); @@ -678,7 +678,7 @@ BOOST_AUTO_TEST_CASE(daylimit) sendEther(account(4), 10 * ether); m_sender = account(4); BOOST_REQUIRE( - callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 90, 0x60, 0x00) == + callContractFunction("execute(address,uint256,bytes)", destination, 90, 0x60, 0x00) == encodeArgs(u256(0)) ); BOOST_CHECK_EQUAL(balanceAt(destination), 0); @@ -686,7 +686,7 @@ BOOST_AUTO_TEST_CASE(daylimit) m_sender = account(0); sendEther(account(1), 10 * ether); BOOST_REQUIRE( - callContractFunction("execute(address,uint256,bytes)", h256(destination, h256::AlignRight), 90, 0x60, 0x00) == + callContractFunction("execute(address,uint256,bytes)", destination, 90, 0x60, 0x00) == encodeArgs(u256(0)) ); BOOST_CHECK_EQUAL(balanceAt(destination), 90); @@ -696,7 +696,7 @@ BOOST_AUTO_TEST_CASE(daylimit_constructor) { deployWallet(200, {}, 1, 20); BOOST_REQUIRE(callContractFunction("m_dailyLimit()") == encodeArgs(u256(20))); - BOOST_REQUIRE(callContractFunction("setDailyLimit(uint256)", h256(30)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("setDailyLimit(uint256)", u256(30)) == encodeArgs()); BOOST_REQUIRE(callContractFunction("m_dailyLimit()") == encodeArgs(u256(30))); } diff --git a/test/libsolidity/ABIDecoderTests.cpp b/test/libsolidity/ABIDecoderTests.cpp index d7c164a46..8a885f39e 100644 --- a/test/libsolidity/ABIDecoderTests.cpp +++ b/test/libsolidity/ABIDecoderTests.cpp @@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(value_types) compileAndRun(sourceCode); ABI_CHECK(callContractFunction( "f(uint256,uint16,uint24,int24,bytes3,bool,address)", - 1, 2, 3, 4, string("abc"), true, u160(m_contractAddress) + 1, 2, 3, 4, string("abc"), true, m_contractAddress ), encodeArgs(u256(20))); ) } @@ -408,7 +408,7 @@ BOOST_AUTO_TEST_CASE(complex_struct) 0x40, 0x100, // S s1[0] - u256(u160(m_contractAddress)), + m_contractAddress, 0x40, // T s1[0].t 1, // length @@ -431,7 +431,7 @@ BOOST_AUTO_TEST_CASE(complex_struct) 0x21, 2, 0x22, 0, 0, 0 ); - ABI_CHECK(callContractFunction(sig, args), encodeArgs(7, u256(u160(m_contractAddress)), 8, 2, 0x1234, 3, 2, 0x22)); + ABI_CHECK(callContractFunction(sig, args), encodeArgs(7, m_contractAddress, 8, 2, 0x1234, 3, 2, 0x22)); // invalid enum value args.data()[0x20 * 28] = 3; ABI_CHECK(callContractFunction(sig, args), encodeArgs()); diff --git a/test/libsolidity/ABIEncoderTests.cpp b/test/libsolidity/ABIEncoderTests.cpp index 6c614e75b..3fca9d29f 100644 --- a/test/libsolidity/ABIEncoderTests.cpp +++ b/test/libsolidity/ABIEncoderTests.cpp @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(value_types) compileAndRun(sourceCode); callContractFunction("f()"); REQUIRE_LOG_DATA(encodeArgs( - 10, u256(65534), u256(0x121212), u256(-1), string("\x1b\xab\xab"), true, u160(u256(-5)) + 10, u256(65534), u256(0x121212), u256(-1), string("\x1b\xab\xab"), true, h160("fffffffffffffffffffffffffffffffffffffffb") )); ) } @@ -273,7 +273,11 @@ BOOST_AUTO_TEST_CASE(storage_array) BOTH_ENCODERS( compileAndRun(sourceCode); callContractFunction("f()"); - REQUIRE_LOG_DATA(encodeArgs(u160(-1), u160(-2), u160(-3))); + REQUIRE_LOG_DATA(encodeArgs( + h160("ffffffffffffffffffffffffffffffffffffffff"), + h160("fffffffffffffffffffffffffffffffffffffffe"), + h160("fffffffffffffffffffffffffffffffffffffffd") + )); ) } @@ -294,7 +298,13 @@ BOOST_AUTO_TEST_CASE(storage_array_dyn) BOTH_ENCODERS( compileAndRun(sourceCode); callContractFunction("f()"); - REQUIRE_LOG_DATA(encodeArgs(0x20, 3, u160(1), u160(2), u160(3))); + REQUIRE_LOG_DATA(encodeArgs( + 0x20, + 3, + h160("0000000000000000000000000000000000000001"), + h160("0000000000000000000000000000000000000002"), + h160("0000000000000000000000000000000000000003") + )); ) } @@ -488,7 +498,7 @@ BOOST_AUTO_TEST_CASE(structs2) 0x40, 0x100, // S s1[0] - u256(u160(m_contractAddress)), + m_contractAddress, 0x40, // T s1[0].t 1, // length diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 293f53cfe..ac7f4d454 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -825,7 +825,7 @@ BOOST_AUTO_TEST_CASE(blockchain) } } )"; - m_evmcHost->tx_context.block_coinbase = EVMHost::convertToEVMC(Address("0x1212121212121212121212121212121212121212")); + m_evmcHost->tx_context.block_coinbase = EVMHost::convertToEVMC(h160("0x1212121212121212121212121212121212121212")); m_evmcHost->newBlock(); m_evmcHost->newBlock(); m_evmcHost->newBlock(); @@ -851,7 +851,7 @@ BOOST_AUTO_TEST_CASE(send_ether) u256 amount(250); compileAndRun(sourceCode, amount + 1); - u160 address(23); + h160 address(23); ABI_CHECK(callContractFunction("a(address,uint256)", address, amount), encodeArgs(1)); BOOST_CHECK_EQUAL(balanceAt(address), amount); ) @@ -884,11 +884,11 @@ BOOST_AUTO_TEST_CASE(transfer_ether) DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "B"); - u160 const nonPayableRecipient = m_contractAddress; + h160 const nonPayableRecipient = m_contractAddress; compileAndRun(sourceCode, 0, "C"); - u160 const oogRecipient = m_contractAddress; + h160 const oogRecipient = m_contractAddress; compileAndRun(sourceCode, 20, "A"); - u160 payableRecipient(23); + h160 payableRecipient(23); ABI_CHECK(callContractFunction("a(address,uint256)", payableRecipient, 10), encodeArgs(10)); BOOST_CHECK_EQUAL(balanceAt(payableRecipient), 10); BOOST_CHECK_EQUAL(balanceAt(m_contractAddress), 10); @@ -1061,7 +1061,7 @@ BOOST_AUTO_TEST_CASE(selfdestruct) } )"; u256 amount(130); - u160 address(23); + h160 address(23); ALSO_VIA_YUL( DISABLE_EWASM_TESTRUN() @@ -1290,7 +1290,7 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls) } )"; compileAndRun(sourceCode, 0, "Helper"); - u160 const c_helperAddress = m_contractAddress; + h160 const c_helperAddress = m_contractAddress; compileAndRun(sourceCode, 0, "Main"); BOOST_REQUIRE(callContractFunction("setHelper(address)", c_helperAddress) == bytes()); BOOST_REQUIRE(callContractFunction("getHelper()", c_helperAddress) == encodeArgs(c_helperAddress)); @@ -1321,7 +1321,7 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls_with_complex_parameters) } )"; compileAndRun(sourceCode, 0, "Helper"); - u160 const c_helperAddress = m_contractAddress; + h160 const c_helperAddress = m_contractAddress; compileAndRun(sourceCode, 0, "Main"); BOOST_REQUIRE(callContractFunction("setHelper(address)", c_helperAddress) == bytes()); BOOST_REQUIRE(callContractFunction("getHelper()", c_helperAddress) == encodeArgs(c_helperAddress)); @@ -1353,7 +1353,7 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls_accessing_this) } )"; compileAndRun(sourceCode, 0, "Helper"); - u160 const c_helperAddress = m_contractAddress; + h160 const c_helperAddress = m_contractAddress; compileAndRun(sourceCode, 0, "Main"); BOOST_REQUIRE(callContractFunction("setHelper(address)", c_helperAddress) == bytes()); BOOST_REQUIRE(callContractFunction("getHelper()", c_helperAddress) == encodeArgs(c_helperAddress)); @@ -1385,7 +1385,7 @@ BOOST_AUTO_TEST_CASE(calls_to_this) } )"; compileAndRun(sourceCode, 0, "Helper"); - u160 const c_helperAddress = m_contractAddress; + h160 const c_helperAddress = m_contractAddress; compileAndRun(sourceCode, 0, "Main"); BOOST_REQUIRE(callContractFunction("setHelper(address)", c_helperAddress) == bytes()); BOOST_REQUIRE(callContractFunction("getHelper()", c_helperAddress) == encodeArgs(c_helperAddress)); @@ -1420,7 +1420,7 @@ BOOST_AUTO_TEST_CASE(inter_contract_calls_with_local_vars) } )"; compileAndRun(sourceCode, 0, "Helper"); - u160 const c_helperAddress = m_contractAddress; + h160 const c_helperAddress = m_contractAddress; compileAndRun(sourceCode, 0, "Main"); BOOST_REQUIRE(callContractFunction("setHelper(address)", c_helperAddress) == bytes()); BOOST_REQUIRE(callContractFunction("getHelper()", c_helperAddress) == encodeArgs(c_helperAddress)); @@ -1451,7 +1451,7 @@ BOOST_AUTO_TEST_CASE(fixed_bytes_in_calls) } )"; compileAndRun(sourceCode, 0, "Helper"); - u160 const c_helperAddress = m_contractAddress; + h160 const c_helperAddress = m_contractAddress; compileAndRun(sourceCode, 0, "Main"); BOOST_REQUIRE(callContractFunction("setHelper(address)", c_helperAddress) == bytes()); BOOST_REQUIRE(callContractFunction("getHelper()", c_helperAddress) == encodeArgs(c_helperAddress)); @@ -1749,7 +1749,7 @@ BOOST_AUTO_TEST_CASE(events_with_same_name) } } )"; - u160 const c_loggedAddress = m_contractAddress; + h160 const c_loggedAddress = m_contractAddress; ALSO_VIA_YUL( DISABLE_EWASM_TESTRUN() @@ -1812,7 +1812,7 @@ BOOST_AUTO_TEST_CASE(events_with_same_name_inherited_emit) } } )"; - u160 const c_loggedAddress = m_contractAddress; + h160 const c_loggedAddress = m_contractAddress; ALSO_VIA_YUL( DISABLE_EWASM_TESTRUN() @@ -1907,7 +1907,7 @@ BOOST_AUTO_TEST_CASE(event_lots_of_data) callContractFunctionWithValue("deposit(bytes32)", value, id); BOOST_REQUIRE_EQUAL(numLogs(), 1); BOOST_CHECK_EQUAL(logAddress(0), m_contractAddress); - BOOST_CHECK(logData(0) == encodeArgs((u160)m_sender, id, value, true)); + BOOST_CHECK(logData(0) == encodeArgs(m_sender, id, value, true)); BOOST_REQUIRE_EQUAL(numLogTopics(0), 1); BOOST_CHECK_EQUAL(logTopic(0, 0), util::keccak256(string("Deposit(address,bytes32,uint256,bool)"))); ) @@ -2300,7 +2300,7 @@ BOOST_AUTO_TEST_CASE(generic_call) } )**"; compileAndRun(sourceCode, 0, "receiver"); - u160 const c_receiverAddress = m_contractAddress; + h160 const c_receiverAddress = m_contractAddress; compileAndRun(sourceCode, 50, "sender"); BOOST_REQUIRE(callContractFunction("doSend(address)", c_receiverAddress) == encodeArgs(23)); BOOST_CHECK_EQUAL(balanceAt(m_contractAddress), 50 - 2); @@ -2335,13 +2335,13 @@ BOOST_AUTO_TEST_CASE(generic_delegatecall) string source = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n" + string(sourceCode); compileAndRun(source, 0, "Receiver"); - u160 const c_receiverAddress = m_contractAddress; + h160 const c_receiverAddress = m_contractAddress; compileAndRun(source, 50, "Sender"); - u160 const c_senderAddress = m_contractAddress; + h160 const c_senderAddress = m_contractAddress; BOOST_CHECK(m_sender != c_senderAddress); // just for sanity ABI_CHECK(callContractFunctionWithValue("doSend(address)", 11, c_receiverAddress), encodeArgs()); ABI_CHECK(callContractFunction("received()"), encodeArgs(u256(23))); - ABI_CHECK(callContractFunction("sender()"), encodeArgs(u160(m_sender))); + ABI_CHECK(callContractFunction("sender()"), encodeArgs(m_sender)); ABI_CHECK(callContractFunction("value()"), encodeArgs(u256(11))); m_contractAddress = c_receiverAddress; ABI_CHECK(callContractFunction("received()"), encodeArgs(u256(0))); @@ -2387,7 +2387,7 @@ BOOST_AUTO_TEST_CASE(generic_staticcall) } )**"; compileAndRun(sourceCode, 0, "A"); - u160 const c_addressA = m_contractAddress; + h160 const c_addressA = m_contractAddress; compileAndRun(sourceCode, 0, "C"); ABI_CHECK(callContractFunction("f(address)", c_addressA), encodeArgs(true, 0x40, 0x20, 23)); ABI_CHECK(callContractFunction("g(address)", c_addressA), encodeArgs(true, 0x40, 0x20, 23 + 42)); @@ -2409,9 +2409,9 @@ BOOST_AUTO_TEST_CASE(library_call_in_homestead) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs()); - ABI_CHECK(callContractFunction("sender()"), encodeArgs(u160(m_sender))); + ABI_CHECK(callContractFunction("sender()"), encodeArgs(m_sender)); } BOOST_AUTO_TEST_CASE(library_call_protection) @@ -2437,13 +2437,13 @@ BOOST_AUTO_TEST_CASE(library_call_protection) )"; compileAndRun(sourceCode, 0, "Lib"); ABI_CHECK(callContractFunction("np(Lib.S storage)", 0), encodeArgs()); - ABI_CHECK(callContractFunction("v(Lib.S storage)", 0), encodeArgs(u160(m_sender))); + ABI_CHECK(callContractFunction("v(Lib.S storage)", 0), encodeArgs(m_sender)); ABI_CHECK(callContractFunction("pu()"), encodeArgs(2)); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("s()"), encodeArgs(0)); - ABI_CHECK(callContractFunction("np()"), encodeArgs(u160(m_sender))); + ABI_CHECK(callContractFunction("np()"), encodeArgs(m_sender)); ABI_CHECK(callContractFunction("s()"), encodeArgs(3)); - ABI_CHECK(callContractFunction("v()"), encodeArgs(u160(m_sender))); + ABI_CHECK(callContractFunction("v()"), encodeArgs(m_sender)); ABI_CHECK(callContractFunction("pu()"), encodeArgs(2)); } @@ -2467,7 +2467,7 @@ BOOST_AUTO_TEST_CASE(library_staticcall_delegatecall) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs(1)); } @@ -2709,7 +2709,7 @@ BOOST_AUTO_TEST_CASE(struct_referencing) compileAndRun(sourceCode, 0, "L"); ABI_CHECK(callContractFunction("f()"), encodeArgs(0, 3)); ABI_CHECK(callContractFunction("g()"), encodeArgs(4)); - compileAndRun(sourceCode, 0, "C", bytes(), map{ {"L", m_contractAddress}}); + compileAndRun(sourceCode, 0, "C", bytes(), map{ {"L", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs(1)); ABI_CHECK(callContractFunction("g()"), encodeArgs(2)); ABI_CHECK(callContractFunction("h()"), encodeArgs(0, 5)); @@ -2755,7 +2755,7 @@ BOOST_AUTO_TEST_CASE(enum_referencing) compileAndRun(sourceCode, 0, "L"); ABI_CHECK(callContractFunction("f()"), encodeArgs(1)); ABI_CHECK(callContractFunction("g()"), encodeArgs(3)); - compileAndRun(sourceCode, 0, "C", bytes(), map{{"L", m_contractAddress}}); + compileAndRun(sourceCode, 0, "C", bytes(), map{{"L", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs(3)); ABI_CHECK(callContractFunction("g()"), encodeArgs(3)); ABI_CHECK(callContractFunction("h()"), encodeArgs(1)); @@ -2982,7 +2982,7 @@ BOOST_AUTO_TEST_CASE(failing_send) } )"; compileAndRun(sourceCode, 0, "Helper"); - u160 const c_helperAddress = m_contractAddress; + h160 const c_helperAddress = m_contractAddress; compileAndRun(sourceCode, 20, "Main"); BOOST_REQUIRE(callContractFunction("callHelper(address)", c_helperAddress) == encodeArgs(true, 20)); } @@ -3587,7 +3587,7 @@ BOOST_AUTO_TEST_CASE(library_call) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f(uint256)", u256(33)), encodeArgs(u256(33) * 9)); } @@ -3602,7 +3602,7 @@ BOOST_AUTO_TEST_CASE(library_function_external) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f(bytes)", u256(0x20), u256(5), "abcde"), encodeArgs("c")); } @@ -3619,7 +3619,7 @@ BOOST_AUTO_TEST_CASE(library_stray_values) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f(uint256)", u256(33)), encodeArgs(u256(42))); } @@ -3649,7 +3649,7 @@ BOOST_AUTO_TEST_CASE(internal_types_in_library) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(4), u256(17))); } @@ -3680,7 +3680,7 @@ BOOST_AUTO_TEST_CASE(mapping_arguments_in_library) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("set(uint256,uint256)", u256(1), u256(42)), encodeArgs(u256(0))); ABI_CHECK(callContractFunction("set(uint256,uint256)", u256(2), u256(84)), encodeArgs(u256(0))); ABI_CHECK(callContractFunction("set(uint256,uint256)", u256(21), u256(7)), encodeArgs(u256(0))); @@ -3728,7 +3728,7 @@ BOOST_AUTO_TEST_CASE(mapping_returns_in_library) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("set(bool,uint256,uint256)", true, u256(1), u256(42)), encodeArgs(u256(0))); ABI_CHECK(callContractFunction("set(bool,uint256,uint256)", true, u256(2), u256(84)), encodeArgs(u256(0))); ABI_CHECK(callContractFunction("set(bool,uint256,uint256)", true, u256(21), u256(7)), encodeArgs(u256(0))); @@ -3804,7 +3804,7 @@ BOOST_AUTO_TEST_CASE(mapping_returns_in_library_named) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(0), u256(42), u256(0), u256(0), u256(21), u256(84))); ABI_CHECK(callContractFunction("g()"), encodeArgs(u256(0), u256(42), u256(0), u256(0), u256(21), u256(17))); } @@ -3832,7 +3832,7 @@ BOOST_AUTO_TEST_CASE(using_library_mappings_public) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(1), u256(0), u256(42), u256(23), u256(0), u256(99))); } @@ -3867,7 +3867,7 @@ BOOST_AUTO_TEST_CASE(using_library_mappings_external) { string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n"; compileAndRun(prefix + libSourceCode, 0, "Lib"); - compileAndRun(prefix + sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(prefix + sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(2), u256(0), u256(84), u256(46), u256(0), u256(198))); } } @@ -3893,7 +3893,7 @@ BOOST_AUTO_TEST_CASE(using_library_mappings_return) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(1), u256(0), u256(42), u256(23), u256(0), u256(99))); } @@ -3921,7 +3921,7 @@ BOOST_AUTO_TEST_CASE(using_library_structs) } )"; compileAndRun(sourceCode, 0, "Lib"); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(7), u256(8))); } @@ -4079,10 +4079,10 @@ BOOST_AUTO_TEST_CASE(reject_ether_sent_to_library) compileAndRun(sourceCode, 10, "c"); BOOST_CHECK_EQUAL(balanceAt(m_contractAddress), 10); BOOST_CHECK_EQUAL(balanceAt(libraryAddress), 0); - ABI_CHECK(callContractFunction("f(address)", encodeArgs(u160(libraryAddress))), encodeArgs(false)); + ABI_CHECK(callContractFunction("f(address)", encodeArgs(libraryAddress)), encodeArgs(false)); BOOST_CHECK_EQUAL(balanceAt(m_contractAddress), 10); BOOST_CHECK_EQUAL(balanceAt(libraryAddress), 0); - ABI_CHECK(callContractFunction("f(address)", encodeArgs(u160(m_contractAddress))), encodeArgs(true)); + ABI_CHECK(callContractFunction("f(address)", encodeArgs(m_contractAddress)), encodeArgs(true)); BOOST_CHECK_EQUAL(balanceAt(m_contractAddress), 10); BOOST_CHECK_EQUAL(balanceAt(libraryAddress), 0); } @@ -4126,7 +4126,7 @@ BOOST_AUTO_TEST_CASE(using_for_function_on_int) } )"; compileAndRun(sourceCode, 0, "D"); - compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); + compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); ABI_CHECK(callContractFunction("f(uint256)", u256(9)), encodeArgs(u256(2 * 9))); } @@ -4144,7 +4144,7 @@ BOOST_AUTO_TEST_CASE(using_for_function_on_struct) } )"; compileAndRun(sourceCode, 0, "D"); - compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); + compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); ABI_CHECK(callContractFunction("f(uint256)", u256(7)), encodeArgs(u256(3 * 7))); ABI_CHECK(callContractFunction("x()"), encodeArgs(u256(3 * 7))); } @@ -4167,7 +4167,7 @@ BOOST_AUTO_TEST_CASE(using_for_overload) } )"; compileAndRun(sourceCode, 0, "D"); - compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); + compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); ABI_CHECK(callContractFunction("f(uint256)", u256(7)), encodeArgs(u256(6 * 7))); ABI_CHECK(callContractFunction("x()"), encodeArgs(u256(6 * 7))); } @@ -4186,7 +4186,7 @@ BOOST_AUTO_TEST_CASE(using_for_by_name) } )"; compileAndRun(sourceCode, 0, "D"); - compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); + compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); ABI_CHECK(callContractFunction("f(uint256)", u256(7)), encodeArgs(u256(6 * 7))); ABI_CHECK(callContractFunction("x()"), encodeArgs(u256(6 * 7))); } @@ -4206,7 +4206,7 @@ BOOST_AUTO_TEST_CASE(bound_function_in_function) } )"; compileAndRun(sourceCode, 0, "L"); - compileAndRun(sourceCode, 0, "C", bytes(), map{{"L", m_contractAddress}}); + compileAndRun(sourceCode, 0, "C", bytes(), map{{"L", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(7))); } @@ -4224,7 +4224,7 @@ BOOST_AUTO_TEST_CASE(bound_function_in_var) } )"; compileAndRun(sourceCode, 0, "D"); - compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); + compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); ABI_CHECK(callContractFunction("f(uint256)", u256(7)), encodeArgs(u256(6 * 7))); ABI_CHECK(callContractFunction("x()"), encodeArgs(u256(6 * 7))); } @@ -4247,7 +4247,7 @@ BOOST_AUTO_TEST_CASE(bound_function_to_string) } )"; compileAndRun(sourceCode, 0, "D"); - compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); + compileAndRun(sourceCode, 0, "C", bytes(), map{{"D", m_contractAddress}}); ABI_CHECK(callContractFunction("f()"), encodeArgs(u256(3))); ABI_CHECK(callContractFunction("g()"), encodeArgs(u256(3))); } @@ -4399,9 +4399,9 @@ BOOST_AUTO_TEST_CASE(mutex) } )"; compileAndRun(sourceCode, 500, "Fund"); - auto fund = m_contractAddress; + h160 const fund = m_contractAddress; BOOST_CHECK_EQUAL(balanceAt(fund), 500); - compileAndRun(sourceCode, 0, "Attacker", encodeArgs(u160(fund))); + compileAndRun(sourceCode, 0, "Attacker", encodeArgs(fund)); ABI_CHECK(callContractFunction("setProtected(bool)", true), encodeArgs()); ABI_CHECK(callContractFunction("attack()"), encodeArgs()); BOOST_CHECK_EQUAL(balanceAt(fund), 500); @@ -4445,7 +4445,7 @@ BOOST_AUTO_TEST_CASE(payable_function_calls_library) } )"; compileAndRun(sourceCode, 0, "L"); - compileAndRun(sourceCode, 0, "C", bytes(), map{{"L", m_contractAddress}}); + compileAndRun(sourceCode, 0, "C", bytes(), map{{"L", m_contractAddress}}); ABI_CHECK(callContractFunctionWithValue("f()", 27), encodeArgs(u256(7))); } @@ -4497,7 +4497,7 @@ BOOST_AUTO_TEST_CASE(mem_resize_is_not_paid_at_call) )"; compileAndRun(sourceCode, 0, "C"); - u160 cAddr = m_contractAddress; + h160 const cAddr = m_contractAddress; compileAndRun(sourceCode, 0, "D"); ABI_CHECK(callContractFunction("f(address)", cAddr), encodeArgs(u256(7))); } @@ -4911,7 +4911,7 @@ BOOST_AUTO_TEST_CASE(interface_contract) } )"; compileAndRun(sourceCode, 0, "A"); - u160 const recipient = m_contractAddress; + h160 const recipient = m_contractAddress; compileAndRun(sourceCode, 0, "C"); ABI_CHECK(callContractFunction("f(address)", recipient), encodeArgs(true)); } @@ -5730,7 +5730,7 @@ BOOST_AUTO_TEST_CASE(event_wrong_abi_name) } )"; compileAndRun(sourceCode, 0, "ClientReceipt", bytes()); - compileAndRun(sourceCode, 0, "Test", bytes(), map{{"ClientReceipt", m_contractAddress}}); + compileAndRun(sourceCode, 0, "Test", bytes(), map{{"ClientReceipt", m_contractAddress}}); callContractFunction("f()"); BOOST_REQUIRE_EQUAL(numLogs(), 1); diff --git a/test/libsolidity/SolidityOptimizer.cpp b/test/libsolidity/SolidityOptimizer.cpp index 89960186d..247ffd454 100644 --- a/test/libsolidity/SolidityOptimizer.cpp +++ b/test/libsolidity/SolidityOptimizer.cpp @@ -119,8 +119,8 @@ protected: u256 m_gasUsedNonOptimized; bytes m_nonOptimizedBytecode; bytes m_optimizedBytecode; - Address m_optimizedContract; - Address m_nonOptimizedContract; + h160 m_optimizedContract; + h160 m_nonOptimizedContract; }; BOOST_FIXTURE_TEST_SUITE(SolidityOptimizer, OptimizerTestFramework)