Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: evm chain param validation #1264

Merged
merged 3 commits into from
Jan 29, 2022
Merged

fix: evm chain param validation #1264

merged 3 commits into from
Jan 29, 2022

Conversation

milapsheth
Copy link
Member

Description

Todos

  • Unit tests
  • Manual tests
  • Documentation
  • Connect epics/issues
  • Tag type of change

Steps to Test

Expected Behaviour

Other Notes

return nil
}
}

if err := validateBytes(m.GatewayCode); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

Validate bytecode first

Copy link
Contributor

Choose a reason for hiding this comment

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

Why? what bug does this fix?

Copy link
Member Author

Choose a reason for hiding this comment

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

On devnet, I used the old bytecode params and it doesn't include absorber. So add-chain succeeded, but VoteConfirmChainRequest fails when setting the param set. add-chain should also validate the bytecode properly.

Copy link
Member Author

Choose a reason for hiding this comment

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

The bug is that if the network is found in the networks list, we return nil right away instead of validating the bytecode.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok then the fix should be that if the network isn't in the list, return an error, otherwise continue instead of return. Simply reordering would leave the problem there when someone wants to add more validation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I prefer that anyways. Still getting used to the preferred coding style here lol

@milapsheth milapsheth added the bug Something isn't working label Jan 29, 2022
return nil
}
}

if err := validateBytes(m.GatewayCode); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

ok then the fix should be that if the network isn't in the list, return an error, otherwise continue instead of return. Simply reordering would leave the problem there when someone wants to add more validation.

@milapsheth milapsheth merged commit 8ff2cad into main Jan 29, 2022
@milapsheth milapsheth deleted the param_validation branch January 29, 2022 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants