ref-finance / ref-contracts

Smart contracts for Ref Finance
MIT License
96 stars 55 forks source link

near and storage tracing - wip #7

Open robert-zaremba opened 3 years ago

robert-zaremba commented 3 years ago

Hm, I'm not 100% sure you actually handled the upgrading - i see direct self.account.get calls. I think the easiest way is to keep account_deposit as old field and create new lookup map with VersionedAccount. And just when loading - check back if it exists and upgrade.

I've asked @evgenykuzyakov about possible strategies few weeks ago. I think if we won't use indexer then then doing byte computation for figuring out the structure version is too error prone.

So, depending which strategy we will take. If we want to do it lazy (so user will do migration when he will use the account next time) then we will need to duplicate the accounts - if we will use indexer then we will do a migration function. We had a chat about it in telegram. Here I wanted to verify the AccountDeposit structure and update.

referencedev commented 3 years ago

27 adds storage handling without needing to upgrade Account data structure. This fixes the issue short term and removes need to keep track storage_used from it for now.