Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove redundant code #780

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions telemetry/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"math/big"

"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/hashicorp/go-metrics"
)

Expand All @@ -20,9 +19,3 @@ func SetGaugeLabelsWithDenom(keys []string, denom string, amount *big.Int, label
telemetry.SetGaugeWithLabels(append(keys, denom), amountFloat32,
append(labels, telemetry.NewLabel("denom", denom)))
}

func SetGaugeLabelsWithCoins(keys []string, coins sdk.Coins, labels ...metrics.Label) {
for _, coin := range coins {
SetGaugeLabelsWithDenom(keys, coin.Denom, coin.Amount.BigInt(), labels...)
}
}
14 changes: 0 additions & 14 deletions testutil/helpers/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package helpers

import (
"crypto/ecdsa"
"encoding/hex"

"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -117,15 +115,3 @@ func GenZeroExternalAddr(module string) string {
func HexAddrToTronAddr(str string) string {
return types.ExternalAddrToStr(trontypes.ModuleName, common.FromHex(str))
}

// NewPubKeyFromHex returns a PubKey from a hex string.
func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey) {
pkBytes, err := hex.DecodeString(pk)
if err != nil {
panic(err)
}
if len(pkBytes) != ed25519.PubKeySize {
panic(sdkerrors.ErrInvalidPubKey.Wrap("size"))
}
return &ed25519.PubKey{Key: pkBytes}
}
8 changes: 0 additions & 8 deletions x/crosschain/keeper/keeper_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,6 @@ func (suite *KeeperTestSuite) EndBlocker() {
suite.Require().NoError(err)
}

func (suite *KeeperTestSuite) SetToken(symbol string, bridgeDenoms ...string) {
// if symbol == fxtypes.DefaultDenom {
// bridgeDenoms = []string{}
// }
// err := suite.Keeper().SetToken(suite.Ctx, "Test Token", symbol, 18, bridgeDenoms...)
// suite.Require().NoError(err)
}

func (suite *KeeperTestSuite) SetIBCDenom(portID, channelID, denom string) ibctransfertypes.DenomTrace {
sourcePrefix := ibctransfertypes.GetDenomPrefix(portID, channelID)
prefixedDenom := sourcePrefix + denom
Expand Down
3 changes: 3 additions & 0 deletions x/crosschain/migrations/v8/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (
)

var (
// Deprecated: OutgoingTxPoolKey indexes the last nonce for the outgoing tx pool
OutgoingTxPoolKey = []byte{0x18}

// Deprecated: DenomToTokenKey prefixes the index of asset denom to external token
DenomToTokenKey = []byte{0x26}

Expand Down
136 changes: 0 additions & 136 deletions x/crosschain/mock/expected_keepers_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions x/crosschain/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,3 @@ type AccountKeeper interface {
NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI
}

type BridgeTokenKeeper interface {
HasToken(ctx context.Context, denom string) (bool, error)
GetBridgeDenoms(ctx context.Context, denom string) ([]string, error)
GetBridgeDenom(ctx context.Context, denom, chainName string) (string, error)
GetBaseDenom(ctx context.Context, alias string) (string, error)
GetAllTokens(ctx context.Context) ([]string, error)
UpdateBridgeDenom(ctx context.Context, denom string, bridgeDenoms ...string) error
SetToken(ctx context.Context, name, symbol string, decimals uint32, bridgeDenoms ...string) error
}
16 changes: 0 additions & 16 deletions x/crosschain/types/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ var (
// eventually executes
OracleAttestationKey = []byte{0x17}

// OutgoingTxPoolKey indexes the last nonce for the outgoing tx pool
OutgoingTxPoolKey = []byte{0x18}

// OutgoingTxBatchKey indexes outgoing tx batches under a nonce and token address
OutgoingTxBatchKey = []byte{0x20}

Expand Down Expand Up @@ -152,19 +149,6 @@ func GetAttestationKey(eventNonce uint64, claimHash []byte) []byte {
return append(OracleAttestationKey, append(sdk.Uint64ToBigEndian(eventNonce), claimHash...)...)
}

// GetOutgoingTxPoolContractPrefix returns the following key format
// This prefix is used for iterating over unbatched transactions for a given contract
func GetOutgoingTxPoolContractPrefix(tokenContract string) []byte {
return append(OutgoingTxPoolKey, []byte(tokenContract)...)
}

// GetOutgoingTxPoolKey returns the following key format
func GetOutgoingTxPoolKey(fee ERC20Token, id uint64) []byte {
amount := make([]byte, 32)
amount = fee.Amount.BigInt().FillBytes(amount)
return append(OutgoingTxPoolKey, append([]byte(fee.Contract), append(amount, sdk.Uint64ToBigEndian(id)...)...)...)
}

// GetOutgoingTxBatchKey returns the following key format
func GetOutgoingTxBatchKey(tokenContract string, batchNonce uint64) []byte {
return append(append(OutgoingTxBatchKey, []byte(tokenContract)...), sdk.Uint64ToBigEndian(batchNonce)...)
Expand Down
1 change: 0 additions & 1 deletion x/crosschain/types/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const (
EthTarget = "eth"

LegacyChainPrefix = "chain/"
IBCPrefix = "ibc/"
)

type FxTarget struct {
Expand Down