pokt-network / poktroll

The official Shannon upgrade implementation of the Pocket Network Protocol implemented using Rollkit.dev
MIT License
15 stars 7 forks source link

[Applicaton] Provable past delegations & delayed undelegations #497

Closed red-0ne closed 2 months ago

red-0ne commented 2 months ago

Summary

Add EndBlockers keeper methods to:

Update the RingClient and RingCache to use archived delegations when needed

Remove stale code implementing PubKeyClient

2255 added lines of code are auto-generated pulsar files

A followup PR for e2e testing the feature involving sending relays to gateways instead of self-signing AppGateServers will come after. E2E tests for:

Issue

Type of change

Select one or more:

Testing

Documentation changes (only if making doc changes)

Local Testing (only if making code changes)

PR Testing (only if making code changes)

Sanity Checklist

Olshansk commented 2 months ago

@red-0ne Aiming to take a look at this tomorrow.

Olshansk commented 2 months ago

Haven't started looking at the code yet but great PR summary @red-0ne!

Olshansk commented 2 months ago

Action Plan:

  1. Refer to this comment: https://github.com/pokt-network/poktroll/issues/476#issuecomment-2052639906
  2. Leave this PR as is: make it a draft and close later (or pick up) depending on how alterative solution evolves
  3. Refer to pseudo-code below for attempt number
  4. Feel free to copy-paste code from here (e.g. tests) in new PR

ClaimValidation() {
    addressesToBuildRing = getActiveGatewayAddr(app, currentSessionNumber)
}

func getActiveGatewayAddr(app, currSessNumber) {
    activeGateways = app.activeGateways
    for sessionNumber, pendingUndelegations := range app.pendingUndelegations {
        if sessionNumber < currSessNumber {
            activeGateways = append(activeGateways, pendingUndelegations...)
        }
    }
    return activeGateways
}

func EndBlocker() {
    cleanUpPendingUndelegations(currSessionNumber)
}

func cleanUpPendingUndelegations() {
    sessionNumbersToRemoveUndelegationsFor = someFunctionUsingGovParam(currSess, numSessionsToGoBack)
    for app := allApplications {
        for sess, undelegations := app.undelegations {
            if sess <sessionNumbersToRemoveUndelegationsFor {
                delete(app.undelegations, sess)
            }
        }
    }
}
red-0ne commented 2 months ago

Closing in favor of #518

Olshansk commented 2 months ago

Closing in favor of #518

Love two things about this:

  1. We're biasing to a simpler solution straight away
  2. We're keeping this as a reference in history for when we need it

đŸ’ª