Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

feat: Allow VerifiedClient DataCap to be topped up #1390

Merged
merged 2 commits into from
Apr 8, 2021

Conversation

placer14
Copy link
Contributor

@placer14 placer14 commented Mar 31, 2021

Implements FIP-0012 and fixes #1325.

Thoughts on these changes:

  • The mock runtime addVerifiedClient function is now overloaded to support an optional expectedAllowance arg to be used in the cases where VerifiedClients will now have more than what was initially allotted. This makes the verification of an expectedAllownace a concern on the caller rather than letting the function reflect on its internal before/after state to verify correctness. I'd personally prefer the latter to keep the call simple, but there were errors when I attempted to access the runtime map for the "before" state of the Client's DataCap allowance. (An example of that is at https://gist.github.com/placer14/f2134a4064373607da44b48b4f338d69.)
  • This change will mix all Verifier's allowances together for each Client address. If there were ever a need to know how DataCap is used on a per-Verifier basis, we would be eliminating that option here.
  • The unit test which protects that a VerifiedClient can be referred to be its ID and non-ID addr is also protecting its ability to be topped-up. If it's preferred that these behaviors are protected by separate tests, I can, but felt the redundancy was unnecessary and left them combined.
  • This change does not limit the DataCap upper bound and expects that DataCap boundaries are already protected where necessary.

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.

Looks good to me, but please wait for approval from @ZenGround0

func (h *verifRegActorTestHarness) addVerifiedClient(rt *mock.Runtime, verifier, client address.Address, caps ...verifreg.DataCap) {
// caps[0] expects allowance to be set
// caps[1] (optional) expected allowance to be verified
// additional args are ignored
Copy link
Member

Choose a reason for hiding this comment

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

Fail the test rather than ignore an unexpected argument. Fail also if the slice has length zero.

Alternatively, I would be just as happy if the two args were explicit, and the usually-redundant expected cap was always explicitly passed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I want to change this to two explict arguments.

Copy link
Contributor

@ZenGround0 ZenGround0 left a comment

Choose a reason for hiding this comment

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

Since your week of work is over @placer14 I'm taking this PR over. I'm going to make some changes to testing but the code change looks good.

func (h *verifRegActorTestHarness) addVerifiedClient(rt *mock.Runtime, verifier, client address.Address, caps ...verifreg.DataCap) {
// caps[0] expects allowance to be set
// caps[1] (optional) expected allowance to be verified
// additional args are ignored
Copy link
Contributor

Choose a reason for hiding this comment

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

I want to change this to two explict arguments.

@ZenGround0 ZenGround0 force-pushed the mg/feat/fip0012-impl branch from ca8050d to c02e51f Compare April 8, 2021 15:25
@ZenGround0 ZenGround0 merged commit 017008a into master Apr 8, 2021
@ZenGround0 ZenGround0 mentioned this pull request Apr 8, 2021
28 tasks
ZenGround0 added a commit that referenced this pull request Apr 13, 2021
* feat: Allow VerifiedClient DataCap to be topped up
* Modify tests

Co-authored-by: ZenGround0 <ZenGround0@users.noreply.github.com>
ZenGround0 added a commit that referenced this pull request Apr 27, 2021
* feat: Allow VerifiedClient DataCap to be topped up
* Modify tests

Co-authored-by: ZenGround0 <ZenGround0@users.noreply.github.com>
ZenGround0 added a commit that referenced this pull request Apr 27, 2021
* feat: Allow VerifiedClient DataCap to be topped up
* Modify tests

Co-authored-by: ZenGround0 <ZenGround0@users.noreply.github.com>
ZenGround0 added a commit that referenced this pull request Apr 27, 2021
* feat: Allow VerifiedClient DataCap to be topped up
* Modify tests

Co-authored-by: ZenGround0 <ZenGround0@users.noreply.github.com>
ZenGround0 added a commit that referenced this pull request May 4, 2021
* v5 actors
* feat: Adjust consensus fault reward to meet FIL-0011
* feat: Allow VerifiedClient DataCap to be topped up (#1390)
* Remove out of date test
* Update to go 1.16
* Remove old migration and simplify agent tests

Co-authored-by: ZenGround0 <ZenGround0@users.noreply.github.com>
Co-authored-by: Mike Greenberg <mike.greenberg@protocol.ai>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clients who apply for additional DataCap need to use a new address every time
3 participants