AcalaNetwork / chopsticks

Create parallel reality of your Substrate network.
Apache License 2.0
138 stars 84 forks source link

refactor decode proof to extract all keys #569

Closed ermalkaleci closed 11 months ago

ermalkaleci commented 11 months ago

this will make it easy to implement new inherent #561 decode_proof will find all possible keys so there's no need to inject unchanged ones

ermalkaleci commented 11 months ago

setValidationData is executed first so other inherent can read proofs from query.parachainSystem.relayStateProof() @girazoki

girazoki commented 11 months ago

thank you!

girazoki commented 11 months ago

@ermalkaleci as I am understanding it, now every key that was proven from the previous block and that is not modified will be included and proved on the new built block?

ermalkaleci commented 11 months ago

yes, you don't need to touch SetValidationData inherent. SetValidationData will be executed first and set new proofs which you can read on your inherent from query.parachainSystem.relayStateProof()

girazoki commented 11 months ago

ah that's amazing. I think it does cover most of our needs so we will shortly propose a PR adding tanssi support. The only thing I am thinking is: what happens if there are some keys being proved in one inherent (set-validation-data) and others in another inherent (authorities-noting in our case) in production? Probably the nibbles passed to set-validation-data do not include all keys to be able to fork correctly.

We might propose the possibility to add additional keys to set-validation-data inherent if that's fine in the PR that supports tanssi (in other words, being able to add additional keys to the WellKnownKeys struct)

girazoki commented 11 months ago

the other thing we can do is refactor our node to inject a single proof (in set-validation-data) that contains all keys we need to prove. That should work with this implementation and I think its cleaner! So in that case you dont need to worry about what I just said :)

ermalkaleci commented 11 months ago

I think I was wrong. I will look again tomorrow, maybe it needs a refactor