paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.com/
1.89k stars 695 forks source link

Vision: Upgrade code via delta. #366

Open gui1117 opened 5 years ago

gui1117 commented 5 years ago

Context

instead of just having srml-system::set_code we could introduce a new extrinsic which allows to send a delta to apply to the current code.

Interest

Unknown variables:

kianenigma commented 5 years ago

this feature is quite unpredictable and this unpredictability might make this feature not wanted at all. and a proper predictable mecanism should be prefered

I guess it really depends on the

finding a binary delta algorithm for our usecase

for which I assume there must be some approaches that might be so great in minimising the size of the diff but will be robust. Might be a dump proposition but I would actually be interested to create to binaries with just a parameter_type difference and apply a normal text diff to them to just observe the patter of changes (if any:P).

xlc commented 5 years ago

Not sure if relaying on compiler internals and implementation details is a good idea. Update rust compiler version/build parameters will certainly cause a lot unrelated diff and could potentially make the delta very large. Also before Rust have reproducible build, it is going to include unnecessary delta anyway.

If the end goal is be able to update parameter_type without update everything, then we should stop give the compiler the wrong assumption that they are constant values. One possible way is the accessor become a host call.

gui1117 commented 5 years ago

actually at first the idea wasn't related to parameter type at all, I was just thinking that it could generally be a potential improvement.

bkchr commented 5 years ago

@kianenigma there are binary diff algorithms exactly for these use cases.

@xlc paramater types are constants, there is no wrong assumption about that. Making anything else with these parameters, is just a huge waste of performance.

@thiolliere I would assume that you already get a rather small diff, with an appropriate binary diff algorithm. What would be the expected advantage of just having to send a diff? We are not talking about gigabytes of data here. The runtime is just around 1mb.