mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Enable ABI coder v2 by default.
This commit is contained in:
parent
e880219649
commit
9a36199892
@ -5,6 +5,7 @@ Breaking Changes:
|
||||
* Code Generator: All arithmetic is checked by default. These checks can be disabled using ``unchecked { ... }``.
|
||||
* Code Generator: Cause a panic if a byte array in storage is accessed whose length is encoded incorrectly.
|
||||
* General: Remove global functions ``log0``, ``log1``, ``log2``, ``log3`` and ``log4``.
|
||||
* General: Enable ABI coder v2 by default. Use ``pragma abicoder v1`` to use v1.
|
||||
* Type Checker: Function call options can only be given once.
|
||||
* Type System: Unary negation can only be used on signed integers, not on unsigned integers.
|
||||
* Type System: Disallow explicit conversions from negative literals and literals larger than ``type(uint160).max`` to ``address`` type.
|
||||
|
@ -32,6 +32,9 @@ the compiler notifying you about it.
|
||||
This will save gas on errors while it still allows static analysis tools to distinguish
|
||||
these situations from a revert on invalid input, like a failing ``require``.
|
||||
|
||||
* ABI coder v2 is enabled by default. You can switch back to ABI coder v1 by using
|
||||
``pragma abicoder v1;`` or enable it explicitly sing ``pragma abicoder v2;``.
|
||||
|
||||
* If a byte array in storage is accessed whose length is encoded incorrectly, a panic is caused.
|
||||
A contract cannot get into this situation unless inline assembly is used to modify the raw representation of storage byte arrays.
|
||||
|
||||
|
@ -94,13 +94,11 @@ 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.
|
||||
|
||||
If you do not specify the pragma, ABI coder v2 will be used by default.
|
||||
|
||||
The new ABI coder (v2) is able to encode and decode arbitrarily nested
|
||||
arrays and structs. It might produce less optimal code and has not
|
||||
received as much testing as the old encoder, but is considered
|
||||
non-experimental as of Solidity 0.6.0. You still have to explicitly
|
||||
activate it using ``pragma abicoder v2;``. Since it will be
|
||||
activated by default starting from Solidity 0.8.0, there is the option to select
|
||||
the old coder using ``pragma abicoder v1;``.
|
||||
arrays and structs, performs more checks but might also be slightly
|
||||
more expensive.
|
||||
|
||||
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
|
||||
@ -122,6 +120,7 @@ enough to make the error go away.
|
||||
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.
|
||||
ABI coder v2 has been the default since Solidity 0.8.0.
|
||||
|
||||
.. index:: ! pragma, experimental
|
||||
|
||||
|
@ -74,7 +74,7 @@ void SyntaxChecker::endVisit(SourceUnit const& _sourceUnit)
|
||||
m_errorReporter.warning(3420_error, {-1, -1, _sourceUnit.location().source}, errorString);
|
||||
}
|
||||
if (!m_sourceUnit->annotation().useABICoderV2.set())
|
||||
m_sourceUnit->annotation().useABICoderV2 = false;
|
||||
m_sourceUnit->annotation().useABICoderV2 = true;
|
||||
m_sourceUnit = nullptr;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user