Skip to content

Commit

Permalink
Merge branch 'main' into ud/evm-rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
Unique-Divine committed May 5, 2024
2 parents db03210 + ffcea96 commit 045cf6d
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 35 deletions.
23 changes: 5 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

#### For next mainnet version

- [#1715](https://github.com/NibiruChain/nibiru/pull/1715) - fix(build): revert! to working build + cherry-picks
- [#1766](https://github.com/NibiruChain/nibiru/pull/1766) - refactor(app-wasmext)!: remove wasmbinding `CosmosMsg::Custom` bindings.
- [#1776](https://github.com/NibiruChain/nibiru/pull/1776) - feat(inflation): make inflation params a collection and add commands to update them
- [#1816](https://github.com/NibiruChain/nibiru/pull/1816) - fix(ibc): fix ibc transaction from wasm contract
- [#1820](https://github.com/NibiruChain/nibiru/pull/1820) - feat: add interchain accounts

#### Nibiru EVM

- [#1837](https://github.com/NibiruChain/nibiru/pull/1837) - feat(eth): protos, eth types, and evm module types
- [#1838](https://github.com/NibiruChain/nibiru/pull/1838) - feat(eth): Go-ethereum, crypto, encoding, and unit tests for evm/types
- [#1841](https://github.com/NibiruChain/nibiru/pull/1841) - feat(eth): Collections encoders for bytes, Ethereum addresses, and Ethereum hashes
- [#1847](https://github.com/NibiruChain/nibiru/pull/1847) - fix(docker-chaosnet): release snapshot docker build failed CI.
- [#1855](https://github.com/NibiruChain/nibiru/pull/1855) - feat(eth-pubsub): Implement in-memory EventBus for real-time topic management and event distribution
- [#1856](https://github.com/NibiruChain/nibiru/pull/1856) - feat(eth-rpc): Conversion types and functions between Ethereum txs and blocks and Tendermint ones.

#### Dapp modules: perp, spot, etc
#### Dapp modules: perp, spot, oracle, etc

- [#1573](https://github.com/NibiruChain/nibiru/pull/1573) - feat(perp): Close markets and compute settlement price
- [#1632](https://github.com/NibiruChain/nibiru/pull/1632) - feat(perp): Add settle position transaction
Expand All @@ -72,29 +69,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#1686](https://github.com/NibiruChain/nibiru/pull/1686) - test(perp): add more tests for perp module msg server for DnR
- [#1687](https://github.com/NibiruChain/nibiru/pull/1687) - chore(wasmbinding): delete CustomQuerier since we have QueryRequest::Stargate now
- [#1705](https://github.com/NibiruChain/nibiru/pull/1705) - feat(perp): Add oracle pair to market object
- [#1718](https://github.com/NibiruChain/nibiru/pull/1718) - fix: fees does not require additional funds
- [#1718](https://github.com/NibiruChain/nibiru/pull/1718) - fix(perp): fees does not require additional funds
- [#1734](https://github.com/NibiruChain/nibiru/pull/1734) - feat(perp): MsgDonateToPerpFund sudo call as part of #1642
- [#1749](https://github.com/NibiruChain/nibiru/pull/1749) - feat(perp): move close market from Wasm Binding to MsgCloseMarket
- [#1752](https://github.com/NibiruChain/nibiru/pull/1752) - feat(oracle): MsgEditOracleParams sudo tx msg as part of #1642
- [#1755](https://github.com/NibiruChain/nibiru/pull/1755) - feat(oracle): Add more events on validator's performance
- [#1764](https://github.com/NibiruChain/nibiru/pull/1764) - fix(perp): make updateswapinvariant aware of total short supply to avoid panics
- [#1710](https://github.com/NibiruChain/nibiru/pull/1710) - refactor(perp): Clean and organize module errors for x/perp

### Non-breaking/Compatible Improvements

- [#1679](https://github.com/NibiruChain/nibiru/pull/1679) - test(perp): add more tests for perp module msg server
- [#1690](https://github.com/NibiruChain/nibiru/pull/1690) - docs(CHANGELOG.md): Correct the change log, providing clarity on what's released.
- [#1695](https://github.com/NibiruChain/nibiru/pull/1695) - fix(sudo): Make blank sudoers root invalid at genesis time.
- [#1710](https://github.com/NibiruChain/nibiru/pull/1710) - refactor(perp): Clean and organize module errors for x/perp
- [#1714](https://github.com/NibiruChain/nibiru/pull/1714) - ci(localnet.sh): Fix script, simplify, and test in CI.
- [#1719](https://github.com/NibiruChain/nibiru/pull/1719) - refactor(test): add is not mandatory interface to action
- [#1723](https://github.com/NibiruChain/nibiru/pull/1723) - ci(e2e-wasm.yml): rm unused workflow
- [#1728](https://github.com/NibiruChain/nibiru/pull/1728) - test(devgas-cli): CLI tests for devgas txs
- [#1731](https://github.com/NibiruChain/nibiru/pull/1731) - feat(cli): add cli command to decode stargate base64 messages
- [#1735](https://github.com/NibiruChain/nibiru/pull/1735) - test(sim): fix simulation tests
- [#1736](https://github.com/NibiruChain/nibiru/pull/1736) - test(sim): add sim genesis state for all custom modules
- [#1799](https://github.com/NibiruChain/nibiru/pull/1799) - refactor,docs(inflation): Document everything + delete unused code. Make perp and spot optional features in localnet.sh
- [#1810](https://github.com/NibiruChain/nibiru/pull/1810) - chore(ci): use ubuntu-latest-m for goreleaser
- [#1818](https://github.com/NibiruChain/nibiru/pull/1818) - feat: add pebbledb support
- [#1859](https://github.com/NibiruChain/nibiru/pull/1859) - refactor(oracle): add oracle slashing events

### Dependencies

Expand All @@ -114,6 +100,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bump `golang.org/x/net` from 0.20.0 to 0.23.0 ([#1850](https://github.com/NibiruChain/nibiru/pull/1850))
- Bump `github.com/supranational/blst` from 0.3.8-0.20220526154634-513d2456b344 to 0.3.11 ([#1851](https://github.com/NibiruChain/nibiru/pull/1851))
- Bump `golangci/golangci-lint-action` from 4 to 5 ([#1854](https://github.com/NibiruChain/nibiru/pull/1854))
- Bump `github.com/hashicorp/go-getter` from 1.7.1 to 1.7.4 ([#1858](https://github.com/NibiruChain/nibiru/pull/1858))

## [v1.2.0](https://github.com/NibiruChain/nibiru/releases/tag/v1.2.0) - 2024-03-28

Expand Down
2 changes: 1 addition & 1 deletion app/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func (app *NibiruApp) InitKeepers(
)

app.OracleKeeper = oraclekeeper.NewKeeper(appCodec, keys[oracletypes.StoreKey],
app.AccountKeeper, app.BankKeeper, app.DistrKeeper, app.stakingKeeper,
app.AccountKeeper, app.BankKeeper, app.DistrKeeper, app.stakingKeeper, app.slashingKeeper,
app.SudoKeeper,
distrtypes.ModuleName,
)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ require (
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.7.1 // indirect
github.com/hashicorp/go-getter v1.7.4 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,8 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY=
github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=
github.com/hashicorp/go-getter v1.7.4 h1:3yQjWuxICvSpYwqSayAdKRFcvBl1y/vogCxczWSmix0=
github.com/hashicorp/go-getter v1.7.4/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
Expand Down
15 changes: 9 additions & 6 deletions x/oracle/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ type Keeper struct {
cdc codec.BinaryCodec
storeKey storetypes.StoreKey

AccountKeeper types.AccountKeeper
bankKeeper types.BankKeeper
distrKeeper types.DistributionKeeper
StakingKeeper types.StakingKeeper
SudoKeeper types.SudoKeeper
AccountKeeper types.AccountKeeper
bankKeeper types.BankKeeper
distrKeeper types.DistributionKeeper
StakingKeeper types.StakingKeeper
slashingKeeper types.SlashingKeeper
sudoKeeper types.SudoKeeper

distrModuleName string

Expand Down Expand Up @@ -57,6 +58,7 @@ func NewKeeper(
bankKeeper types.BankKeeper,
distrKeeper types.DistributionKeeper,
stakingKeeper types.StakingKeeper,
slashingKeeper types.SlashingKeeper,
sudoKeeper types.SudoKeeper,

distrName string,
Expand All @@ -73,7 +75,8 @@ func NewKeeper(
bankKeeper: bankKeeper,
distrKeeper: distrKeeper,
StakingKeeper: stakingKeeper,
SudoKeeper: sudoKeeper,
slashingKeeper: slashingKeeper,
sudoKeeper: sudoKeeper,
distrModuleName: distrName,
Params: collections.NewItem(storeKey, 11, collections.ProtoValueEncoder[types.Params](cdc)),
ExchangeRates: collections.NewMap(storeKey, 1, asset.PairKeyEncoder, collections.ProtoValueEncoder[types.DatedPrice](cdc)),
Expand Down
9 changes: 4 additions & 5 deletions x/oracle/keeper/slash.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ func (k Keeper) SlashAndResetMissCounters(ctx sdk.Context) {
continue
}

k.StakingKeeper.Slash(
ctx, consAddr,
distributionHeight, validator.GetConsensusPower(powerReduction), slashFraction,
k.slashingKeeper.Slash(
ctx, consAddr, slashFraction, validator.GetConsensusPower(powerReduction), distributionHeight,
)
k.Logger(ctx).Info("slash", "validator", consAddr.String(), "fraction", slashFraction.String())
k.StakingKeeper.Jail(ctx, consAddr)
k.Logger(ctx).Info("oracle slash", "validator", consAddr.String(), "fraction", slashFraction.String())
k.slashingKeeper.Jail(ctx, consAddr)
}
}

Expand Down
2 changes: 1 addition & 1 deletion x/oracle/keeper/sudo.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (k sudoExtension) EditOracleParams(
ctx sdk.Context, newParams oracletypes.MsgEditOracleParams,
sender sdk.AccAddress,
) (paramsAfter oracletypes.Params, err error) {
if err := k.SudoKeeper.CheckPermissions(sender, ctx); err != nil {
if err := k.sudoKeeper.CheckPermissions(sender, ctx); err != nil {
return paramsAfter, err
}

Expand Down
9 changes: 8 additions & 1 deletion x/oracle/keeper/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import (
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/params"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
Expand Down Expand Up @@ -139,9 +141,12 @@ func CreateTestFixture(t *testing.T) TestFixture {
tKeyParams := sdk.NewTransientStoreKey(paramstypes.TStoreKey)
keyOracle := sdk.NewKVStoreKey(types.StoreKey)
keyStaking := sdk.NewKVStoreKey(stakingtypes.StoreKey)
keySlashing := sdk.NewKVStoreKey(slashingtypes.StoreKey)
keyDistr := sdk.NewKVStoreKey(distrtypes.StoreKey)
keySudo := sdk.NewKVStoreKey(sudotypes.StoreKey)

govModuleAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()

db := dbm.NewMemDB()
ms := store.NewCommitMultiStore(db)
ctx := sdk.NewContext(ms, tmproto.Header{Time: time.Now().UTC(), Height: 1}, false, log.NewNopLogger())
Expand Down Expand Up @@ -201,11 +206,12 @@ func CreateTestFixture(t *testing.T) TestFixture {
bankKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

stakingParams := stakingtypes.DefaultParams()
stakingParams.BondDenom = denoms.NIBI
stakingKeeper.SetParams(ctx, stakingParams)

slashingKeeper := slashingkeeper.NewKeeper(appCodec, legacyAmino, keySlashing, stakingKeeper, govModuleAddr)

distrKeeper := distrkeeper.NewKeeper(
appCodec,
keyDistr,
Expand Down Expand Up @@ -253,6 +259,7 @@ func CreateTestFixture(t *testing.T) TestFixture {
bankKeeper,
distrKeeper,
stakingKeeper,
slashingKeeper,
sudoKeeper,
distrtypes.ModuleName,
)
Expand Down
5 changes: 5 additions & 0 deletions x/oracle/types/expected_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ type StakingKeeper interface {
PowerReduction(ctx sdk.Context) (res sdkmath.Int)
}

type SlashingKeeper interface {
Slash(ctx sdk.Context, consAddr sdk.ConsAddress, fraction sdk.Dec, power int64, height int64)
Jail(sdk.Context, sdk.ConsAddress)
}

// DistributionKeeper is expected keeper for distribution module
type DistributionKeeper interface {
AllocateTokensToValidator(ctx sdk.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins)
Expand Down

0 comments on commit 045cf6d

Please sign in to comment.