Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .circleci/soltest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#
# EVM=version_string Specifies EVM version to compile for (such as homestead, etc)
# OPTIMIZE=1 Enables backend optimizer
# ABI_ENCODER_V1=1 Forcibly enables ABI coder version 1
# SOLTEST_FLAGS=<flags> Appends <flags> to default SOLTEST_ARGS
#
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -54,7 +53,6 @@ get_logfile_basename() {
local run="$1"
local filename="${EVM}"
test "${OPTIMIZE}" = "1" && filename="${filename}_opt"
test "${ABI_ENCODER_V1}" = "1" && filename="${filename}_abiv1"
filename="${filename}_${run}"

echo -ne "${filename}"
Expand All @@ -81,7 +79,6 @@ do
SOLTEST_ARGS=("--evm-version=$EVM" "${SOLTEST_FLAGS[@]}")

test "${OPTIMIZE}" = "1" && SOLTEST_ARGS+=(--optimize)
test "${ABI_ENCODER_V1}" = "1" && SOLTEST_ARGS+=(--abiencoderv1)

BATCH_ARGS=("--batches" "$((CPUs * CIRCLE_NODE_TOTAL))" "--selected-batch" "$((CPUs * CIRCLE_NODE_INDEX + run))")

Expand Down
14 changes: 6 additions & 8 deletions .circleci/soltest_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ IFS=" " read -ra EVM_VALUES <<< "${1:-${DEFAULT_EVM_VALUES[@]}}"
DEFAULT_EVM=osaka
OPTIMIZE_VALUES=(0 1)

# Run for ABI encoder v1, without SMTChecker tests.
EVM="${DEFAULT_EVM}" \
OPTIMIZE=1 \
ABI_ENCODER_V1=1 \
BOOST_TEST_ARGS="-t !smtCheckerTests" \
"${REPODIR}/.circleci/soltest.sh"

# We shift the batch index so that long-running tests
# do not always run in the same executor for all EVM versions
INDEX_SHIFT=0
Expand All @@ -72,11 +65,16 @@ do
# Run SMTChecker tests only when OPTIMIZE == 0
DISABLE_SMTCHECKER=""
[ "${OPTIMIZE}" != "0" ] && DISABLE_SMTCHECKER="-t !smtCheckerTests"
# Tests that do not depend on any options, such as the Keccak256 suite, are ran only
# once on the first iteration of this loop as they produce deterministic results regardless
# of the EVM version, or any other inputs.
DISABLE_NOOPTIONS=""
[ "${INDEX_SHIFT}" != "0" ] && DISABLE_NOOPTIONS="-t !@nooptions"

EVM="$EVM" \
OPTIMIZE="$OPTIMIZE" \
SOLTEST_FLAGS="$SOLTEST_FLAGS $ENFORCE_GAS_ARGS" \
BOOST_TEST_ARGS="-t !@nooptions $DISABLE_SMTCHECKER" \
BOOST_TEST_ARGS="$DISABLE_NOOPTIONS $DISABLE_SMTCHECKER" \
INDEX_SHIFT="$INDEX_SHIFT" \
"${REPODIR}/.circleci/soltest.sh"

Expand Down
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### 0.9.0 (unreleased)

Breaking Changes:
* Code Generator: Remove ABIEncoderV1.
Comment thread
nikola-matic marked this conversation as resolved.
Resolved
* EVM: Drop support for EVM versions `homestead`, `tangerineWhistle`, `spuriousDragon` and `byzantium`.
* SMTChecker: Remove BMC engine.
* SMTChecker: Drop support for cvc5 as the backend SMT solver.
Expand Down
7 changes: 7 additions & 0 deletions docs/090-breaking-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ the compiler notifying you about it.
New Restrictions
================

* ABI coder v1 has been removed and ``pragma abicoder v1;`` is no longer accepted.
ABI coder v2, which has been the default since Solidity 0.8.0, is now the only implementation.


Interface Changes
=================
Expand All @@ -36,4 +39,8 @@ interface, or how you analyze the output produced by it.
How to update your code
=======================

* Remove ``pragma abicoder v1;``.
Note that ABI coder v2 performs more validation on the inputs, which makes some function calls more expensive
and can make calls revert that did not revert with ABI coder v1 when they contain data that does not conform
to the parameter types.

4 changes: 1 addition & 3 deletions docs/contracts/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ you must provide return values together with the return statement.

- mappings,
- internal function types,
- reference types with location set to ``storage``,
- multi-dimensional arrays (applies only to :ref:`ABI coder v1 <abi_coder>`),
- structs (applies only to :ref:`ABI coder v1 <abi_coder>`).
- reference types with location set to ``storage``.

This restriction does not apply to library functions because of their different :ref:`internal ABI <library-selectors>`.

Expand Down
42 changes: 12 additions & 30 deletions docs/layout-of-source-files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,40 +97,22 @@ these follow the same syntax used by `npm <https://docs.npmjs.com/cli/v6/using-n
ABI Coder Pragma
----------------

By using ``pragma abicoder v1`` or ``pragma abicoder v2`` you can
select between the two implementations of the ABI encoder and decoder.

The new ABI coder (v2) is able to encode and decode arbitrarily nested
arrays and structs. Apart from supporting more types, it involves more extensive
validation and safety checks, which may result in higher gas costs, but also heightened
security.
It is considered non-experimental as of Solidity 0.6.0 and it is enabled by default starting
with Solidity 0.8.0. The old ABI coder can still be selected using ``pragma abicoder v1;``.

.. warning::
The ABI coder v1 is deprecated and scheduled for removal.
Use ABI coder v2 instead.

The set of types supported by the new encoder is a strict superset of
the ones supported by the old one. Contracts that use it can interact with ones
that do not without limitations. The reverse is possible only as long as the
non-``abicoder v2`` contract does not try to make calls that would require
decoding types only supported by the new encoder. The compiler can detect this
and will issue an error. Simply enabling ``abicoder v2`` for your contract is
enough to make the error go away.
The ABI coder pragma selects the implementation of the ABI encoder and decoder.
ABI coder v2 is the only available implementation and is always enabled,
which means that ``pragma abicoder v2;`` is accepted but has no effect.

ABI coder v2 is able to encode and decode arbitrarily nested arrays and structs.
It is considered non-experimental as of Solidity 0.6.0 and has been enabled by default
since Solidity 0.8.0.

.. note::
This pragma applies to all the code defined in the file where it is activated,
regardless of where that code ends up eventually. This means that a contract
whose source file is selected to compile with ABI coder v1
can still contain code that uses the new encoder
by inheriting it from another contract. This is allowed if the new types are only
used internally and not in external function signatures.
The old ABI coder (v1) was removed in Solidity 0.9.0 and ``pragma abicoder v1;`` is no longer accepted.
Compared to it, ABI coder v2 supports more types and involves more extensive
validation and safety checks, which may result in higher gas costs, but also heightened
security.

.. note::
Up to Solidity 0.7.4, it was possible to select the ABI coder v2
by using ``pragma experimental ABIEncoderV2``, but it was not possible
to explicitly select coder v1 because it was the default.
Up to Solidity 0.7.4, the ABI coder v2 was selected by using ``pragma experimental ABIEncoderV2``.

.. index:: ! pragma; experimental
.. _experimental_pragma:
Expand Down
4 changes: 0 additions & 4 deletions docs/types/reference-types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,6 @@ Array Members
it includes explicitly clearing the removed
elements similar to calling :ref:`delete<delete>` on them.

.. note::
To use arrays of arrays in external (instead of public) functions, you need to
activate ABI coder v2.

.. note::
In EVM versions before Byzantium, it was not possible to access
dynamic arrays returned from function calls. If you call functions
Expand Down
23 changes: 3 additions & 20 deletions libsolidity/analysis/SyntaxChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,7 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
"Experimental pragma ABIEncoderV2 is deprecated and will be removed in a future release."
);
if (m_sourceUnit->annotation().useABICoderV2.set())
{
if (!*m_sourceUnit->annotation().useABICoderV2)
m_errorReporter.syntaxError(
8273_error,
_pragma.location(),
"ABI coder v1 has already been selected through \"pragma abicoder v1\"."
);
}
solAssert(*m_sourceUnit->annotation().useABICoderV2);
else
m_sourceUnit->annotation().useABICoderV2 = true;
}
Expand All @@ -150,12 +143,12 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
solAssert(m_sourceUnit, "");
if (
_pragma.literals().size() != 2 ||
!std::set<std::string>{"v1", "v2"}.count(_pragma.literals()[1])
_pragma.literals()[1] != "v2"
)
m_errorReporter.syntaxError(
2745_error,
_pragma.location(),
"Expected either \"pragma abicoder v1\" or \"pragma abicoder v2\"."
"Expected \"pragma abicoder v2\"."
);
else if (m_sourceUnit->annotation().useABICoderV2.set())
m_errorReporter.syntaxError(
Expand All @@ -165,16 +158,6 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
);
else
m_sourceUnit->annotation().useABICoderV2 = (_pragma.literals()[1] == "v2");

if (
_pragma.literals().size() > 1 &&
_pragma.literals()[1] == "v1"
)
m_errorReporter.warning(
9511_error,
_pragma.location(),
"ABI coder v1 is deprecated and scheduled for removal. Use ABI coder v2 instead."
);
}
else if (_pragma.literals()[0] == "solidity")
{
Expand Down
6 changes: 6 additions & 0 deletions scripts/error_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,23 @@ def examine_id_coverage(top_dir, source_id_to_file_names, new_ids_only=False):
"1823",
"1988",
"2066",
"2428",
"2443",
"2763",
"2833",
"3061",
Comment thread
blishko marked this conversation as resolved.
Resolved
"3356",
"3893",
"3996",
"4010",
"4458",
"4802",
"4902",
"4957",
"5272",
"5798",
"5840",
"6594",
"7128",
"7400",
"7589",
Expand Down
38 changes: 15 additions & 23 deletions scripts/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,35 +102,27 @@ CURRENT_EVM_VERSION="osaka"
# Run the Solidity unit-tests in the matrix combination of optimizer / no optimizer
for optimize in "" "--optimize"
do
for abiv1 in "no" "yes"
do
force_abiv1_flag=()
if [[ "$abiv1" == "yes" ]]
then
force_abiv1_flag=(--abiencoderv1)
fi
printTask "--> Running tests using $optimize --evm-version $CURRENT_EVM_VERSION ${force_abiv1_flag[*]}..."
printTask "--> Running tests using $optimize --evm-version $CURRENT_EVM_VERSION..."

log=()
if [ -n "$log_directory" ]
log=()
if [ -n "$log_directory" ]
then
if [ -n "$optimize" ]
then
if [ -n "$optimize" ]
then
log+=("--logger=JUNIT,error,$log_directory/opt_$CURRENT_EVM_VERSION.xml")
else
log+=("--logger=JUNIT,error,$log_directory/noopt_$CURRENT_EVM_VERSION.xml")
fi
log+=("--logger=JUNIT,error,$log_directory/opt_$CURRENT_EVM_VERSION.xml")
else
log+=("--logger=JUNIT,error,$log_directory/noopt_$CURRENT_EVM_VERSION.xml")
fi
fi

set +e
"${SOLIDITY_BUILD_DIR}"/test/soltest --show-progress "${log[@]}" -- --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$CURRENT_EVM_VERSION" "${SMT_FLAGS[@]}" "${force_abiv1_flag[@]}"
set +e
"${SOLIDITY_BUILD_DIR}"/test/soltest --show-progress "${log[@]}" -- --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$CURRENT_EVM_VERSION" "${SMT_FLAGS[@]}"

if test "0" -ne "$?"; then
exit 1
fi
set -e
if test "0" -ne "$?"; then
exit 1
fi
set -e

done
done

if [[ -n $CMDLINE_PID ]] && ! wait $CMDLINE_PID
Expand Down
9 changes: 2 additions & 7 deletions test/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ void CommonOptions::addOptions()
("optimize", po::bool_switch(&optimize)->default_value(optimize), "enables optimization")
("enforce-gas-cost", po::value<bool>(&enforceGasTest)->default_value(enforceGasTest)->implicit_value(true), "Enforce checking gas cost in semantic tests.")
("enforce-gas-cost-min-value", po::value(&enforceGasTestMinValue)->default_value(enforceGasTestMinValue), "Threshold value to enforce adding gas checks to a test.")
("abiencoderv1", po::bool_switch(&useABIEncoderV1)->default_value(useABIEncoderV1), "enables abi encoder v1")
("show-messages", po::bool_switch(&showMessages)->default_value(showMessages), "enables message output")
("show-metadata", po::bool_switch(&showMetadata)->default_value(showMetadata), "enables metadata output");
}
Expand Down Expand Up @@ -150,13 +149,10 @@ void CommonOptions::validate() const

if (!enforceGasTest)
std::cout << std::endl << "WARNING :: Gas cost expectations are not being enforced" << std::endl << std::endl;
else if (evmVersion() != langutil::EVMVersion{} || useABIEncoderV1)
else if (evmVersion() != langutil::EVMVersion{})
{
std::cout << std::endl << "WARNING :: Enforcing gas cost expectations with non-standard settings:" << std::endl;
if (evmVersion() != langutil::EVMVersion{})
std::cout << "- EVM version: " << evmVersion().name() << " (default: " << langutil::EVMVersion{}.name() << ")" << std::endl;
if (useABIEncoderV1)
std::cout << "- ABI coder: v1 (default: v2)" << std::endl;
std::cout << "- EVM version: " << evmVersion().name() << " (default: " << langutil::EVMVersion{}.name() << ")" << std::endl;
std::cout << std::endl << "DO NOT COMMIT THE UPDATED EXPECTATIONS." << std::endl << std::endl;
}
}
Expand Down Expand Up @@ -217,7 +213,6 @@ std::string CommonOptions::toString(std::vector<std::string> const& _selectedOpt
std::map<std::string, std::string> optionValueMap = {
{"evmVersion", evmVersion().name()},
{"optimize", boolToString(optimize)},
{"useABIEncoderV1", boolToString(useABIEncoderV1)},
{"batch", std::to_string(selectedBatch + 1) + "/" + std::to_string(batches)},
{"enforceGasTest", boolToString(enforceGasTest)},
{"enforceGasTestMinValue", enforceGasTestMinValue.str()},
Expand Down
3 changes: 1 addition & 2 deletions test/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ struct CommonOptions
u256 enforceGasTestMinValue = 100000;
bool disableSemanticTests = false;
bool disableSMT = false;
bool useABIEncoderV1 = false;
bool showMessages = false;
bool showMetadata = false;
size_t batches = 1;
Expand All @@ -81,7 +80,7 @@ struct CommonOptions
virtual void validate() const;

/// @returns string with a key=value list of the options separated by comma
/// Ex.: "evmVersion=london, optimize=true, useABIEncoderV1=false"
/// Ex.: "evmVersion=london, optimize=true"
virtual std::string toString(std::vector<std::string> const& _selectedOptions) const;
/// Helper to print the value of settings used
virtual void printSelectedOptions(std::ostream& _stream, std::string const& _linePrefix, std::vector<std::string> const& _selectedOptions) const;
Expand Down
1 change: 0 additions & 1 deletion test/cmdlineTests/viair_abicoder_v1/args

This file was deleted.

11 changes: 0 additions & 11 deletions test/cmdlineTests/viair_abicoder_v1/err

This file was deleted.

8 changes: 0 additions & 8 deletions test/cmdlineTests/viair_abicoder_v1/input.sol

This file was deleted.

Loading
Loading