Skip to content

feat: Add ParseGenesis as initialization hook#149

Draft
michaelkaplan13 wants to merge 2 commits intomainfrom
michaelkaplan13/parse-genesis-hook
Draft

feat: Add ParseGenesis as initialization hook#149
michaelkaplan13 wants to merge 2 commits intomainfrom
michaelkaplan13/parse-genesis-hook

Conversation

@michaelkaplan13
Copy link
Contributor

Adds a ParseGenesis hook to allow for custom genesis initialization defined by the consumer.

This allows the consumer to initialize EVM upgrade activation times, as discussed in this comment. I was able to confirm on the AvalancheGo side that providing a coreth compatible ParseGenesis implementation results in newer transaction types being support upon initialization of the SAE VM.

@ARR4N
Copy link
Collaborator

ARR4N commented Feb 5, 2026

What kind of changes does the hook make after JSON decoding? It feels a bit weird that the genesis bytes don't include sufficient information to be unmarshalled via the standard means.

EDIT: sorry, I missed that you'd linked to the implementation. libevm extras support JSON round-tripping so why aren't they just encoded into the genesis bytes?

@michaelkaplan13
Copy link
Contributor Author

michaelkaplan13 commented Feb 5, 2026

What kind of changes does the hook make after JSON decoding? It feels a bit weird that the genesis bytes don't include sufficient information to be unmarshalled via the standard means.

EDIT: sorry, I missed that you'd linked to the implementation. libevm extras support JSON round-tripping so why aren't they just encoded into the genesis bytes?

The honest answer is because I wasn't aware/didn't think of that. 🙂

Would this work for supporting chains though? As far as I understand, the Avalanche upgrade activation times are not encoded into the C-Chain or EVM L1 genesis blocks, and instead provided from the AvalancheGo node level configuration through the snowCtx to individual chains. We could also encode the Avalanche upgrade activations in the genesis bytes of new chains, but I don't think we can add it to existing chains?

@ARR4N
Copy link
Collaborator

ARR4N commented Feb 6, 2026

As far as I understand, the Avalanche upgrade activation times are not encoded into the C-Chain or EVM L1 genesis blocks, and instead provided from the AvalancheGo node level configuration through the snowCtx to individual chains.

That was my understanding too. So SinceGenesis.Initialize() needs to handle snowCtx.NetworkUpgrades. It might still require a hook like ApplyNetworkUpgrades(*params.ChainConfig, []foo.NetworkUpgrade) error though.

@michaelkaplan13 michaelkaplan13 marked this pull request as draft February 11, 2026 15:04
@michaelkaplan13
Copy link
Contributor Author

Converted to draft for now until we get to align on the right approach

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