Skip to content

ethdebug: Improve current testing infra#16727

Merged
nikola-matic merged 5 commits into
argotorg:developfrom
walnuthq:feature/ethdebug
May 28, 2026
Merged

ethdebug: Improve current testing infra#16727
nikola-matic merged 5 commits into
argotorg:developfrom
walnuthq:feature/ethdebug

Conversation

@djolertrk
Copy link
Copy Markdown
Contributor

Handle multiple things ethdebug related:

  • Add LLVM lit tests (this could be interesting for codegen tests as well)
    $ lit -sv test/lit --param solc=build/solc/solc
  • Emit schema-compliant compilation resources so we can execute first "round-trip-tests" in producer (here) and in consumer soldb via conformance tests added into the format repo
  • Validate ETHDebug output against pinned schemas

@djolertrk djolertrk marked this pull request as draft May 15, 2026 14:53
@nikola-matic nikola-matic self-assigned this May 18, 2026
@djolertrk djolertrk force-pushed the feature/ethdebug branch 2 times, most recently from 4c86c71 to 5186b7e Compare May 19, 2026 14:07
Copy link
Copy Markdown
Contributor

@nikola-matic nikola-matic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed earlier, can you please migrate the llvm-lit test to the new ethdebug isoltest (#16675 - merged this morning)?

I'll be doing some follow up tasks regarding the ethdebug isoltest, so feel free to let me know if you have any requests :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to get rid of all of these (brink, ens and prb-math), i.e. just drop the commits after a rebase - I fixed these some time ago.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, I will do it.

@djolertrk
Copy link
Copy Markdown
Contributor Author

As discussed earlier, can you please migrate the llvm-lit test to the new ethdebug isoltest (#16675 - merged this morning)?

I'll be doing some follow up tasks regarding the ethdebug isoltest, so feel free to let me know if you have any requests :)

Hi @nikola-matic, thanks for the feedback! Yes sure! I will do it, and also include into CI the ethdebug compilation overhead (almost ready), and of course, if something is missing in the ethdebug isoltest, I will let you know.

And just to confirm, we do not want to include llvm lit at all in this PR, right?

@nikola-matic
Copy link
Copy Markdown
Contributor

And just to confirm, we do not want to include llvm lit at all in this PR, right?

Correct - team is very much used to the isoltest way of doing things, and reviewing will go much smoother with isoltest instead of llvm-lit for the time being.

@djolertrk
Copy link
Copy Markdown
Contributor Author

This PR depends on these changes outside of this repo:

Copy link
Copy Markdown
Contributor

@nikola-matic nikola-matic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - you went a bit overboard with the CI though :)

Comment thread libevmasm/Ethdebug.cpp Outdated
Comment on lines +132 to +137
void appendLengthPrefixed(std::string& _target, std::string_view _value)
{
_target += std::to_string(_value.size());
_target += ":";
_target += _value;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void appendLengthPrefixed(std::string& _target, std::string_view _value)
{
_target += std::to_string(_value.size());
_target += ":";
_target += _value;
}
std::string lengthPrefixed(std::string_view _value)
{
return fmt::format("{}:{}", _value.size(), _value);
}

Comment thread libevmasm/Ethdebug.cpp
_target += _value;
}

std::string compilationID(std::vector<Source> const& _sources)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also apply fmt::format here, but it's not a dealbreaker.

Comment thread .circleci/config.yml Outdated
command: |
pytest test/ethdebugSchemaTests --solc-binary-path=/tmp/workspace/solc/solc-static-linux -v

t_ethdebug_overhead:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't add a CI step for benchmarking at this stage - running it on every commit incurs additional cost for us, and the vast majority of PRs will not be touching anything ethdebug related (in terms of the entire repository, ethdebug PRs obviously will).

Also, what would be the failure condition for such a step? I don't see one here - it seems that it only runs the benchmark three times and stores the (average?) result as an artifact.

For the time being, just get rid of all of the CircleCI changes, and instead let's agree to dump the results as a comment in the PR (as a table, or whatever format you deem acceptable).

The extention tot_ethdebug_output_validity is fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what would be the failure condition for such a step? I don't see one here - it seems that it only runs the benchmark three times and stores the (average?) result as an artifact.

For the time being, just get rid of all of the CircleCI changes, and instead let's agree to dump the results as a comment in the PR (as a table, or whatever format you deem acceptable).

Well, this tests the compilation overhead, so definitely it needs to be invoked several times, and to report the if the "overhead" is more than a trash-hold (atm I put > 50%). It could be pretty heavy to keep it as default in the CI, so yes, let's remove it for now.

And this solc-bench-change is the PR that introduces the new benchmark there, so we can discuss the format of the output there, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that it would be a bit much to run this in the CI for every push, let's agree to just paste the benchmarking results from solc-bench to solc PRs when they're opened, so we can see the effects.

Comment thread libevmasm/Ethdebug.cpp
Comment on lines +159 to +166
{
schema::materials::Source result;
result.id = schema::materials::ID{_source.id};
result.path = _source.path;
result.contents = _source.contents;
result.encoding = std::nullopt;
result.language = _source.language;
return result;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{
schema::materials::Source result;
result.id = schema::materials::ID{_source.id};
result.path = _source.path;
result.contents = _source.contents;
result.encoding = std::nullopt;
result.language = _source.language;
return result;
{
return {
.id = schema::materials::ID{_source.id},
.path = _source.path,
.contents = _source.contents,
.encoding = std::nullopt,
.language = _source.language,
};

c++20 very nice 👍 You can also drop .encoding = std::nullopt, since it'll be default initialized as such.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I agree, c++20 it is :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that CI Windows job rejects C++20

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bleeeh, this .id = schema::materials::ID{_source.id} is the offender that triggers an ICE in MSVC, and is only fixed in MSVC 19.33 (family 17.3). Unfortunately, this would mean we'd have to bump MSVC from 2019 to 2022, and we're not doing that now.

Revert it back to how it was then.

Comment thread libevmasm/Ethdebug.cpp
for (auto const& source: _sources)
sources.emplace_back(materialSource(source));

schema::materials::Compilation result;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Named struct initialization here as well.

// .compilation.id: <IGNORE>
// .compilation.sources | length: 1
// .compilation.sources[0].id: 0
// .compilation.sources[0].path: <IGNORE>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should test this in test/libsolidity/ethdebugTests/multi_source_name_collision.sol and test/libsolidity/ethdebugTests/multi_source.sol as it's multisource with paths.

You can also create a new test if you feel like something is undertested, or the current tests don't allow for the best representation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least for these basic ETHDebug things, no, but in future, once we start adding more complex things into it (like variable values), it will definitely need to evolve a bit.

@djolertrk djolertrk marked this pull request as ready for review May 25, 2026 14:50
@nikola-matic nikola-matic merged commit c28af75 into argotorg:develop May 28, 2026
83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants