8000 Nil Pointer Dereference Error When Querying Transactions with Proof in CometBFT · Issue #3352 · cometbft/cometbft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Nil Pointer Dereference Error When Querying Transactions with Proof in CometBFT #3352

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

Closed
tuky191 opened this issue Jun 27, 2024 · 0 comments · Fixed by #3355
Closed

Nil Pointer Dereference Error When Querying Transactions with Proof in CometBFT #3352

tuky191 opened this issue Jun 27, 2024 · 0 comments · Fixed by #3355
Assignees
Labels
bug Something isn't working rpc
Milestone

Comments

@tuky191
Copy link
tuky191 commented Jun 27, 2024

Bug Report

Have you tried the latest version: yes

ABCI app: any CosmosSDK chain

What happened?

When querying a transaction from LCD, that has min_retain_blocks set, the result is nil pointer error for transactions from blocks that had been deleted away.

for example:

https://api-injective-ia.cosmosia.notional.ventures/cosmos/tx/v1beta1/txs/71B0034D463EC79CB0011C7F4EA9EE3B39342AF6BE40AA0402C672A43B21DA3B

{"code":2,"message":"runtime error: invalid memory address or nil pointer dereference: panic","details":[]}

The transaction itself is present in the CometBFT, which can be proved by calling the TX RPC endpoint directly with and without a proof.

https://rpc-injective-ia.cosmosia.notional.ventures/tx?hash=0x71B0034D463EC79CB0011C7F4EA9EE3B39342AF6BE40AA0402C672A43B21DA3B&prove=true

{
  "jsonrpc": "2.0",
  "id": -1,
  "error": {
    "code": -32603,
    "message": "Internal error",
    "data": "runtime error: invalid memory address or nil pointer dereference"
  }
}

https://rpc-injective-ia.cosmosia.notional.ventures/tx?hash=0x71B0034D463EC79CB0011C7F4EA9EE3B39342AF6BE40AA0402C672A43B21DA3B&prove=false

{
  "jsonrpc": "2.0",
  "id": -1,
  "result": {
    "hash": "71B0034D463EC79CB0011C7F4EA9EE3B39342AF6BE40AA0402C672A43B21DA3B",
    "height": "75002060",
    "index": 5,
    "tx_result": {
      "code": 0,
      "data": 
omitted

Root cause for the nil pointer error can be found here. When block is no longer available, LoadBlock returns nil Block, which triggers the panic on the next line.

cometbft/rpc/core/tx.go

Lines 116 to 117 in 7f24fd2

block := env.BlockStore.LoadBlock(r.Height)
proof = block.Data.Txs.Proof(int(r.Index))

What did you expect to happen?

I expect an error stating that proof is not available, since block had been pruned away.

@tuky191 tuky191 added bug Something isn't working needs-triage This issue/PR has not yet been triaged by the team. labels Jun 27, 2024
@tuky191 tuky191 changed the title https://api-injective-ia.cosmosia.notional.ventures/cosmos/tx/v1beta1/txs/71B0034D463EC79CB0011C7F4EA9EE3B39342AF6BE40AA0402C672A43B21DA3B Nil Pointer Dereference Error When Querying Transactions with Proof in CometBFT Jun 27, 2024
@melekes melekes added rpc and removed needs-triage This issue/PR has not yet been triaged by the team. labels Jun 28, 2024
@melekes melekes added this to CometBFT Jun 28, 2024
@github-project-automation github-project-automation bot moved this to Todo in CometBFT Jun 28, 2024
@melekes melekes self-assigned this Jun 28, 2024
melekes added a commit that referenced this issue Jun 28, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 28, 2024
when block is absent
Closes #3352

<!--

Please add a reference to the issue that this PR addresses and indicate
which
files are most critical to review. If it fully addresses a particular
issue,
please include "Closes #XXX" (where "XXX" is the issue number).

If this PR is non-trivial/large/complex, please ensure that you have
either
created an issue that the team's had a chance to respond to, or had some
discussion with the team prior to submitting substantial pull requests.
The team
can be reached via GitHub Discussions or the Cosmos Network Discord
server in
the #cometbft channel. GitHub Discussions is preferred over Discord as
it
allows us to keep track of conversations topically.
https://github.com/cometbft/cometbft/discussions

If the work in this PR is not aligned with the team's current
priorities, please
be advised that it may take some time before it is merged - especially
if it has
not yet been discussed with the team.

See the project board for the team's current priorities:
https://github.com/orgs/cometbft/projects/1

-->

---

#### PR checklist

- [ ] ~~Tests written/updated~~
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] ~~Updated relevant documentation (`docs/` or `spec/`) and code
comments~~
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
@github-project-automation github-project-automation bot moved this from Todo to Done in CometBFT Jun 28, 2024
mergify bot pushed a commit that referenced this issue Jun 28, 2024
when block is absent
Closes #3352

<!--

Please add a reference to the issue that this PR addresses and indicate
which
files are most critical to review. If it fully addresses a particular
issue,
please include "Closes #XXX" (where "XXX" is the issue number).

If this PR is non-trivial/large/complex, please ensure that you have
either
created an issue that the team's had a chance to respond to, or had some
discussion with the team prior to submitting substantial pull requests.
The team
can be reached via GitHub Discussions or the Cosmos Network Discord
server in
the #cometbft channel. GitHub Discussions is preferred over Discord as
it
allows us to keep track of conversations topically.
https://github.com/cometbft/cometbft/discussions

If the work in this PR is not aligned with the team's current
priorities, please
be advised that it may take some time before it is merged - especially
if it has
not yet been discussed with the team.

See the project board for the team's current priorities:
https://github.com/orgs/cometbft/projects/1

-->

---

#### PR checklist

- [ ] ~~Tests written/updated~~
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] ~~Updated relevant documentation (`docs/` or `spec/`) and code
comments~~
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

(cherry picked from commit 3d9bbb6)
mergify bot pushed a commit that referenced this issue Jun 28, 2024
when block is absent
Closes #3352

<!--

Please add a reference to the issue that this PR addresses and indicate
which
files are most critical to review. If it fully addresses a particular
issue,
please include "Closes #XXX" (where "XXX" is the issue number).

If this PR is non-trivial/large/complex, please ensure that you have
either
created an issue that the team's had a chance to respond to, or had some
discussion with the team prior to submitting substantial pull requests.
The team
can be reached via GitHub Discussions or the Cosmos Network Discord
server in
the #cometbft channel. GitHub Discussions is preferred over Discord as
it
allows us to keep track of conversations topically.
https://github.com/cometbft/cometbft/discussions

If the work in this PR is not aligned with the team's current
priorities, please
be advised that it may take some time before it is merged - especially
if it has
not yet been discussed with the team.

See the project board for the team's current priorities:
https://github.com/orgs/cometbft/projects/1

-->

---

#### PR checklist

- [ ] ~~Tests written/updated~~
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] ~~Updated relevant documentation (`docs/` or `spec/`) and code
comments~~
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

