Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paych actor: Drop account req, use AuthenticateMessage to verify sigs #824

Merged
merged 4 commits into from
Nov 16, 2022

Conversation

arajasek
Copy link
Contributor

@arajasek arajasek commented Nov 9, 2022

Part of #424.

In addition to obviating the need for Paych to/from addresses to be accounts, this also removes the need for them to exist in state at the time of creation -- this PR makes it possible to supply to/from ID addresses that don't actually exist in state at the time of paych creation.

We need to decide if this is something we want, or is undesirable. If the latter, we probably want a new syscall to check for ID addrs existing in state (we could achieve this by misusing existing syscalls, but I would prefer not to).

@codecov-commenter
Copy link

codecov-commenter commented Nov 9, 2022

Codecov Report

❗ No coverage uploaded for pull request base (integration/builtin-api@54c278f). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 2840559 differs from pull request most recent head 71194a8. Consider uploading reports for the commit 71194a8 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@                    Coverage Diff                     @@
##             integration/builtin-api     #824   +/-   ##
==========================================================
  Coverage                           ?   88.19%           
==========================================================
  Files                              ?       96           
  Lines                              ?    19884           
  Branches                           ?        0           
==========================================================
  Hits                               ?    17537           
  Misses                             ?     2347           
  Partials                           ?        0           

@arajasek arajasek requested a review from anorth November 10, 2022 18:45
Copy link
Member

@anorth anorth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR makes it possible to supply to/from ID addresses that don't actually exist in state at the time of paych creation.
We need to decide if this is something we want, or is undesirable.

I think it's undesirable. It's almost certainly an error from the caller, so a regression in functionality here.

pub mod account {
use super::*;

pub const AUTHENTICATE_MESSAGE_METHOD: u64 = 3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the exported frc42 method number in order to support other actors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite right, thank you.

actors/paych/src/lib.rs Show resolved Hide resolved
// Resolve both parties if necessary.
// Note that this does NOT guarantee that the parties exist in state yet.
let to =
rt.resolve_address(&params.to).with_context_code(ExitCode::USR_NOT_FOUND, || {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prior code returned USR_ILLEGAL_ARGUMENT here (in resolve_to_actor_id as well as if the actor type was wrong). The FRC46 token uses USR_NOT_FOUND.

In the first instance, I think it's better not to change behaviour right now, so use ILLEGAL_ARGUMENT. However, this address resolution thing strikes me as fundamental enough that maybe we should dedicate a new user exit code for it? Let's discuss in Slack.

actors/paych/tests/paych_actor_test.rs Show resolved Hide resolved
Comment on lines 376 to 387
rt.expect_send(
payer_addr,
AUTHENTICATE_MESSAGE_METHOD,
RawBytes::serialize(AuthenticateMessageParams {
signature: sv.clone().signature.unwrap().bytes,
message: sv.signing_bytes().unwrap(),
})
.unwrap(),
TokenAmount::zero(),
RawBytes::default(),
ExitCode::OK,
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is duplicated enough to pull out to a helper function

@anorth
Copy link
Member

anorth commented Nov 11, 2022

FYI @Stebalien

// if raw was an ID address, we need to confirm that it actually exists in the state tree
Protocol::ID => {
let resolved = raw.id().map_err(|_| {
actor_error!(illegal_state, "failed to convert ID address to ID")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Just unwrap() this, we do it everywhere. I think if it deserialized and has ID protocol, this should not fail.

format!("no code for address {}", raw)
})
}
// just resolve all other cases, will fail if not in state tree
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this. Knowing that the Init actor has one map of Address -> ID and another ID -> State, I would expect only the former to be inspected when resolving an address.

When we delete an actor, the address mapping remains but the actor state is deleted. Since the actor doesn't exist any more, I think we want this to fail to resolve in this use case (ref)

I get a sense you were trying to avoid get_actor_code_cid, but I really do think it's the perfect thing. The prior structure of (1) resolve to an ID address, then (2) check the actor exists (has code) was better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, fixed

/// ResolveToActorID resolves the given address to it's actor ID.
/// If an actor ID for the given address dosen't exist yet, it tries to create one by sending
/// ResolveToActorID resolves the given address to its actor ID.
/// If an actor ID for the given address doesn't exist yet, it tries to create one by sending
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arajasek arajasek merged commit 564117f into integration/builtin-api Nov 16, 2022
@arajasek arajasek deleted the asr/paych-accounts branch November 16, 2022 22:21
arajasek added a commit that referenced this pull request Nov 16, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 16, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 17, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 17, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 17, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 21, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 23, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 27, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 28, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 28, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 29, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 30, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Nov 30, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Dec 5, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Dec 7, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
vyzo pushed a commit that referenced this pull request Dec 7, 2022
* Remove the market actor state mutation pattern (#734)

Fixes #656

* Proof of concept exported API for Account actor (#797)

* Export stable methods for public access (#807)

* Export Datacap Actor methods

* Export Init Actor methods

* Export Market Actor methods

* Export Miner Actor methods

* Export Multisig Actor methods

* Export Verifreg Actor methods

* Address review

* Restrict internal APIs of all actors (#809)

* Exported API method for market actor escrow/locked balance (#812)

* Power actor: Add exported getters for raw power (#810)

* Power actor: Add exported getters for raw power

* FRC-XXXX is FRC-0042

* Power actor: network_raw_power: Return this_epoch_raw_byte_power

* Power actor: miner_raw_power: Return whether above consensus min power

* Power actor: types: serialize one-element structs transparently

* Address review

* Miner actor: Add exported getters for info and monies (#811)

* Miner actor: Add exported getters for info and monies

* Tweak comment

* Miner actor: Replace GetWorker and GetControls with IsControllingAddress

* Miner actor: Add exported GetAvailableBalance

* Miner actor: Add exported GetVestingFunds

* Miner actor: Remove exported monies getters

* Miner actor: types: serialize one-element structs transparently

* Address review

* Address review

* Built-in market API for deal proposal metadata (#818)

* Call exported authenticate method from PSD (#829)


Co-authored-by: zenground0 <[email protected]>

* Drop CALLER_TYPES_SIGNABLE and signable caller validation (#821)

* Market actor: Minor improvements to two exported getters (#826)

* Market actor: GetDealTermExported: Return (start_epoch, duration)

* Market actor: Export getter for deal total price

* Exported API for market deal activation state (#819)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs (#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review

* Account actor: Deprecate AuthenticateMessage (#856)

* Market actor: Export PublishStorageDeals (#857)

* Miner: Export several more methods (#863)

* Miner: Export ChangeWorkerAddress

* Miner: Export ChangePeerID

* Miner: Export WithdrawBalance

* Miner: Export ChangeMultiaddrs

* Miner: Export ConfirmUpdateWorkerKey

* Miner: Export RepayDebt

* Miner: Export ChangeOwnerAddress

* Miner: Add exported getters for PeerID & multiaddrs

* Miner: Refactor: Rename ConfirmUpdateWorkerKey to ConfirmChangeWorkerAddress

* Power actor: Export methods to CreateMiner and get miner counts (#868)

* Power: Export CreateMiner

* Power Actor: Export MinerCount and MinerConsensusCount

* Update actors/power/src/lib.rs

Co-authored-by: Alex <[email protected]>

Co-authored-by: Alex <[email protected]>

* Verifreg: Export AddVerifiedClient and GetClaims (#873)

* Verifreg: Rename AddVerifierClientParams to AddVerifiedClientParams

* Verifreg: Export AddVerifiedClient and GetClaims

* Datacap actor: Modify exported methods (#909)

* Datacap: Export Mint and Destroy

* Datacap actor: Deprecate all internal methods

* Datacap actor: Rename BalanceOf to Balance

* Datacap actor: Add Granularity method

* fix: comments on newly exported methods (#910)

Co-authored-by: RK <[email protected]>
Co-authored-by: Alex <[email protected]>
Co-authored-by: ZenGround0 <[email protected]>
Co-authored-by: zenground0 <[email protected]>
arajasek added a commit that referenced this pull request Dec 11, 2022
…#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
arajasek added a commit that referenced this pull request Jan 12, 2023
* Proof of concept exported API for Account actor (#797)

* Export stable methods for public access (#807)

* Export Datacap Actor methods

* Export Init Actor methods

* Export Market Actor methods

* Export Miner Actor methods

* Export Multisig Actor methods

* Export Verifreg Actor methods

* Address review

* Restrict internal APIs of all actors (#809)

* Exported API method for market actor escrow/locked balance (#812)

* Power actor: Add exported getters for raw power (#810)

* Power actor: Add exported getters for raw power

* FRC-XXXX is FRC-0042

* Power actor: network_raw_power: Return this_epoch_raw_byte_power

* Power actor: miner_raw_power: Return whether above consensus min power

* Power actor: types: serialize one-element structs transparently

* Address review

* Miner actor: Add exported getters for info and monies (#811)

* Miner actor: Add exported getters for info and monies

* Tweak comment

* Miner actor: Replace GetWorker and GetControls with IsControllingAddress

* Miner actor: Add exported GetAvailableBalance

* Miner actor: Add exported GetVestingFunds

* Miner actor: Remove exported monies getters

* Miner actor: types: serialize one-element structs transparently

* Address review

* Address review

* Built-in market API for deal proposal metadata (#818)

* Call exported authenticate method from PSD (#829)


Co-authored-by: zenground0 <[email protected]>

* Drop CALLER_TYPES_SIGNABLE and signable caller validation (#821)

* Market actor: Minor improvements to two exported getters (#826)

* Market actor: GetDealTermExported: Return (start_epoch, duration)

* Market actor: Export getter for deal total price

* Exported API for market deal activation state (#819)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs (#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review

* Account actor: Deprecate AuthenticateMessage (#856)

* Market actor: Export PublishStorageDeals (#857)

* Miner: Export several more methods (#863)

* Miner: Export ChangeWorkerAddress

* Miner: Export ChangePeerID

* Miner: Export WithdrawBalance

* Miner: Export ChangeMultiaddrs

* Miner: Export ConfirmUpdateWorkerKey

* Miner: Export RepayDebt

* Miner: Export ChangeOwnerAddress

* Miner: Add exported getters for PeerID & multiaddrs

* Miner: Refactor: Rename ConfirmUpdateWorkerKey to ConfirmChangeWorkerAddress

* Power actor: Export methods to CreateMiner and get miner counts (#868)

* Power: Export CreateMiner

* Power Actor: Export MinerCount and MinerConsensusCount

* Update actors/power/src/lib.rs

Co-authored-by: Alex <[email protected]>

Co-authored-by: Alex <[email protected]>

* Verifreg: Export AddVerifiedClient and GetClaims (#873)

* Verifreg: Rename AddVerifierClientParams to AddVerifiedClientParams

* Verifreg: Export AddVerifiedClient and GetClaims

* Datacap actor: Modify exported methods (#909)

* Datacap: Export Mint and Destroy

* Datacap actor: Deprecate all internal methods

* Datacap actor: Rename BalanceOf to Balance

* Datacap actor: Add Granularity method

* fix: comments on newly exported methods (#910)

* Miner: Export method to GetPendingOwner

* MarketNotifyDeal (#944)


Co-authored-by: zenground0 <[email protected]>

* Verifreg: Call AuthenticateMessage instead of validating siggys

* Multisig: Do not export any functionality (#967)

* use const for EX_DEAL_EXPIRED (#954)

* Address review

Co-authored-by: Alex <[email protected]>
Co-authored-by: ZenGround0 <[email protected]>
Co-authored-by: zenground0 <[email protected]>
Co-authored-by: Shashank <[email protected]>
shamb0 pushed a commit to shamb0/builtin-actors that referenced this pull request Jan 31, 2023
…filecoin-project#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review
shamb0 pushed a commit to shamb0/builtin-actors that referenced this pull request Jan 31, 2023
…ecoin-project#1004)

* Proof of concept exported API for Account actor (filecoin-project#797)

* Export stable methods for public access (filecoin-project#807)

* Export Datacap Actor methods

* Export Init Actor methods

* Export Market Actor methods

* Export Miner Actor methods

* Export Multisig Actor methods

* Export Verifreg Actor methods

* Address review

* Restrict internal APIs of all actors (filecoin-project#809)

* Exported API method for market actor escrow/locked balance (filecoin-project#812)

* Power actor: Add exported getters for raw power (filecoin-project#810)

* Power actor: Add exported getters for raw power

* FRC-XXXX is FRC-0042

* Power actor: network_raw_power: Return this_epoch_raw_byte_power

* Power actor: miner_raw_power: Return whether above consensus min power

* Power actor: types: serialize one-element structs transparently

* Address review

* Miner actor: Add exported getters for info and monies (filecoin-project#811)

* Miner actor: Add exported getters for info and monies

* Tweak comment

* Miner actor: Replace GetWorker and GetControls with IsControllingAddress

* Miner actor: Add exported GetAvailableBalance

* Miner actor: Add exported GetVestingFunds

* Miner actor: Remove exported monies getters

* Miner actor: types: serialize one-element structs transparently

* Address review

* Address review

* Built-in market API for deal proposal metadata (filecoin-project#818)

* Call exported authenticate method from PSD (filecoin-project#829)

Co-authored-by: zenground0 <[email protected]>

* Drop CALLER_TYPES_SIGNABLE and signable caller validation (filecoin-project#821)

* Market actor: Minor improvements to two exported getters (filecoin-project#826)

* Market actor: GetDealTermExported: Return (start_epoch, duration)

* Market actor: Export getter for deal total price

* Exported API for market deal activation state (filecoin-project#819)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs (filecoin-project#824)

* Paych actor: Drop account req, use AuthenticateMessage to verify sigs

* Address review

* Address review

* Account actor: Deprecate AuthenticateMessage (filecoin-project#856)

* Market actor: Export PublishStorageDeals (filecoin-project#857)

* Miner: Export several more methods (filecoin-project#863)

* Miner: Export ChangeWorkerAddress

* Miner: Export ChangePeerID

* Miner: Export WithdrawBalance

* Miner: Export ChangeMultiaddrs

* Miner: Export ConfirmUpdateWorkerKey

* Miner: Export RepayDebt

* Miner: Export ChangeOwnerAddress

* Miner: Add exported getters for PeerID & multiaddrs

* Miner: Refactor: Rename ConfirmUpdateWorkerKey to ConfirmChangeWorkerAddress

* Power actor: Export methods to CreateMiner and get miner counts (filecoin-project#868)

* Power: Export CreateMiner

* Power Actor: Export MinerCount and MinerConsensusCount

* Update actors/power/src/lib.rs

Co-authored-by: Alex <[email protected]>

Co-authored-by: Alex <[email protected]>

* Verifreg: Export AddVerifiedClient and GetClaims (filecoin-project#873)

* Verifreg: Rename AddVerifierClientParams to AddVerifiedClientParams

* Verifreg: Export AddVerifiedClient and GetClaims

* Datacap actor: Modify exported methods (filecoin-project#909)

* Datacap: Export Mint and Destroy

* Datacap actor: Deprecate all internal methods

* Datacap actor: Rename BalanceOf to Balance

* Datacap actor: Add Granularity method

* fix: comments on newly exported methods (filecoin-project#910)

* Miner: Export method to GetPendingOwner

* MarketNotifyDeal (filecoin-project#944)

Co-authored-by: zenground0 <[email protected]>

* Verifreg: Call AuthenticateMessage instead of validating siggys

* Multisig: Do not export any functionality (filecoin-project#967)

* use const for EX_DEAL_EXPIRED (filecoin-project#954)

* Address review

Co-authored-by: Alex <[email protected]>
Co-authored-by: ZenGround0 <[email protected]>
Co-authored-by: zenground0 <[email protected]>
Co-authored-by: Shashank <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants