Skip to content

Conversation

@phrwlk
Copy link
Contributor

@phrwlk phrwlk commented Aug 13, 2025

Remove unused EncodingContext::clear() and EncodingContext::solver() from libsolidity/formal/EncodingContext.{h,cpp}.

@github-actions
Copy link

Thank you for your contribution to the Solidity compiler! A team member will follow up shortly.

If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother.

If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix.

Copy link
Member

@clonker clonker left a comment

Choose a reason for hiding this comment

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

if @blishko agrees, I think we should just remove clear as well as solver member functions

Comment on lines 58 to 69
void EncodingContext::clear()
{
m_variables.clear();
m_expressions.clear();
m_globalContext.clear();
m_assertions.clear();
m_solver = nullptr;
m_accumulateAssertions = true;
resetUniqueId();
m_state.reset();
}

Copy link
Member

Choose a reason for hiding this comment

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

Clearly that method was never used, it would be better to remove it entirely instead of adding unused implementation detail IMO.

void popSolver();
void addAssertion(smtutil::Expression const& _e);
size_t solverStackHeight() { return m_assertions.size(); } const
size_t solverStackHeight() const { return m_assertions.size(); }
Copy link
Member

@clonker clonker Aug 14, 2025

Choose a reason for hiding this comment

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

lol this is a funny one, the const in the current version actually carries over to the next function and makes the return value pointer const (const smtutil::SolverInterface*). In any case, I dont think this (the solver method) is used anywhere, either.

@blishko
Copy link
Collaborator

blishko commented Aug 14, 2025

I agree with @clonker.
The method EncodingContext::clear should be removed.
EncodingContext::solver can also be removed. This can be done in this PR or we can do it in another one as well.

@phrwlk, please apply to changes, update the PR description, and rebase on top of latest develop.

@phrwlk phrwlk changed the title fix(formal): implement EncodingContext::clear and const-qualify solverStackHeight() refactor(formal): remove unused clear()/solver() Aug 14, 2025
@phrwlk phrwlk force-pushed the fix/formal-encoding-context-clear-const branch 2 times, most recently from dcf23ec to 5b773a5 Compare August 14, 2025 15:28
@phrwlk
Copy link
Contributor Author

phrwlk commented Aug 14, 2025

I agree with @clonker. The method EncodingContext::clear should be removed. EncodingContext::solver can also be removed. This can be done in this PR or we can do it in another one as well.

@phrwlk, please apply to changes, update the PR description, and rebase on top of latest develop.

Done

Copy link
Member

@clonker clonker left a comment

Choose a reason for hiding this comment

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

Thanks!

@clonker
Copy link
Member

clonker commented Aug 14, 2025

Ah but actually @phrwlk could you rebase again? We are avoiding merge commits on the main develop branch.

@phrwlk
Copy link
Contributor Author

phrwlk commented Aug 14, 2025

Ah but actually @phrwlk could you rebase again? We are avoiding merge commits on the main develop branch.
i need a bit time to find out what i've already done with rebase))

@phrwlk phrwlk force-pushed the fix/formal-encoding-context-clear-const branch from 6daae41 to 68364ab Compare August 14, 2025 18:42
@phrwlk
Copy link
Contributor Author

phrwlk commented Aug 14, 2025

Ah but actually @phrwlk could you rebase again? We are avoiding merge commits on the main develop branch.

done

@cameel cameel changed the title refactor(formal): remove unused clear()/solver() refactor(formal): remove unused clear()/solver() from EncodingContext Aug 14, 2025
@blishko blishko merged commit c79f2cc into argotorg:develop Aug 14, 2025
72 of 74 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.

4 participants