DimensionDev / Maskbook-Talks

Where talks of Maskbook happen.
7 stars 1 forks source link

Discuss: A new way to do hot reloading #23

Open yisiliu opened 4 years ago

yisiliu commented 4 years ago

During the red packet campaign, we came into a few problems involving hot reloading of some key variables, e.g. keys and contract addresses. When such problems happened, the only thing we can do is to update the code, compile and re-publish it. This required an indeterministic lag of updates.

I would like to propose a new way to do such type of hot reloading. Since we have already integrated web3 into our extension, we can directly take advantage of this. We can store these key variables in a smart contract so that our extension could periodically update with the smart contract. Or we can do this in an on-demand or lazy manner that, we could add a field bool valid and a function invalid() in each smart contract (e.g. red packet) and every time valid == bool, the extension checks the smart contract that store the key variables to update.

What do you guys think?

neruthes commented 4 years ago

Should be a good practice.