Skip to content

fix: implement AdaptUnmarshalParams #7

Merged
AdriaCarrera merged 2 commits intorelease/v0.6.x-xrplevm.xfrom
fix/get-params-for-legacy-txs
Mar 11, 2026
Merged

fix: implement AdaptUnmarshalParams #7
AdriaCarrera merged 2 commits intorelease/v0.6.x-xrplevm.xfrom
fix/get-params-for-legacy-txs

Conversation

@JordiParraCrespo
Copy link

Description

This pull request introduces a compatibility adapter for EVM parameters, allowing the system to seamlessly handle both the current cosmos.evm schema and the legacy Ethermint schema. The main change is the addition of a robust unmarshalling function, which is now used by the keeper to read parameters, ensuring smooth upgrades and backward compatibility. Comprehensive tests are added to verify correct behavior across all supported scenarios.

Core compatibility improvements:

  • Added AdaptUnmarshalParams in x/vm/keeper/adapter.go to transparently unmarshal EVM params from either the current or legacy schema, converting fields as needed and handling schema incompatibilities.
  • Updated Keeper.GetParams in x/vm/keeper/params.go to use AdaptUnmarshalParams, ensuring that parameter reads work regardless of the underlying schema, and panic on unrecoverable errors.

Testing and validation:

  • Added x/vm/keeper/adapter_test.go with unit tests covering current schema, legacy schema, minimal legacy params, invalid legacy values, and random bytes, ensuring the adapter behaves correctly in all edge cases.
  • Added x/vm/keeper/params_test.go with integration-style tests for GetParams, verifying correct operation with empty stores, both schemas, and error handling for invalid data.

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

@AdriaCarrera AdriaCarrera merged commit 20765f9 into release/v0.6.x-xrplevm.x Mar 11, 2026
10 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants