Skip to content

Commit

Permalink
initialize chain with 0th eth contract address
Browse files Browse the repository at this point in the history
  • Loading branch information
kstoykov committed Jan 5, 2022
1 parent 577ec8d commit 852367d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions module/x/gravity/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState) {
k.SetStaticValCosmosAddr(ctx, cosmosAddr)
}

var bridgeContractAddress string
k.paramSpace.Get(ctx, types.ParamsStoreKeyBridgeContractAddress, &bridgeContractAddress)
if bridgeContractAddress == "" {
k.paramSpace.Set(ctx, types.ParamsStoreKeyBridgeContractAddress, types.ZeroAddressString)
}

}

// ExportGenesis exports all the state needed to restart the chain
Expand Down
2 changes: 1 addition & 1 deletion module/x/gravity/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func DefaultParams() *Params {
return &Params{
GravityId: "defaultgravityid",
ContractSourceHash: "",
BridgeEthereumAddress: "0x0000000000000000000000000000000000000000",
BridgeEthereumAddress: ZeroAddressString,
BridgeChainId: 0,
SignedValsetsWindow: 10000,
SignedBatchesWindow: 10000,
Expand Down
2 changes: 1 addition & 1 deletion module/x/gravity/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (msg MsgSendToEth) ValidateBasic() error {
if !msg.BridgeFee.IsValid() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidCoins, "fee")
}
if msg.EthDest == "0x0000000000000000000000000000000000000000" {
if msg.EthDest == ZeroAddressString {
return sdkerrors.Wrap(fmt.Errorf("sending to 0th address"), "ethereum address")
}
if err := ValidateEthAddress(msg.EthDest); err != nil {
Expand Down

0 comments on commit 852367d

Please sign in to comment.