(cherry picked from commit 3d9bbb6)

# Conflicts:
#	.changelog/v0.38.3/bug-fixes/3352-nil-pointer-tx-search.md
#	rpc/core/tx.go
mergify bot pushed a commit that referenced this issue Jun 28, 2024
when block is absent
Closes #3352

<!--

Please add a reference to the issue that this PR addresses and indicate
which
files are most critical to review. If it fully addresses a particular
issue,
please include "Closes #XXX" (where "XXX" is the issue number).

If this PR is non-trivial/large/complex, please ensure that you have
either
created an issue that the team's had a chance to respond to, or had some
discussion with the team prior to submitting substantial pull requests.
The team
can be reached via GitHub Discussions or the Cosmos Network Discord
server in
the #cometbft channel. GitHub Discussions is preferred over Discord as
it
allows us to keep track of conversations topically.
https://github.com/cometbft/cometbft/discussions

If the work in this PR is not aligned with the team's current
priorities, please
be advised that it may take some time before it is merged - especially
if it has
not yet been discussed with the team.

See the project board for the team's current priorities:
https://github.com/orgs/cometbft/projects/1

-->

---

#### PR checklist

- [ ] ~~Tests written/updated~~
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] ~~Updated relevant documentation (`docs/` or `spec/`) and code
comments~~
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

(cherry picked from commit 3d9bbb6)

# Conflicts:
#	rpc/core/tx.go
melekes added a commit that referenced this issue Jun 28, 2024
…3355) (#3356)

when block is absent
Closes #3352



---

#### PR checklist

- [ ] ~~Tests written/updated~~
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] ~~Updated relevant documentation (`docs/` or `spec/`) and code
comments~~
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request #3355 done by
[Mergify](https://mergify.com).

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
melekes added a commit that referenced this issue Jun 28, 2024
…3355) (#3357)

when block is absent
Closes #3352



---

#### PR checklist

- [ ] ~~Tests written/updated~~
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] ~~Updated relevant documentation (`docs/` or `spec/`) and code
comments~~
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request #3355 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
melekes added a commit that referenced this issue Jun 28, 2024
…3355) (#3358)

when block is absent
Closes #3352



---

#### PR checklist

- [ ] ~~Tests written/updated~~
- [x] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] ~~Updated relevant documentation (`docs/` or `spec/`) and code
comments~~
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec
<hr>This is an automatic backport of pull request #3355 done by
[Mergify](https://mergify.com).

---------

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
@adizere adizere modified the milestones: 2024-Q3, 2024-Q2 Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rpc
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants
0