Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
aljo242 committed May 29, 2024
1 parent dcbeb83 commit 0aafcde
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 281 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ check-proto-format:
--workdir /workspace $(PROTO_FORMATTER_IMAGE) \
format proto -d --exit-code

TEST_E2E_DEPS = build-docker-image-e2e
TEST_E2E_DEPS = build-docker-image
TEST_E2E_TAGS = e2e

build-docker-image-e2e:
Expand Down
1 change: 0 additions & 1 deletion network/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ $BINARY $GENESIS_PREFIX add-genesis-account "$($BINARY --home "$CHAIN_DIR" keys
$BINARY $GENESIS_PREFIX add-genesis-account "$($BINARY --home "$CHAIN_DIR" keys show rly1 --keyring-backend test -a --home "$CHAIN_DIR")" "100000000000000$STAKEDENOM" --home "$CHAIN_DIR"
$BINARY $GENESIS_PREFIX add-genesis-account "$($BINARY --home "$CHAIN_DIR" keys show rly2 --keyring-backend test -a --home "$CHAIN_DIR")" "100000000000000$STAKEDENOM" --home "$CHAIN_DIR"


sed -i -e 's/timeout_commit = "5s"/timeout_commit = "1s"/g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's/timeout_propose = "3s"/timeout_propose = "1s"/g' "$CHAIN_DIR/config/config.toml"
sed -i -e 's/index_all_keys = false/index_all_keys = true/g' "$CHAIN_DIR/config/config.toml"
Expand Down
69 changes: 54 additions & 15 deletions tests/ictest/e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
package ictest_test

import (
"encoding/json"
"fmt"
"github.com/icza/dyno"
"log"
"strconv"
"strings"
"testing"

sdkmath "cosmossdk.io/math"
"github.com/stretchr/testify/suite"

"github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/neutron-org/neutron/v4/app"
"github.com/neutron-org/neutron/v4/tests/ictest"
feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types"
"github.com/strangelove-ventures/interchaintest/v8"
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/stretchr/testify/suite"

"github.com/neutron-org/neutron/v4/app"
"github.com/neutron-org/neutron/v4/tests/ictest"
)

var (
Expand All @@ -23,16 +28,21 @@ var (
// config params
numValidators = 3
numFullNodes = 1
denom = "ntrn"
denom = "stake"

image = ibc.DockerImage{
Repository: "neutron-e2e",
Version: "latest",
UidGid: "1000:1000",
}
encodingConfig = MakeEncodingConfig()
noHostMount = false
gasAdjustment = 10.0
encodingConfig = &testutil.TestEncodingConfig{
InterfaceRegistry: app.MakeEncodingConfig().InterfaceRegistry,
Codec: app.MakeEncodingConfig().Marshaler,
TxConfig: app.MakeEncodingConfig().TxConfig,
Amino: app.MakeEncodingConfig().Amino,
}
noHostMount = false
gasAdjustment = 10.0

genesisKV = []cosmos.GenesisKV{
{
Expand Down Expand Up @@ -83,23 +93,52 @@ var (
ChainID: "chain-id-0",
Bin: "neutrond",
Bech32Prefix: "neutron",
SkipGenTx: false,
CoinType: "118",
GasAdjustment: gasAdjustment,
GasPrices: fmt.Sprintf("0%s", denom),
TrustingPeriod: "48h",
NoHostMount: noHostMount,
ModifyGenesis: cosmos.ModifyGenesis(genesisKV),
ModifyGenesis: ModifyGenesis(genesisKV),
},
}
)

func MakeEncodingConfig() *testutil.TestEncodingConfig {
cfg := cosmos.DefaultEncoding()
app.ModuleBasics.RegisterInterfaces(cfg.Codec, cfg.InterfaceRegistry)
return &cfg
}

func TestE2ETestSuite(t *testing.T) {
s := ictest.NewE2ETestSuiteFromSpec(spec)
suite.Run(t, s)
}

func ModifyGenesis(genesisKV []cosmos.GenesisKV) func(ibc.ChainConfig, []byte) ([]byte, error) {
return func(chainConfig ibc.ChainConfig, genbz []byte) ([]byte, error) {
g := make(map[string]interface{})
if err := json.Unmarshal(genbz, &g); err != nil {
return nil, fmt.Errorf("failed to unmarshal genesis file: %w", err)
}

for idx, values := range genesisKV {
splitPath := strings.Split(values.Key, ".")

path := make([]interface{}, len(splitPath))
for i, component := range splitPath {
if v, err := strconv.Atoi(component); err == nil {
path[i] = v
} else {
path[i] = component
}
}

if err := dyno.Set(g, values.Value, path...); err != nil {
return nil, fmt.Errorf("failed to set value (index:%d) in genesis json: %w", idx, err)
}
}

log.Fatal(g)

out, err := json.Marshal(g)
if err != nil {
return nil, fmt.Errorf("failed to marshal genesis bytes to json: %w", err)
}
return out, nil
}
}
25 changes: 18 additions & 7 deletions tests/ictest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,27 @@ go 1.22.3

replace (
cosmossdk.io/client/v2 => cosmossdk.io/client/v2 v2.0.0-beta.1.0.20240124105859-5ad1805d0e79
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d
github.com/ChainSafe/go-schnorrkel/1 => github.com/ChainSafe/go-schnorrkel v1.1.0
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/neutron-org/neutron/v4 => ../../
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7

// TODO: update our cosmos-sdk up to 0.50.6+ to remove downgrade of upgrade modules cosmossdk.io/x/{evidence,feegrant,upgrade}
cosmossdk.io/x/evidence => cosmossdk.io/x/evidence v0.1.0
cosmossdk.io/x/feegrant => cosmossdk.io/x/feegrant v0.1.0
cosmossdk.io/x/upgrade => cosmossdk.io/x/upgrade v0.1.1
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d
github.com/ChainSafe/go-schnorrkel/1 => github.com/ChainSafe/go-schnorrkel v1.1.0
github.com/CosmWasm/wasmd => github.com/neutron-org/wasmd v0.45.1-0.20240501180153-d9bebe629e05
github.com/cosmos/admin-module => github.com/neutron-org/admin-module v1.0.2-0.20240402143659-7dcb4a8c2056
github.com/cosmos/cosmos-sdk => github.com/neutron-org/cosmos-sdk v0.50.0-beta.0.0.20240226131019-8efae68de5cc
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/neutron-org/neutron/v4 => ../../
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.18.0
github.com/prometheus/client_model => github.com/prometheus/client_model v0.6.0
github.com/prometheus/common => github.com/prometheus/common v0.47.0
github.com/prometheus/procfs => github.com/prometheus/procfs v0.12.0
github.com/skip-mev/feemarket => github.com/neutron-org/feemarket v0.0.0-20240527102030-5f3610192e23
//github.com/skip-mev/feemarket => ../feemarket
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7
)

require (
Expand All @@ -50,12 +47,14 @@ require (
cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/storage v1.38.0 // indirect
cosmossdk.io/api v0.7.4 // indirect
cosmossdk.io/client/v2 v2.0.0-beta.1 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/core v0.11.0 // indirect
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
cosmossdk.io/errors v1.0.1 // indirect
cosmossdk.io/log v1.3.1 // indirect
cosmossdk.io/store v1.1.0 // indirect
cosmossdk.io/x/circuit v0.1.1 // indirect
cosmossdk.io/x/evidence v0.1.1 // indirect
cosmossdk.io/x/feegrant v0.1.1 // indirect
cosmossdk.io/x/tx v0.13.3 // indirect
Expand All @@ -67,6 +66,9 @@ require (
github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect
github.com/ChainSafe/go-schnorrkel/1 v0.0.0-00010101000000-000000000000 // indirect
github.com/ComposableFi/go-subkey/v2 v2.0.0-tm03420 // indirect
github.com/CosmWasm/wasmd v0.50.0 // indirect
github.com/CosmWasm/wasmvm v1.5.2 // indirect
github.com/CosmWasm/wasmvm/v2 v2.0.0 // indirect
github.com/DataDog/datadog-go v3.2.0+incompatible // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e // indirect
Expand All @@ -80,23 +82,27 @@ require (
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.0 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v0.11.0 // indirect
github.com/cosmos/admin-module v0.0.0-20220204080909-475a98e03f31 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-db v1.0.2 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/gogoproto v1.4.12 // indirect
github.com/cosmos/iavl v1.1.2 // indirect
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.1 // indirect
github.com/cosmos/ibc-go/modules/capability v1.0.0 // indirect
github.com/cosmos/ibc-go/v8 v8.2.1 // indirect
github.com/cosmos/ics23/go v0.10.0 // indirect
Expand All @@ -113,6 +119,7 @@ require (
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.9+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
Expand Down Expand Up @@ -140,6 +147,7 @@ require (
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
Expand Down Expand Up @@ -168,6 +176,7 @@ require (
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/iancoleman/orderedmap v0.3.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/icza/dyno v0.0.0-20220812133438-f0b6f8a18845 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
Expand Down Expand Up @@ -226,6 +235,8 @@ require (
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/skip-mev/block-sdk/v2 v2.1.1 // indirect
github.com/skip-mev/slinky v0.4.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
Expand Down
Loading

0 comments on commit 0aafcde

Please sign in to comment.