Skip to content

Commit

Permalink
chore: remove unnecessary proof param asTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Oct 7, 2024
1 parent c5a9b94 commit 50ea8ed
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 455 deletions.
354 changes: 88 additions & 266 deletions api/poktroll/proof/tx.pulsar.go

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions proto/poktroll/proof/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ message MsgUpdateParam {
// specified in the `Params`` message in `proof/params.proto.`
string name = 2;
oneof as_type {
string as_string = 3 [(gogoproto.jsontag) = "as_string"];
int64 as_int64 = 6 [(gogoproto.jsontag) = "as_int64"];
bytes as_bytes = 7 [(gogoproto.jsontag) = "as_bytes"];
float as_float = 8 [(gogoproto.jsontag) = "as_float"];
cosmos.base.v1beta1.Coin as_coin = 9 [(gogoproto.jsontag) = "as_coin"];
Expand Down
3 changes: 0 additions & 3 deletions testutil/integration/suites/param_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ var (
ProofSubmissionFee: &ValidProofSubmissionFeeCoin,
},
ParamTypes: map[ParamType]any{
ParamTypeUint64: prooftypes.MsgUpdateParam_AsInt64{},
ParamTypeInt64: prooftypes.MsgUpdateParam_AsInt64{},
ParamTypeString: prooftypes.MsgUpdateParam_AsString{},
ParamTypeBytes: prooftypes.MsgUpdateParam_AsBytes{},
ParamTypeFloat32: prooftypes.MsgUpdateParam_AsFloat{},
ParamTypeCoin: prooftypes.MsgUpdateParam_AsCoin{},
Expand Down
4 changes: 0 additions & 4 deletions x/proof/types/message_update_param.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdatePara
var valueAsType isMsgUpdateParam_AsType

switch v := value.(type) {
case string:
valueAsType = &MsgUpdateParam_AsString{AsString: v}
case int64:
valueAsType = &MsgUpdateParam_AsInt64{AsInt64: v}
case []byte:
valueAsType = &MsgUpdateParam_AsBytes{AsBytes: v}
case *sdk.Coin:
Expand Down
6 changes: 3 additions & 3 deletions x/proof/types/message_update_param_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) {
msg: MsgUpdateParam{
Authority: "invalid_address",
Name: "", // Doesn't matter for this test
AsType: &MsgUpdateParam_AsInt64{AsInt64: 1},
AsType: &MsgUpdateParam_AsFloat{AsFloat: 0},
},

expectedErr: ErrProofInvalidAddress,
Expand All @@ -29,7 +29,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) {
msg: MsgUpdateParam{
Authority: sample.AccAddress(),
Name: "WRONG_relay_difficulty_target_hash",
AsType: &MsgUpdateParam_AsInt64{AsInt64: 1},
AsType: &MsgUpdateParam_AsFloat{AsFloat: 0},
},

expectedErr: ErrProofParamNameInvalid,
Expand All @@ -38,7 +38,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) {
msg: MsgUpdateParam{
Authority: sample.AccAddress(),
Name: ParamRelayDifficultyTargetHash,
AsType: &MsgUpdateParam_AsString{AsString: "invalid"},
AsType: &MsgUpdateParam_AsFloat{AsFloat: 0},
},
expectedErr: ErrProofParamInvalid,
}, {
Expand Down
228 changes: 51 additions & 177 deletions x/proof/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 50ea8ed

Please sign in to comment.