Skip to content

Conversation

@leonardoalt
Copy link

We shouldn't add the nondeterministic interface constraint for external calls from constructors since they can't re-enter anyway.

@leonardoalt leonardoalt force-pushed the smt_fix_ext_constructor branch 2 times, most recently from b081fbe to 54e7b82 Compare August 12, 2021 14:23
function s(uint _x) public { x = _x; }
constructor(D d) {
uint a = d.ext(this);
assert(x == 0); // should hold because there's no reentrancy from the constructor
Copy link
Author

Choose a reason for hiding this comment

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

Before this PR this used to fail

ekpyron
ekpyron previously approved these changes Aug 12, 2021
for (auto var: function->returnParameters())
m_context.variable(*var)->increaseIndex();

if (!m_currentFunction || m_currentFunction->isConstructor())
Copy link
Collaborator

Choose a reason for hiding this comment

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

!m_currentFunction is stuff like state variable initialization and thereby always constructor context I guess?

Copy link
Author

Choose a reason for hiding this comment

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

Yep!

Copy link
Author

Choose a reason for hiding this comment

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

If !m_currentFunction here, it means there was a state variable init that made an external call

@leonardoalt leonardoalt enabled auto-merge August 12, 2021 14:29
@leonardoalt
Copy link
Author

@ekpyron can you reapprove? had to fix test expectations that I forgot

@leonardoalt leonardoalt merged commit b0164bd into develop Aug 12, 2021
@leonardoalt leonardoalt deleted the smt_fix_ext_constructor branch August 12, 2021 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants