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: add support for bsc headers #1334

Merged
merged 6 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions common/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ func IsEVMChain(chainID int64) bool {
chainID == 137 // polygon mainnet
}

func IsHeaderSupportedEvmChain(chainID int64) bool {
return chainID == 5 || // Goerli
chainID == 97 || // BSC testnet
chainID == 1337 || // eth privnet
chainID == 1 || // eth mainnet
chainID == 56 // bsc mainnet
}

func (chain Chain) IsKlaytnChain() bool {
return chain.ChainId == 1001
}
Expand Down
2 changes: 1 addition & 1 deletion x/observer/types/messages_add_block_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (msg *MsgAddBlockHeader) ValidateBasic() error {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error())
}

if common.IsEthereumChain(msg.ChainId) || common.IsBitcoinChain(msg.ChainId) {
if common.IsHeaderSupportedEvmChain(msg.ChainId) || common.IsBitcoinChain(msg.ChainId) {
if len(msg.BlockHash) != 32 {
return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block hash length (%d)", len(msg.BlockHash))
}
Expand Down
Loading