Skip to content

Commit 042b26e

Browse files
committed
Remove EOF: Terming infrastructure.
1 parent c8e7dde commit 042b26e

21 files changed

Lines changed: 16 additions & 93 deletions

test/Common.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ void CommonOptions::addOptions()
111111
{
112112
options.add_options()
113113
("evm-version", po::value(&evmVersionString), "which EVM version to use")
114-
// "eof-version" is declared as uint64_t, since uint8_t will be parsed as character by boost.
115-
("eof-version", po::value<uint64_t>()->implicit_value(1u), "which EOF version to use")
116114
("testpath", po::value<fs::path>(&this->testPath)->default_value(solidity::test::testPath()), "path to test files")
117115
("vm", po::value<std::vector<fs::path>>(&vmPaths), "path to evmc library, can be supplied multiple times.")
118116
("batches", po::value<size_t>(&this->batches)->default_value(1), "set number of batches to split the tests into")
@@ -161,12 +159,6 @@ void CommonOptions::validate() const
161159
std::cout << "- ABI coder: v1 (default: v2)" << std::endl;
162160
std::cout << std::endl << "DO NOT COMMIT THE UPDATED EXPECTATIONS." << std::endl << std::endl;
163161
}
164-
165-
solRequire(
166-
!eofVersion().has_value(),
167-
ConfigException,
168-
"EOF is not supported by EVM versions earlier than " + langutil::EVMVersion::future().name() + "."
169-
);
170162
}
171163

172164
bool CommonOptions::parse(int argc, char const* const* argv)
@@ -181,14 +173,6 @@ bool CommonOptions::parse(int argc, char const* const* argv)
181173
auto parsedOptions = cmdLineParser.run();
182174
po::store(parsedOptions, arguments);
183175
po::notify(arguments);
184-
if (arguments.count("eof-version"))
185-
{
186-
// Request as uint64_t, since uint8_t will be parsed as character by boost.
187-
uint64_t eofVersion = arguments["eof-version"].as<uint64_t>();
188-
if (eofVersion != 1)
189-
BOOST_THROW_EXCEPTION(std::runtime_error("Invalid EOF version: " + std::to_string(eofVersion)));
190-
m_eofVersion = 1;
191-
}
192176

193177
for (auto const& parsedOption: parsedOptions.options)
194178
if (parsedOption.position_key >= 0)
@@ -306,20 +290,6 @@ bool isValidSemanticTestPath(boost::filesystem::path const& _testPath)
306290
return true;
307291
}
308292

309-
boost::unit_test::precondition::predicate_t nonEOF()
310-
{
311-
return [](boost::unit_test::test_unit_id) {
312-
return !solidity::test::CommonOptions::get().eofVersion().has_value();
313-
};
314-
}
315-
316-
boost::unit_test::precondition::predicate_t onEOF()
317-
{
318-
return [](boost::unit_test::test_unit_id) {
319-
return solidity::test::CommonOptions::get().eofVersion().has_value();
320-
};
321-
}
322-
323293
boost::unit_test::precondition::predicate_t minEVMVersionCheck(langutil::EVMVersion _minEVMVersion)
324294
{
325295
return [_minEVMVersion](boost::unit_test::test_unit_id) {

test/Common.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ struct CommonOptions
7070
size_t selectedBatch = 0;
7171

7272
langutil::EVMVersion evmVersion() const;
73-
std::optional<uint8_t> eofVersion() const { return m_eofVersion; }
7473
yul::EVMDialect const& evmDialect() const;
7574

7675
virtual void addOptions();
@@ -98,7 +97,6 @@ struct CommonOptions
9897

9998
private:
10099
std::string evmVersionString;
101-
std::optional<uint8_t> m_eofVersion;
102100
static std::unique_ptr<CommonOptions const> m_singleton;
103101
};
104102

@@ -112,14 +110,6 @@ bool isValidSemanticTestPath(boost::filesystem::path const& _testPath);
112110
/// @return A predicate (function) that can be passed into @a boost::unit_test::precondition().
113111
boost::unit_test::precondition::predicate_t minEVMVersionCheck(langutil::EVMVersion _minEVMVersion);
114112

115-
/// Helper that can be used to skip tests when the EOF is not supported by the test case.
116-
/// @return A predicate (function) that can be passed into @a boost::unit_test::precondition().
117-
boost::unit_test::precondition::predicate_t nonEOF();
118-
119-
/// Helper that can be used to skip tests when the legacy bytecode is not supported by the test case.
120-
/// @return A predicate (function) that can be passed into @a boost::unit_test::precondition().
121-
boost::unit_test::precondition::predicate_t onEOF();
122-
123113
bool loadVMs(CommonOptions const& _options);
124114

125115
/**

test/EVMHost.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ evmc::VM& EVMHost::getVM(std::string const& _path)
7171
std::cerr << ":" << std::endl << errorMsg;
7272
std::cerr << std::endl;
7373
}
74-
vms[_path]->set_option("validate_eof", "1");
7574
}
7675

7776
if (vms.count(_path) > 0)
@@ -315,6 +314,8 @@ evmc::Result EVMHost::call(evmc_message const& _message) noexcept
315314
}
316315
}
317316

317+
solAssert(message.kind != EVMC_EOFCREATE);
318+
318319
if (message.kind == EVMC_CREATE)
319320
{
320321
// TODO is the nonce incremented on failure, too?
@@ -350,17 +351,13 @@ evmc::Result EVMHost::call(evmc_message const& _message) noexcept
350351

351352
code = evmc::bytes(message.input_data, message.input_data + message.input_size);
352353
}
353-
else if (message.kind == EVMC_CREATE2 || message.kind == EVMC_EOFCREATE)
354+
else if (message.kind == EVMC_CREATE2)
354355
{
355356
h160 createAddress(keccak256(
356357
bytes{0xff} +
357358
bytes(std::begin(message.sender.bytes), std::end(message.sender.bytes)) +
358359
bytes(std::begin(message.create2_salt.bytes), std::end(message.create2_salt.bytes)) +
359-
keccak256(
360-
message.kind == EVMC_CREATE2 ?
361-
bytes(message.input_data, message.input_data + message.input_size) :
362-
bytes(message.code, message.code + message.code_size)
363-
).asBytes()
360+
keccak256(bytes(message.input_data, message.input_data + message.input_size)).asBytes()
364361
), h160::AlignRight);
365362

366363
message.recipient = convertToEVMC(createAddress);
@@ -375,16 +372,14 @@ evmc::Result EVMHost::call(evmc_message const& _message) noexcept
375372
return result;
376373
}
377374

378-
if (message.kind == EVMC_CREATE2)
379-
code = evmc::bytes(message.input_data, message.input_data + message.input_size);
380-
else // EOFCREATE
381-
code = evmc::bytes(message.code, message.code + message.code_size);
375+
376+
code = evmc::bytes(message.input_data, message.input_data + message.input_size);
382377
}
383378
else
384379
code = accounts[message.code_address].code;
385380

386381
auto& destination = accounts[message.recipient];
387-
if (message.kind == EVMC_CREATE || message.kind == EVMC_CREATE2 || message.kind == EVMC_EOFCREATE)
382+
if (message.kind == EVMC_CREATE || message.kind == EVMC_CREATE2)
388383
// Mark account as created if it is a CREATE or CREATE2 call
389384
// TODO: Should we roll changes back on failure like we do for `accounts`?
390385
m_newlyCreatedAccounts.emplace(message.recipient);
@@ -421,7 +416,7 @@ evmc::Result EVMHost::call(evmc_message const& _message) noexcept
421416
}
422417
evmc::Result result = m_vm.execute(*this, m_evmRevision, message, code.data(), code.size());
423418

424-
if (message.kind == EVMC_CREATE || message.kind == EVMC_CREATE2 || message.kind == EVMC_EOFCREATE)
419+
if (message.kind == EVMC_CREATE || message.kind == EVMC_CREATE2)
425420
{
426421
int64_t codeDepositGas = static_cast<int64_t>(evmasm::GasCosts::createDataGas * result.output_size);
427422
result.gas_left -= codeDepositGas;
@@ -434,7 +429,6 @@ evmc::Result EVMHost::call(evmc_message const& _message) noexcept
434429
}
435430
else
436431
{
437-
// TODO: Add proper codehash calculation for EOF.
438432
m_totalCodeDepositGas += codeDepositGas;
439433
result.create_address = message.recipient;
440434
destination.code = evmc::bytes(result.output_data, result.output_data + result.output_size);
@@ -1387,7 +1381,7 @@ void EVMHostPrinter::callRecords()
13871381
case evmc_call_kind::EVMC_CREATE2:
13881382
return "CREATE2";
13891383
case evmc_call_kind::EVMC_EOFCREATE:
1390-
return "EOFCREATE";
1384+
solAssert(false); // EOF is not supported.
13911385
}
13921386
unreachable();
13931387
};

test/ExecutionFramework.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ u256 ExecutionFramework::blockNumber() const
147147

148148
void ExecutionFramework::sendMessage(bytes const& _bytecode, bytes const& _arguments, bool _isCreation, u256 const& _value)
149149
{
150-
auto const eof = _bytecode.size() > 1 && _bytecode[0] == 0xef && _bytecode[1] == 0x00;
151150
m_evmcHost->newBlock();
152151

153152
auto const data = _bytecode + _arguments;
@@ -163,19 +162,14 @@ void ExecutionFramework::sendMessage(bytes const& _bytecode, bytes const& _argum
163162
std::cout << " in: " << util::toHex(data) << std::endl;
164163
}
165164
evmc_message message{};
166-
message.input_data = eof ? _arguments.data() : data.data();
167-
message.input_size = eof ? _arguments.size() : data.size();
168-
if (eof)
169-
{
170-
message.code = _bytecode.data();
171-
message.code_size = _bytecode.size();
172-
}
165+
message.input_data = data.data();
166+
message.input_size = data.size();
173167
message.sender = EVMHost::convertToEVMC(m_sender);
174168
message.value = EVMHost::convertToEVMC(_value);
175169

176170
if (_isCreation)
177171
{
178-
message.kind = eof ? EVMC_EOFCREATE : EVMC_CREATE;
172+
message.kind = EVMC_CREATE;
179173
message.recipient = {};
180174
message.code_address = {};
181175
}

test/TestCase.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,20 +146,11 @@ void EVMVersionRestrictedTestCase::processEVMVersionSetting()
146146

147147
void EVMVersionRestrictedTestCase::processBytecodeFormatSetting()
148148
{
149-
std::optional<uint8_t> eofVersion = solidity::test::CommonOptions::get().eofVersion();
150-
// EOF only available since Osaka
151-
solAssert(!eofVersion.has_value());
152-
153-
std::string bytecodeFormatString = m_reader.stringSetting("bytecodeFormat", "legacy,>=EOFv1");
154-
if (bytecodeFormatString == "legacy,>=EOFv1" || bytecodeFormatString == ">=EOFv1,legacy")
149+
std::string bytecodeFormatString = m_reader.stringSetting("bytecodeFormat", "legacy");
150+
if (bytecodeFormatString == "legacy")
155151
return;
156152

157-
// TODO: This is naive implementation because for now we support only one EOF version.
158-
if (bytecodeFormatString == "legacy" && eofVersion.has_value())
159-
m_shouldRun = false;
160-
else if (bytecodeFormatString == ">=EOFv1" && !eofVersion.has_value())
161-
m_shouldRun = false;
162-
else if (bytecodeFormatString != "legacy" && bytecodeFormatString != ">=EOFv1" )
153+
if (bytecodeFormatString != "legacy")
163154
BOOST_THROW_EXCEPTION(std::runtime_error{"Invalid bytecodeFormat flag: \"" + bytecodeFormatString + "\""});
164155
}
165156

test/TestCase.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class TestCase
3939
{
4040
std::string filename;
4141
langutil::EVMVersion evmVersion;
42-
std::optional<uint8_t> eofVersion;
4342
std::vector<boost::filesystem::path> vmPaths;
4443
bool enforceGasCost = false;
4544
u256 enforceGasCostMinValue;

test/libsolidity/semanticTests/constructor/callvalue_check.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ contract B4 { constructor() {} }
1111
contract C {
1212
function createWithValue(bytes memory c, uint256 value) public payable returns (bool) {
1313
uint256 y = 0;
14-
// TODO: This test is hard to recreate for EOF as for now eofcreate is disallowed in inline assembly.
1514
assembly { y := create(value, add(c, 0x20), mload(c)) }
1615
return y != 0;
1716
}

test/libsolidity/semanticTests/deployedCodeExclusion/bound_function.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// TODO: Recreate this test for EOF when subassembly deduplication will be supported for EOF too.
21
function longdata(S memory) pure returns (bytes memory) {
32
return
43
"xasopca.pngaibngidak.jbtnudak.cAP.BRRSMCPJAGPD KIAJDOMHUKR,SCPID"

test/libsolidity/semanticTests/deployedCodeExclusion/library_function.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// TODO: Recreate this test for EOF when subassembly deduplication will be supported for EOF too.
21
library L {
32
function longdata() pure internal returns (bytes memory) {
43
return

test/libsolidity/semanticTests/deployedCodeExclusion/module_function.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// TODO: Recreate this test for EOF when subassembly deduplication will be supported for EOF too.
21
==== Source: mod.sol ====
32
function longdata() pure returns (bytes memory) {
43
return

0 commit comments

Comments
 (0)