Skip to content

Commit 9b2c13e

Browse files
Maxxlab
authored andcommitted
chore: set oracle default params and values for the testnet launch
- slashing fraction is 0 - voting period is ~1 min - only ATOM with a correct IBC denom - fix unit tests
1 parent 40474ca commit 9b2c13e

File tree

6 files changed

+7
-38
lines changed

6 files changed

+7
-38
lines changed

x/oracle/keeper/grpc_query_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@ func (s *KeeperTestSuite) TestQueryAllExchangeRate() {
3030
s.app.OracleKeeper.SetExchangeRate(s.ctx, types.PersistenceSymbol, sdk.OneDec())
3131
// Set exchange rate for ATOM.
3232
s.app.OracleKeeper.SetExchangeRate(s.ctx, types.AtomSymbol, sdk.OneDec())
33-
// Set exchange rate for OSMO.
34-
s.app.OracleKeeper.SetExchangeRate(s.ctx, types.OsmosisSymbol, sdk.OneDec())
35-
// Set exchange rate for USDC.
36-
s.app.OracleKeeper.SetExchangeRate(s.ctx, types.USDCSymbol, sdk.OneDec())
3733

3834
resp, err = s.queryClient.AllExchangeRates(s.ctx.Context(), &types.QueryAllExchangeRatesRequest{})
3935
s.Require().NoError(err)
40-
s.Require().Len(resp.ExchangeRates, 4)
36+
s.Require().Len(resp.ExchangeRates, 2)
4137
}

x/oracle/types/asset.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,10 @@ const (
1616
BlocksPerYear = BlocksPerDay * 365
1717
MicroUnit = int64(1e6)
1818

19-
// TODO: discuss the denom values, took the denoms from: https://docs.osmosis.zone/osmosis-core/asset-info/
2019
// AtomDenom supported by oracle
21-
AtomDenom string = "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2"
20+
AtomDenom string = "ibc/4A17832B26BF318D052563EFFE677C1DE11DF8CE104F00204860F3E3439818B2"
2221
AtomSymbol string = "ATOM"
2322
AtomExponent = uint32(6)
24-
25-
// OsmosisDenom supported by oracle
26-
OsmosisDenom string = "uosmo"
27-
OsmosisSymbol string = "OSMO"
28-
OsmosisExponent = uint32(6)
29-
30-
// USDCDenom supported by oracle
31-
USDCDenom string = "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858"
32-
USDCSymbol string = "USDC"
33-
UsdcExponent = uint32(6)
3423
)
3524

3625
type (

x/oracle/types/denom_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestDenomString(t *testing.T) {
1818
},
1919
{
2020
denom: types.DenomAtom,
21-
expectedStr: "base_denom: ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2\nsymbol_denom: ATOM\nexponent: 6\n",
21+
expectedStr: "base_denom: ibc/4A17832B26BF318D052563EFFE677C1DE11DF8CE104F00204860F3E3439818B2\nsymbol_denom: ATOM\nexponent: 6\n",
2222
},
2323
}
2424

@@ -71,7 +71,7 @@ func TestDenomListString(t *testing.T) {
7171
},
7272
{
7373
denomList: types.DenomList{types.DenomPersistence, types.DenomAtom},
74-
expectedStr: "base_denom: uxprt\nsymbol_denom: XPRT\nexponent: 6\n\nbase_denom: ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2\nsymbol_denom: ATOM\nexponent: 6",
74+
expectedStr: "base_denom: uxprt\nsymbol_denom: XPRT\nexponent: 6\n\nbase_denom: ibc/4A17832B26BF318D052563EFFE677C1DE11DF8CE104F00204860F3E3439818B2\nsymbol_denom: ATOM\nexponent: 6",
7575
},
7676
}
7777

x/oracle/types/params.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var (
2323

2424
// Default parameter values
2525
const (
26-
DefaultVotePeriod = BlocksPerMinute / 2 // 30 seconds
26+
DefaultVotePeriod = BlocksPerMinute * 1 // 1 minute
2727
DefaultSlashWindow = BlocksPerWeek // window for a week
2828
DefaultRewardDistributionWindow = BlocksPerYear // window for a year
2929

@@ -42,18 +42,8 @@ var (
4242
SymbolDenom: AtomSymbol,
4343
Exponent: AtomExponent,
4444
},
45-
{
46-
BaseDenom: OsmosisDenom,
47-
SymbolDenom: OsmosisSymbol,
48-
Exponent: OsmosisExponent,
49-
},
50-
{
51-
BaseDenom: USDCDenom,
52-
SymbolDenom: USDCSymbol,
53-
Exponent: UsdcExponent,
54-
},
5545
}
56-
DefaultSlashFraction = sdk.NewDecWithPrec(1, 4) // 0.01%
46+
DefaultSlashFraction = sdk.NewDec(0) // 0%
5747
DefaultMinValidPerWindow = sdk.NewDecWithPrec(5, 2) // 5%
5848

5949
oneDec = sdk.OneDec()

x/oracle/types/utils_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ var (
2323
SymbolDenom: AtomSymbol,
2424
Exponent: 6,
2525
}
26-
27-
DenomOsmosis = Denom{
28-
BaseDenom: OsmosisDenom,
29-
SymbolDenom: AtomSymbol,
30-
Exponent: 6,
31-
}
3226
)
3327

3428
// MockStakingKeeper implements the StakingKeeper interface.

x/oracle/types/vote_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestExchangeRateTuplesString(t *testing.T) {
4545
exchangeRateTuple,
4646
NewExchangeRateTuple(AtomDenom, sdk.SmallestDec()),
4747
}
48-
require.Equal(t, "- denom: uxprt\n exchange_rate: \"1.000000000000000000\"\n- denom: ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2\n exchange_rate: \"0.000000000000000001\"\n", exchangeRateTuples.String())
48+
require.Equal(t, "- denom: uxprt\n exchange_rate: \"1.000000000000000000\"\n- denom: ibc/4A17832B26BF318D052563EFFE677C1DE11DF8CE104F00204860F3E3439818B2\n exchange_rate: \"0.000000000000000001\"\n", exchangeRateTuples.String())
4949
}
5050

5151
func TestParseExchangeRateTuples(t *testing.T) {

0 commit comments

Comments
 (0)