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:fountain:add grant-datacap support #10856

Merged
merged 5 commits into from
May 12, 2023
Merged

Conversation

JesseXie
Copy link
Contributor

Related Issues

adding the support to grant datacap from fountain

Proposed Changes

Add a new endpoint for grant datacap.

Additional Info

Checklist

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

  • Commits have a clear commit message.
  • [ x] 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, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

@JesseXie JesseXie requested a review from a team as a code owner May 11, 2023 06:42
Copy link
Contributor

@maciejwitowski maciejwitowski left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! (I'm not an expert in FIL+ though)

smsg, err = h.api.MpoolPushMessage(
h.ctx, &types.Message{
Params: params,
From: h.from,
Copy link
Contributor

Choose a reason for hiding this comment

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

I would consider sanity-checking that h.from is a valid verifier (notary) with enough data cap for this step, but that's optional.

For example of how to do so:

lotus/cli/filplus.go

Lines 656 to 676 in 6ca975e

func checkNotary(ctx context.Context, api v0api.FullNode, vaddr address.Address) (bool, abi.StoragePower, error) {
vid, err := api.StateLookupID(ctx, vaddr, types.EmptyTSK)
if err != nil {
return false, big.Zero(), err
}
act, err := api.StateGetActor(ctx, verifreg.Address, types.EmptyTSK)
if err != nil {
return false, big.Zero(), err
}
apibs := blockstore.NewAPIBlockstore(api)
store := adt.WrapStore(ctx, cbor.NewCborStore(apibs))
st, err := verifreg.Load(store, act)
if err != nil {
return false, big.Zero(), err
}
return st.VerifierDataCap(vid)
}

@JesseXie JesseXie merged commit bc60171 into master May 12, 2023
93 checks passed
@JesseXie JesseXie deleted the lotus-fountain-add-datacap branch May 12, 2023 18:20
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.

None yet

3 participants