Skip to content

Fix incorrect assumption about erc7201 constant function call#16672

Open
matheusaaguiar wants to merge 3 commits into
developfrom
fix_erc7201_invalid_param_number_ice
Open

Fix incorrect assumption about erc7201 constant function call#16672
matheusaaguiar wants to merge 3 commits into
developfrom
fix_erc7201_invalid_param_number_ice

Conversation

@matheusaaguiar
Copy link
Copy Markdown
Contributor

Fix #16633.

@matheusaaguiar matheusaaguiar self-assigned this May 5, 2026
@matheusaaguiar matheusaaguiar changed the title Fix erc7201 invalid param number ice Fix incorrect assumption about erc7201 constant function call May 5, 2026
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.

I'd say this warrants a changelog - it's a user visible change after all.

case FunctionType::Kind::ERC7201:
{
solAssert(_functionCall.arguments().size() == 1);
if (_functionCall.arguments().size() != 1)
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.

Can you not move this to TypeChecker?

Copy link
Copy Markdown
Contributor Author

@matheusaaguiar matheusaaguiar May 5, 2026

Choose a reason for hiding this comment

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

The problem here is that for certain cases, like array lengths, the constant folding happens before, during DeclarationTypeChecker visits... I could add that there, but feels a bit out of place too.
At first, I wanted to rely on TypeChecker and missed that this could be triggered before it was verified (see this comment)

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.

Fair enough

@matheusaaguiar matheusaaguiar force-pushed the fix_erc7201_invalid_param_number_ice branch from e902b88 to 3bc1409 Compare May 7, 2026 05:57
@matheusaaguiar matheusaaguiar force-pushed the fix_erc7201_invalid_param_number_ice branch from 3bc1409 to 7284376 Compare May 7, 2026 18:50
@matheusaaguiar matheusaaguiar force-pushed the fix_erc7201_invalid_param_number_ice branch from 7284376 to c877f69 Compare May 7, 2026 18:52
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.

ICE in ConstantEvaluator::endVisit(FunctionCall) when erc7201() is called with no arguments as a constant

2 participants