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

Bump default autofund amount & fail fast if not enough balance for autofunding #609

Merged
merged 1 commit into from
Sep 23, 2020

Conversation

jsign
Copy link
Contributor

@jsign jsign commented Sep 23, 2020

PR:

  • Bump default autofunding amount to what was decided for SR2.
  • Fail creating new addresses if they will most probably fail if the master address doesn't have enough balance.

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
@jsign jsign added enhancement New feature or request patch labels Sep 23, 2020
@jsign jsign added this to the Sprint 46 milestone Sep 23, 2020
@jsign jsign self-assigned this Sep 23, 2020
@@ -295,7 +295,7 @@ func setupFlags() error {
pflag.String("repopath", "~/.powergate", "Path of the repository where Powergate state will be saved.")
pflag.Bool("devnet", false, "Indicate that will be running on an ephemeral devnet. --repopath will be autocleaned on exit.")
pflag.String("ipfsapiaddr", "/ip4/127.0.0.1/tcp/5001", "IPFS API endpoint multiaddress. (Optional, only needed if FFS is used)")
pflag.Int64("walletinitialfund", 4000000000000000, "FFS initial funding transaction amount in attoFIL received by --lotusmasteraddr. (if set)")
pflag.Int64("walletinitialfund", 250_000_000_000_000_000, "FFS initial funding transaction amount in attoFIL received by --lotusmasteraddr. (if set)")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was decided to default to 0.25 FIL in SR2.

if err != nil {
return "", fmt.Errorf("getting balance from master addr: %s", err)
}
if balance.LessThan(types.BigAdd(types.BigInt{Int: m.iAmount}, types.NewInt(feeThreshold))) {
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 if most prob the txn will fail if we don't have enough funds. The txn is sent async since is a blocking process in the Lotus API now since has to estimate feeds and that takes time.

We still have two improvements to do here:

  • Instead of using feeThreshold as a constant, we could craft a more dynamic calculation of estimated fees. (autofunding: dynamic calculation of fee limit #610)
  • Think about a possibly more reliable way to send the funding txn. If for some wild reason the sent txn failed, we'd get some unwanted result of a 0 balance addr. So looks like we should have a better tracking mechanism about this... not sure though what might be a good solution apart from just retrying with some exponential backoff. (autofunding: more reliable track of funding txn #611)

@jsign jsign marked this pull request as ready for review September 23, 2020 14:37
@jsign jsign requested a review from asutula September 23, 2020 14:37
@jsign jsign merged commit c9a807b into master Sep 23, 2020
@jsign jsign deleted the jsign/failifnotenoughfunds branch September 23, 2020 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants