-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
depends on #1603 - can't make tests with current test_client implementation |
@svyatonik can we ice this until the offline-fallback is in? Mostly because I want to make sure that some things are handled correctly for light clients (that they are actually halting in case of a forced change.) |
@svyatonik this requires conflict fixes. @rphmeier / @andresilva can you have another look at this? |
@svyatonik more conflicts to be resolved... |
testing blocked by #2499 + I have found some verification issue - the fix will be here |
Could you merge master to include #2499 and fix conflicts? |
@andresilva Will do, but there's (unfortunately) another major issue - I'm currently preparing separate PR for that && will leave this PR as |
This conflicts quite heavily with my WIP for a networking cleanup. I'm going to wait for this to be in to continue. |
@andresilva @tomaka Sorry for delay - I've merged with master (had the same "too many files open problem" issue - we need to figure out the reason). This is ready for review again, but if you want to do a real testing, you should also cherry-pick commits from #2512 (the Aura part was broken, the GRANDPA looks OK to me). |
going to need resolving... |
* GrandpaLightBlockImport * extract authorities in AuraVerifier * post-merge fix * restore authorities cache * license * new finality proof draft * generalized PendingJustifications * finality proof messages * fixed compilation * pass verifier to import_finality_proof * do not fetch remote proof from light import directly * FinalityProofProvider * fixed authorities cache test * restored finality proof tests * finality_proof docs * use DB backend in test client * justification_is_fetched_by_light_client_when_consensus_data_changes * restore justification_is_fetched_by_light_client_when_consensus_data_changes * some more tests * added authorities-related TODO * removed unneeded clear_finality_proof_requests field * truncated some long lines * more granular light import tests * only provide finality proof if it is generated by the requested set * post-merge fix * finality_proof_is_none_if_first_justification_is_generated_by_unknown_set * make light+grandpa test rely on finality proofs (instead of simple justifications) * empty_finality_proof_is_returned_to_light_client_when_authority_set_is_different * missing trait method impl * fixed proof-of-finality docs * one more doc fix * fix docs * initialize authorities cache (post-merge fix) * fixed cache initialization (post-merge fix) * post-fix merge: fix light + GRANDPA tests (bad way) * proper fix of empty_finality_proof_is_returned_to_light_client_when_authority_set_is_different * fixed easy grumbles * import finality proofs in BlockImportWorker thread * allow import of finality proofs for non-requested blocks * limit number of fragments in finality proof * GRANDPA post-merge fix * BABE: pos-merge fix
closes #269
I'm opening this PR to share the ideas && to make sure I'm on the right track. So the general idea is:
DigestItem::AuthoritiesChange
now). This differs from original description of Light-client Authority Set Handoffs #269 and what has been discussed in GRANDPA finality proof draft #1268. But since full clients do not pause sync, I'm not sure - why light clients should (that's what bothering me). So light block importer only tries to get finalization of such blocks ASAP;2.1) assuming that every change of this set if accompanied with justification;
2.2) when seeing a justification we could assume that it is created with previous set;
2.3) if check-with-previous-set fails, we're fetching GRANDPA authorities set from the remote full node;
2.4) if recheck-with-new-set works, then we're finalizing the block + storing new set + new set_id (which is increased by one on every change) locally
This should work when justifications are already created (i.e. when we're syncing from the scratch). But there's a case when this strategy will fail:
set_id
from 10 to 11);set_id
is still 10 on light);set_id
from 11 to 12 is imported by FULL && justification J2 is created;set_id
.That's where I suppose finality proof could help (if changed a bit). So that new finality proof (which will work in both optimistic + pessimistic cases) will be:
REQUEST: prove finalization of BEST_BLOCK given that our best finalized is BEST_FINALIZED
RESPONSE:
assume that we have best justification for BEST_BLOCK+2
if GRANDPA set has NOT been changed in [BEST_FINALIZED; BEST_BLOCK+2]:
we only need to respond with justification for BEST_BLOCK+2
if GRANDPA set has been changed in that range:
we need to respond with justifications for all intermediate changes
+ proof-of-execution for
GRANDPA::authorities
for all intermediate changes+ justification for BEST_BLOCK+2
The goal of this PR is to have:
2.1) I've reenabled authorities cache for that => when Aura verifier requests authorities, they're fetched from the cache;
2.2) I've added extraction of
new_authorities
into Aura verifier => light client is notified when the set changes && the cache is updated accordingly.cc @rphmeier