Skip to content

Commit

Permalink
merge main, update change log
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Feb 15, 2024
2 parents 4549d3b + 35d2aab commit d4e0a7c
Show file tree
Hide file tree
Showing 40 changed files with 5,149 additions and 488 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
if: env.GIT_DIFF
with:
go-version: '1.21'
- uses: golangci/golangci-lint-action@v3
- uses: golangci/golangci-lint-action@v4
if: env.GIT_DIFF
with:
# If you change this version, be sure to also change it in contrib/devtools/Makefile.
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,26 @@ Ref: https://keepachangelog.com/en/1.0.0/

## [Unreleased]

### Improvements

* Add new force_transfer access that is required for an account to do a forced transfer ([#1829](https://github.com/provenance-io/provenance/issues/1829)).
* Add exchange commitment stuff to CLI [PR 1830](https://github.com/provenance-io/provenance/pull/1830).
* Update the MsgFees Params to set the nhash per usd-mil to 40,000,000 ($0.025/hash) [#1833](https://github.com/provenance-io/provenance/pull/1833).
* Bid order prices are no longer restricted to amounts that can be evenly applied to a buyer settlement fee ratio [1834](https://github.com/provenance-io/provenance/pull/1843).

### API Breaking

* Accounts that have transfer access in a marker are no longer allowed to do forced transfers ([#1829](https://github.com/provenance-io/provenance/issues/1829)).
Accounts must now have the force_transfer access for that.

### Dependencies

- Bump `codecov/codecov-action` from 3 to 4 ([#1828](https://github.com/provenance-io/provenance/pull/1828))
- Bump `peter-evans/create-pull-request` from 5.0.2 to 6.0.0 ([#1827](https://github.com/provenance-io/provenance/pull/1827))
- Bump `bufbuild/buf-setup-action` from 1.28.1 to 1.29.0 ([#1825](https://github.com/provenance-io/provenance/pull/1825))
- Bump `serde-json-wasm` from 1.0.0 to 1.0.1 ([#1836](https://github.com/provenance-io/provenance/pull/1836))
- Bump `serde-json-wasm` from 1.0.0 to 1.0.1 in /testutil/contracts/rate-limiter ([#1836](https://github.com/provenance-io/provenance/pull/1836))
- Bump `serde-json-wasm` from 0.5.1 to 0.5.2 in /testutil/contracts/counter ([#1837](https://github.com/provenance-io/provenance/pull/1837))
- Bump `serde-json-wasm` from 0.5.1 to 0.5.2 in /testutil/contracts/echo ([#1838](https://github.com/provenance-io/provenance/pull/1838))

---

Expand Down
34 changes: 24 additions & 10 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ var upgrades = map[string]appUpgrade{
removeInactiveValidatorDelegations(ctx, app)
convertNavUnits(ctx, app)

// This isn't in an rc because it was handled via gov prop for testnet.
updateMsgFeesNhashPerMil(ctx, app)

return vm, nil
},
},
Expand Down Expand Up @@ -234,33 +237,33 @@ var _ = runModuleMigrations
// This should be applied in most upgrades.
func removeInactiveValidatorDelegations(ctx sdk.Context, app *App) {
unbondingTimeParam := app.StakingKeeper.GetParams(ctx).UnbondingTime
ctx.Logger().Info(fmt.Sprintf("removing all delegations from validators that have been inactive (unbonded) for %d days", int64(unbondingTimeParam.Hours()/24)))
ctx.Logger().Info(fmt.Sprintf("Removing all delegations from validators that have been inactive (unbonded) for %d days.", int64(unbondingTimeParam.Hours()/24)))
removalCount := 0
validators := app.StakingKeeper.GetAllValidators(ctx)
for _, validator := range validators {
if validator.IsUnbonded() {
inactiveDuration := ctx.BlockTime().Sub(validator.UnbondingTime)
if inactiveDuration >= unbondingTimeParam {
ctx.Logger().Info(fmt.Sprintf("validator %v has been inactive (unbonded) for %d days and will be removed", validator.OperatorAddress, int64(inactiveDuration.Hours()/24)))
ctx.Logger().Info(fmt.Sprintf("Validator %v has been inactive (unbonded) for %d days and will be removed.", validator.OperatorAddress, int64(inactiveDuration.Hours()/24)))
valAddress, err := sdk.ValAddressFromBech32(validator.OperatorAddress)
if err != nil {
ctx.Logger().Error(fmt.Sprintf("invalid operator address: %s: %v", validator.OperatorAddress, err))
ctx.Logger().Error(fmt.Sprintf("Invalid operator address: %s: %v.", validator.OperatorAddress, err))
continue
}
delegations := app.StakingKeeper.GetValidatorDelegations(ctx, valAddress)
for _, delegation := range delegations {
ctx.Logger().Info(fmt.Sprintf("undelegate delegator %v from validator %v of all shares (%v)", delegation.DelegatorAddress, validator.OperatorAddress, delegation.GetShares()))
ctx.Logger().Info(fmt.Sprintf("Undelegate delegator %v from validator %v of all shares (%v).", delegation.DelegatorAddress, validator.OperatorAddress, delegation.GetShares()))
_, err = app.StakingKeeper.Undelegate(ctx, delegation.GetDelegatorAddr(), valAddress, delegation.GetShares())
if err != nil {
ctx.Logger().Error(fmt.Sprintf("failed to undelegate delegator %s from validator %s: %v", delegation.GetDelegatorAddr().String(), valAddress.String(), err))
ctx.Logger().Error(fmt.Sprintf("Failed to undelegate delegator %s from validator %s: %v.", delegation.GetDelegatorAddr().String(), valAddress.String(), err))
continue
}
}
removalCount++
}
}
}
ctx.Logger().Info(fmt.Sprintf("a total of %d inactive (unbonded) validators have had all their delegators removed", removalCount))
ctx.Logger().Info(fmt.Sprintf("A total of %d inactive (unbonded) validators have had all their delegators removed.", removalCount))
}

// setupICQ sets the correct default values for ICQKeeper.
Expand Down Expand Up @@ -354,24 +357,35 @@ func updateIbcMarkerDenomMetadata(ctx sdk.Context, app *App) {

// convertNavUnits iterates all the net asset values and updates their units if they are using usd.
func convertNavUnits(ctx sdk.Context, app *App) {
ctx.Logger().Info("Converting NAV units")
ctx.Logger().Info("Converting NAV units.")
err := app.MarkerKeeper.IterateAllNetAssetValues(ctx, func(markerAddr sdk.AccAddress, nav markertypes.NetAssetValue) (stop bool) {
if nav.Price.Denom == markertypes.UsdDenom {
nav.Price.Amount = nav.Price.Amount.Mul(math.NewInt(10))
marker, err := app.MarkerKeeper.GetMarker(ctx, markerAddr)
if err != nil {
ctx.Logger().Error(fmt.Sprintf("Unable to get marker for address: %s, error: %s", markerAddr, err))
ctx.Logger().Error(fmt.Sprintf("Unable to get marker for address: %s, error: %s.", markerAddr, err))
return false
}
err = app.MarkerKeeper.SetNetAssetValue(ctx, marker, nav, "upgrade")
if err != nil {
ctx.Logger().Error(fmt.Sprintf("Unable to set net asset value for marker: %s, error: %s", markerAddr, err))
ctx.Logger().Error(fmt.Sprintf("Unable to set net asset value for marker: %s, error: %s.", markerAddr, err))
return false
}
}
return false
})
if err != nil {
ctx.Logger().Error(fmt.Sprintf("Unable to iterate all net asset values error: %s", err))
ctx.Logger().Error(fmt.Sprintf("Unable to iterate all net asset values error: %s.", err))
}
ctx.Logger().Info("Done converting NAV units.")
}

// updateMsgFeesNhashPerMil updates the MsgFees Params to set the NhashPerUsdMil to 40,000,000.
func updateMsgFeesNhashPerMil(ctx sdk.Context, app *App) {
var newVal uint64 = 40_000_000
ctx.Logger().Info(fmt.Sprintf("Setting MsgFees Params NhashPerUsdMil to %d.", newVal))
params := app.MsgFeesKeeper.GetParams(ctx)
params.NhashPerUsdMil = newVal
app.MsgFeesKeeper.SetParams(ctx, params)
ctx.Logger().Info("Done setting MsgFees Params NhashPerUsdMil.")
}
Loading

0 comments on commit d4e0a7c

Please sign in to comment.