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

Include verified-clients and remaining data-cap #795

Merged
merged 8 commits into from
Mar 11, 2021
Merged

Include verified-clients and remaining data-cap #795

merged 8 commits into from
Mar 11, 2021

Conversation

jsign
Copy link
Contributor

@jsign jsign commented Mar 8, 2021

This PR:

  • Includes in the Addresses(...) API information about verified-addresses.
  • The scheduler will fail-fast in any of the following cases:
    • The wallet-address isn't verified.
    • The remaining data-cap of the verified wallet address isn't enough to make the deal.

jsign added 3 commits March 8, 2021 10:53
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
@jsign jsign self-assigned this Mar 8, 2021
jsign added 3 commits March 9, 2021 11:09
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
package module
package lotuswallet
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exploring moving away from module package names, too generic.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me.

Comment on lines 137 to 149
if cfg.VerifiedDeal {
vci, err := fc.wm.GetVerifiedClientInfo(ctx, cfg.Addr)
if err != nil && err != wallet.ErrNoVerifiedClient {
return nil, nil, 0, fmt.Errorf("get address verified client info: %s", err)
}
if err == wallet.ErrNoVerifiedClient {
return nil, nil, 0, fmt.Errorf("wallet address isn't a verified client")
}
pieceSizeBig := big.NewInt(int64(pieceSize))
if pieceSizeBig.Cmp(vci.RemainingDatacapBytes) == 1 {
return nil, nil, 0, fmt.Errorf("the remaining data-cap %d MiB is less than piece-size %d MiB", pieceSize/1024/1024, vci.RemainingDatacapBytes.Uint64()/1024/1024)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fail-fast logic to unverified or not-enough-data-cap situations.

VerifiedClientInfo verified_client_info = 5;

message VerifiedClientInfo {
string remaining_datacap_bytes = 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is string since the native type is BigInt, so in some extreme case, the user could have a lot of verified deal capacity.

@jsign jsign requested a review from asutula March 9, 2021 17:59
@jsign jsign marked this pull request as ready for review March 9, 2021 17:59
Copy link
Member

@asutula asutula left a comment

Choose a reason for hiding this comment

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

Nice!

package module
package lotuswallet
Copy link
Member

Choose a reason for hiding this comment

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

Sounds good to me.

jsign added 2 commits March 10, 2021 12:46
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
@jsign jsign merged commit aee7459 into master Mar 11, 2021
@jsign jsign deleted the jsign/vc branch March 11, 2021 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants