mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
libsolidity/codegen: Use calldatacopy to cheaply zero memory instead of
codecopy. Motiviation: Zero'ing memory is commonplace in contracts, but with the upcoming Layer-2 EVM translation layers and other on-chain verification mechanisms, using `codecopy` becomes a `costly` operation in those sandboxes. Using `calldatacopy` achieves the same thing, gas costs are also the same as codecopy, and is significantly cheaper in the `sandbox` situation.
This commit is contained in:
@@ -10179,7 +10179,7 @@ BOOST_AUTO_TEST_CASE(create_dynamic_array_with_zero_length)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(correctly_initialize_memory_array_in_constructor)
|
||||
{
|
||||
// Memory arrays are initialized using codecopy past the size of the code.
|
||||
// Memory arrays are initialized using calldatacopy past the size of the calldata.
|
||||
// This test checks that it also works in the constructor context.
|
||||
char const* sourceCode = R"(
|
||||
contract C {
|
||||
|
||||
Reference in New Issue
Block a user