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(assets): allow native chain to be registered #200

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions precompiles/assets/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ func (p Precompile) IsRegisteredClientChain(
if err != nil {
return nil, err
}
if clientChainID == 0 {
// explicitly return false for client chain ID 0 to prevent `setPeer` calls
return method.Outputs.Pack(true, false)
}
exists := p.assetsKeeper.ClientChainExists(ctx, uint64(clientChainID))
return method.Outputs.Pack(true, exists)
}
8 changes: 0 additions & 8 deletions x/assets/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ func (gs GenesisState) ValidateClientChains() (map[uint64]struct{}, error) {
i,
)
}
// this is our primary method of cross-chain communication.
if info.LayerZeroChainID == 0 {
return errorsmod.Wrapf(
ErrInvalidGenesisData,
"nil LayerZeroChainID for chain %s",
info.Name,
)
}
// the address length is used to convert from bytes32 to address.
if info.AddressLength == 0 {
return errorsmod.Wrapf(
Expand Down
16 changes: 0 additions & 16 deletions x/assets/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,6 @@ func (suite *GenesisTestSuite) TestValidateGenesis() {
},
expPass: false,
},
{
name: "invalid genesis due to zero layer zero chain id",
genState: &types.GenesisState{
Params: types.DefaultParams(),
ClientChains: []types.ClientChainInfo{
ethClientChain,
},
},
malleate: func(gs *types.GenesisState) {
gs.ClientChains[0].LayerZeroChainID = 0
},
unmalleate: func(gs *types.GenesisState) {
gs.ClientChains[0].LayerZeroChainID = 101
},
expPass: false,
},
{
name: "invalid genesis due to zero address length",
genState: &types.GenesisState{
Expand Down
Loading