e2e

package module
v0.0.0-...-bd42ebf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2025 License: Apache-2.0 Imports: 33 Imported by: 0

README

Testing

We utilize the interchaintest testing suite.

All tests are located in the interchaintest folder.

How to Run tests:

Requirements:
  • Docker (running)
  • Golang
  1. If you don't already have heighliner installed, install it. Otherwise, skip this step.

Heighliner is a tool used to help streamline the creation of the docker image we'll create in step 2.

make get-heighliner

  1. Create local docker image that contains the noble binary. If you make any code changes, you'll want to re-make the image before running tests.

make local-image

  1. Now we can run the tests. There are two ways to run the test.

    a. If you are using VS Code you can simply click the run test button above each test. For this to work, you may need to install the Go extension to VS Code.

    vsCode_runTest

    b. Or you can run it from the command line:

    cd interchaintest
    go test -v -run <NAME_OF_TEST>
    
    # Example
    go test -timeout 10m -v -run TestCCTP_DepForBurnWithCallerOnEth
    

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LocalImages = []ibc.DockerImage{
		{
			Repository: "noble",
			Version:    "local",
			UIDGID:     "1025:1025",
		},
	}

	DenomMetadataUsdc = banktypes.Metadata{
		Description: "USD Coin",
		DenomUnits: []*banktypes.DenomUnit{
			{
				Denom:    "uusdc",
				Exponent: 0,
				Aliases: []string{
					"microusdc",
				},
			},
			{
				Denom:    "usdc",
				Exponent: 6,
				Aliases:  []string{},
			},
		},
		Base:    "uusdc",
		Display: "usdc",
		Name:    "usdc",
		Symbol:  "USDC",
	}
)

Functions

func BlacklistAccount

func BlacklistAccount(t *testing.T, ctx context.Context, val *cosmos.ChainNode, blacklister ibc.Wallet, toBlacklist ibc.Wallet)

BlacklistAccount blacklists an account and then runs the `show-blacklisted` query to ensure the account was successfully blacklisted on chain

func ConfigureMinter

func ConfigureMinter(t *testing.T, ctx context.Context, val *cosmos.ChainNode, minterController, minter ibc.Wallet, allowance int64)

ConfigureMinter configures a minter with a specified allowance of `uusdc`. It then runs the `show-minters` query to ensure the minter was properly configured

func GhcrImage

func GhcrImage(version string) ibc.DockerImage

func ICAAddress

func ICAAddress(
	ctx context.Context,
	controller *cosmos.CosmosChain,
	address string,
	connectionID string,
) (string, error)

ICAAddress attempts to query the address of a registered interchain account on a controller chain for a given address and connection ID.

func NobleChainSpec

func NobleChainSpec(
	ctx context.Context,
	nw *NobleWrapper,
	chainID string,
	version []ibc.DockerImage,
	nv, nf int,
	setupAllCircleRoles bool,
) *interchaintest.ChainSpec

func NobleEncoding

func NobleEncoding() *testutil.TestEncodingConfig

func PauseFiatTF

func PauseFiatTF(t *testing.T, ctx context.Context, val *cosmos.ChainNode, pauser ibc.Wallet)

PauseFiatTF pauses the fiat tokenfactory. It then runs the `show-paused` query to ensure the the tokenfactory was successfully paused

func RegisterICAAccount

func RegisterICAAccount(ctx context.Context, icaTs *ICATestSuite) (string, error)

RegisterICAAccount attempts to register a new interchain account on a host chain via a controller chain.

func SendICATx

func SendICATx(ctx context.Context, icaTs *ICATestSuite) error

SendICATx attempts to serialize a slice of sdk.Msg and generate interchain account packet data, using the specified encoding, before attempting to send an ICA tx via the controller module.

func SetupMinterAndController

func SetupMinterAndController(t *testing.T, ctx context.Context, noble *cosmos.CosmosChain, val *cosmos.ChainNode, masterMinter ibc.Wallet, allowance int64) (minter ibc.Wallet, minterController ibc.Wallet)

SetupMinterAndController creates a minter controller and minter. It also sets up a minter with an specified allowance of `uusdc`

func ShowBlacklisted

func ShowBlacklisted(ctx context.Context, val *cosmos.ChainNode, blacklistedWallet ibc.Wallet) (fiattokenfactorytypes.QueryGetBlacklistedResponse, error)

ShowBlacklisted queries for a specific blacklisted address by running: `query fiat-tokenfactory show-blacklisted <address>`. An error is returned if the address is not blacklisted

func ShowBlacklister

ShowBlacklister queries for the token factory Blacklister by running: `query fiat-tokenfactory show-blacklister`.

func ShowMasterMinter

ShowMasterMinter queries for the token factory Master Minter by running: `query fiat-tokenfactory show-master-minter`.

func ShowMinterController

