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

feat!: Enforce stricter validations for genesis accounts and enabled precompiles #74

Merged
merged 4 commits into from
Aug 2, 2024

Conversation

nddeluca
Copy link
Member

@nddeluca nddeluca commented Aug 1, 2024

These changes add the assertion that genesis accounts may only be contracts. This means they must have code set, a nonce of 1, and have no public key associated with their x/auth account. This also applies to enabled precompiles, which we also assert has a genesis account with code set to a fixed value.

Changes:

  • Genesis accounts must have code set (be a contract)
  • Contracts must have a nonce of 1 and have no public key
  • Enabled precompiles must have a genesis account and be a contract
  • Enabled precompiles must have code equal to 0x01

Replaces #65

Base automatically changed from nd-improve-evm-genesis-testing to main August 2, 2024 21:22
Genesis accounts currently serve no purpose for non-contract accounts.
Currently, they can exist but code and storage will be empty and
therefore has no effect besids ensuring the matching account is subject
to similar validations as a contract.

This change restrics valid genesis accounts to those with Code only.
Storage can still be empty for contracts, as there is no requirement for
values to be set in state for all contracts.
Using capital letters for test case names improved readability when
reading and parsing.
On some chains running ethermint, a self destruct bug that caused the
code for other contract accounts to be deleted would result in exported
genesis accounts with empty code.  A patch was then added to genesis
that allowed the hash check to be skipped in order for these genesis
files to be re-imported successfully.

This does not affect us contracts on Kava, so this check is being
removed.
Since Genesis Accounts may only be contracts, we add the assertion that
they must have a positive sequence (eip-155) and that they do not have a
public key set.  A contract can not be associated with a public key and
must have a default nonce set.

In addition, since enabled precompiles are contract accounts, we enforce
that these have matching genesis accounts to share these validations and
in addition, enforce a fixed code.
@nddeluca nddeluca force-pushed the nd-strict-genesis-validations branch from cd02af6 to b2308ed Compare August 2, 2024 21:25
@nddeluca nddeluca merged commit 5869608 into main Aug 2, 2024
25 checks passed
@nddeluca nddeluca deleted the nd-strict-genesis-validations branch August 2, 2024 22:40
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.

1 participant