diff --git a/types/upgrade.go b/types/upgrade.go index d80f4b946..8e9a8e998 100644 --- a/types/upgrade.go +++ b/types/upgrade.go @@ -12,6 +12,7 @@ const ( BEP8 = "BEP8" // Mini-BEP2 token LaunchBscUpgrade = "LaunchBscUpgrade" BEP82 = "BEP82" // https://github.com/binance-chain/BEPs/pull/82 + FixFailAckPackage = "FixFailAckPackage" ) var MainNetConfig = UpgradeConfig{ diff --git a/x/gov/client/utils.go b/x/gov/client/utils.go index 9bed23a3d..15294407c 100644 --- a/x/gov/client/utils.go +++ b/x/gov/client/utils.go @@ -32,6 +32,12 @@ func NormalizeProposalType(proposalType string) string { return "CreateValidator" case "RemoveValidator", "remove_validator": return "RemoveValidator" + case "SCParamsChange", "sc_params_change": + return "SCParamsChange" + case "CSCParamsChange", "csc_params_change": + return "CSCParamsChange" + case "ManageChanPermission", "manage_chan_permission": + return "ManageChanPermission" } return "" } diff --git a/x/oracle/handler.go b/x/oracle/handler.go index b053bd2ab..6deb8ca7d 100644 --- a/x/oracle/handler.go +++ b/x/oracle/handler.go @@ -144,11 +144,19 @@ func handlePackage(ctx sdk.Context, oracleKeeper Keeper, chainId sdk.ChainID, pa var sendSequence int64 = -1 if packageType == sdk.SynCrossChainPackageType { if crash { - sendSeq, err := oracleKeeper.IbcKeeper.CreateRawIBCPackageById(ctx, chainId, - pack.ChannelId, sdk.FailAckCrossChainPackageType, pack.Payload) - if err != nil { + var ibcErr sdk.Error + var sendSeq uint64 + if sdk.IsUpgrade(sdk.FixFailAckPackage) && len(pack.Payload) >= sTypes.PackageHeaderLength { + sendSeq, ibcErr = oracleKeeper.IbcKeeper.CreateRawIBCPackageById(ctx, chainId, + pack.ChannelId, sdk.FailAckCrossChainPackageType, pack.Payload[sTypes.PackageHeaderLength:]) + } else { + logger.Error("found payload without header", "channelID", pack.ChannelId, "sequence", pack.Sequence, "payload", hex.EncodeToString(pack.Payload)) + sendSeq, ibcErr = oracleKeeper.IbcKeeper.CreateRawIBCPackageById(ctx, chainId, + pack.ChannelId, sdk.FailAckCrossChainPackageType, pack.Payload) + } + if ibcErr != nil { logger.Error("failed to write FailAckCrossChainPackage", "err", err) - return sdk.Event{}, err + return sdk.Event{}, ibcErr } sendSequence = int64(sendSeq) } else {