Skip to content

Commit a523095

Browse files
committed
fix from comments
1 parent 0d5268f commit a523095

20 files changed

+184
-111
lines changed

scripts/start_grogu.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,18 @@ do
3131
grogu keys add feeder$i
3232
done
3333

34-
# send band tokens to feeders
35-
echo "y" | bandd tx bank send validator $(grogu keys list -a) 1000000uband --gas-prices 0.0025uband --keyring-backend test --chain-id bandchain
34+
addresses=$(grogu keys list -a)
3635

37-
# wait for sending band tokens transaction success
38-
sleep 2
36+
for address in $(echo $addresses | tr " " "\n")
37+
do
38+
# send band tokens to feeders
39+
echo "y" | bandd tx bank send validator $address 1000000uband --gas-prices 0.0025uband --keyring-backend test --chain-id bandchain
40+
# wait for sending band tokens transaction success
41+
sleep 2
42+
done
3943

4044
# add feeder to bandchain
41-
echo "y" | bandd tx feeds add-grantees $(grogu keys list -a) --from validator --gas-prices 0.0025uband --keyring-backend test --chain-id bandchain
45+
echo "y" | bandd tx feeds add-feeders $addresses --from validator --gas-prices 0.0025uband --keyring-backend test --chain-id bandchain
4246

4347
# wait for addding feeder transaction success
4448
sleep 2

x/feeds/client/cli/tx.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ func GetTxCmd() *cobra.Command {
3838
RunE: client.ValidateCmd,
3939
}
4040
txCmd.AddCommand(
41-
GetTxCmdAddGrantees(),
42-
GetTxCmdRemoveGrantees(),
41+
GetTxCmdAddFeeders(),
42+
GetTxCmdRemoveFeeders(),
4343
GetTxCmdSubmitSignals(),
4444
GetTxCmdUpdateReferenceSourceConfig(),
4545
)
@@ -100,17 +100,17 @@ $ %s tx feeds signal BTC:1000000 --from mykey
100100
return cmd
101101
}
102102

103-
// GetTxCmdAddGrantees creates a CLI command for adding new grantees
104-
func GetTxCmdAddGrantees() *cobra.Command {
103+
// GetTxCmdAddFeeders creates a CLI command for adding new feeders
104+
func GetTxCmdAddFeeders() *cobra.Command {
105105
cmd := &cobra.Command{
106-
Use: "add-grantees [grantee1] [grantee2] ...",
106+
Use: "add-feeders [feeder1] [feeder2] ...",
107107
Short: "Add agents authorized to submit signal prices transactions.",
108108
Args: cobra.MinimumNArgs(1),
109109
Long: strings.TrimSpace(
110110
fmt.Sprintf(
111111
`Add agents authorized to submit feeds transactions.
112112
Example:
113-
$ %s tx feeds add-grantees band1p40yh3zkmhcv0ecqp3mcazy83sa57rgjp07dun band1m5lq9u533qaya4q3nfyl6ulzqkpkhge9q8tpzs --from mykey
113+
$ %s tx feeds add-feeders band1p40yh3zkmhcv0ecqp3mcazy83sa57rgjp07dun band1m5lq9u533qaya4q3nfyl6ulzqkpkhge9q8tpzs --from mykey
114114
`,
115115
version.AppName,
116116
),
@@ -129,17 +129,17 @@ $ %s tx feeds add-grantees band1p40yh3zkmhcv0ecqp3mcazy83sa57rgjp07dun band1m5lq
129129
return cmd
130130
}
131131

132-
// GetTxCmdRemoveGrantees creates a CLI command for removing grantees from granter
133-
func GetTxCmdRemoveGrantees() *cobra.Command {
132+
// GetTxCmdRemoveFeeders creates a CLI command for removing feeders from granter
133+
func GetTxCmdRemoveFeeders() *cobra.Command {
134134
cmd := &cobra.Command{
135-
Use: "remove-grantees [grantee1] [grantee2] ...",
136-
Short: "Remove agents from the list of authorized grantees.",
135+
Use: "remove-feeders [feeder1] [feeder2] ...",
136+
Short: "Remove agents from the list of authorized feeders.",
137137
Args: cobra.MinimumNArgs(1),
138138
Long: strings.TrimSpace(
139139
fmt.Sprintf(
140-
`Remove agents from the list of authorized grantees.
140+
`Remove agents from the list of authorized feeders.
141141
Example:
142-
$ %s tx feeds remove-grantees band1p40yh3zkmhcv0ecqp3mcazy83sa57rgjp07dun band1m5lq9u533qaya4q3nfyl6ulzqkpkhge9q8tpzs --from mykey
142+
$ %s tx feeds remove-feeders band1p40yh3zkmhcv0ecqp3mcazy83sa57rgjp07dun band1m5lq9u533qaya4q3nfyl6ulzqkpkhge9q8tpzs --from mykey
143143
`,
144144
version.AppName,
145145
),
@@ -156,11 +156,11 @@ $ %s tx feeds remove-grantees band1p40yh3zkmhcv0ecqp3mcazy83sa57rgjp07dun band1m
156156
func GetTxCmdUpdateReferenceSourceConfig() *cobra.Command {
157157
cmd := &cobra.Command{
158158
Use: "update-reference-source-config [ipfs-hash] [version]",
159-
Short: "Update reference reference source config",
159+
Short: "Update reference source config",
160160
Args: cobra.ExactArgs(2),
161161
Long: strings.TrimSpace(
162162
fmt.Sprintf(
163-
`Update reference reference source configuration that will be use as the default service for price querying.
163+
`Update reference source configuration that will be use as the default service for price querying.
164164
Example:
165165
$ %s tx feeds update-reference-source-config <YOUR_IPFS_HASH> 1.0.0 --from mykey
166166
`,

x/feeds/keeper/calculate_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ func TestCalculateDeviation(t *testing.T) {
8989
func TestSumPower(t *testing.T) {
9090
require.Equal(t, int64(1250009), sumPower([]types.Signal{
9191
{
92-
ID: "crypto_price.bandusd",
92+
ID: "CS:BAND-USD",
9393
Power: 100000,
9494
},
9595
{
96-
ID: "crypto_price.atomusd",
96+
ID: "CS:ATOM-USD",
9797
Power: 150000,
9898
},
9999
{
100-
ID: "crypto_price.osmousd",
100+
ID: "CS:OSMO-USD",
101101
Power: 1000009,
102102
},
103103
}))

x/feeds/keeper/genesis_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ func (suite *KeeperTestSuite) TestExportGenesis() {
2020
Delegator: ValidDelegator.String(),
2121
Signals: []types.Signal{
2222
{
23-
ID: "crypto_price.bandusd",
23+
ID: "CS:BAND-USD",
2424
Power: 10000 * 1e6,
2525
},
2626
{
27-
ID: "crypto_price.btcusd",
27+
ID: "CS:BTC-USD",
2828
Power: 20000 * 1e9,
2929
},
3030
},
@@ -33,11 +33,11 @@ func (suite *KeeperTestSuite) TestExportGenesis() {
3333
Delegator: ValidDelegator2.String(),
3434
Signals: []types.Signal{
3535
{
36-
ID: "crypto_price.bandusd",
36+
ID: "CS:BAND-USD",
3737
Power: 20000 * 1e6,
3838
},
3939
{
40-
ID: "crypto_price.btcusd",
40+
ID: "CS:BTC-USD",
4141
Power: 40000 * 1e9,
4242
},
4343
},
@@ -61,11 +61,11 @@ func (suite *KeeperTestSuite) TestInitGenesis() {
6161
Delegator: ValidDelegator.String(),
6262
Signals: []types.Signal{
6363
{
64-
ID: "crypto_price.bandusd",
64+
ID: "CS:BAND-USD",
6565
Power: 10000 * 1e6,
6666
},
6767
{
68-
ID: "crypto_price.btcusd",
68+
ID: "CS:BTC-USD",
6969
Power: 20000 * 1e6,
7070
},
7171
},
@@ -74,11 +74,11 @@ func (suite *KeeperTestSuite) TestInitGenesis() {
7474
Delegator: ValidDelegator2.String(),
7575
Signals: []types.Signal{
7676
{
77-
ID: "crypto_price.bandusd",
77+
ID: "CS:BAND-USD",
7878
Power: 20000 * 1e6,
7979
},
8080
{
81-
ID: "crypto_price.btcusd",
81+
ID: "CS:BTC-USD",
8282
Power: 40000 * 1e6,
8383
},
8484
},
@@ -98,29 +98,29 @@ func (suite *KeeperTestSuite) TestInitGenesis() {
9898
Equal(ds.Signals, suite.feedsKeeper.GetDelegatorSignals(ctx, sdk.MustAccAddressFromBech32(ds.Delegator)))
9999
}
100100

101-
stpBand, err := suite.feedsKeeper.GetSignalTotalPower(ctx, "crypto_price.bandusd")
101+
stpBand, err := suite.feedsKeeper.GetSignalTotalPower(ctx, "CS:BAND-USD")
102102
suite.Require().NoError(err)
103103
suite.Require().Equal(types.Signal{
104-
ID: "crypto_price.bandusd",
104+
ID: "CS:BAND-USD",
105105
Power: 30000 * 1e6,
106106
}, stpBand)
107107

108-
stpBtc, err := suite.feedsKeeper.GetSignalTotalPower(ctx, "crypto_price.btcusd")
108+
stpBtc, err := suite.feedsKeeper.GetSignalTotalPower(ctx, "CS:BTC-USD")
109109
suite.Require().NoError(err)
110110
suite.Require().Equal(types.Signal{
111-
ID: "crypto_price.btcusd",
111+
ID: "CS:BTC-USD",
112112
Power: 60000 * 1e6,
113113
}, stpBtc)
114114

115115
suite.Require().Equal(types.SupportedFeeds{
116116
Feeds: []types.Feed{
117117
{
118-
SignalID: "crypto_price.btcusd",
118+
SignalID: "CS:BTC-USD",
119119
Power: 60000000000,
120120
Interval: 60,
121121
},
122122
{
123-
SignalID: "crypto_price.bandusd",
123+
SignalID: "CS:BAND-USD",
124124
Power: 30000000000,
125125
Interval: 120,
126126
},

x/feeds/keeper/grpc_query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ func (q queryServer) Params(c context.Context, _ *types.QueryParamsRequest) (*ty
269269
}, nil
270270
}
271271

272-
// IsFeeder queries if the given address is a feeder grantee of the validator
272+
// IsFeeder queries if the given address is a feeder feeder of the validator
273273
func (q queryServer) IsFeeder(
274274
c context.Context,
275275
req *types.QueryIsFeederRequest,

x/feeds/keeper/grpc_query_test.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ func (suite *KeeperTestSuite) TestQueryDelegatorSignals() {
1515
// setup
1616
signals := []types.Signal{
1717
{
18-
ID: "crypto_price.bandusd",
18+
ID: "CS:BAND-USD",
1919
Power: 1e9,
2020
},
2121
{
22-
ID: "crypto_price.btcusd",
22+
ID: "CS:BTC-USD",
2323
Power: 1e9,
2424
},
2525
}
@@ -45,12 +45,12 @@ func (suite *KeeperTestSuite) TestQueryPrices() {
4545
// setup
4646
prices := []*types.Price{
4747
{
48-
SignalID: "crypto_price.atomusd",
48+
SignalID: "CS:ATOM-USD",
4949
Price: 100000000,
5050
Timestamp: 1234567890,
5151
},
5252
{
53-
SignalID: "crypto_price.bandusd",
53+
SignalID: "CS:BAND-USD",
5454
Price: 200000000,
5555
Timestamp: 1234567890,
5656
},
@@ -97,7 +97,7 @@ func (suite *KeeperTestSuite) TestQueryPrices() {
9797
"filter",
9898
func() {
9999
req = &types.QueryPricesRequest{
100-
SignalIds: []string{"crypto_price.bandusd"},
100+
SignalIds: []string{"CS:BAND-USD"},
101101
}
102102
expRes = &types.QueryPricesResponse{
103103
Prices: prices[1:],
@@ -130,23 +130,23 @@ func (suite *KeeperTestSuite) TestQueryPrice() {
130130
// setup
131131

132132
price := types.Price{
133-
SignalID: "crypto_price.bandusd",
133+
SignalID: "CS:BAND-USD",
134134
Price: 100000000,
135135
Timestamp: 1234567890,
136136
}
137137
suite.feedsKeeper.SetPrice(ctx, price)
138138

139139
// query and check
140140
res, err := queryClient.Price(context.Background(), &types.QueryPriceRequest{
141-
SignalId: "crypto_price.bandusd",
141+
SignalId: "CS:BAND-USD",
142142
})
143143
suite.Require().NoError(err)
144144
suite.Require().Equal(&types.QueryPriceResponse{
145145
Price: price,
146146
}, res)
147147

148148
res, err = queryClient.Price(context.Background(), &types.QueryPriceRequest{
149-
SignalId: "crypto_price.atomusd",
149+
SignalId: "CS:ATOM-USD",
150150
})
151151
suite.Require().ErrorContains(err, "price not found")
152152
suite.Require().Nil(res)
@@ -158,11 +158,11 @@ func (suite *KeeperTestSuite) TestQueryValidatorPrices() {
158158
// setup
159159
feeds := []types.Feed{
160160
{
161-
SignalID: "crypto_price.atomusd",
161+
SignalID: "CS:ATOM-USD",
162162
Interval: 100,
163163
},
164164
{
165-
SignalID: "crypto_price.bandusd",
165+
SignalID: "CS:BAND-USD",
166166
Interval: 100,
167167
},
168168
}
@@ -172,13 +172,13 @@ func (suite *KeeperTestSuite) TestQueryValidatorPrices() {
172172
valPrices := []types.ValidatorPrice{
173173
{
174174
Validator: ValidValidator.String(),
175-
SignalID: "crypto_price.atomusd",
175+
SignalID: "CS:ATOM-USD",
176176
Price: 1e9,
177177
Timestamp: ctx.BlockTime().Unix(),
178178
},
179179
{
180180
Validator: ValidValidator.String(),
181-
SignalID: "crypto_price.bandusd",
181+
SignalID: "CS:BAND-USD",
182182
Price: 1e9,
183183
Timestamp: ctx.BlockTime().Unix(),
184184
},
@@ -199,7 +199,7 @@ func (suite *KeeperTestSuite) TestQueryValidatorPrices() {
199199
// query with specific SignalIds
200200
res, err = queryClient.ValidatorPrices(context.Background(), &types.QueryValidatorPricesRequest{
201201
Validator: ValidValidator.String(),
202-
SignalIds: []string{"crypto_price.atomusd"},
202+
SignalIds: []string{"CS:ATOM-USD"},
203203
})
204204
suite.Require().NoError(err)
205205
suite.Require().Equal(&types.QueryValidatorPricesResponse{
@@ -218,7 +218,7 @@ func (suite *KeeperTestSuite) TestQueryValidatorPrices() {
218218
// query with specific SignalIds for invalid validator
219219
res, err = queryClient.ValidatorPrices(context.Background(), &types.QueryValidatorPricesRequest{
220220
Validator: InvalidValidator.String(),
221-
SignalIds: []string{"crypto_price.atomusd"},
221+
SignalIds: []string{"CS:ATOM-USD"},
222222
})
223223
suite.Require().NoError(err)
224224
suite.Require().Equal(&types.QueryValidatorPricesResponse{
@@ -253,11 +253,11 @@ func (suite *KeeperTestSuite) TestQuerySignalTotalPowers() {
253253
// setup
254254
signals := []*types.Signal{
255255
{
256-
ID: "crypto_price.atomusd",
256+
ID: "CS:ATOM-USD",
257257
Power: 100000000,
258258
},
259259
{
260-
ID: "crypto_price.bandusd",
260+
ID: "CS:BAND-USD",
261261
Power: 100000000,
262262
},
263263
}
@@ -303,7 +303,7 @@ func (suite *KeeperTestSuite) TestQuerySignalTotalPowers() {
303303
"filter",
304304
func() {
305305
req = &types.QuerySignalTotalPowersRequest{
306-
SignalIds: []string{"crypto_price.bandusd"},
306+
SignalIds: []string{"CS:BAND-USD"},
307307
}
308308
expRes = &types.QuerySignalTotalPowersResponse{
309309
SignalTotalPowers: signals[1:],
@@ -363,7 +363,7 @@ func (suite *KeeperTestSuite) TestQuerySupportedFeeds() {
363363
func() {
364364
feeds := []types.Feed{
365365
{
366-
SignalID: "crypto_price.bandusd",
366+
SignalID: "CS:BAND-USD",
367367
Power: 36000000000,
368368
Interval: 100,
369369
},
@@ -373,7 +373,7 @@ func (suite *KeeperTestSuite) TestQuerySupportedFeeds() {
373373

374374
feedWithDeviations := []types.FeedWithDeviation{
375375
{
376-
SignalID: "crypto_price.bandusd",
376+
SignalID: "CS:BAND-USD",
377377
Power: 36000000000,
378378
Interval: 100,
379379
DeviationBasisPoint: 83,

0 commit comments

Comments
 (0)