Skip to content

dev: simplify condition in is_account_alive #1190

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

Open
wants to merge 3 commits into
base: forks/prague
Choose a base branch
from

Conversation

enitrat
Copy link
Contributor

@enitrat enitrat commented Apr 11, 2025

What was wrong?

The condition for is_account_alive is strictly equivalent to == EMPTY_ACCOUNT. Thus, for simplicity, I modified it (and ensuring that if the Account model came to change, this would be properly reflected in this function.

@enitrat enitrat changed the base branch from master to forks/prague April 11, 2025 18:50
@enitrat enitrat force-pushed the dev/simplify-is-account-alive branch from ac5904d to 85f5945 Compare April 11, 2025 18:50
@enitrat
Copy link
Contributor Author

enitrat commented Apr 18, 2025

hi @SamWilsn, @gurukamath, I made a small change for clarity, let me know how that sounds!

@@ -463,11 +463,7 @@ def is_account_alive(state: State, address: Address) -> bool:
if account is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Or even:

    return account is not None and account != EMPTY_ACCOUNT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah definitely better this way :)

@enitrat enitrat requested a review from SamWilsn April 29, 2025 16:13
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.

2 participants