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

New sequencer and rollapp registration flow #347

Merged
merged 6 commits into from
Aug 5, 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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ e2e-test: clean-e2e
# Executes IBC tests via rollup-e2e-testing
e2e-test-ibc-success-evm: clean-e2e
cd tests && go test -timeout=30m -race -v -run TestIBCTransferSuccess_EVM .

e2e-test-spinup: clean-e2e
cd tests && go test -timeout=30m -race -v -run TestSpinUp .

e2e-eibc-update-already-fulfill-evm: clean-e2e
cd tests && go test -timeout=30m -race -v -run TestEIBCFulfillAlreadyFulfilledDemand_EVM .
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ replace (

require (
github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869
github.com/decentrio/rollup-e2e-testing v0.0.0-20240718115231-5ffec3805af4
github.com/decentrio/rollup-e2e-testing v0.0.0-20240805094848-68d57d56ae62
github.com/dymensionxyz/dymension/v3 v3.1.0-rc03.0.20240717194206-54c0fca5fada
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869 h1:qWpUYGOsrSC+1Vmd2TjhbsSpntvvx9PsX3AoeMunFxc=
github.com/decentrio/e2e-testing-live v0.0.0-20240718080249-ee255229c869/go.mod h1:HZNYnPwmSxkwTPjSD5yolauc1Vx1ZzKL4FFMxTq4H5Y=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240718115231-5ffec3805af4 h1:ZZFkAHWyK8KEF/tsyNIQ3xIhQHr2hAFyz0KE4iJM1q0=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240718115231-5ffec3805af4/go.mod h1:NwTceYVxAaIZI65g/PdibVnGRMXuZzqzhDIkWsqJaQM=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240805094848-68d57d56ae62 h1:9FL0ehOjknP7jgDXYlJ91MytI02CyYJOwtIZfelqypM=
github.com/decentrio/rollup-e2e-testing v0.0.0-20240805094848-68d57d56ae62/go.mod h1:NwTceYVxAaIZI65g/PdibVnGRMXuZzqzhDIkWsqJaQM=
github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4=
github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo=
github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=
Expand Down
8 changes: 8 additions & 0 deletions tests/data/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"website": "https://dymension.xyz/",
"description": "This is a description of the Rollapp.",
"logo_data_uri": "data:image/jpeg;base64,/000",
"token_logo_uri": "data:image/jpeg;base64,/000",
"telegram": "https://t.me/example",
"x": "https://x.com/dymension"
}
3 changes: 3 additions & 0 deletions tests/disconnection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ func customConfig() ibc.ChainConfig {
if err := dyno.Set(g, "10000000000", "app_state", "gov", "params", "min_deposit", 0, "amount"); err != nil {
return nil, fmt.Errorf("failed to set amount on gov min_deposit in genesis json: %w", err)
}
if err := dyno.Set(g, "1000000000000", "app_state", "rollapp", "params", "registration_fee", "amount"); err != nil {
return nil, fmt.Errorf("failed to set registration_fee in genesis json: %w", err)
}
if err := dyno.Set(g, "adym", "app_state", "gamm", "params", "pool_creation_fee", 0, "denom"); err != nil {
return nil, fmt.Errorf("failed to set amount on gov min_deposit in genesis json: %w", err)
}
Expand Down
83 changes: 83 additions & 0 deletions tests/ibc_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,89 @@ import (
"github.com/decentrio/rollup-e2e-testing/testutil"
)

func TestSpinUp(t *testing.T) {
if testing.Short() {
t.Skip()
}

ctx := context.Background()

configFileOverrides := make(map[string]any)
dymintTomlOverrides := make(testutil.Toml)
dymintTomlOverrides["settlement_layer"] = "dymension"
dymintTomlOverrides["settlement_node_address"] = fmt.Sprintf("http://dymension_100-1-val-0-%s:26657", t.Name())
dymintTomlOverrides["rollapp_id"] = "rollappevm_1234-1"
dymintTomlOverrides["settlement_gas_prices"] = "0adym"
dymintTomlOverrides["max_idle_time"] = "3s"
dymintTomlOverrides["max_proof_time"] = "500ms"
dymintTomlOverrides["batch_submit_max_time"] = "100s"

configFileOverrides["config/dymint.toml"] = dymintTomlOverrides
// Create chain factory with dymension
numHubVals := 1
numHubFullNodes := 1
numRollAppFn := 0
numRollAppVals := 1

cf := test.NewBuiltinChainFactory(zaptest.NewLogger(t), []*test.ChainSpec{
{
Name: "rollapp1",
ChainConfig: ibc.ChainConfig{
Type: "rollapp-dym",
Name: "rollapp-temp",
ChainID: "rollappevm_1234-1",
Images: []ibc.DockerImage{rollappEVMImage},
Bin: "rollappd",
Bech32Prefix: "ethm",
Denom: "urax",
CoinType: "60",
GasPrices: "0.0urax",
GasAdjustment: 1.1,
TrustingPeriod: "112h",
EncodingConfig: encodingConfig(),
NoHostMount: false,
ModifyGenesis: modifyRollappEVMGenesis(rollappEVMGenesisKV),
ConfigFileOverrides: configFileOverrides,
},
NumValidators: &numRollAppVals,
NumFullNodes: &numRollAppFn,
},
{
Name: "dymension-hub",
ChainConfig: dymensionConfig,
NumValidators: &numHubVals,
NumFullNodes: &numHubFullNodes,
},
})

// Get chains from the chain factory
chains, err := cf.Chains(t.Name())
require.NoError(t, err)

rollapp1 := chains[0].(*dym_rollapp.DymRollApp)
dymension := chains[1].(*dym_hub.DymHub)

// Relayer Factory
client, network := test.DockerSetup(t)

ic := test.NewSetup().
AddRollUp(dymension, rollapp1)

rep := testreporter.NewNopReporter()
eRep := rep.RelayerExecReporter(t)

err = ic.Build(ctx, eRep, test.InterchainBuildOptions{
TestName: t.Name(),
Client: client,
NetworkID: network,
SkipPathCreation: true,

// This can be used to write to the block database which will index all block data e.g. txs, msgs, events, etc.
// BlockDatabaseFile: test.DefaultBlockDatabaseFilepath(),
}, nil, "", nil)
require.NoError(t, err)
}

// TestIBCTransferSuccess ensure that the transfer between Hub and Rollapp is accurate.
func TestIBCTransferSuccess_EVM(t *testing.T) {
if testing.Short() {
Expand Down
8 changes: 4 additions & 4 deletions tests/sequencer_invariant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ func TestSequencerInvariant_EVM(t *testing.T) {
rollappUserAddr := rollappUser.FormattedAddress()

command = []string{}
command = append(command, "sequencer", "create-sequencer", string(pub1), rollapp1.Config().ChainID, "{\"Moniker\":\"myrollapp-sequencer\",\"Identity\":\"\",\"Website\":\"\",\"SecurityContact\":\"\",\"Details\":\"\"}", "1000000000adym",
command = append(command, "sequencer", "create-sequencer", string(pub1), rollapp1.Config().ChainID, rollapp1.GetSequencerKeyDir()+"/metadata.json", "1000000000adym",
"--broadcast-mode", "async")

_, err = dymension.GetNode().ExecTx(ctx, sequencer1.KeyName(), command...)
require.NoError(t, err)

command = []string{}
command = append(command, "sequencer", "create-sequencer", string(pub2), rollapp1.Config().ChainID, "{\"Moniker\":\"myrollapp-sequencer\",\"Identity\":\"\",\"Website\":\"\",\"SecurityContact\":\"\",\"Details\":\"\"}", "1000000000adym",
command = append(command, "sequencer", "create-sequencer", string(pub2), rollapp1.Config().ChainID, rollapp1.GetSequencerKeyDir()+"/metadata.json", "1000000000adym",
"--broadcast-mode", "async")

_, err = dymension.GetNode().ExecTx(ctx, sequencer2.KeyName(), command...)
Expand Down Expand Up @@ -467,14 +467,14 @@ func TestSequencerInvariant_Wasm(t *testing.T) {
rollappUserAddr := rollappUser.FormattedAddress()

command = []string{}
command = append(command, "sequencer", "create-sequencer", string(pub1), rollapp1.Config().ChainID, "{\"Moniker\":\"myrollapp-sequencer\",\"Identity\":\"\",\"Website\":\"\",\"SecurityContact\":\"\",\"Details\":\"\"}", "1000000000adym",
command = append(command, "sequencer", "create-sequencer", string(pub1), rollapp1.Config().ChainID, rollapp1.GetSequencerKeyDir()+"/metadata.json", "1000000000adym",
"--broadcast-mode", "async")

_, err = dymension.GetNode().ExecTx(ctx, sequencer1.KeyName(), command...)
require.NoError(t, err)

command = []string{}
command = append(command, "sequencer", "create-sequencer", string(pub2), rollapp1.Config().ChainID, "{\"Moniker\":\"myrollapp-sequencer\",\"Identity\":\"\",\"Website\":\"\",\"SecurityContact\":\"\",\"Details\":\"\"}", "1000000000adym",
command = append(command, "sequencer", "create-sequencer", string(pub2), rollapp1.Config().ChainID, rollapp1.GetSequencerKeyDir()+"/metadata.json", "1000000000adym",
"--broadcast-mode", "async")

_, err = dymension.GetNode().ExecTx(ctx, sequencer2.KeyName(), command...)
Expand Down
3 changes: 3 additions & 0 deletions tests/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@ func modifyDymensionGenesis(genesisKV []cosmos.GenesisKV) func(ibc.ChainConfig,
if err := dyno.Set(g, "adym", "app_state", "gov", "params", "min_deposit", 0, "denom"); err != nil {
return nil, fmt.Errorf("failed to set denom on gov min_deposit in genesis json: %w", err)
}
if err := dyno.Set(g, "1000000000000", "app_state", "rollapp", "params", "registration_fee", "amount"); err != nil {
return nil, fmt.Errorf("failed to set registration_fee in genesis json: %w", err)
}
if err := dyno.Set(g, "10000000000", "app_state", "gov", "params", "min_deposit", 0, "amount"); err != nil {
return nil, fmt.Errorf("failed to set amount on gov min_deposit in genesis json: %w", err)
}
Expand Down
Loading