casper-ecosystem / cep18

Implementation of ERC20 token for the CasperLabs platform.
https://casper.network/docs/dapp-dev-guide
Apache License 2.0
26 stars 47 forks source link

Condor rc3 #142

Closed deuszex closed 1 day ago

deuszex commented 1 month ago

2.0.0-rc3 compatible. Migration entrypoints for balance and allowance keys to move from old Key formats to new ones (AddressableEntity). Events: EventsMode::CES events included (forked original to update to rc3). EventsMode::Native events included (Casper Native events). EventsMode::NativeNCES (uses both Native and CES eventing). Compiles on latest rust.

Added 1.5.6 fixture(state snapshot) to test migration from 1.5.6 to 2.0.0-rc3.

TODO: Fixture guide/tutorial.

Added entrypoint:

sczembor commented 2 weeks ago

The current approach relies on a user-provided key map, which introduces the risk of errors and could be cumbersome for larger migrations. Also, it doesn't account for potential "race" if the contract is used post condor and before/while the migration process.

I'd like to propose an alternative "on-demand" migration. This approach would:

  1. Trigger migration automatically whenever a account or contract (AddressableEntity) interacts with the smart contract.
  2. Reconstruct the old key (AccountHash, ContractHash) and transfer the balance, allowances to the new AddressableEntity key structure if the migration didnt already occurred.

This eliminates the need for a manual key map and reduces the risk of errors. While it might add some complexity, I believe it offers a more robust and scalable solution.

I'm happy to discuss it and see your point of view. @deuszex @gRoussac

deuszex commented 2 weeks ago

@sczembor That is the so collad "lazy migration" that we have discussed already on our meetings on which you are also present, and as I've said on the mentioned meetings, these decision will go through the proper chain of command, when the relevant personnel are available.

deuszex commented 1 day ago

Closing in favour of another PR