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

feat: wallet: per-token filtering rules #8428

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

Conversation

magik6k
Copy link
Contributor

@magik6k magik6k commented Apr 4, 2022

Related Issues

resolves #7670

Proposed Changes

This PR adds experimental lotus-wallet filtering rules. For more see the lotus-wallet command description.

TODO

  • Tests
  • Integrate
  • Docs
  • (followup) Make sure all signing operations specify signature type (e.g. market ask sigs)

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • All commits have a clear commit message.
  • The PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, test
    • area: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps
  • This PR has tests for new functionality or change in behaviour
  • If new user-facing features are introduced, clear usage guidelines and / or documentation updates should be included in https://lotus.filecoin.io or Discussion Tutorials.
  • CI is green

@magik6k magik6k force-pushed the feat/wallet-rules branch 2 times, most recently from d97f625 to ade6cec Compare April 10, 2022 12:37
cmd/lotus-wallet/main.go Outdated Show resolved Hide resolved
Copy link
Contributor

@travisperson travisperson left a comment

Choose a reason for hiding this comment

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

I'd imagine a lot of people are going to want to write these rules directly in go and generate them due to the complexity of the nested structure and reuse of common rules.

We should make sure that all required methods are exported to support generating rules. This will also allow people to test and verify that their rules work as intended.

cmd/lotus-wallet/main.go Show resolved Hide resolved
@magik6k magik6k marked this pull request as ready for review June 1, 2022 10:11
@magik6k magik6k requested a review from a team as a code owner June 1, 2022 10:11
@magik6k magik6k changed the title [WIP] feat: wallet: per-token filtering rules feat: wallet: per-token filtering rules Jun 1, 2022
Copy link
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

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

Some notes, not done yet.

// Token creation time. Can be used to revoke older tokens
Created time.Time

// Rules limit actions which can be performed with a tokes. By default, when
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Rules limit actions which can be performed with a tokes. By default, when
// Rules limit actions which can be performed with a token. By default, when

is one of the specified addresses
- {"Destination": {"Addr":["fXXX",..], "Next": Rule}} - Check that the
destination address is one of the specified addresses
- {"Method": {"Method":[number..], "Next": Rule}} - Check that the method number
Copy link
Contributor

Choose a reason for hiding this comment

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

This gets somewhat limited because MethodNums overlap between actors (so you can't easily only allow SubmitWindowedPost without also allowing whatever number 5 is for all the other actors)...It's fine, though I would call it out in the examples below.

Copy link
Contributor

Choose a reason for hiding this comment

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

@arajasek Wouldn't you just chain a destination rule with the Method rule to make sure you're calling the right method?

Copy link
Contributor

Choose a reason for hiding this comment

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

@geoff-vball Yeah, that would work, but then you're only approving PoSts to specific miner addresses (which is not an unreasonable restriction). Slightly blunts the overall utility.

}
fallthrough
case ErrAccept:

Copy link
Contributor

Choose a reason for hiding this comment

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

Add comment that we explicitly "do nothing" here?

"github.com/ipfs/go-cid"
"golang.org/x/xerrors"

market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market

@arajasek
Copy link
Contributor

The client's dealStarter method uses the Lotus API's WalletSign

dealProposalSig, err := a.WalletSign(ctx, walletKey, dealProposalSerialized)

This method always indicates the type as Unknown, which could cause issues...

Type: api.MTUnknown,

@rjan90
Copy link
Contributor

rjan90 commented Sep 10, 2024

@magik6k Do you plan to work, and land this anytime soon? Else, should we close it?

@rjan90
Copy link
Contributor

rjan90 commented Sep 10, 2024

Returning the PR to draft.

@BigLep BigLep marked this pull request as draft September 10, 2024 14:48
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.

Remote wallet management for lotus-miner
5 participants