-
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
perf: mempool: lower priority optimizations #10693
perf: mempool: lower priority optimizations #10693
Conversation
…hether curTsLks are needed as comments
…t we only need to make a single allocation
…ything except an ID address is robust) here, and return if so. That will: be faster reduce the size of this cache by half, because we can drop mp.keyCache.Add(ka, ka) on line 491.
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.
Will do a second pass tomorrow just to squint at the locks, but LGTM.
return mp.resolveToKeyFromID(ctx, addr) | ||
} | ||
|
||
func (mp *MessagePool) resolveToKeyFromID(ctx context.Context, addr address.Address) (address.Address, error) { |
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 don't think we need a new method here, just add the "is not ID" check to resolveToKey
and leave it as before?
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 prefer the way I have it. I think it's easier to read! Definitely happy to defer to your suggestion if you have a preference
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.
No strong preference!
mset, ok, err := mp.getPendingMset(ctx, from) | ||
if err != nil { | ||
log.Warnf("errored while getting pending mset: %w", err) | ||
return nil, err |
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.
Can we please chain these errors (return nil, xerrors.Errorf("....%w", err)
?
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.
(it makes debugging a lot easier when things go wrong)
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.
YES, that code is a lot cleaner! Appreciate the tip!!
return mp.resolveToKeyFromID(ctx, addr) | ||
} | ||
|
||
func (mp *MessagePool) resolveToKeyFromID(ctx context.Context, addr address.Address) (address.Address, error) { |
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.
No strong preference!
return mp.resolveToKeyFromID(ctx, addr) | ||
} | ||
|
||
func (mp *MessagePool) resolveToKeyFromID(ctx context.Context, addr address.Address) (address.Address, error) { |
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.
@Stebalien In what cases can an actor have both an f4 and an f2 address? Is that just EVM actors (not including EthAccounts)?
I wanna make sure you can never have an actor have both an f4 and an f2 address AND serving as a top-level sender, because that would make things funky here.
(Not really related to changes in this PR)
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.
Just EVM actors, at least for now. Account abstraction may someday change this, but that's a whole can of worms.
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 looks correct. I'm slightly concerned about the dance with mp.republished
(we're assuming that nothing changes while we drop the lock), but that's existing behavior.
Related Issues
#10597
Proposed Changes
Checklist
Before you mark the PR ready for review, please make sure that:
<PR type>: <area>: <change being made>
fix: mempool: Introduce a cache for valid signatures
PR type
: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, testarea
, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps