-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Set lower feecap on PoSt messages with low balance #4217
Conversation
storage/wdpost_run.go
Outdated
mm.GasPremium = msg.GasPremium | ||
} | ||
|
||
mm.GasFeeCap, err = s.api.GasEstimateFeeCap(ctx, &mm, 2, types.EmptyTSK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should for sure be more than 2, if you are setting Premium for 5 block inclusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set it a bit higher, bust still pretty low - this is estimating the lowest fee we'll set on the message if we don't have enough funds in any account to set more. If we have enough funds, we'll use the default estimation from GasEstimateMessageGas above
d43e256
to
bcab3e5
Compare
} | ||
|
||
leastBad := address.Undef | ||
bestAvail := minFunds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this method could be written more cleanly as something like:
for _,a := range append(controlAddrs, owner, worker) {
ok, err := maybeUseAddress(a, &leastBad, &bestAvail)
if ok {
return leastBad, bestAvail
}
}
c56b4ec
to
bd34424
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work, but I'm confused about the logic. We seem to be doing:
- if we find any address with more than `goodFunds`, use that address
- if not, of all the addresses that have more than `minFunds`, use the one with most balance
- if no such addresses exist, eff it, use worker (even if there's a control address with greater balance than worker)
Why not do:
- if we find any address with more than `goodFunds`, use that address
- if not, use the address that has the most balance (regardless of whether it is better than `minFunds` or not)
The change would probably be to initialize bestAvail
to worker's balance at line 39, and remove the worker from the list of addresses we call maybeUseAddress
with (and remove the special-case in 53-61).
bd34424
to
2571277
Compare
2571277
to
9f807f4
Compare
81ae8ca
to
1999156
Compare
…st-smaller-feecap Set lower feecap on PoSt messages with low balance
More testing definitely todo