In the kaia_getTotalSupply API, add an optional showPartial *bool parameter that controls the error behavior.
As-is: API returns...
(a) Return a full information or
(b) Return a partial information
To-be: API returns..
Regular use case: If showPartial == nil || *showPartial == false (default)
(a) Return a full information or
(c) API Fails. If --upstream-en is configured and the error contains "missing trie node", retry with upstream.
Advanced/Debugging use case: If *showPartial == true
(a) Return a full information or
(b) Return a partial information
More generous --upstream-en criteria
Updated shouldRequestUpstream() to recognize a wrapped error that contains "missing trie node" error.
Rationale
Regular users of this API are interested in the full information including the totalSupply field. For those uses, responses (b) and (c) are both unsatisfactory. But compared to (b), (c) is better because it can at least retry via --upstream-en.
Please put an x in the boxes related to your change.
[x] Bugfix
[ ] New feature or enhancement
[ ] Others
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
[x] I have read the CLA and signed by comment I have read the CLA Document and I hereby sign the CLA in first time contribute
[x] Lint and unit tests pass locally with my changes ($ make test)
[x] I have added tests that prove my fix is effective or that my feature works
[ ] I have added necessary documentation (if appropriate)
[ ] Any dependent changes have been merged and published in downstream modules
Related issues
Please leave the issue numbers or links related to this PR here.
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...
Proposed changes
kaia_getTotalSupply
API, add an optionalshowPartial *bool
parameter that controls the error behavior.showPartial == nil || *showPartial == false
(default)--upstream-en
is configured and the error contains "missing trie node", retry with upstream.*showPartial == true
--upstream-en
criteriashouldRequestUpstream()
to recognize a wrapped error that contains "missing trie node" error.Rationale
Regular users of this API are interested in the full information including the
totalSupply
field. For those uses, responses (b) and (c) are both unsatisfactory. But compared to (b), (c) is better because it can at least retry via--upstream-en
.Response example
(a) Return a full information
(b) Return a partial information with the
result.error
field containing "missing trie node" error message.(c) API Fails
Types of changes
Please put an x in the boxes related to your change.
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
I have read the CLA Document and I hereby sign the CLA
in first time contribute$ make test
)Related issues
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...