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

Expose a retrieval-deal filter similar ( if not identical ) to the storage-filter #4195

Closed
ribasushi opened this issue Oct 6, 2020 · 0 comments · Fixed by #4424
Closed
Assignees

Comments

@ribasushi
Copy link
Collaborator

Miners need ability to reject retrieval deals based on an external hook just like they can do for storage deals today:

Override(new(dtypes.DealFilter), modules.BasicDealFilter(dealfilter.CliDealFilter(cfg.Dealmaking.Filter))),

If possible - the same Filter=... config option should be reused, and the JSON fed to the program can have an extra identifier "this is a storage deal" / "this is a retrieval deal".

At present the storage-deal `Filter` program receives the following as input:
expand
{
  "Proposal": {
    "PieceCID": {
      "/": "baga6ea4seaqkszyboqhhsakpcpesq7xptojhacvewgde3hykipl7e2idqukboky"
    },
    "PieceSize": 134217728,
    "VerifiedDeal": false,
    "Client": "t1kxd4qebtvwx6bn6a4ypc3afiwmdhsabtppdmwxi",
    "Provider": "t01013",
    "Label": "mAXCg5AIgPjcct4EJGoUpVyBp1LNS+nObc+wuAm0JLEbRR9RnNeM",
    "StartEpoch": 7664,
    "EndEpoch": 528705,
    "StoragePricePerEpoch": "62500000",
    "ProviderCollateral": "270047582",
    "ClientCollateral": "0"
  },
  "ClientSignature": {
    "Type": 1,
    "Data": "U6b7DMxGAunm3+P8gi7efmS8ecnsTAKc8sGjRYS0UHhX/TupXLH93CDngqEcUQce2Zkyb5AT3Y963cJgVyoW3QE="
  },
  "ProposalCid": {
    "/": "bafyreihtud3iumsm4dyio3bu3sstj6w5lfs5wucoiikisyjpqe4yl63rwq"
  },
  "AddFundsCid": null,
  "PublishCid": null,
  "Miner": "12D3KooWGdpXeqJbLEUyJp4o1GvLVxzoGiYGKiYUq6LB5r8f1vF4",
  "Client": "12D3KooWSRvagorF8HSaraZRpXWq4JpjrfJfa6kQ22kv8wnxztRF",
  "State": 15,
  "PiecePath": "",
  "MetadataPath": "",
  "SlashEpoch": 0,
  "FastRetrieval": true,
  "Message": "",
  "StoreID": 2,
  "FundsReserved": "0",
  "Ref": {
    "TransferType": "graphsync",
    "Root": {
      "/": "bafykbzacea7dohfxqeervbjjk4qgtvftkl5hhg3t5qxae3ijfrdncr6um426g"
    },
    "PieceCid": null,
    "PieceSize": 0
  },
  "AvailableForRetrieval": false,
  "DealID": 0,
  "CreationTime": "2020-10-01T15:58:00.157336467Z"
}

Its exit code is being evaluated here:

c := exec.Command("sh", "-c", cmd)
c.Stdin = bytes.NewReader(j)
c.Stdout = &out
c.Stderr = &out
switch err := c.Run().(type) {
case nil:
return true, "", nil
case *exec.ExitError:
return false, out.String(), nil
default:
return false, "filter cmd run error", err
}

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 a pull request may close this issue.

2 participants