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
Improve action pool #4030
Improve action pool #4030
Conversation
* support input/data field in web3 request * add test --------- Co-authored-by: CoderZhi <thecoderzhi@gmail.com>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #4030 +/- ##
==========================================
+ Coverage 75.38% 76.40% +1.02%
==========================================
Files 303 332 +29
Lines 25923 28414 +2491
==========================================
+ Hits 19541 21710 +2169
- Misses 5360 5602 +242
- Partials 1022 1102 +80 ☔ View full report in Codecov by Sentry. |
return act | ||
} | ||
|
||
func (ap *accountPool) Range(callback func(addr string, acct ActQueue)) { |
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.
func (ap *accountPool) Range(callback func(addr string, acct ActQueue)) {
for addr, account := range ap.accounts {
callback(addr, account.actQueue)
}
heap.Init(&ap.priorityQueue)
}
@@ -215,14 +221,14 @@ func (worker *queueWorker) Reset(ctx context.Context) { | |||
worker.mu.RLock() | |||
defer worker.mu.RUnlock() | |||
|
|||
for from, queue := range worker.accountActs { | |||
worker.accountActs.Range(func(from string, queue ActQueue) { |
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.
should worker.mu.Lock()
be used here instead of worker.mu.RLock()
?
} | ||
|
||
if intrinsicGas, _ := act.IntrinsicGas(); atomic.LoadUint64(&ap.gasInPool)+intrinsicGas > ap.cfg.MaxGasLimitPerPool { | ||
_actpoolMtc.WithLabelValues("overMaxGasLimitPerPool").Inc() |
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.
let's keep this metric, to count the number of this type of rejected tx
@@ -40,6 +40,8 @@ var ( | |||
Name: "iotex_actpool_rejection_metrics", | |||
Help: "actpool metrics.", | |||
}, []string{"type"}) | |||
// ErrGasTooHigh error when the intrinsic gas of an action is too high | |||
ErrGasTooHigh = errors.New("action gas is too high") |
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.
move to action/const.go
? that's where all other errors like ErrTxPoolOverflow, ErrNonceTooHigh
are defined
} | ||
worker.ap.removeInvalidActs([]action.SealedEnvelope{*actToReplace}) | ||
if actToReplace.SenderAddress().String() == sender && actToReplace.Nonce() == nonce { | ||
err = action.ErrTxPoolOverflow |
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.
add a metric here, to count the number of this type error
_actpoolMtc.WithLabelValues("overMaxNumActsPerPool").Inc()
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 7 New issues |
* fix Dockerfile * [api] support "input" field in web3 request params (#3971) * support input/data field in web3 request * add test --------- Co-authored-by: CoderZhi <thecoderzhi@gmail.com> * set gprc MaxConnectionIdle to 5 min (#4023) * draft * [actpool] only expire tx with nonce > pendingNonce * implement replacing logic * fix accountpool update * unittest * delete account * place empty queue at the end * add unittest * address comments * Update actpool.go * address comments * Rebase queueworker.go --------- Co-authored-by: Dustin Xie <dahuaxie@gmail.com> Co-authored-by: Chen Chen <34592639+envestcc@users.noreply.github.com> Co-authored-by: envestcc <chen1233216@hotmail.com>
Fixes #(issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: