Skip to content

Commit 17ec114

Browse files
authored
Support validating initcode containers in eofparse (#934)
1 parent b790bc7 commit 17ec114

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/eofparse/eofparse.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Copyright 2023 The evmone Authors.
33
// SPDX-License-Identifier: Apache-2.0
44

5+
#include <CLI/CLI.hpp>
56
#include <evmc/evmc.hpp>
67
#include <evmone/eof.hpp>
78
#include <iostream>
@@ -35,10 +36,18 @@ std::optional<evmc::bytes> from_hex_skip_nonalnum(InputIterator begin, InputIter
3536

3637
} // namespace
3738

38-
int main()
39+
int main(int argc, char* argv[])
3940
{
4041
try
4142
{
43+
CLI::App app{"evmone eofparse tool"};
44+
const auto& initcode_flag =
45+
*app.add_flag("--initcode", "Validate code as initcode containers");
46+
47+
app.parse(argc, argv);
48+
const auto container_kind =
49+
initcode_flag ? evmone::ContainerKind::initcode : evmone::ContainerKind::runtime;
50+
4251
int num_errors = 0;
4352
for (std::string line; std::getline(std::cin, line);)
4453
{
@@ -54,7 +63,7 @@ int main()
5463
}
5564

5665
const auto& eof = *o;
57-
const auto err = evmone::validate_eof(EVMC_PRAGUE, evmone::ContainerKind::runtime, eof);
66+
const auto err = evmone::validate_eof(EVMC_PRAGUE, container_kind, eof);
5867
if (err != evmone::EOFValidationError::success)
5968
{
6069
std::cout << "err: " << evmone::get_error_message(err) << "\n";

0 commit comments

Comments
 (0)