Skip to content
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

fix nil issues reported by nilness and staticcheck #688

Open
wants to merge 6 commits into
base: dev-upgrade
Choose a base branch
from

Conversation

gzliudan
Copy link
Collaborator

@gzliudan gzliudan commented Oct 23, 2024

Proposed changes

This PR fixes the nil issues reported by from nilness and staticcheck.

  • issues from staticcheck
cmd/puppeth/wizard_netstats.go:85:20: possible nil pointer dereference (SA5011)
        cmd/puppeth/wizard_netstats.go:88:5: this check suggests that the pointer can be nil
mobile/ethereum.go:71:24: possible nil pointer dereference (SA5011)
        mobile/ethereum.go:68:5: this check suggests that the pointer can be nil
  • issues from nilness
consensus/XDPoS/engines/engine_v2/forensics.go:212:125: nil dereference in field selection

light/postprocess.go:167:8: panic with nil value
les/backend.go:150:8: panic with nil value
les/odr_requests.go:199:8: panic with nil value
les/odr_requests.go:359:8: panic with nil value
les/peer.go:282:8: panic with nil value
les/peer.go:304:8: panic with nil value
les/peer.go:323:8: panic with nil value
les/randselect.go:112:9: panic with nil value
les/randselect.go:172:7: panic with nil value
les/retrieve.go:309:8: panic with nil value
p2p/discv5/ticket.go:444:8: panic with nil value
p2p/discv5/ticket.go:805:7: panic with nil value

accounts/abi/bind/base.go:294:9: impossible condition: nil != nil
whisper/whisperv6/whisper.go:504:9: impossible condition: nil != nil

consensus/clique/clique.go:393:11: tautological condition: nil == nil
trie/trie.go:244:11: tautological condition: nil == nil

consensus/XDPoS/engines/engine_v1/engine.go:479:11: tautological condition: nil == nil
cmd/gc/main.go:190:17: tautological condition: non-nil != nil
cmd/gc/main.go:173:19: tautological condition: non-nil != nil
core/blockchain.go:1665:46: tautological condition: non-nil != nil
core/blockchain.go:1944:45: tautological condition: non-nil != nil
core/order_pool_test.go:64:9: impossible condition: nil != nil
eth/handler.go:286:10: tautological condition: non-nil != nil

Types of changes

What types of changes does your code introduce to XDC network?
Put an in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Regular KTLO or any of the maintaince work. e.g code style
  • CICD Improvement

Impacted Components

Which part of the codebase this PR will touch base on,

Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

@gzliudan gzliudan changed the title fix some issues about nil from nilness and staticcheck fix nil issues reported by nilness and staticcheck Oct 23, 2024
@gzliudan gzliudan force-pushed the fix-nil-deref branch 2 times, most recently from a0411bf to 320cfb1 Compare October 25, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant