Skip to content

Commit

Permalink
fix: use blank slash contract not 0x0000
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxMustermann2 committed Oct 29, 2024
1 parent d84a457 commit 4bbf229
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
2 changes: 0 additions & 2 deletions precompiles/avs/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -200,7 +199,6 @@ func (suite *AVSManagerPrecompileSuite) TestOptOut() {

expectedState := &StateForCheck{
OptedInfo: &operatorTypes.OptedInfo{
SlashContract: "0x0000000000000000000000000000000000000000",
OptedInHeight: uint64(optInHeight),
OptedOutHeight: uint64(suite.Ctx.BlockHeight()),
},
Expand Down
4 changes: 3 additions & 1 deletion x/avs/keeper/avs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 0 additions & 2 deletions x/operator/keeper/opt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 0 additions & 2 deletions x/operator/keeper/slash.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 4bbf229

Please sign in to comment.