func ShowMinterController(ctx context.Context, val *cosmos.ChainNode, minterController ibc.Wallet) (fiattokenfactorytypes.QueryGetMinterControllerResponse, error)

ShowMinterController queries for a specific minter controller by running: `query fiat-tokenfactory show-minter-controller <address>`. An error is returned if the minter controller does not exist

func ShowMinters

ShowMinters queries for a specific minter by running: `query fiat-tokenfactory show-minters <address>`. An error is returned if the minter does not exist

func ShowOwner

ShowOwner queries for the token factory Owner by running: `query fiat-tokenfactory show-owner`.

func ShowPaused

ShowPaused queries the paused state of the token factory by running: `query fiat-tokenfactory show-paused`.

func ShowPauser

ShowPauser queries for the token factory Pauser by running: `query fiat-tokenfactory show-pauser`.

func SimdEncoding

func SimdEncoding() *testutil.TestEncodingConfig

func TestChainUpgrade

func TestChainUpgrade(
	t *testing.T,
	genesisVersion string,
	upgrades []ChainUpgrade,
	testICA bool,
)

func UnblacklistAccount

func UnblacklistAccount(t *testing.T, ctx context.Context, val *cosmos.ChainNode, blacklister ibc.Wallet, unBlacklist ibc.Wallet)

UnblacklistAccount unblacklists an account and then runs the `show-blacklisted` query to ensure the account was successfully unblacklisted on chain

func UnpauseFiatTF

func UnpauseFiatTF(t *testing.T, ctx context.Context, val *cosmos.ChainNode, pauser ibc.Wallet)

UnpauseFiatTF pauses the fiat tokenfactory. It then runs the `show-paused` query to ensure the the tokenfactory was successfully unpaused

Types

type CCTPRoles

type CCTPRoles struct {
	Owner           ibc.Wallet
	AttesterManager ibc.Wallet
	TokenController ibc.Wallet
}

type ChainUpgrade

type ChainUpgrade struct {
	Image       ibc.DockerImage
	UpgradeName string // if upgradeName is empty, assumes patch/rolling update
	Emergency   bool
	PreUpgrade  func(t *testing.T, ctx context.Context, noble *cosmos.CosmosChain, authority ibc.Wallet, icaTs *ICATestSuite)
	PostUpgrade func(t *testing.T, ctx context.Context, noble *cosmos.CosmosChain, authority ibc.Wallet, icaTs *ICATestSuite)
}

type FiatTfRoles

type FiatTfRoles struct {
	Owner            ibc.Wallet
	MasterMinter     ibc.Wallet
	MinterController ibc.Wallet
	Minter           ibc.Wallet
	Blacklister      ibc.Wallet
	Pauser           ibc.Wallet
}

type ICAAddressResponse

type ICAAddressResponse struct {
	Address string `json:"address"`
}

ICAAddressResponse represents the response from querying an interchain account via the controller module.

type ICATestSuite

type ICATestSuite struct {
	Host                   *cosmos.CosmosChain
	Controller             *cosmos.CosmosChain
	Relayer                ibc.Relayer
	Rep                    *testreporter.RelayerExecReporter
	OwnerAddress           string
	IcaAddress             string
	InitBal                math.Int
	HostConnectionID       string
	ControllerConnectionID string

	Encoding string
	Msgs     []sdk.Msg
	TxMemo   string
}

ICATestSuite is used to test interchain accounts. The IcaAddress field is initially an empty string, after initializing the ICA account you must update the field with the corresponding value if you need to send ICA txs in later test logic.

type NobleWrapper

type NobleWrapper struct {
	Chain       *cosmos.CosmosChain
	FiatTfRoles FiatTfRoles
	CCTPRoles   CCTPRoles
	Authority   ibc.Wallet
}

func NobleSpinUp

func NobleSpinUp(t *testing.T, ctx context.Context, version []ibc.DockerImage, setupAllCircleRoles bool) (nw NobleWrapper, client *client.Client)

NobleSpinUp starts noble chain

setupAllCircleRoles: if true, all Tokenfactory and CCTP roles will be created and setup at genesis, if false, only the Owner role will be created

func NobleSpinUpIBC

func NobleSpinUpIBC(t *testing.T, ctx context.Context, version []ibc.DockerImage, setupAllCircleRoles bool) (
	nw NobleWrapper,
	ibcSimd *cosmos.CosmosChain,
	rf interchaintest.RelayerFactory,
	r ibc.Relayer,
	ibcPathName string,
	rep *testreporter.Reporter,
	eRep *testreporter.RelayerExecReporter,
	client *client.Client,
	network string,
)

NobleSpinUpIBC is the same as nobleSpinUp but it also spins up a ibcSimd chain and creates an IBC path between them

setupAllCircleRoles: if true, all Tokenfactory and CCTP roles will be created and setup at genesis, if false, only the Owner role will be created

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL