-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
C:lightComponent: LightComponent: LightT:enhancementType: EnhancementType: EnhancementT:perfType: PerformanceType: Performance
Description
From in-person discussion, changes to https://github.com/tendermint/tendermint/blob/master/lite/dynamic_verifier.go#L59
// If the validators have changed since the last known time, it looks to
// ic.trusted and ic.source to prove the new validators. On success, it will
// try to store the SignedHeader in ic.trusted if the next
// validator can be sourced.
func (ic *DynamicVerifier) Certify(shdr types.SignedHeader) error {
// TODO: If I'm already trying to certify this,
// then block on the old request,
// and then resume once the old request is done.
// TODO: move the below to "WaitForPendingVerifications(height)" and call it.
// ic.mtx.Lock()
// if pending := ic.pendingVerifications[shdr.height]; pending != nil
// ic.mtx.Unlock()
// <- pending // pending is chan struct{}
// else
// pending := make(chan struct{}, 0)
// ic.pendingVerifications[shdr.height] = pending
// defer func() {
// close(pending)
// ic.mtx.Lock()
// delete ic.pendingVerifications[shrd.height]
// ic.mtx.Unlock()
// }()
// ic.mtx.Unlock()
// TODO: Get the exact trusted commit for h, and if it is
// equal to shdr, then don't even verify it,
// and just return nil.
// Get the latest known full commit <= h-1 from our trusted providers.
// The full commit at h-1 contains the valset to sign for h.
h := shdr.Height - 1
trustedFC, err := ic.trusted.LatestFullCommit(ic.chainID, 1, h)This issue covers:
- Adding the height-based lock-release code as above so that we avoid performing duplicate computation for the same height
- Caching trusted commits that we've already fetched & verifie
- Renaming all instances of
CertifytoVerify
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C:lightComponent: LightComponent: LightT:enhancementType: EnhancementType: EnhancementT:perfType: PerformanceType: Performance