Skip to content

Conversation

@wanwiset25
Copy link
Collaborator

Proposed changes

verify from masternodes instead of snap.NextEpochCandidates (masternodes = candidates - standbys - penalties)
ref audit ticket: XFN-62

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 consensus: verify with masternodes list instead of candidates consensus: verify with masternodes list instead of candidates, close XFN-62 Nov 3, 2025
}

snapshot, err := x.getSnapshot(chain, vote.GapNumber, true)
masternodes, err:= x.GetMasternodesFromGapNumber(chain, vote.GapNumber)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is vote proposedBlockInfo with block number, use that number to get header is faster

@gzliudan
Copy link
Collaborator

gzliudan commented Nov 4, 2025

please change merge target branch to v2.6.x-beta-certik-audit

@gzliudan gzliudan requested a review from liam-lai November 5, 2025 14:14
}

snapshot, err := x.getSnapshot(chain, vote.GapNumber, true)
prevBlockHeader := chain.GetHeaderByNumber(vote.ProposedBlockInfo.Number.Uint64()-1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check how vote.gap number get calculated and use the same method for calculated getEpochSwitchInfo

verified, err := engineV2.VerifyVoteMessage(blockchain, voteMsg)
assert.False(t, verified)
assert.NotNil(t, err)
assert.Nil(t, err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then you can delete this test

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this task when epochswitchinfo is not found

@wanwiset25
Copy link
Collaborator Author

won't merge in this mainnet release due to change risk
will go through regular release process ref: #1628

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.

4 participants