Skip to content

Commit

Permalink
update peggy types
Browse files Browse the repository at this point in the history
  • Loading branch information
mankenavenkatesh committed Jun 14, 2021
1 parent 7bf4143 commit 58b0a91
Show file tree
Hide file tree
Showing 2 changed files with 162 additions and 189 deletions.
21 changes: 0 additions & 21 deletions chain/peggy/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func (s GenesisState) ValidateBasic() error {
}

// DefaultGenesisState returns empty genesis state
// TODO: set some better defaults here
func DefaultGenesisState() *GenesisState {
return &GenesisState{
Params: DefaultParams(),
Expand Down Expand Up @@ -247,22 +246,12 @@ func validatePeggyID(i interface{}) error {
}

func validateContractHash(i interface{}) error {
// TODO: should we validate that the input here is a properly formatted
// SHA256 (or other) hash?
if _, ok := i.(string); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}

func validateStartThreshold(i interface{}) error {
// TODO: do we want to validate a range of values here?
if _, ok := i.(uint64); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}

func validateBridgeChainID(i interface{}) error {
if _, ok := i.(uint64); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
Expand Down Expand Up @@ -313,7 +302,6 @@ func validateBridgeContractAddress(i interface{}) error {
return fmt.Errorf("invalid parameter type: %T", i)
}
if err := ValidateEthAddress(v); err != nil {
// TODO: ensure that empty addresses are valid in params
if !strings.Contains(err.Error(), "empty") {
return err
}
Expand All @@ -322,63 +310,55 @@ func validateBridgeContractAddress(i interface{}) error {
}

func validateSignedValsetsWindow(i interface{}) error {
// TODO: do we want to set some bounds on this value?
if _, ok := i.(uint64); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}

func validateUnbondSlashingValsetsWindow(i interface{}) error {
// TODO: do we want to set some bounds on this value?
if _, ok := i.(uint64); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}

func validateSlashFractionValset(i interface{}) error {
// TODO: do we want to set some bounds on this value?
if _, ok := i.(sdk.Dec); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}

func validateSignedBatchesWindow(i interface{}) error {
// TODO: do we want to set some bounds on this value?
if _, ok := i.(uint64); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}

func validateSignedClaimsWindow(i interface{}) error {
// TODO: do we want to set some bounds on this value?
if _, ok := i.(uint64); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}

func validateSlashFractionBatch(i interface{}) error {
// TODO: do we want to set some bounds on this value?
if _, ok := i.(sdk.Dec); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}

func validateSlashFractionClaim(i interface{}) error {
// TODO: do we want to set some bounds on this value?
if _, ok := i.(sdk.Dec); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
return nil
}

func validateSlashFractionConflictingClaim(i interface{}) error {
// TODO: do we want to set some bounds on this value?
if _, ok := i.(sdk.Dec); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
Expand Down Expand Up @@ -429,7 +409,6 @@ func validateClaimSlashingEnabled(i interface{}) error {
}

func validateSlashFractionBadEthSignature(i interface{}) error {
// TODO: do we want to set some bounds on this value?
if _, ok := i.(sdk.Dec); !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
Expand Down
Loading

0 comments on commit 58b0a91

Please sign in to comment.