|  | 
|  | 1 | +--- | 
|  | 2 | +fip: <to be assigned> | 
|  | 3 | +title: Standard Authentication Method for Actors | 
|  | 4 | +author: Alex North (@anorth), Aayush Rajasekaran (@arajasek) | 
|  | 5 | +discussions-to: https://github.com/filecoin-project/FIPs/discussions/413 | 
|  | 6 | +status: Draft | 
|  | 7 | +type: Technical (Interface) | 
|  | 8 | +created: 2022-09-02 | 
|  | 9 | +replaces: [FIP-0035](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0035.md) | 
|  | 10 | +--- | 
|  | 11 | + | 
|  | 12 | +## Simple Summary | 
|  | 13 | + | 
|  | 14 | +The Filecoin protocol has entities called "actors" that can be involved in computation on the Filecoin blockchain.  | 
|  | 15 | +There are various different kinds of actors; among the most common are accounts and multisigs.  | 
|  | 16 | +With [the planned introduction of the Filecoin Virtual Machine](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0030.md), there will be many new kinds of user-defined actors. | 
|  | 17 | +Unfortunately, today, the only kind of actors that can be asked to verify whether they have authorized a piece of data are account actors -- they do so through a signature validation. | 
|  | 18 | +This FIP is the starting point to evolve a convention by which any actor can verify such authorization. It simply proposes adding a special "authorize" message that actors can choose to implement.  | 
|  | 19 | +If they do so, it can be used by other actors to validate their authorization of data. | 
|  | 20 | + | 
|  | 21 | +## Abstract | 
|  | 22 | + | 
|  | 23 | +There is a need for arbitrary actors to be able to authorize (to other actors) that they have approved of a piece of data. This need will become more pressing with the Filecoin Virtual Machine. | 
|  | 24 | +This FIP proposes adding an `Authorize` message that any actor can choose to implement. This message can be called by any other actor to verify whether the "authorizer" | 
|  | 25 | +approves of a piece of data. This is a small change to the existing actors, and allows for user-defined actors to flexibly implement this method according to their needs. | 
|  | 26 | + | 
|  | 27 | +## Change Motivation | 
|  | 28 | + | 
|  | 29 | +We want any actors, including user-defined actors, to be able to confirm that they have authorized some data. | 
|  | 30 | +If we don't have this ability, we will need to engineer around it in painful ways. The proposed [FIP-0035](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0035.md) | 
|  | 31 | +is a concrete example; it proposes adding several new methods and data types in order to enable | 
|  | 32 | +user-defined actors to serve as clients for storage deals.  | 
|  | 33 | + | 
|  | 34 | +It will be infeasible to modify the builtin-actors themselves every time we want to be able to authorize some new kind of information, and doing so will require more total messages  | 
|  | 35 | +to be landing on the Filecoin blockchain. Instead, a flexible, universal approach for actors to authorize data would be preferred. | 
|  | 36 | + | 
|  | 37 | +## Specification | 
|  | 38 | + | 
|  | 39 | +We propose adding the following method to the built-in `Account` Actor.  | 
|  | 40 | +This method can then be the blueprint for other builtin actors (eg. the multisig actor),  | 
|  | 41 | +as well as a template for user-defined actors. | 
|  | 42 | + | 
|  | 43 | +``` | 
|  | 44 | +    /// Authenticates whether the provided authorization is valid for the provided message. | 
|  | 45 | +    /// Errors if the authentication is invalid. | 
|  | 46 | +    pub fn verify_authorization(params: VerifyAuthorizationParams) -> Result<(), ActorError> | 
|  | 47 | +``` | 
|  | 48 | + | 
|  | 49 | +The params to this method is a wrapper over the message and signature to validate: | 
|  | 50 | + | 
|  | 51 | +``` | 
|  | 52 | +pub struct VerifyAuthorizationParams { | 
|  | 53 | +    pub authorization: Vec<u8>, | 
|  | 54 | +    pub message: Vec<u8>, | 
|  | 55 | +} | 
|  | 56 | +``` | 
|  | 57 | + | 
|  | 58 | +Further, we propose modifying the StorageMarketActor to call this method when validating `ClientDealProposal`s instead of validating signatures directly. | 
|  | 59 | + | 
|  | 60 | +## Design Rationale | 
|  | 61 | + | 
|  | 62 | +The idea is to create a flexible, lightweight endpoint that actors can expose to callers that might want to | 
|  | 63 | +validate its authorization. Some actors will have very obvious implementations: the account actor simply  | 
|  | 64 | +performs a signature validation, while an `m/n` multisig need only perform `m` signature validations. | 
|  | 65 | +Other actors might opt for creative implementations of such authorization based on their needs. Yet  | 
|  | 66 | +others can choose not to support this endpoint at all -- the Filecoin protocol's singleton builtin-actors | 
|  | 67 | +such as the Storage Power Actor, the System Actor, the Cron Actor, etc. will likely choose to omit this method. | 
|  | 68 | + | 
|  | 69 | +## Backwards Compatibility | 
|  | 70 | + | 
|  | 71 | +Introducing new methods to the builtin-actors needs a network upgrade, but otherwise breaks no backwards compatibility. | 
|  | 72 | + | 
|  | 73 | +## Test Cases | 
|  | 74 | + | 
|  | 75 | +Proposed test cases include: | 
|  | 76 | + | 
|  | 77 | +- that the `verify_authorization` method on account actors can be called and succeeds with valid input | 
|  | 78 | +- that the `verify_authorization` method on account actors can be called, but fails with invalid input | 
|  | 79 | +- that storage deals can be made with the changes to the `StorageMarketActor` | 
|  | 80 | + | 
|  | 81 | +## Security Considerations | 
|  | 82 | + | 
|  | 83 | +We need to be careful with the security of the `verify_authorization` implementations of the | 
|  | 84 | +builtin-actors. User-defined contracts are free to implement these methods as they see fit. | 
|  | 85 | + | 
|  | 86 | +This FIP only proposes adding the `verify_authorization` method to the account actor, which  | 
|  | 87 | +simply invokes the signature validation syscall. | 
|  | 88 | + | 
|  | 89 | +## Incentive Considerations | 
|  | 90 | + | 
|  | 91 | +This proposal is generally well-aligned with the incentives of the network. It can be considered | 
|  | 92 | +as a simpler replacement for FIP-0035, with the only drawback being that this proposal as currently written does not allow for multisigs to be storage clients. It would be trivial  | 
|  | 93 | +to add a similar `verify_authorization` method to the multisig actor, though. | 
|  | 94 | + | 
|  | 95 | +## Product Considerations | 
|  | 96 | + | 
|  | 97 | +This proposal is the first step towards enabling non-account actors to function as clients for | 
|  | 98 | +storage deals, which is a major product improvement. Furthermore, it enables future innovation  | 
|  | 99 | +that relies on the ability of non-account actors to authorize data as approved. | 
|  | 100 | + | 
|  | 101 | +## Implementation | 
|  | 102 | + | 
|  | 103 | +Partial implementation [here](https://github.com/filecoin-project/builtin-actors/pull/502) | 
|  | 104 | + | 
|  | 105 | +## Copyright | 
|  | 106 | +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). | 
0 commit comments