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

hardfork: add bsc chainID to encodeSigHeader when submitting evidence for slashing #312

Merged
merged 10 commits into from
Dec 21, 2022

Conversation

randyahx
Copy link
Contributor

@randyahx randyahx commented Dec 15, 2022

Summary of issue submitted:

In BSC sealHash is calculated taking into account Chain ID. However encodeSigHeader does not take into account chainID, meaning that sealHash will return an incorrect hash, thus ExtractSignerFromHeader() returns an invalid signer. In BSC header hash is Sealed including chainID, so encodeSigHeader() must include the chain ID.

Changes:

Added bsc chainID as a param in encodeSigHeader
Added sideChainIdFromText to convert chainID text inputs to big.Int

Tested by submitting doublesign evidence using bsc-double-sign-sdk before and after BEP174 upgrade.
Results: Validator put into jail

Ezkerrox and others added 5 commits December 5, 2022 09:59
add chainID as a parameter

fix test header_test.go

update sys library

updated side chain ID and tests

tests working correctly now, sideConAddr changed due to missing private key

Remove print

bep174: add bsc chainID to encodeSigHeader when submitting evidence for slashing

bep174: add bsc chainID to encodeSigHeader when submitting evidence for slashing
@randyahx randyahx changed the title Bep174 eip: add bsc chainID to encodeSigHeader when submitting evidence for slashing Dec 15, 2022
@randyahx randyahx changed the title eip: add bsc chainID to encodeSigHeader when submitting evidence for slashing bep174: add bsc chainID to encodeSigHeader when submitting evidence for slashing Dec 15, 2022
bsc/header.go Outdated Show resolved Hide resolved
x/slashing/handler.go Outdated Show resolved Hide resolved
sideConsAddr2, err = msg.Headers[1].ExtractSignerFromHeader(chainID)
} else {
sideConsAddr, err = msg.Headers[0].ExtractSignerFromHeader(nil)
sideConsAddr2, err = msg.Headers[1].ExtractSignerFromHeader(nil)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The err will be overwritten here. We should have err and err2 here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

x/slashing/handler.go Outdated Show resolved Hide resolved
x/slashing/handler.go Outdated Show resolved Hide resolved
bsc/header.go Outdated Show resolved Hide resolved
bsc/header.go Outdated Show resolved Hide resolved
x/slashing/handler.go Outdated Show resolved Hide resolved
@unclezoro unclezoro changed the title bep174: add bsc chainID to encodeSigHeader when submitting evidence for slashing hardfork: add bsc chainID to encodeSigHeader when submitting evidence for slashing Dec 21, 2022
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