Skip to content

Commit

Permalink
chore(data-proxy): clean up proto annotations
Browse files Browse the repository at this point in the history
Part-of: #316
  • Loading branch information
Thomasvdam committed Aug 22, 2024
1 parent 2403bf4 commit 47f26fd
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 104 deletions.
4 changes: 2 additions & 2 deletions proto/sedachain/data_proxy/v1/data_proxy.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ message ProxyConfig {

// fee_update defines an upcoming fee change which will take effect at a
// future height.
FeeUpdate fee_update = 5 [ (gogoproto.nullable) = true ];
FeeUpdate fee_update = 5;
}

// FeeUpdate defines a new fee amount and the height at which it will take
// effect.
message FeeUpdate {
// new_fee defines the new fee for the data proxy.
cosmos.base.v1beta1.Coin new_fee = 1 [ (gogoproto.nullable) = false ];
cosmos.base.v1beta1.Coin new_fee = 1;

// update_height defines the height after which the new fee comes into effect.
int64 update_height = 2;
Expand Down
2 changes: 1 addition & 1 deletion proto/sedachain/data_proxy/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ message MsgEditDataProxy {

string new_memo = 3;

cosmos.base.v1beta1.Coin new_fee = 4 [ (gogoproto.nullable) = true ];
cosmos.base.v1beta1.Coin new_fee = 4;

// 0 will default to the minimum delay configured in the params
uint32 fee_update_delay = 5;
Expand Down
2 changes: 1 addition & 1 deletion x/data-proxy/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (k *Keeper) ProcessFeeUpdates(ctx sdk.Context) error {
return err
}

proxyConfig.Fee = &proxyConfig.FeeUpdate.NewFee
proxyConfig.Fee = proxyConfig.FeeUpdate.NewFee
proxyConfig.FeeUpdate = nil

if err := k.DataProxyConfigs.Set(ctx, pubkey, proxyConfig); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion x/data-proxy/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *KeeperTestSuite) TestImportExportGenesis() {
Fee: s.NewFeeFromString("5000"),
Memo: "not my proxy friend",
FeeUpdate: &types.FeeUpdate{
NewFee: *s.NewFeeFromString("10000"),
NewFee: s.NewFeeFromString("10000"),
UpdateHeight: 500,
},
},
Expand Down
2 changes: 1 addition & 1 deletion x/data-proxy/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (s *KeeperTestSuite) TestQuerier_ProxyConfig() {
Fee: &sdk.Coin{Denom: "aseda", Amount: math.NewInt(5)},
Memo: "",
FeeUpdate: &types.FeeUpdate{
NewFee: sdk.Coin{Denom: "aseda", Amount: math.NewInt(10)},
NewFee: &sdk.Coin{Denom: "aseda", Amount: math.NewInt(10)},
UpdateHeight: 6,
},
},
Expand Down
2 changes: 1 addition & 1 deletion x/data-proxy/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (k Keeper) processProxyFeeUpdate(ctx sdk.Context, pubKeyBytes []byte, proxy
// Determine update height
updateHeight := ctx.BlockHeight() + int64(updateDelay)
feeUpdate := &types.FeeUpdate{
NewFee: *newFee,
NewFee: newFee,
UpdateHeight: updateHeight,
}

Expand Down
12 changes: 6 additions & 6 deletions x/data-proxy/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (s *KeeperTestSuite) TestKeeper_EndBlockFeeUpdate() {
Memo: "test",
FeeUpdate: &types.FeeUpdate{
UpdateHeight: 0,
NewFee: *s.NewFeeFromString("987654321"),
NewFee: s.NewFeeFromString("987654321"),
},
AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5",
})
Expand Down Expand Up @@ -77,7 +77,7 @@ func (s *KeeperTestSuite) TestKeeper_EndBlockFeeUpdate() {
Memo: "test",
FeeUpdate: &types.FeeUpdate{
UpdateHeight: updateHeight,
NewFee: *s.NewFeeFromString("30"),
NewFee: s.NewFeeFromString("30"),
},
AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5",
})
Expand All @@ -99,12 +99,12 @@ func (s *KeeperTestSuite) TestKeeper_EndBlockFeeUpdate() {
Memo: "test",
FeeUpdate: &types.FeeUpdate{
UpdateHeight: 1,
NewFee: *s.NewFeeFromString("30"),
NewFee: s.NewFeeFromString("30"),
},
AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5",
}
if i < 5 {
expected.Fee = &expected.FeeUpdate.NewFee
expected.Fee = expected.FeeUpdate.NewFee
expected.FeeUpdate = nil
}

Expand Down Expand Up @@ -138,12 +138,12 @@ func (s *KeeperTestSuite) TestKeeper_EndBlockFeeUpdate() {
Memo: "test",
FeeUpdate: &types.FeeUpdate{
UpdateHeight: 1,
NewFee: *s.NewFeeFromString("30"),
NewFee: s.NewFeeFromString("30"),
},
AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5",
}

expected.Fee = &expected.FeeUpdate.NewFee
expected.Fee = expected.FeeUpdate.NewFee
expected.FeeUpdate = nil

s.Require().Equal(expected, proxyConfig)
Expand Down
4 changes: 2 additions & 2 deletions x/data-proxy/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (s *KeeperTestSuite) TestMsgServer_EditDataProxy() {
Fee: s.NewFeeFromString("9"),
Memo: "test",
FeeUpdate: &types.FeeUpdate{
NewFee: *s.NewFeeFromString("1337"),
NewFee: s.NewFeeFromString("1337"),
// Height in test is 0, so update height should be minimum
UpdateHeight: int64(types.DefaultMinFeeUpdateDelay),
},
Expand All @@ -275,7 +275,7 @@ func (s *KeeperTestSuite) TestMsgServer_EditDataProxy() {
Fee: s.NewFeeFromString("9"),
Memo: "test",
FeeUpdate: &types.FeeUpdate{
NewFee: *s.NewFeeFromString("1337"),
NewFee: s.NewFeeFromString("1337"),
UpdateHeight: int64(types.DefaultMinFeeUpdateDelay + 100),
},
AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5",
Expand Down
90 changes: 48 additions & 42 deletions x/data-proxy/types/data_proxy.pb.go

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

Loading

0 comments on commit 47f26fd

Please sign in to comment.