Skip to content

Commit

Permalink
Release/v1.2.0 (#276)
Browse files Browse the repository at this point in the history
* remove v1.1.0 upgrade handler

* remove epoch skipping logic

* add airdrop module account to receivable accounts

* tidy debug messages; tweak chunk size; fix clipping comparison

* bump ibc-go to v5.2.0
  • Loading branch information
Joe Bowman authored Jan 3, 2023
1 parent 8ac748b commit 0ce6daf
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 221 deletions.
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ var (
allowedReceivingModAcc = map[string]bool{
distrtypes.ModuleName: true,
interchainstakingtypes.ModuleName: true,
airdroptypes.ModuleName: true,
}
)

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/CosmWasm/wasmd v0.29.2
github.com/cosmos/cosmos-proto v1.0.0-alpha8
github.com/cosmos/cosmos-sdk v0.46.7
github.com/cosmos/ibc-go/v5 v5.1.0
github.com/cosmos/ibc-go/v5 v5.2.0
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.2
github.com/gorilla/mux v1.8.0
Expand Down Expand Up @@ -46,7 +46,7 @@ require (
github.com/DataDog/zstd v1.5.0 // indirect
github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect
github.com/Workiva/go-datastructures v1.0.53 // indirect
github.com/armon/go-metrics v0.4.0 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go v1.40.45 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-metrics v0.4.0 h1:yCQqn7dwca4ITXb+CbubHmedzaQYHhNhrEXLYUeEe8Q=
github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA=
github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
Expand Down Expand Up @@ -250,8 +250,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4
github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw=
github.com/cosmos/iavl v0.19.4 h1:t82sN+Y0WeqxDLJRSpNd8YFX5URIrT+p8n6oJbJ2Dok=
github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
github.com/cosmos/ibc-go/v5 v5.1.0 h1:m1NHXFkwwvNeJegZqtyox1WLinh+PMy4ivU/Cs9KjeA=
github.com/cosmos/ibc-go/v5 v5.1.0/go.mod h1:H6sV0/CkNRDtvSrhbsIgiog1WnSwhguGfg8x34MOVEk=
github.com/cosmos/ibc-go/v5 v5.2.0 h1:LxwttRQqdUJpQ3/Gc3XPg5lkRo3pcbzx65dxFIY6ONE=
github.com/cosmos/ibc-go/v5 v5.2.0/go.mod h1:MhDUMDVSboK5JW2pEWHNcw0wJHaHqKV/vwwP7awGhzI=
github.com/cosmos/interchain-accounts v0.3.2 h1:7S5rSndahpjkzUvG00kKZrTZsEuVHuVC9a7p0qDVcF8=
github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w=
github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g=
Expand Down
5 changes: 0 additions & 5 deletions x/interchainstaking/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ type zoneItrFn func(index int64, zoneInfo types.Zone) (stop bool)
func (k Keeper) BeginBlocker(ctx sdk.Context) {
defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker)

if ctx.ChainID() == "quicksilver-1" && ctx.BlockHeight() == 115001 {
// trigger one time function in lieu of upgrade handler that will trigger on chain resumption.
V010100UpgradeHandler(ctx, &k)
}

if ctx.BlockHeight()%30 == 0 {
if err := k.GCCompletedRedelegations(ctx); err != nil {
k.Logger(ctx).Error("error in GCCompletedRedelegations", "error", err)
Expand Down
11 changes: 1 addition & 10 deletions x/interchainstaking/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,12 @@ import (
"github.com/ingenuity-build/quicksilver/x/interchainstaking/types"
)

// we do not wish to process epoch boundaries that occurred during the chain halt.
func skipProductionEpoch(ctx sdk.Context, epochNumber int64) bool {
if ctx.ChainID() != "quicksilver-1" {
return false
}

return epochNumber < 7 // epoch 7 will start on 4th Jan 2023.
}

func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) {
}

func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) {
// every epoch
if epochIdentifier == "epoch" && !skipProductionEpoch(ctx, epochNumber) {
if epochIdentifier == "epoch" {
k.Logger(ctx).Info("handling epoch end")

k.IterateZones(ctx, func(index int64, zoneInfo types.Zone) (stop bool) {
Expand Down
32 changes: 16 additions & 16 deletions x/interchainstaking/keeper/ibc_packet_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack
k.Logger(ctx).Error("unable to unmarshal MsgRedeemTokensforShares response", "error", err)
return err
}
k.Logger(ctx).Debug("Tokens redeemed for shares", "response", response)
k.Logger(ctx).Info("Tokens redeemed for shares", "response", response)
// we should update delegation records here.
if err := k.HandleRedeemTokens(ctx, src, response.Amount); err != nil {
return err
Expand Down Expand Up @@ -133,7 +133,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack
k.Logger(ctx).Error("unable to unmarshal MsgBeginRedelegate response", "error", err)
return err
}
k.Logger(ctx).Error("Redelegation initiated", "response", response)
k.Logger(ctx).Info("Redelegation initiated", "response", response)
if err := k.HandleBeginRedelegate(ctx, src, response.CompletionTime, packetData.Memo); err != nil {
return err
}
Expand All @@ -157,7 +157,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack
k.Logger(ctx).Error("unable to unmarshal MsgSend response", "error", err)
return err
}
k.Logger(ctx).Debug("Funds Transferred", "response", response)
k.Logger(ctx).Info("Funds Transferred", "response", response)
// check tokenTransfers - if end user unescrow and burn txs
if err := k.HandleCompleteSend(ctx, src, packetData.Memo); err != nil {
return err
Expand All @@ -170,7 +170,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack
k.Logger(ctx).Error("unable to unmarshal MsgMultiSend response", "error", err)
return err
}
k.Logger(ctx).Debug("Funds Transferred (Multi)", "response", response)
k.Logger(ctx).Info("Funds Transferred (Multi)", "response", response)
if err := k.HandleCompleteMultiSend(ctx, src, packetData.Memo); err != nil {
return err
}
Expand All @@ -182,7 +182,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack
k.Logger(ctx).Error("unable to unmarshal MsgMultiSend response", "error", err)
return err
}
k.Logger(ctx).Debug("Withdraw Address Updated", "response", response)
k.Logger(ctx).Info("Withdraw Address Updated", "response", response)
if err := k.HandleUpdatedWithdrawAddress(ctx, src); err != nil {
return err
}
Expand All @@ -194,7 +194,7 @@ func (k *Keeper) HandleAcknowledgement(ctx sdk.Context, packet channeltypes.Pack
k.Logger(ctx).Error("unable to unmarshal MsgTransfer response", "error", err)
return err
}
k.Logger(ctx).Debug("MsgTranfer acknowledgement received")
k.Logger(ctx).Info("MsgTranfer acknowledgement received")
if err := k.HandleMsgTransfer(ctx, src); err != nil {
return err
}
Expand Down Expand Up @@ -321,7 +321,7 @@ func (k *Keeper) handleSendToDelegate(ctx sdk.Context, zone *types.Zone, msg *ba
}
}

k.Logger(ctx).Error("messages to send", "messages", msgs)
k.Logger(ctx).Info("messages to send", "messages", msgs)

return k.SubmitTx(ctx, msgs, zone.DelegationAddress, memo)
}
Expand Down Expand Up @@ -449,7 +449,7 @@ func (k *Keeper) HandleQueuedUnbondings(ctx sdk.Context, zone *types.Zone, epoch
err = fmt.Errorf("unable to find a validator we expected to exist [%s]", dist.Valoper)
return true
}
if val.DelegatorShares.Equal(sdk.NewDecFromInt(val.VotingPower)) && dist.Amount > 0 {
if !val.DelegatorShares.Equal(sdk.NewDecFromInt(val.VotingPower)) && dist.Amount > 0 {
dist.Amount--
}
}
Expand Down Expand Up @@ -491,7 +491,7 @@ func (k *Keeper) HandleQueuedUnbondings(ctx sdk.Context, zone *types.Zone, epoch
}
}

k.Logger(ctx).Error("unbonding messages", "msg", msgs)
k.Logger(ctx).Info("unbonding messages to send", "msg", msgs)

return k.SubmitTx(ctx, msgs, zone.DelegationAddress, fmt.Sprintf("withdrawal/%d", epoch))
}
Expand Down Expand Up @@ -610,7 +610,7 @@ func (k *Keeper) HandleBeginRedelegate(ctx sdk.Context, msg sdk.Msg, completion
k.Logger(ctx).Error("unable to find redelegation record", "chain", zone.ChainId, "source", redelegateMsg.ValidatorSrcAddress, "dst", redelegateMsg.ValidatorDstAddress, "epoch", epochNumber)
return fmt.Errorf("unable to find redelegation record for chain %s, src: %s, dst: %s, at epoch %d", zone.ChainId, redelegateMsg.ValidatorSrcAddress, redelegateMsg.ValidatorDstAddress, epochNumber)
}
k.Logger(ctx).Error("updating redelegation record with completion time")
k.Logger(ctx).Info("updating redelegation record with completion time", "completion", completion)
record.CompletionTime = completion
k.SetRedelegationRecord(ctx, record)
return nil
Expand Down Expand Up @@ -650,7 +650,7 @@ func (k *Keeper) HandleUndelegate(ctx sdk.Context, msg sdk.Msg, completion time.
if completion.After(record.CompletionTime) {
record.CompletionTime = completion
}
k.Logger(ctx).Error("withdrawal record to save", "rcd", record)
k.Logger(ctx).Info("withdrawal record to save", "rcd", record)
k.UpdateWithdrawalRecordStatus(ctx, &record, WithdrawStatusUnbond)
}
delegationQuery := stakingtypes.QueryDelegatorDelegationsRequest{DelegatorAddr: undelegateMsg.DelegatorAddress}
Expand Down Expand Up @@ -760,7 +760,7 @@ func (k *Keeper) UpdateDelegationRecordsForAddress(ctx sdk.Context, zone types.Z
if err != nil {
return err
}
k.Logger(ctx).Error("ERROR 1", "response", response)
k.Logger(ctx).Info("Delegation query response", "response", response)
_, delAddr, err := bech32.DecodeAndConvert(delegatorAddress)
if err != nil {
return err
Expand Down Expand Up @@ -845,7 +845,7 @@ func (k *Keeper) UpdateDelegationRecordForAddress(ctx sdk.Context, delegatorAddr
} else {
delegation.Amount = amount
}
k.Logger(ctx).Error("Updating delegation tuple amount", "delegator", delegatorAddress, "validator", validatorAddress, "old_amount", oldAmount, "inbound_amount", amount.Amount, "new_amount", delegation.Amount, "abs", absolute)
k.Logger(ctx).Info("Updating delegation tuple amount", "delegator", delegatorAddress, "validator", validatorAddress, "old_amount", oldAmount, "inbound_amount", amount.Amount, "new_amount", delegation.Amount, "abs", absolute)
}
k.SetDelegation(ctx, zone, delegation)
if err := k.EmitValsetRequery(ctx, zone.ConnectionId, zone.ChainId); err != nil {
Expand Down Expand Up @@ -875,7 +875,7 @@ func (k *Keeper) HandleWithdrawRewards(ctx sdk.Context, msg sdk.Msg) error {
// performance only.
if withdrawalMsg.DelegatorAddress != zone.PerformanceAddress.Address {
zone.WithdrawalWaitgroup--
k.Logger(ctx).Error("WAITGROUP DECREMENTED", "wg", zone.WithdrawalWaitgroup)
k.Logger(ctx).Info("Decremented waitgroup", "wg", zone.WithdrawalWaitgroup)
k.SetZone(ctx, zone)
}
k.Logger(ctx).Info("Received MsgWithdrawDelegatorReward acknowledgement", "wg", zone.WithdrawalWaitgroup, "delegator", withdrawalMsg.DelegatorAddress)
Expand All @@ -887,7 +887,7 @@ func (k *Keeper) HandleWithdrawRewards(ctx sdk.Context, msg sdk.Msg) error {
if err != nil {
return err
}
k.Logger(ctx).Error("TRIGGER DISTRIBUTE REWARDS")
k.Logger(ctx).Info("Distributing rewards")
// total rewards balance withdrawn
k.ICQKeeper.MakeRequest(
ctx,
Expand Down Expand Up @@ -959,7 +959,7 @@ func DistributeRewardsFromWithdrawAccount(k Keeper, ctx sdk.Context, args []byte
Token: coin,
Sender: zone.WithdrawalAddress.Address,
Receiver: k.AccountKeeper.GetModuleAddress(types.ModuleName).String(),
TimeoutTimestamp: uint64(ctx.BlockTime().UnixNano() + 5*time.Minute.Nanoseconds()),
TimeoutTimestamp: uint64(ctx.BlockTime().UnixNano() + 6*time.Hour.Nanoseconds()),
TimeoutHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 0},
},
)
Expand Down
4 changes: 2 additions & 2 deletions x/interchainstaking/keeper/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

const (
Unset = "unset"
ICAMsgChunkSize = 10
ICAMsgChunkSize = 5
)

func (k Keeper) HandleReceiptTransaction(ctx sdk.Context, txr *sdk.TxResponse, txn *tx.Tx, zone types.Zone) error {
Expand All @@ -48,7 +48,7 @@ func (k Keeper) HandleReceiptTransaction(ctx sdk.Context, txr *sdk.TxResponse, t
return fmt.Errorf("sender mismatch: expected %q, got %q", senderAddress, sender)
}

k.Logger(ctx).Error("Deposit receipt", "deposit_address", zone.DepositAddress.GetAddress(), "sender", sender, "amount", amount)
k.Logger(ctx).Info("Deposit receipt", "deposit_address", zone.DepositAddress.GetAddress(), "sender", sender, "amount", amount)
thisCoins, err := sdk.ParseCoinsNormalized(amount)
if err != nil {
k.Logger(ctx).Error("unable to parse coin", "string", amount)
Expand Down
83 changes: 0 additions & 83 deletions x/interchainstaking/keeper/v1_1_upgrade_handler.go

This file was deleted.

Loading

0 comments on commit 0ce6daf

Please sign in to comment.