From 4bbf2296668d8348e892c89f5120889336b94519 Mon Sep 17 00:00:00 2001 From: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com> Date: Tue, 29 Oct 2024 13:37:47 +0000 Subject: [PATCH] fix: use blank slash contract not 0x0000 --- precompiles/avs/utils_test.go | 2 -- x/avs/keeper/avs.go | 4 +++- x/operator/keeper/opt_test.go | 2 -- x/operator/keeper/slash.go | 2 -- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/precompiles/avs/utils_test.go b/precompiles/avs/utils_test.go index 00a78dc5f..5f52298d8 100644 --- a/precompiles/avs/utils_test.go +++ b/precompiles/avs/utils_test.go @@ -150,7 +150,6 @@ func (suite *AVSManagerPrecompileSuite) TestOptIn() { usdValue := operatorKeeper.CalculateUSDValue(suite.delegationAmount, price.Value, suite.assetDecimal, price.Decimal) expectedState := &StateForCheck{ OptedInfo: &operatorTypes.OptedInfo{ - SlashContract: "0x0000000000000000000000000000000000000000", OptedInHeight: uint64(suite.Ctx.BlockHeight()), OptedOutHeight: operatorTypes.DefaultOptedOutHeight, }, @@ -200,7 +199,6 @@ func (suite *AVSManagerPrecompileSuite) TestOptOut() { expectedState := &StateForCheck{ OptedInfo: &operatorTypes.OptedInfo{ - SlashContract: "0x0000000000000000000000000000000000000000", OptedInHeight: uint64(optInHeight), OptedOutHeight: uint64(suite.Ctx.BlockHeight()), }, diff --git a/x/avs/keeper/avs.go b/x/avs/keeper/avs.go index 6f8e820bb..646a9cd8a 100644 --- a/x/avs/keeper/avs.go +++ b/x/avs/keeper/avs.go @@ -46,7 +46,9 @@ func (k *Keeper) GetAVSSlashContract(ctx sdk.Context, avsAddr string) (string, e if err != nil { return "", errorsmod.Wrap(err, fmt.Sprintf("GetAVSSlashContract: key is %s", avsAddr)) } - + if avsInfo.Info.SlashAddr == (common.Address{}).String() { + return "", nil + } return avsInfo.Info.SlashAddr, nil } diff --git a/x/operator/keeper/opt_test.go b/x/operator/keeper/opt_test.go index e5db044e5..56e54a175 100644 --- a/x/operator/keeper/opt_test.go +++ b/x/operator/keeper/opt_test.go @@ -141,7 +141,6 @@ func (suite *OperatorTestSuite) TestOptIn() { OptedInfo: &operatorTypes.OptedInfo{ OptedInHeight: uint64(suite.Ctx.BlockHeight()), OptedOutHeight: operatorTypes.DefaultOptedOutHeight, - SlashContract: common.Address{}.String(), }, AVSTotalShare: usdValue, AVSOperatorShare: usdValue, @@ -191,7 +190,6 @@ func (suite *OperatorTestSuite) TestOptOut() { OptedInfo: &operatorTypes.OptedInfo{ OptedInHeight: uint64(optInHeight), OptedOutHeight: uint64(suite.Ctx.BlockHeight()), - SlashContract: common.Address{}.String(), }, AVSTotalShare: sdkmath.LegacyNewDec(0), AVSOperatorShare: sdkmath.LegacyNewDec(0), diff --git a/x/operator/keeper/slash.go b/x/operator/keeper/slash.go index df384888e..1f1c6a58d 100644 --- a/x/operator/keeper/slash.go +++ b/x/operator/keeper/slash.go @@ -5,7 +5,6 @@ import ( "github.com/ExocoreNetwork/exocore/utils" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" errorsmod "cosmossdk.io/errors" @@ -203,7 +202,6 @@ func (k Keeper) SlashWithInfractionReason( SlashID: slashID, SlashEventHeight: infractionHeight, SlashProportion: slashFactor, - SlashContract: common.Address{}.String(), } err := k.Slash(ctx, slashParam) if err != nil {