1

I am working on a scenario, where I have to upgrade my application and change account address type(from Substrate address to Ethereum address[similar to moonbeam unified account]).

I made the corresponding changes. There is code version A which supports Substrate address and code version B supports Ethereum address.

If I run code version B, it works fine. I am able to see balances of genesis accounts.

If I run code Version A and perform runtime upgrade for version B, balances of genesis accounts become zero after runtime upgrade.

Unfortunately I won't be able to share code but any help/thought would be appreciable.

Can someone please give me an idea what was happening inside?

1 Answer 1

1

That's true.

You shouldn't see any balances.

Here is how the account data is stored:

Account StorageMap - 32 bytes -> account data

After the runtime upgrade it was changed to:

Account StorageMap - 20 bytes -> account data

But you didn't do any migration for the DB.

The old data is still a 32 -> data map in the DB.


Check how I do the migration:

https://github.com/darwinia-network/darwinia-2.0/blob/92533724d8192f8917b51f0eaf5dc665bfe3317e/pallet/account-migration/src/lib.rs#L19-L41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.