Skip to content

Correct off-chain delegation validation always requires an archive node #2510

@JoeCap08055

Description

@JoeCap08055

What happened?

Description

In the current Delegation model, we only store the revoked_at block number. A Delegation is either currently in-force (revoked_at == 0), or has been revoked as of some block (revoked_at > 0). This has issues even for the following simple sequence of events:

flowchart TD
    A(["User delegates a schema to Provider A at block 100"]) --> B(["User revokes delegation at block 400"])    
Loading

In this scenario, we can always determine that any content posted by Provider A on behalf of the user after block 400 is unauthorized; however, for any content prior to block 400, we do not currently retain enough information to know whether the now-revoked delegation was in force or not, because we do not know at which block it was granted. The only way to determine that would be to access an archive node and query state at the block in question.

So... is the solution to also store the granted_at block number? That would mitigate the above scenario. However, consider the following sequence of events:

flowchart TD
    A(["User delegates a schema to Provider A at block 100"]) --> B(["User revokes delegation at block 400"])    
    B --> C(["User re-delegates at block 1000"])
    C --> D(["User revokes delegation at block 2000"])
Loading

In this scenario, with access to the granted_at block, although we are able to validate content past block 2000 as unauthorized, and content between blocks 1000-2000 as authorized, we have no knowledge of the prior delegation from blocks 100-400. For that information, we still require an archive node.

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions