Skip to content

0xEcd003160088F28eaC6A008ad4B64FF6ec20369C - #676

Open
Fahhd1400 wants to merge 10 commits into
bnb-chain:fix/stale-consensus-authfrom
Fahhd1400:master
Open

0xEcd003160088F28eaC6A008ad4B64FF6ec20369C#676
Fahhd1400 wants to merge 10 commits into
bnb-chain:fix/stale-consensus-authfrom
Fahhd1400:master

Conversation

@Fahhd1400

@Fahhd1400 Fahhd1400 commented Jul 6, 2026

Copy link
Copy Markdown

add a description of your changes here...

Rationale

tell us why we need these changes...

Example

add an example CLI or API response...

Changes

Notable changes:

  • add each change in a bullet point here
  • ...

allformless and others added 9 commits November 27, 2025 01:37
Co-authored-by: NathanBSC <122502194+NathanBSC@users.noreply.github.com>
Co-authored-by: NathanBSC <122502194+NathanBSC@users.noreply.github.com>
…n#659)

* chore: update generate script for testnet

* fix: ci check for compare bytecodes

* feat: modify LOCK_PERIOD_FOR_TOKEN_RECOVER to 300 second

* feat: sync testnet genesis

* stakehub: reject rotated consensus keys in bep563 auth

---------

Co-authored-by: zoro <296179868@qq.com>
Co-authored-by: Ethan <cosinlinker@gmail.com>
Co-authored-by: Roshan <luoshen1997@gmail.com>
Co-authored-by: buddho <galaxystroller@gmail.com>
Co-authored-by: zzzckck <152148891+zzzckck@users.noreply.github.com>
Co-authored-by: buddho <7995985+buddh0@users.noreply.github.com>
…26-950) (bnb-chain#667)

BSCGovernor._castVote was gated only by notInBlackList, which checks
msg.sender. The inherited OZ castVoteBySig / castVoteWithReasonAndParamsBySig
recover the voter from the EIP-712 signature and call _castVote with that
recovered address as `account`, while msg.sender is the relayer. A blacklisted
voter could therefore have a clean relayer submit its signed ballot and vote
with its full weight, bypassing the per-address governance freeze.

Add an explicit check on the recovered voter (`account`) inside _castVote,
the single chokepoint all vote entrypoints funnel through. Direct castVote is
unaffected (account == msg.sender); clean relayed votes still succeed.

Adds GovernorBlacklistBySig.t.sol regression coverage (runs under CI's
archive-fork environment).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rotation (bnb-chain#664)

* fix: felony-cross-call consistency

* fix: felony-cross-call consistency

* test: adapt unit tests to mainnet turnLength and slash threshold changes

Mainnet governance changed parameters that the fork-based tests read from
live state: turnLength 16 -> 8, misdemeanorThreshold 200 -> 333 and
felonyThreshold 600 -> 1000 (raised after the block interval dropped to
~0.45s), which made the hardcoded assertions fail.

- ValidatorSet.t.sol: expect getTurnLength() == 8
- SlashIndicator.t.sol: bump MISDEMEANOR_THRESHOLD/FELONY_THRESHOLD to 333/1000
- SlashIndicator.t.sol: derive the testMisdemeanor re-slash loop bound from the
  live post-clean count instead of a hardcoded number, so it no longer needs
  retuning when thresholds change

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test: add regression for felony cross-call after consensus-key rotation

Covers the window the PR fixes: once a validator rotates its consensus key
and the active set has synced K_new, the double-sign evidence still carries
K_old, so SlashIndicator.felony(K_old) is a no-op. The eviction must come
from StakeHub.doubleSignSlash -> felony(valInfo.consensusAddress = K_new);
without it the slashed+jailed validator would remain in the active set.

Verified against a BSC mainnet fork.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test: adapt Governor test to mainnet votingPeriod/lateQuorum changes

testProposeQuorumReached recomputed the expected voting period from a fixed
BLOCK_INTERVAL (3s), which drifted out of date after mainnet retuned the
governor for the ~0.45s block interval (votingPeriod 806400 -> 1344000,
lateQuorumVoteExtension 115200 -> 172800). Read the live values from the
governor instead so the assertions track the on-chain params.

Verified against a BSC mainnet fork.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* ci: fork archive node for unit tests to fix missing-trie-node

The CI forked bsc-dataseed (non-archive), which only retains ~128 recent
blocks of state. After the block interval dropped to ~0.45s that window
shrank to ~57s, so the forked block's state was pruned mid-run and tests
failed with "missing trie node". Fork an archive endpoint (secrets.ARCHIVE_RPC)
instead, which retains historical state for the whole run.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…chain#668)

* chore: regenerate genesis bytecode for StakeHub and BSCGovernor

Sync the committed genesis (mainnet/testnet/dev) with the current contracts.
StakeHub changed in bnb-chain#664 (propagate slash eviction to BSCValidatorSet after
consensus-key rotation) and BSCGovernor in bnb-chain#667 (reject blacklisted voter on
castVoteBySig), but the genesis bytecode was not regenerated, so check-genesis
diffed. Only the 0x2002 (StakeHub) and 0x2004 (BSCGovernor) code entries change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* ci: pin foundry to v1.2.1 in check-genesis

check-genesis installed an unpinned (latest) foundry, whose
`forge install --no-git forge-std@v1.7.3` fails on forge-std's nested
ds-test submodule ("not a git repository: ../../.git/modules/lib/ds-test"),
so the job died before ever reaching the genesis bytecode comparison.
Pin v1.2.1 to match unit-test.yml, which installs the same dependency cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chore: merge develop into master for Pasteur hardfork
@hashdit-bot

hashdit-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

Pull Request Review

This PR primarily hardens CI/workflow security and updates dependency usage in GitHub Actions (moving from checkout@master/cache@v3 to newer versions, pinning semantic PR action by commit, and adjusting cache strategy to npm). It also improves command-injection resistance in scripts/check-bsc-hardfork-bytecode.ts by switching from execSync to execFileSync, validating/sanitizing PR-derived inputs, and isolating temporary clone directories. In Solidity, it fixes governance and slashing edge cases (blacklist bypass via castVoteBySig, consensus-key rotation eviction flow) and adds regression tests for these paths.

Sensitive Content

Blockchain Address:

  • 0xEcd003160088F28eaC6A008ad4B64FF6ec20369C (Ethereum-style address) in PR title
  • 0x08E68Ec70FA3b629784fDB28887e206ce8561E08 (Ethereum-style address) in contracts/BSCGovernor.sol and test/GovernorBlacklistBySig.t.sol

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

@Fahhd1400
Fahhd1400 marked this pull request as draft July 6, 2026 23:17
@Fahhd1400
Fahhd1400 marked this pull request as ready for review July 6, 2026 23:18

@Fahhd1400 Fahhd1400 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

0xecd003160088f28eac6a008ad4b64ff6ec20369c

0xecd003160088f28eac6a008ad4b64ff6ec20369c
@hashdit-bot

hashdit-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

Pull Request Review

This PR hardens CI workflows and smart-contract logic while updating tests and genesis configuration. It modernizes GitHub Actions usage (new action versions, npm cache, pinned action commit, secret-based RPC endpoint), and significantly improves the check-bsc-hardfork-bytecode script by replacing shell interpolation with validated inputs plus execFileSync and temp-directory cleanup. On-chain changes address governance blacklist bypass via relayed signatures and validator eviction after consensus-key rotation, with corresponding regression tests added/updated.

Sensitive Content

Blockchain Address:

  • 0xEcd003160088F28eaC6A008ad4B64FF6ec20369C (Ethereum-style address) in PR title
  • 0x08E68Ec70FA3b629784fDB28887e206ce8561E08 (Ethereum address) in contracts/BSCGovernor.sol and test/GovernorBlacklistBySig.t.sol — governor protector address

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

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.

5 participants