diff --git a/.github/workflows/automated-tests.yml b/.github/workflows/automated-tests.yml index ad53314e76..f7d9988bad 100644 --- a/.github/workflows/automated-tests.yml +++ b/.github/workflows/automated-tests.yml @@ -56,3 +56,17 @@ jobs: go-version: "1.20" - name: E2E tests run: make test-e2e-short-cometmock + Trace-Tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + lfs: true + - name: Checkout LFS objects + run: git lfs checkout + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: "1.20" + - name: E2E tests + run: make test-trace diff --git a/.github/workflows/manual-e2e.yml b/.github/workflows/manual-e2e.yml index 3893d009df..ff3780bcde 100644 --- a/.github/workflows/manual-e2e.yml +++ b/.github/workflows/manual-e2e.yml @@ -20,7 +20,7 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E happy-path test - run: go run ./tests/e2e/... --tc happy-path + run: go run ./tests/e2e/... --tc happy-path::default changeover-test: runs-on: ubuntu-latest timeout-minutes: 20 @@ -36,7 +36,7 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E changeover test - run: go run ./tests/e2e/... --tc changeover + run: go run ./tests/e2e/... --tc changeover::changeover democracy-reward-test: runs-on: ubuntu-latest timeout-minutes: 20 @@ -52,7 +52,7 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E democracy-reward tests - run: go run ./tests/e2e/... --tc democracy-reward + run: go run ./tests/e2e/... --tc democracy-reward::democracy-reward democracy-test: runs-on: ubuntu-latest timeout-minutes: 20 @@ -68,7 +68,7 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E democracy tests - run: go run ./tests/e2e/... --tc democracy + run: go run ./tests/e2e/... --tc democracy::democracy slash-throttle-test: runs-on: ubuntu-latest timeout-minutes: 20 @@ -84,7 +84,7 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E slash-throttle tests - run: go run ./tests/e2e/... --tc slash-throttle + run: go run ./tests/e2e/... --tc slash-throttle::slash-throttle multiconsumer-test: runs-on: ubuntu-latest timeout-minutes: 40 @@ -100,4 +100,4 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E multi-consumer tests - run: go run ./tests/e2e/... --tc multiconsumer + run: go run ./tests/e2e/... --tc multiconsumer::multiconsumer diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index 913f7e0bbe..39bb0ec37f 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -33,7 +33,7 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E happy-path test - run: go run ./tests/e2e/... --tc happy-path + run: go run ./tests/e2e/... --tc happy-path::default changeover-test: runs-on: ubuntu-latest timeout-minutes: 20 @@ -49,7 +49,7 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E changeover test - run: go run ./tests/e2e/... --tc changeover + run: go run ./tests/e2e/... --tc changeover::changeover democracy-reward-test: runs-on: ubuntu-latest timeout-minutes: 20 @@ -65,7 +65,7 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E democracy-reward tests - run: go run ./tests/e2e/... --tc democracy-reward + run: go run ./tests/e2e/... --tc democracy-reward::democracy-reward democracy-test: runs-on: ubuntu-latest timeout-minutes: 20 @@ -81,7 +81,7 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E democracy tests - run: go run ./tests/e2e/... --tc democracy + run: go run ./tests/e2e/... --tc democracy::democracy slash-throttle-test: runs-on: ubuntu-latest timeout-minutes: 20 @@ -97,7 +97,7 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E slash-throttle tests - run: go run ./tests/e2e/... --tc slash-throttle + run: go run ./tests/e2e/... --tc slash-throttle::slash-throttle multiconsumer-test: runs-on: ubuntu-latest timeout-minutes: 40 @@ -113,7 +113,7 @@ jobs: with: go-version: "1.20" # The Go version to download (if necessary) and use. - name: E2E multi-consumer tests - run: go run ./tests/e2e/... --tc multiconsumer + run: go run ./tests/e2e/... --tc multiconsumer::multiconsumer nightly-test-fail: needs: diff --git a/Makefile b/Makefile index ac7c38f068..3f053cc9b8 100644 --- a/Makefile +++ b/Makefile @@ -31,12 +31,12 @@ test-diff: # run only happy path E2E tests test-e2e-short: - go run ./tests/e2e/... --tc happy-path + go run ./tests/e2e/... --tc happy-path::default # run only happy path E2E tests with cometmock # this set of traces does not test equivocation but it does check downtime test-e2e-short-cometmock: - go run ./tests/e2e/... --tc happy-path-short --use-cometmock --use-gorelayer + go run ./tests/e2e/... --tc happy-path-short::default --use-cometmock --use-gorelayer # run full E2E tests in sequence (including multiconsumer) test-e2e-multi-consumer: @@ -52,7 +52,7 @@ test-gaia-e2e: # run only happy path E2E tests using latest tagged gaia test-gaia-e2e-short: - go run ./tests/e2e/... --tc happy-path --use-gaia + go run ./tests/e2e/... --tc happy-path::default --use-gaia # run full E2E tests in parallel (including multiconsumer) using latest tagged gaia test-gaia-e2e-parallel: @@ -66,7 +66,7 @@ test-gaia-e2e-tagged: # run only happy path E2E tests using latest tagged gaia # usage: GAIA_TAG=v9.0.0 make test-gaia-e2e-short-tagged test-gaia-e2e-short-tagged: - go run ./tests/e2e/... --tc happy-path --use-gaia --gaia-tag $(GAIA_TAG) + go run ./tests/e2e/... --tc happy-path::default --use-gaia --gaia-tag $(GAIA_TAG) # run full E2E tests in parallel (including multiconsumer) using specific tagged version of gaia # usage: GAIA_TAG=v9.0.0 make test-gaia-e2e-parallel-tagged @@ -77,6 +77,10 @@ test-gaia-e2e-parallel-tagged: test-no-cache: go test ./... -count=1 && go run ./tests/e2e/... +# test reading a trace from a file +test-trace: + go run ./tests/e2e/... --test-file tests/e2e/tracehandler_testdata/happyPath.json::default + ############################################################################### ### Linting ### ############################################################################### diff --git a/go.mod b/go.mod index 3fc1b177b7..04dd213fee 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect github.com/creachadair/taskgroup v0.4.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect @@ -88,7 +88,7 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.5.9 github.com/google/orderedcode v0.0.1 // indirect github.com/google/uuid v1.3.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect @@ -161,7 +161,7 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect - pgregory.net/rapid v0.5.5 // indirect + pgregory.net/rapid v0.5.7 sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index 033aa8adf2..fb48cdb841 100644 --- a/go.sum +++ b/go.sum @@ -1882,8 +1882,8 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= -pgregory.net/rapid v0.5.5/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= +pgregory.net/rapid v0.5.7 h1:p7/XbOgyFY1I/3Q12UTXfos70VZTcgc3WeoyiEru5cs= +pgregory.net/rapid v0.5.7/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/tests/e2e/.gitignore b/tests/e2e/.gitignore new file mode 100644 index 0000000000..d383c56fff --- /dev/null +++ b/tests/e2e/.gitignore @@ -0,0 +1 @@ +testdata diff --git a/tests/e2e/action_rapid_test.go b/tests/e2e/action_rapid_test.go new file mode 100644 index 0000000000..d50cae72d0 --- /dev/null +++ b/tests/e2e/action_rapid_test.go @@ -0,0 +1,485 @@ +package main + +import ( + "encoding/json" + "fmt" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "pgregory.net/rapid" +) + +func TestActionMarshalling(t *testing.T) { + rapid.Check(t, func(t *rapid.T) { + action := GetActionGen().Draw(t, "Action") + err := MarshalAndUnmarshalAction(action) + if err != nil { + t.Fatalf("error marshalling and unmarshalling action: %v", err) + } + }) +} + +func MarshalAndUnmarshalAction(action interface{}) error { + // wraps the action with a step, since it needs custom unmarshalling that is called by the step unmarshaller + step := Step{ + Action: action, + } + jsonobj, err := json.Marshal(step) + if err != nil { + return fmt.Errorf("error marshalling action inside step: %v", err) + } + + var got Step + err = json.Unmarshal(jsonobj, &got) + if err != nil { + return fmt.Errorf("error unmarshalling action inside step: %v", err) + } + + diff := cmp.Diff(step, got) + if diff != "" { + return fmt.Errorf("got (-), want (+): %v", diff) + } + + return nil +} + +// This needs to be adjusted manually when new actions are added and should +// include generators for all actions that are mentioned in main.go/runStep. +func GetActionGen() *rapid.Generator[any] { + return rapid.OneOf( + GetStartSovereignChainActionGen().AsAny(), + GetSubmitLegacyUpgradeProposalActionGen().AsAny(), + GetWaitUntilBlockActionGen().AsAny(), + GetChangeoverChainActionGen().AsAny(), + GetSendTokensActionGen().AsAny(), + GetStartChainActionGen().AsAny(), + GetSubmitTextProposalActionGen().AsAny(), + GetSubmitConsumerAdditionProposalActionGen().AsAny(), + GetSubmitConsumerRemovalProposalActionGen().AsAny(), + GetSubmitParamChangeProposalActionGen().AsAny(), + GetSubmitEquivocationProposalActionGen().AsAny(), + GetVoteGovProposalActionGen().AsAny(), + GetStartConsumerChainActionGen().AsAny(), + GetAddChainToRelayerActionGen().AsAny(), + GetAddIbcConnectionActionGen().AsAny(), + GetAddIbcChannelActionGen().AsAny(), + GetStartRelayerActionGen().AsAny(), + GetTransferChannelCompleteActionGen().AsAny(), + GetRelayPacketsActionGen().AsAny(), + GetRelayRewardPacketsToProviderActionGen().AsAny(), + GetDelegateTokensActionGen().AsAny(), + GetUnbondTokensActionGen().AsAny(), + GetRedelegateTokensActionGen().AsAny(), + GetDowntimeSlashActionGen().AsAny(), + GetUnjailValidatorActionGen().AsAny(), + GetRegisterRepresentativeActionGen().AsAny(), + GetDoublesignSlashActionGen().AsAny(), + GetAssignConsumerPubKeyActionGen().AsAny(), + GetSlashThrottleDequeueGen().AsAny(), + GetCreateIbcClientsActionGen().AsAny(), + CreateCancelUnbondTokensActionGen().AsAny(), + CreateLightClientEquivocationAttackActionGen().AsAny(), + CreateLightClientAmnesiaAttackActionGen().AsAny(), + CreateLightClientLunaticAttackActionGen().AsAny(), + ) +} + +func CreateLightClientEquivocationAttackActionGen() *rapid.Generator[lightClientEquivocationAttackAction] { + return rapid.Custom(func(t *rapid.T) lightClientEquivocationAttackAction { + return lightClientEquivocationAttackAction{ + Validator: GetValidatorIDGen().Draw(t, "Validator"), + Chain: GetChainIDGen().Draw(t, "Chain"), + } + }) +} + +func CreateLightClientAmnesiaAttackActionGen() *rapid.Generator[lightClientAmnesiaAttackAction] { + return rapid.Custom(func(t *rapid.T) lightClientAmnesiaAttackAction { + return lightClientAmnesiaAttackAction{ + Validator: GetValidatorIDGen().Draw(t, "Validator"), + Chain: GetChainIDGen().Draw(t, "Chain"), + } + }) +} + +func CreateLightClientLunaticAttackActionGen() *rapid.Generator[lightClientLunaticAttackAction] { + return rapid.Custom(func(t *rapid.T) lightClientLunaticAttackAction { + return lightClientLunaticAttackAction{ + Validator: GetValidatorIDGen().Draw(t, "Validator"), + Chain: GetChainIDGen().Draw(t, "Chain"), + } + }) +} + +func CreateCancelUnbondTokensActionGen() *rapid.Generator[cancelUnbondTokensAction] { + return rapid.Custom(func(t *rapid.T) cancelUnbondTokensAction { + return cancelUnbondTokensAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Amount: rapid.Uint().Draw(t, "Amount"), + Delegator: GetValidatorIDGen().Draw(t, "Delegator"), + Validator: GetValidatorIDGen().Draw(t, "Validator"), + } + }) +} + +func GetCreateIbcClientsActionGen() *rapid.Generator[createIbcClientsAction] { + return rapid.Custom(func(t *rapid.T) createIbcClientsAction { + return createIbcClientsAction{ + ChainA: GetChainIDGen().Draw(t, "ChainA"), + ChainB: GetChainIDGen().Draw(t, "ChainB"), + } + }) +} + +func GetStartSovereignChainActionGen() *rapid.Generator[StartSovereignChainAction] { + return rapid.Custom(func(t *rapid.T) StartSovereignChainAction { + return StartSovereignChainAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Validators: GetStartChainValidatorsGen().Draw(t, "Validators"), + GenesisChanges: rapid.String().Draw(t, "GenesisChanges"), + } + }) +} + +func GetSubmitLegacyUpgradeProposalActionGen() *rapid.Generator[LegacyUpgradeProposalAction] { + return rapid.Custom(func(t *rapid.T) LegacyUpgradeProposalAction { + return LegacyUpgradeProposalAction{ + ChainID: GetChainIDGen().Draw(t, "ChainID"), + UpgradeTitle: rapid.String().Draw(t, "UpgradeTitle"), + Proposer: GetValidatorIDGen().Draw(t, "Proposer"), + UpgradeHeight: rapid.Uint64().Draw(t, "UpgradeHeight"), + } + }) +} + +func GetWaitUntilBlockActionGen() *rapid.Generator[waitUntilBlockAction] { + return rapid.Custom(func(t *rapid.T) waitUntilBlockAction { + return waitUntilBlockAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Block: rapid.Uint().Draw(t, "Block"), + } + }) +} + +func GetChangeoverChainActionGen() *rapid.Generator[ChangeoverChainAction] { + return rapid.Custom(func(t *rapid.T) ChangeoverChainAction { + return ChangeoverChainAction{ + SovereignChain: GetChainIDGen().Draw(t, "SovereignChain"), + ProviderChain: GetChainIDGen().Draw(t, "ProviderChain"), + Validators: GetStartChainValidatorsGen().Draw(t, "Validators"), + GenesisChanges: rapid.String().Draw(t, "GenesisChanges"), + } + }) +} + +func GetSendTokensActionGen() *rapid.Generator[SendTokensAction] { + return rapid.Custom(func(t *rapid.T) SendTokensAction { + return SendTokensAction{ + Amount: rapid.Uint().Draw(t, "Amount"), + Chain: GetChainIDGen().Draw(t, "Chain"), + From: GetValidatorIDGen().Draw(t, "From"), + To: GetValidatorIDGen().Draw(t, "To"), + } + }) +} + +func GetStartChainActionGen() *rapid.Generator[StartChainAction] { + return rapid.Custom(func(t *rapid.T) StartChainAction { + return StartChainAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Validators: GetStartChainValidatorsGen().Draw(t, "Validators"), + GenesisChanges: rapid.String().Draw(t, "GenesisChanges"), + SkipGentx: rapid.Bool().Draw(t, "SkipGentx"), + } + }) +} + +func GetStartChainValidatorsGen() *rapid.Generator[[]StartChainValidator] { + return rapid.Custom(func(t *rapid.T) []StartChainValidator { + return rapid.SliceOf(GetStartChainValidatorGen()).Draw(t, "StartChainValidators") + }) +} + +func GetStartChainValidatorGen() *rapid.Generator[StartChainValidator] { + return rapid.Custom(func(t *rapid.T) StartChainValidator { + return StartChainValidator{ + Id: GetValidatorIDGen().Draw(t, "Id"), + Allocation: rapid.Uint().Draw(t, "Allocation"), + Stake: rapid.Uint().Draw(t, "Stake"), + } + }) +} + +func GetSubmitTextProposalActionGen() *rapid.Generator[submitTextProposalAction] { + return rapid.Custom(func(t *rapid.T) submitTextProposalAction { + return submitTextProposalAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + From: GetValidatorIDGen().Draw(t, "From"), + Deposit: rapid.Uint().Draw(t, "Deposit"), + PropType: rapid.String().Draw(t, "PropType"), + Title: rapid.String().Draw(t, "Title"), + Description: rapid.String().Draw(t, "Description"), + } + }) +} + +func GetSubmitConsumerAdditionProposalActionGen() *rapid.Generator[submitConsumerAdditionProposalAction] { + return rapid.Custom(func(t *rapid.T) submitConsumerAdditionProposalAction { + return submitConsumerAdditionProposalAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + From: GetValidatorIDGen().Draw(t, "From"), + Deposit: rapid.Uint().Draw(t, "Deposit"), + ConsumerChain: GetChainIDGen().Draw(t, "ConsumerChain"), + SpawnTime: rapid.Uint().Draw(t, "SpawnTime"), + InitialHeight: GetHeightGen().Draw(t, "InitialHeight"), + } + }) +} + +func GetSubmitConsumerRemovalProposalActionGen() *rapid.Generator[submitConsumerRemovalProposalAction] { + return rapid.Custom(func(t *rapid.T) submitConsumerRemovalProposalAction { + return submitConsumerRemovalProposalAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + From: GetValidatorIDGen().Draw(t, "From"), + Deposit: rapid.Uint().Draw(t, "Deposit"), + ConsumerChain: GetChainIDGen().Draw(t, "ConsumerChain"), + StopTimeOffset: time.Duration(rapid.Int64().Draw(t, "StopTimeOffset")), + } + }) +} + +func GetSubmitParamChangeProposalActionGen() *rapid.Generator[submitParamChangeLegacyProposalAction] { + return rapid.Custom(func(t *rapid.T) submitParamChangeLegacyProposalAction { + return submitParamChangeLegacyProposalAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + From: GetValidatorIDGen().Draw(t, "From"), + Deposit: rapid.Uint().Draw(t, "Deposit"), + Subspace: rapid.String().Draw(t, "Subspace"), + Key: rapid.String().Draw(t, "Key"), + Value: rapid.String().Draw(t, "Value"), // TODO: make this more generic + } + }) +} + +func GetSubmitEquivocationProposalActionGen() *rapid.Generator[submitEquivocationProposalAction] { + return rapid.Custom(func(t *rapid.T) submitEquivocationProposalAction { + return submitEquivocationProposalAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + From: GetValidatorIDGen().Draw(t, "From"), + Deposit: rapid.Uint().Draw(t, "Deposit"), + Height: rapid.Int64().Draw(t, "Height"), + Time: GetTimeGen().Draw(t, "Time"), + Power: rapid.Int64().Draw(t, "Power"), + } + }) +} + +func TestMarshalAndUnmarshalTime(t *testing.T) { + rapid.Check(t, func(t *rapid.T) { + time1 := GetTimeGen().Draw(t, "time") + data, err := time1.MarshalJSON() + require.NoError(t, err) + var time2 time.Time + err = time2.UnmarshalJSON(data) + require.NoError(t, err) + require.True(t, time1.Equal(time2)) + }) +} + +func GetTimeGen() *rapid.Generator[time.Time] { + return rapid.Custom(func(t *rapid.T) time.Time { + return time.Unix(rapid.Int64Range(-5.9959e+10, 1.5779e+11).Draw(t, "unix time"), 0).UTC() + }) +} + +func GetVoteGovProposalActionGen() *rapid.Generator[voteGovProposalAction] { + return rapid.Custom(func(t *rapid.T) voteGovProposalAction { + return voteGovProposalAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + From: rapid.SliceOf(GetValidatorIDGen()).Draw(t, "From"), + Vote: rapid.SliceOf(rapid.String()).Draw(t, "Vote"), + PropNumber: rapid.Uint().Draw(t, "PropNumber"), + } + }) +} + +func GetStartConsumerChainActionGen() *rapid.Generator[startConsumerChainAction] { + return rapid.Custom(func(t *rapid.T) startConsumerChainAction { + return startConsumerChainAction{ + ConsumerChain: GetChainIDGen().Draw(t, "ConsumerChain"), + ProviderChain: GetChainIDGen().Draw(t, "ProviderChain"), + Validators: GetStartChainValidatorsGen().Draw(t, "Validators"), + GenesisChanges: rapid.String().Draw(t, "GenesisChanges"), + } + }) +} + +func GetAddChainToRelayerActionGen() *rapid.Generator[addChainToRelayerAction] { + return rapid.Custom(func(t *rapid.T) addChainToRelayerAction { + return addChainToRelayerAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Validator: GetValidatorIDGen().Draw(t, "Validator"), + } + }) +} + +func GetAddIbcConnectionActionGen() *rapid.Generator[addIbcConnectionAction] { + return rapid.Custom(func(t *rapid.T) addIbcConnectionAction { + return addIbcConnectionAction{ + ChainA: GetChainIDGen().Draw(t, "ChainA"), + ChainB: GetChainIDGen().Draw(t, "ChainB"), + ClientA: rapid.Uint().Draw(t, "ClientA"), + ClientB: rapid.Uint().Draw(t, "ClientB"), + } + }) +} + +func GetAddIbcChannelActionGen() *rapid.Generator[addIbcChannelAction] { + return rapid.Custom(func(t *rapid.T) addIbcChannelAction { + return addIbcChannelAction{ + ChainA: GetChainIDGen().Draw(t, "ChainA"), + ChainB: GetChainIDGen().Draw(t, "ChainB"), + ConnectionA: rapid.Uint().Draw(t, "ConnectionA"), + PortA: rapid.String().Draw(t, "PortA"), + PortB: rapid.String().Draw(t, "PortB"), + Order: rapid.String().Draw(t, "Order"), + } + }) +} + +func GetStartRelayerActionGen() *rapid.Generator[startRelayerAction] { + return rapid.Just(startRelayerAction{}) +} + +func GetTransferChannelCompleteActionGen() *rapid.Generator[transferChannelCompleteAction] { + return rapid.Custom(func(t *rapid.T) transferChannelCompleteAction { + return transferChannelCompleteAction{ + ChainA: GetChainIDGen().Draw(t, "ChainA"), + ChainB: GetChainIDGen().Draw(t, "ChainB"), + ConnectionA: rapid.Uint().Draw(t, "ConnectionA"), + PortA: rapid.String().Draw(t, "PortA"), + PortB: rapid.String().Draw(t, "PortB"), + Order: rapid.String().Draw(t, "Order"), + ChannelA: rapid.Uint().Draw(t, "ChannelA"), + ChannelB: rapid.Uint().Draw(t, "ChannelB"), + } + }) +} + +func GetRelayPacketsActionGen() *rapid.Generator[relayPacketsAction] { + return rapid.Custom(func(t *rapid.T) relayPacketsAction { + return relayPacketsAction{ + ChainA: GetChainIDGen().Draw(t, "Chain"), + ChainB: GetChainIDGen().Draw(t, "Chain"), + Port: rapid.String().Draw(t, "Port"), + Channel: rapid.Uint().Draw(t, "Channel"), + } + }) +} + +func GetRelayRewardPacketsToProviderActionGen() *rapid.Generator[relayRewardPacketsToProviderAction] { + return rapid.Custom(func(t *rapid.T) relayRewardPacketsToProviderAction { + return relayRewardPacketsToProviderAction{ + ConsumerChain: GetChainIDGen().Draw(t, "ConsumerChain"), + ProviderChain: GetChainIDGen().Draw(t, "ProviderChain"), + Port: rapid.String().Draw(t, "Port"), + Channel: rapid.Uint().Draw(t, "Channel"), + } + }) +} + +func GetDelegateTokensActionGen() *rapid.Generator[delegateTokensAction] { + return rapid.Custom(func(t *rapid.T) delegateTokensAction { + return delegateTokensAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Amount: rapid.Uint().Draw(t, "Amount"), + From: GetValidatorIDGen().Draw(t, "From"), + To: GetValidatorIDGen().Draw(t, "To"), + } + }) +} + +func GetUnbondTokensActionGen() *rapid.Generator[unbondTokensAction] { + return rapid.Custom(func(t *rapid.T) unbondTokensAction { + return unbondTokensAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Amount: rapid.Uint().Draw(t, "Amount"), + Sender: GetValidatorIDGen().Draw(t, "Sender"), + UnbondFrom: GetValidatorIDGen().Draw(t, "UnbondFrom"), + } + }) +} + +func GetRedelegateTokensActionGen() *rapid.Generator[redelegateTokensAction] { + return rapid.Custom(func(t *rapid.T) redelegateTokensAction { + return redelegateTokensAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Amount: rapid.Uint().Draw(t, "Amount"), + Src: GetValidatorIDGen().Draw(t, "Src"), + Dst: GetValidatorIDGen().Draw(t, "Dst"), + TxSender: GetValidatorIDGen().Draw(t, "TxSender"), + } + }) +} + +func GetDowntimeSlashActionGen() *rapid.Generator[downtimeSlashAction] { + return rapid.Custom(func(t *rapid.T) downtimeSlashAction { + return downtimeSlashAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Validator: GetValidatorIDGen().Draw(t, "Validator"), + } + }) +} + +func GetUnjailValidatorActionGen() *rapid.Generator[unjailValidatorAction] { + return rapid.Custom(func(t *rapid.T) unjailValidatorAction { + return unjailValidatorAction{ + Validator: GetValidatorIDGen().Draw(t, "Validator"), + Provider: GetChainIDGen().Draw(t, "Provider"), + } + }) +} + +func GetRegisterRepresentativeActionGen() *rapid.Generator[registerRepresentativeAction] { + return rapid.Custom(func(t *rapid.T) registerRepresentativeAction { + return registerRepresentativeAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Representatives: rapid.SliceOf(GetValidatorIDGen()).Draw(t, "Representatives"), + Stakes: rapid.SliceOf(rapid.Uint()).Draw(t, "Stakes"), + } + }) +} + +func GetDoublesignSlashActionGen() *rapid.Generator[doublesignSlashAction] { + return rapid.Custom(func(t *rapid.T) doublesignSlashAction { + return doublesignSlashAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Validator: GetValidatorIDGen().Draw(t, "Validator"), + } + }) +} + +func GetAssignConsumerPubKeyActionGen() *rapid.Generator[assignConsumerPubKeyAction] { + return rapid.Custom(func(t *rapid.T) assignConsumerPubKeyAction { + return assignConsumerPubKeyAction{ + Chain: GetChainIDGen().Draw(t, "Chain"), + Validator: GetValidatorIDGen().Draw(t, "Validator"), + ConsumerPubkey: rapid.String().Draw(t, "ConsumerPubkey"), + ReconfigureNode: rapid.Bool().Draw(t, "ReconfigureNode"), + ExpectError: rapid.Bool().Draw(t, "ExpectError"), + } + }) +} + +func GetSlashThrottleDequeueGen() *rapid.Generator[slashThrottleDequeue] { + return rapid.Custom(func(t *rapid.T) slashThrottleDequeue { + return slashThrottleDequeue{ + Chain: GetChainIDGen().Draw(t, "Chain"), + CurrentQueueSize: rapid.Int().Draw(t, "CurrentQueueSize"), + NextQueueSize: rapid.Int().Draw(t, "NextQueueSize"), + Timeout: time.Duration(rapid.Int().Draw(t, "Timeout")) * time.Millisecond, + } + }) +} diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 2256156958..54a871ecb0 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -23,10 +23,10 @@ import ( ) type SendTokensAction struct { - chain chainID - from validatorID - to validatorID - amount uint + Chain ChainID + From ValidatorID + To ValidatorID + Amount uint } const done = "done!!!!!!!!" @@ -35,18 +35,18 @@ func (tr TestRun) sendTokens( action SendTokensAction, verbose bool, ) { - binaryName := tr.chainConfigs[action.chain].binaryName + binaryName := tr.chainConfigs[action.Chain].BinaryName //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, BinaryName, "tx", "bank", "send", - tr.validatorConfigs[action.from].delAddress, - tr.validatorConfigs[action.to].delAddress, - fmt.Sprint(action.amount)+`stake`, + tr.validatorConfigs[action.From].DelAddress, + tr.validatorConfigs[action.To].DelAddress, + fmt.Sprint(action.Amount)+`stake`, - `--chain-id`, string(tr.chainConfigs[action.chain].chainId), - `--home`, tr.getValidatorHome(action.chain, action.from), - `--node`, tr.getValidatorNode(action.chain, action.from), + `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), + `--home`, tr.getValidatorHome(action.Chain, action.From), + `--node`, tr.getValidatorNode(action.Chain, action.From), `--keyring-backend`, `test`, `-y`, ) @@ -59,28 +59,28 @@ func (tr TestRun) sendTokens( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.chain, 2, 30*time.Second) + tr.waitBlocks(action.Chain, 2, 30*time.Second) } type StartChainAction struct { - chain chainID - validators []StartChainValidator + Chain ChainID + Validators []StartChainValidator // Genesis changes specific to this action, appended to genesis changes defined in chain config - genesisChanges string - skipGentx bool + GenesisChanges string + SkipGentx bool } type StartChainValidator struct { - id validatorID - allocation uint - stake uint + Id ValidatorID + Allocation uint + Stake uint } func (tr *TestRun) startChain( action StartChainAction, verbose bool, ) { - chainConfig := tr.chainConfigs[action.chain] + chainConfig := tr.chainConfigs[action.Chain] type jsonValAttrs struct { Mnemonic string `json:"mnemonic"` Allocation string `json:"allocation"` @@ -96,20 +96,20 @@ func (tr *TestRun) startChain( } var validators []jsonValAttrs - for _, val := range action.validators { + for _, val := range action.Validators { validators = append(validators, jsonValAttrs{ - Mnemonic: tr.validatorConfigs[val.id].mnemonic, - NodeKey: tr.validatorConfigs[val.id].nodeKey, - ValId: fmt.Sprint(val.id), - PrivValidatorKey: tr.validatorConfigs[val.id].privValidatorKey, - Allocation: fmt.Sprint(val.allocation) + "stake", - Stake: fmt.Sprint(val.stake) + "stake", - IpSuffix: tr.validatorConfigs[val.id].ipSuffix, - - ConsumerMnemonic: tr.validatorConfigs[val.id].consumerMnemonic, - ConsumerPrivValidatorKey: tr.validatorConfigs[val.id].consumerPrivValidatorKey, + Mnemonic: tr.validatorConfigs[val.Id].Mnemonic, + NodeKey: tr.validatorConfigs[val.Id].NodeKey, + ValId: fmt.Sprint(val.Id), + PrivValidatorKey: tr.validatorConfigs[val.Id].PrivValidatorKey, + Allocation: fmt.Sprint(val.Allocation) + "stake", + Stake: fmt.Sprint(val.Stake) + "stake", + IpSuffix: tr.validatorConfigs[val.Id].IpSuffix, + + ConsumerMnemonic: tr.validatorConfigs[val.Id].ConsumerMnemonic, + ConsumerPrivValidatorKey: tr.validatorConfigs[val.Id].ConsumerPrivValidatorKey, // if true node will be started with consumer key for each consumer chain - StartWithConsumerKey: tr.validatorConfigs[val.id].useConsumerKey, + StartWithConsumerKey: tr.validatorConfigs[val.Id].UseConsumerKey, }) } @@ -120,10 +120,10 @@ func (tr *TestRun) startChain( // Concat genesis changes defined in chain config, with any custom genesis changes for this chain instantiation var genesisChanges string - if action.genesisChanges != "" { - genesisChanges = chainConfig.genesisChanges + " | " + action.genesisChanges + if action.GenesisChanges != "" { + genesisChanges = chainConfig.GenesisChanges + " | " + action.GenesisChanges } else { - genesisChanges = chainConfig.genesisChanges + genesisChanges = chainConfig.GenesisChanges } var cometmockArg string @@ -134,10 +134,10 @@ func (tr *TestRun) startChain( } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "/bin/bash", - "/testnet-scripts/start-chain.sh", chainConfig.binaryName, string(vals), - string(chainConfig.chainId), chainConfig.ipPrefix, genesisChanges, - fmt.Sprint(action.skipGentx), + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "/bin/bash", + "/testnet-scripts/start-chain.sh", chainConfig.BinaryName, string(vals), + string(chainConfig.ChainId), chainConfig.IpPrefix, genesisChanges, + fmt.Sprint(action.SkipGentx), // override config/config.toml for each node on chain // usually timeout_commit and peer_gossip_sleep_duration are changed to vary the test run duration // lower timeout_commit means the blocks are produced faster making the test run shorter @@ -172,25 +172,26 @@ func (tr *TestRun) startChain( } tr.addChainToRelayer(addChainToRelayerAction{ - chain: action.chain, - validator: action.validators[0].id, + Chain: action.Chain, + Validator: action.Validators[0].Id, }, verbose) // store the fact that we started the chain - tr.runningChains[action.chain] = true - fmt.Println("Started chain", action.chain) + tr.runningChains[action.Chain] = true + fmt.Println("Started chain", action.Chain) if tr.timeOffset != 0 { // advance time for this chain so that it is in sync with the rest of the network - tr.AdvanceTimeForChain(action.chain, tr.timeOffset) + tr.AdvanceTimeForChain(action.Chain, tr.timeOffset) } } type submitTextProposalAction struct { - chain chainID - from validatorID - deposit uint - title string - description string + Chain ChainID + From ValidatorID + Deposit uint + PropType string + Title string + Description string } func (tr TestRun) submitTextProposal( @@ -199,15 +200,16 @@ func (tr TestRun) submitTextProposal( ) { // TEXT PROPOSAL //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "tx", "gov", "submit-legacy-proposal", - `--title`, action.title, - `--description`, action.description, - `--deposit`, fmt.Sprint(action.deposit)+`stake`, - `--from`, `validator`+fmt.Sprint(action.from), - `--chain-id`, string(tr.chainConfigs[action.chain].chainId), - `--home`, tr.getValidatorHome(action.chain, action.from), - `--node`, tr.getValidatorNode(action.chain, action.from), + `--title`, action.Title, + `--description`, action.Description, + `--type`, action.PropType, + `--deposit`, fmt.Sprint(action.Deposit)+`stake`, + `--from`, `validator`+fmt.Sprint(action.From), + `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), + `--home`, tr.getValidatorHome(action.Chain, action.From), + `--node`, tr.getValidatorNode(action.Chain, action.From), `--keyring-backend`, `test`, `-y`, ).CombinedOutput() @@ -216,31 +218,31 @@ func (tr TestRun) submitTextProposal( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.chain, 1, 10*time.Second) + tr.waitBlocks(action.Chain, 1, 10*time.Second) } type submitConsumerAdditionProposalAction struct { - preCCV bool - chain chainID - from validatorID - deposit uint - consumerChain chainID - spawnTime uint - initialHeight clienttypes.Height - distributionChannel string + PreCCV bool + Chain ChainID + From ValidatorID + Deposit uint + ConsumerChain ChainID + SpawnTime uint + InitialHeight clienttypes.Height + DistributionChannel string } func (tr TestRun) submitConsumerAdditionProposal( action submitConsumerAdditionProposalAction, verbose bool, ) { - spawnTime := tr.containerConfig.now.Add(time.Duration(action.spawnTime) * time.Millisecond) + spawnTime := tr.containerConfig.Now.Add(time.Duration(action.SpawnTime) * time.Millisecond) params := ccvtypes.DefaultParams() prop := client.ConsumerAdditionProposalJSON{ Title: "Propose the addition of a new chain", Summary: "Gonna be a great chain", - ChainId: string(tr.chainConfigs[action.consumerChain].chainId), - InitialHeight: action.initialHeight, + ChainId: string(tr.chainConfigs[action.ConsumerChain].ChainId), + InitialHeight: action.InitialHeight, GenesisHash: []byte("gen_hash"), BinaryHash: []byte("bin_hash"), SpawnTime: spawnTime, @@ -250,8 +252,8 @@ func (tr TestRun) submitConsumerAdditionProposal( CcvTimeoutPeriod: params.CcvTimeoutPeriod, TransferTimeoutPeriod: params.TransferTimeoutPeriod, UnbondingPeriod: params.UnbondingPeriod, - Deposit: fmt.Sprint(action.deposit) + `stake`, - DistributionTransmissionChannel: action.distributionChannel, + Deposit: fmt.Sprint(action.Deposit) + `stake`, + DistributionTransmissionChannel: action.DistributionChannel, } bz, err := json.Marshal(prop) @@ -265,7 +267,7 @@ func (tr TestRun) submitConsumerAdditionProposal( } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/temp-proposal.json")).CombinedOutput() if err != nil { @@ -274,13 +276,13 @@ func (tr TestRun) submitConsumerAdditionProposal( //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. // CONSUMER ADDITION PROPOSAL - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "tx", "gov", "submit-legacy-proposal", "consumer-addition", "/temp-proposal.json", - `--from`, `validator`+fmt.Sprint(action.from), - `--chain-id`, string(tr.chainConfigs[action.chain].chainId), - `--home`, tr.getValidatorHome(action.chain, action.from), + `--from`, `validator`+fmt.Sprint(action.From), + `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), + `--home`, tr.getValidatorHome(action.Chain, action.From), `--gas`, `900000`, - `--node`, tr.getValidatorNode(action.chain, action.from), + `--node`, tr.getValidatorNode(action.Chain, action.From), `--keyring-backend`, `test`, `-y`, ).CombinedOutput() @@ -290,28 +292,28 @@ func (tr TestRun) submitConsumerAdditionProposal( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(chainID("provi"), 2, 10*time.Second) + tr.waitBlocks(ChainID("provi"), 2, 10*time.Second) } type submitConsumerRemovalProposalAction struct { - chain chainID - from validatorID - deposit uint - consumerChain chainID - stopTimeOffset time.Duration // offset from time.Now() + Chain ChainID + From ValidatorID + Deposit uint + ConsumerChain ChainID + StopTimeOffset time.Duration // offset from time.Now() } func (tr TestRun) submitConsumerRemovalProposal( action submitConsumerRemovalProposalAction, verbose bool, ) { - stopTime := tr.containerConfig.now.Add(action.stopTimeOffset) + stopTime := tr.containerConfig.Now.Add(action.StopTimeOffset) prop := client.ConsumerRemovalProposalJSON{ - Title: fmt.Sprintf("Stop the %v chain", action.consumerChain), + Title: fmt.Sprintf("Stop the %v chain", action.ConsumerChain), Summary: "It was a great chain", - ChainId: string(tr.chainConfigs[action.consumerChain].chainId), + ChainId: string(tr.chainConfigs[action.ConsumerChain].ChainId), StopTime: stopTime, - Deposit: fmt.Sprint(action.deposit) + `stake`, + Deposit: fmt.Sprint(action.Deposit) + `stake`, } bz, err := json.Marshal(prop) @@ -325,7 +327,7 @@ func (tr TestRun) submitConsumerRemovalProposal( } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/temp-proposal.json")).CombinedOutput() if err != nil { @@ -333,13 +335,14 @@ func (tr TestRun) submitConsumerRemovalProposal( } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - // CONSUMER REMOVAL PROPOSAL - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, - "tx", "gov", "submit-legacy-proposal", "consumer-removal", "/temp-proposal.json", - `--from`, `validator`+fmt.Sprint(action.from), - `--chain-id`, string(tr.chainConfigs[action.chain].chainId), - `--home`, tr.getValidatorHome(action.chain, action.from), - `--node`, tr.getValidatorNode(action.chain, action.from), + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, + + "tx", "gov", "submit-legacy-proposal", "consumer-removal", + "/temp-proposal.json", + `--from`, `validator`+fmt.Sprint(action.From), + `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), + `--home`, tr.getValidatorHome(action.Chain, action.From), + `--node`, tr.getValidatorNode(action.Chain, action.From), `--gas`, "900000", `--keyring-backend`, `test`, `-y`, @@ -350,16 +353,16 @@ func (tr TestRun) submitConsumerRemovalProposal( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(chainID("provi"), 2, 20*time.Second) + tr.waitBlocks(ChainID("provi"), 2, 20*time.Second) } type submitParamChangeLegacyProposalAction struct { - chain chainID - from validatorID - deposit uint - subspace string - key string - value interface{} + Chain ChainID + From ValidatorID + Deposit uint + Subspace string + Key string + Value interface{} } type paramChangeProposalJSON struct { @@ -384,8 +387,8 @@ func (tr TestRun) submitParamChangeProposal( Title: "Legacy Param change", Summary: "Changing legacy module params", Description: "Changing legacy module params", - Changes: []paramChangeJSON{{Subspace: action.subspace, Key: action.key, Value: action.value}}, - Deposit: fmt.Sprint(action.deposit) + `stake`, + Changes: []paramChangeJSON{{Subspace: action.Subspace, Key: action.Key, Value: action.Value}}, + Deposit: fmt.Sprint(action.Deposit) + `stake`, } bz, err := json.Marshal(prop) @@ -399,7 +402,7 @@ func (tr TestRun) submitParamChangeProposal( } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/params-proposal.json")).CombinedOutput() if err != nil { @@ -407,13 +410,15 @@ func (tr TestRun) submitParamChangeProposal( } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - // PARAM CHANGE PROPOSAL // we should be able to make these all one command which will be cool - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, + // PARAM CHANGE PROPOSAL + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, + "tx", "gov", "submit-legacy-proposal", "param-change", "/params-proposal.json", - `--from`, `validator`+fmt.Sprint(action.from), - `--chain-id`, string(tr.chainConfigs[action.chain].chainId), - `--home`, tr.getValidatorHome(action.chain, action.from), - `--node`, tr.getValidatorNode(action.chain, action.from), + + `--from`, `validator`+fmt.Sprint(action.From), + `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), + `--home`, tr.getValidatorHome(action.Chain, action.From), + `--node`, tr.getValidatorNode(action.Chain, action.From), `--gas`, "900000", `--keyring-backend`, `test`, `-y`, @@ -425,38 +430,38 @@ func (tr TestRun) submitParamChangeProposal( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.chain, 2, 60*time.Second) + tr.waitBlocks(action.Chain, 2, 60*time.Second) } type submitEquivocationProposalAction struct { - chain chainID - height int64 - time time.Time - power int64 - validator validatorID - deposit uint - from validatorID + Chain ChainID + Height int64 + Time time.Time + Power int64 + Validator ValidatorID + Deposit uint + From ValidatorID } func (tr TestRun) submitEquivocationProposal(action submitEquivocationProposalAction, verbose bool) { - val := tr.validatorConfigs[action.validator] - providerChain := tr.chainConfigs[chainID("provi")] + val := tr.validatorConfigs[action.Validator] + providerChain := tr.chainConfigs[ChainID("provi")] prop := client.EquivocationProposalJSON{ Summary: "Validator equivocation!", EquivocationProposal: types.EquivocationProposal{ Title: "Validator equivocation!", - Description: fmt.Sprintf("Validator: %s has committed an equivocation infraction on chainID: %s", action.validator, action.chain), + Description: fmt.Sprintf("Validator: %s has committed an equivocation infraction on ChainID: %s", action.Validator, action.Chain), Equivocations: []*evidencetypes.Equivocation{ { - Height: action.height, - Time: action.time, - Power: action.power, - ConsensusAddress: val.valconsAddress, + Height: action.Height, + Time: action.Time, + Power: action.Power, + ConsensusAddress: val.ValconsAddress, }, }, }, - Deposit: fmt.Sprint(action.deposit) + `stake`, + Deposit: fmt.Sprint(action.Deposit) + `stake`, } bz, err := json.Marshal(prop) @@ -470,7 +475,7 @@ func (tr TestRun) submitEquivocationProposal(action submitEquivocationProposalAc } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/equivocation-proposal.json")).CombinedOutput() if err != nil { @@ -479,12 +484,14 @@ func (tr TestRun) submitEquivocationProposal(action submitEquivocationProposalAc //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. // EQUIVOCATION PROPOSAL - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, providerChain.binaryName, + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, providerChain.BinaryName, + "tx", "gov", "submit-legacy-proposal", "equivocation", "/equivocation-proposal.json", - `--from`, `validator`+fmt.Sprint(action.from), - `--chain-id`, string(providerChain.chainId), - `--home`, tr.getValidatorHome(providerChain.chainId, action.from), - `--node`, tr.getValidatorNode(providerChain.chainId, action.from), + + `--from`, `validator`+fmt.Sprint(action.From), + `--chain-id`, string(providerChain.ChainId), + `--home`, tr.getValidatorHome(providerChain.ChainId, action.From), + `--node`, tr.getValidatorNode(providerChain.ChainId, action.From), `--gas`, "9000000", `--keyring-backend`, `test`, `-y`, @@ -495,14 +502,14 @@ func (tr TestRun) submitEquivocationProposal(action submitEquivocationProposalAc } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(chainID("provi"), 2, 30*time.Second) + tr.waitBlocks(ChainID("provi"), 2, 30*time.Second) } type voteGovProposalAction struct { - chain chainID - from []validatorID - vote []string - propNumber uint + Chain ChainID + From []ValidatorID + Vote []string + PropNumber uint } func (tr *TestRun) voteGovProposal( @@ -510,21 +517,21 @@ func (tr *TestRun) voteGovProposal( verbose bool, ) { var wg sync.WaitGroup - for i, val := range action.from { + for i, val := range action.From { wg.Add(1) - vote := action.vote[i] - go func(val validatorID, vote string) { + vote := action.Vote[i] + go func(val ValidatorID, vote string) { defer wg.Done() //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "tx", "gov", "vote", - fmt.Sprint(action.propNumber), vote, + fmt.Sprint(action.PropNumber), vote, `--from`, `validator`+fmt.Sprint(val), - `--chain-id`, string(tr.chainConfigs[action.chain].chainId), - `--home`, tr.getValidatorHome(action.chain, val), - `--node`, tr.getValidatorNode(action.chain, val), + `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), + `--home`, tr.getValidatorHome(action.Chain, val), + `--node`, tr.getValidatorNode(action.Chain, val), `--keyring-backend`, `test`, `--gas`, "900000", `-y`, @@ -537,15 +544,15 @@ func (tr *TestRun) voteGovProposal( wg.Wait() // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.chain, 1, 10*time.Second) - tr.WaitTime(time.Duration(tr.chainConfigs[action.chain].votingWaitTime) * time.Second) + tr.waitBlocks(action.Chain, 1, 10*time.Second) + tr.WaitTime(time.Duration(tr.chainConfigs[action.Chain].VotingWaitTime) * time.Second) } type startConsumerChainAction struct { - consumerChain chainID - providerChain chainID - validators []StartChainValidator - genesisChanges string + ConsumerChain ChainID + ProviderChain ChainID + Validators []StartChainValidator + GenesisChanges string } func (tr *TestRun) startConsumerChain( @@ -553,12 +560,12 @@ func (tr *TestRun) startConsumerChain( verbose bool, ) { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.providerChain].binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.ProviderChain].BinaryName, "query", "provider", "consumer-genesis", - string(tr.chainConfigs[action.consumerChain].chainId), + string(tr.chainConfigs[action.ConsumerChain].ChainId), - `--node`, tr.getQueryNode(action.providerChain), + `--node`, tr.getQueryNode(action.ProviderChain), `-o`, `json`, ) @@ -572,24 +579,24 @@ func (tr *TestRun) startConsumerChain( } consumerGenesis := ".app_state.ccvconsumer = " + string(bz) - consumerGenesisChanges := tr.chainConfigs[action.consumerChain].genesisChanges + consumerGenesisChanges := tr.chainConfigs[action.ConsumerChain].GenesisChanges if consumerGenesisChanges != "" { - consumerGenesis = consumerGenesis + " | " + consumerGenesisChanges + " | " + action.genesisChanges + consumerGenesis = consumerGenesis + " | " + consumerGenesisChanges + " | " + action.GenesisChanges } tr.startChain(StartChainAction{ - chain: action.consumerChain, - validators: action.validators, - genesisChanges: consumerGenesis, - skipGentx: true, + Chain: action.ConsumerChain, + Validators: action.Validators, + GenesisChanges: consumerGenesis, + SkipGentx: true, }, verbose) } type ChangeoverChainAction struct { - sovereignChain chainID - providerChain chainID - validators []StartChainValidator - genesisChanges string + SovereignChain ChainID + ProviderChain ChainID + Validators []StartChainValidator + GenesisChanges string } func (tr TestRun) changeoverChain( @@ -599,12 +606,12 @@ func (tr TestRun) changeoverChain( // sleep until the consumer chain genesis is ready on consumer time.Sleep(5 * time.Second) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.providerChain].binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.ProviderChain].BinaryName, "query", "provider", "consumer-genesis", - string(tr.chainConfigs[action.sovereignChain].chainId), + string(tr.chainConfigs[action.SovereignChain].ChainId), - `--node`, tr.getQueryNode(action.providerChain), + `--node`, tr.getQueryNode(action.ProviderChain), `-o`, `json`, ) @@ -618,14 +625,14 @@ func (tr TestRun) changeoverChain( } consumerGenesis := ".app_state.ccvconsumer = " + string(bz) - consumerGenesisChanges := tr.chainConfigs[action.sovereignChain].genesisChanges + consumerGenesisChanges := tr.chainConfigs[action.SovereignChain].GenesisChanges if consumerGenesisChanges != "" { - consumerGenesis = consumerGenesis + " | " + consumerGenesisChanges + " | " + action.genesisChanges + consumerGenesis = consumerGenesis + " | " + consumerGenesisChanges + " | " + action.GenesisChanges } tr.startChangeover(ChangeoverChainAction{ - validators: action.validators, - genesisChanges: consumerGenesis, + Validators: action.Validators, + GenesisChanges: consumerGenesis, }, verbose) } @@ -633,7 +640,7 @@ func (tr TestRun) startChangeover( action ChangeoverChainAction, verbose bool, ) { - chainConfig := tr.chainConfigs[chainID("sover")] + chainConfig := tr.chainConfigs[ChainID("sover")] type jsonValAttrs struct { Mnemonic string `json:"mnemonic"` Allocation string `json:"allocation"` @@ -649,20 +656,20 @@ func (tr TestRun) startChangeover( } var validators []jsonValAttrs - for _, val := range action.validators { + for _, val := range action.Validators { validators = append(validators, jsonValAttrs{ - Mnemonic: tr.validatorConfigs[val.id].mnemonic, - NodeKey: tr.validatorConfigs[val.id].nodeKey, - ValId: fmt.Sprint(val.id), - PrivValidatorKey: tr.validatorConfigs[val.id].privValidatorKey, - Allocation: fmt.Sprint(val.allocation) + "stake", - Stake: fmt.Sprint(val.stake) + "stake", - IpSuffix: tr.validatorConfigs[val.id].ipSuffix, - - ConsumerMnemonic: tr.validatorConfigs[val.id].consumerMnemonic, - ConsumerPrivValidatorKey: tr.validatorConfigs[val.id].consumerPrivValidatorKey, + Mnemonic: tr.validatorConfigs[val.Id].Mnemonic, + NodeKey: tr.validatorConfigs[val.Id].NodeKey, + ValId: fmt.Sprint(val.Id), + PrivValidatorKey: tr.validatorConfigs[val.Id].PrivValidatorKey, + Allocation: fmt.Sprint(val.Allocation) + "stake", + Stake: fmt.Sprint(val.Stake) + "stake", + IpSuffix: tr.validatorConfigs[val.Id].IpSuffix, + + ConsumerMnemonic: tr.validatorConfigs[val.Id].ConsumerMnemonic, + ConsumerPrivValidatorKey: tr.validatorConfigs[val.Id].ConsumerPrivValidatorKey, // if true node will be started with consumer key for each consumer chain - StartWithConsumerKey: tr.validatorConfigs[val.id].useConsumerKey, + StartWithConsumerKey: tr.validatorConfigs[val.Id].UseConsumerKey, }) } @@ -673,16 +680,16 @@ func (tr TestRun) startChangeover( // Concat genesis changes defined in chain config, with any custom genesis changes for this chain instantiation var genesisChanges string - if action.genesisChanges != "" { - genesisChanges = chainConfig.genesisChanges + " | " + action.genesisChanges + if action.GenesisChanges != "" { + genesisChanges = chainConfig.GenesisChanges + " | " + action.GenesisChanges } else { - genesisChanges = chainConfig.genesisChanges + genesisChanges = chainConfig.GenesisChanges } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "/bin/bash", - "/testnet-scripts/start-changeover.sh", chainConfig.upgradeBinary, string(vals), - "sover", chainConfig.ipPrefix, genesisChanges, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "/bin/bash", + "/testnet-scripts/start-changeover.sh", chainConfig.UpgradeBinary, string(vals), + "sover", chainConfig.IpPrefix, genesisChanges, tr.tendermintConfigOverride, ) @@ -713,8 +720,8 @@ func (tr TestRun) startChangeover( } type addChainToRelayerAction struct { - chain chainID - validator validatorID + Chain ChainID + Validator ValidatorID } const hermesChainConfigTemplate = ` @@ -779,37 +786,37 @@ func (tr TestRun) addChainToGorelayer( action addChainToRelayerAction, verbose bool, ) { - queryNodeIP := tr.getQueryNodeIP(action.chain) - chainId := tr.chainConfigs[action.chain].chainId + queryNodeIP := tr.getQueryNodeIP(action.Chain) + ChainId := tr.chainConfigs[action.Chain].ChainId rpcAddr := "http://" + queryNodeIP + ":26658" chainConfig := fmt.Sprintf(gorelayerChainConfigTemplate, - chainId, + ChainId, rpcAddr, ) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, "rly", "config", "init").CombinedOutput() + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "rly", "config", "init").CombinedOutput() if err != nil && !strings.Contains(string(bz), "config already exists") { log.Fatal(err, "\n", string(bz)) } - chainConfigFileName := fmt.Sprintf("/root/%s_config.json", chainId) + chainConfigFileName := fmt.Sprintf("/root/%s_config.json", ChainId) bashCommand := fmt.Sprintf(`echo '%s' >> %s`, chainConfig, chainConfigFileName) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, "bash", "-c", + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, "bash", "-c", bashCommand).CombinedOutput() if err != nil { log.Fatal(err, "\n", string(bz)) } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - addChainCommand := exec.Command("docker", "exec", tr.containerConfig.instanceName, "rly", "chains", "add", "--file", chainConfigFileName, string(chainId)) + addChainCommand := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "rly", "chains", "add", "--file", chainConfigFileName, string(ChainId)) executeCommand(addChainCommand, "add chain") //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - keyRestoreCommand := exec.Command("docker", "exec", tr.containerConfig.instanceName, "rly", "keys", "restore", string(chainId), "default", tr.validatorConfigs[action.validator].mnemonic) + keyRestoreCommand := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "rly", "keys", "restore", string(ChainId), "default", tr.validatorConfigs[action.Validator].Mnemonic) executeCommand(keyRestoreCommand, "restore keys") } @@ -817,8 +824,8 @@ func (tr TestRun) addChainToHermes( action addChainToRelayerAction, verbose bool, ) { - queryNodeIP := tr.getQueryNodeIP(action.chain) - chainId := tr.chainConfigs[action.chain].chainId + queryNodeIP := tr.getQueryNodeIP(action.Chain) + ChainId := tr.chainConfigs[action.Chain].ChainId keyName := "query" rpcAddr := "http://" + queryNodeIP + ":26658" grpcAddr := "tcp://" + queryNodeIP + ":9091" @@ -826,7 +833,7 @@ func (tr TestRun) addChainToHermes( chainConfig := fmt.Sprintf(hermesChainConfigTemplate, grpcAddr, - chainId, + ChainId, keyName, rpcAddr, wsAddr, @@ -836,7 +843,7 @@ func (tr TestRun) addChainToHermes( bashCommand := fmt.Sprintf(`echo '%s' >> %s`, chainConfig, "/root/.hermes/config.toml") //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, "bash", "-c", + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "bash", "-c", bashCommand, ).CombinedOutput() if err != nil { @@ -844,9 +851,9 @@ func (tr TestRun) addChainToHermes( } // Save mnemonic to file within container - saveMnemonicCommand := fmt.Sprintf(`echo '%s' > %s`, tr.validatorConfigs[action.validator].mnemonic, "/root/.hermes/mnemonic.txt") + saveMnemonicCommand := fmt.Sprintf(`echo '%s' > %s`, tr.validatorConfigs[action.Validator].Mnemonic, "/root/.hermes/mnemonic.txt") //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, "bash", "-c", + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, "bash", "-c", saveMnemonicCommand, ).CombinedOutput() if err != nil { @@ -854,9 +861,9 @@ func (tr TestRun) addChainToHermes( } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, "hermes", + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, "hermes", "keys", "add", - "--chain", string(tr.chainConfigs[action.chain].chainId), + "--chain", string(tr.chainConfigs[action.Chain].ChainId), "--mnemonic-file", "/root/.hermes/mnemonic.txt", ).CombinedOutput() @@ -886,10 +893,10 @@ const gorelayerPathConfigTemplate = `{ ` type addIbcConnectionAction struct { - chainA chainID - chainB chainID - clientA uint - clientB uint + ChainA ChainID + ChainB ChainID + ClientA uint + ClientB uint } func (tr TestRun) addIbcConnection( @@ -907,23 +914,23 @@ func (tr TestRun) addIbcConnectionGorelayer( action addIbcConnectionAction, verbose bool, ) { - pathName := tr.GetPathNameForGorelayer(action.chainA, action.chainB) + pathName := tr.GetPathNameForGorelayer(action.ChainA, action.ChainB) - pathConfig := fmt.Sprintf(gorelayerPathConfigTemplate, action.chainA, action.clientA, action.chainB, action.clientB) + pathConfig := fmt.Sprintf(gorelayerPathConfigTemplate, action.ChainA, action.ClientA, action.ChainB, action.ClientB) pathConfigFileName := fmt.Sprintf("/root/%s_config.json", pathName) bashCommand := fmt.Sprintf(`echo '%s' >> %s`, pathConfig, pathConfigFileName) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - pathConfigCommand := exec.Command("docker", "exec", tr.containerConfig.instanceName, "bash", "-c", + pathConfigCommand := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "bash", "-c", bashCommand) executeCommand(pathConfigCommand, "add path config") //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - newPathCommand := exec.Command("docker", "exec", tr.containerConfig.instanceName, "rly", + newPathCommand := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "rly", "paths", "add", - string(tr.chainConfigs[action.chainA].chainId), - string(tr.chainConfigs[action.chainB].chainId), + string(tr.chainConfigs[action.ChainA].ChainId), + string(tr.chainConfigs[action.ChainB].ChainId), pathName, "--file", pathConfigFileName, ) @@ -931,31 +938,31 @@ func (tr TestRun) addIbcConnectionGorelayer( executeCommand(newPathCommand, "new path") //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - newClientsCommand := exec.Command("docker", "exec", tr.containerConfig.instanceName, "rly", + newClientsCommand := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "rly", "transact", "clients", pathName, ) executeCommand(newClientsCommand, "new clients") - tr.waitBlocks(action.chainA, 1, 10*time.Second) - tr.waitBlocks(action.chainB, 1, 10*time.Second) + tr.waitBlocks(action.ChainA, 1, 10*time.Second) + tr.waitBlocks(action.ChainB, 1, 10*time.Second) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - newConnectionCommand := exec.Command("docker", "exec", tr.containerConfig.instanceName, "rly", + newConnectionCommand := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "rly", "transact", "connection", pathName, ) executeCommand(newConnectionCommand, "new connection") - tr.waitBlocks(action.chainA, 1, 10*time.Second) - tr.waitBlocks(action.chainB, 1, 10*time.Second) + tr.waitBlocks(action.ChainA, 1, 10*time.Second) + tr.waitBlocks(action.ChainB, 1, 10*time.Second) } type createIbcClientsAction struct { - chainA chainID - chainB chainID + ChainA ChainID + ChainB ChainID } // if clients are not provided hermes will first @@ -966,10 +973,10 @@ func (tr TestRun) createIbcClientsHermes( verbose bool, ) { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "hermes", + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "hermes", "create", "connection", - "--a-chain", string(tr.chainConfigs[action.chainA].chainId), - "--b-chain", string(tr.chainConfigs[action.chainB].chainId), + "--a-chain", string(tr.chainConfigs[action.ChainA].ChainId), + "--b-chain", string(tr.chainConfigs[action.ChainB].ChainId), ) cmdReader, err := cmd.StdoutPipe() @@ -1003,11 +1010,11 @@ func (tr TestRun) addIbcConnectionHermes( verbose bool, ) { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "hermes", + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "hermes", "create", "connection", - "--a-chain", string(tr.chainConfigs[action.chainA].chainId), - "--a-client", "07-tendermint-"+fmt.Sprint(action.clientA), - "--b-client", "07-tendermint-"+fmt.Sprint(action.clientB), + "--a-chain", string(tr.chainConfigs[action.ChainA].ChainId), + "--a-client", "07-tendermint-"+fmt.Sprint(action.ClientA), + "--b-client", "07-tendermint-"+fmt.Sprint(action.ClientB), ) cmdReader, err := cmd.StdoutPipe() @@ -1037,13 +1044,13 @@ func (tr TestRun) addIbcConnectionHermes( } type addIbcChannelAction struct { - chainA chainID - chainB chainID - connectionA uint - portA string - portB string - order string - version string + ChainA ChainID + ChainB ChainID + ConnectionA uint + PortA string + PortB string + Order string + Version string } type startRelayerAction struct{} @@ -1065,7 +1072,7 @@ func (tr TestRun) startGorelayer( ) { // gorelayer start is running in detached mode //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", "-d", tr.containerConfig.instanceName, "rly", + cmd := exec.Command("docker", "exec", "-d", tr.containerConfig.InstanceName, "rly", "start", ) @@ -1084,7 +1091,7 @@ func (tr TestRun) startHermes( ) { // hermes start is running in detached mode //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", "-d", tr.containerConfig.instanceName, "hermes", + cmd := exec.Command("docker", "exec", "-d", tr.containerConfig.InstanceName, "hermes", "start", ) @@ -1112,15 +1119,15 @@ func (tr TestRun) addIbcChannelGorelayer( action addIbcChannelAction, verbose bool, ) { - pathName := tr.GetPathNameForGorelayer(action.chainA, action.chainB) + pathName := tr.GetPathNameForGorelayer(action.ChainA, action.ChainB) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "rly", + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "rly", "transact", "channel", pathName, - "--src-port", action.portA, - "--dst-port", action.portB, - "--version", tr.containerConfig.ccvVersion, - "--order", action.order, + "--src-port", action.PortA, + "--dst-port", action.PortB, + "--version", tr.containerConfig.CcvVersion, + "--order", action.Order, "--debug", ) executeCommand(cmd, "addChannel") @@ -1132,20 +1139,20 @@ func (tr TestRun) addIbcChannelHermes( ) { // if version is not specified, use the default version when creating ccv connections // otherwise, use the provided version schema (usually it is ICS20-1 for IBC transfer) - chanVersion := action.version + chanVersion := action.Version if chanVersion == "" { - chanVersion = tr.containerConfig.ccvVersion + chanVersion = tr.containerConfig.CcvVersion } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "hermes", + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "hermes", "create", "channel", - "--a-chain", string(tr.chainConfigs[action.chainA].chainId), - "--a-connection", "connection-"+fmt.Sprint(action.connectionA), - "--a-port", action.portA, - "--b-port", action.portB, + "--a-chain", string(tr.chainConfigs[action.ChainA].ChainId), + "--a-connection", "connection-"+fmt.Sprint(action.ConnectionA), + "--a-port", action.PortA, + "--b-port", action.PortB, "--channel-version", chanVersion, - "--order", action.order, + "--order", action.Order, ) if verbose { @@ -1179,14 +1186,14 @@ func (tr TestRun) addIbcChannelHermes( } type transferChannelCompleteAction struct { - chainA chainID - chainB chainID - connectionA uint - portA string - portB string - order string - channelA uint - channelB uint + ChainA ChainID + ChainB ChainID + ConnectionA uint + PortA string + PortB string + Order string + ChannelA uint + ChannelB uint } func (tr TestRun) transferChannelComplete( @@ -1198,41 +1205,41 @@ func (tr TestRun) transferChannelComplete( } //#nosec G204 -- Bypass linter warning for spawning subprocess with chanOpenTryCmd arguments. - chanOpenTryCmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "hermes", + chanOpenTryCmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "hermes", "tx", "chan-open-try", - "--dst-chain", string(tr.chainConfigs[action.chainB].chainId), - "--src-chain", string(tr.chainConfigs[action.chainA].chainId), - "--dst-connection", "connection-"+fmt.Sprint(action.connectionA), - "--dst-port", action.portB, - "--src-port", action.portA, - "--src-channel", "channel-"+fmt.Sprint(action.channelA), + "--dst-chain", string(tr.chainConfigs[action.ChainB].ChainId), + "--src-chain", string(tr.chainConfigs[action.ChainA].ChainId), + "--dst-connection", "connection-"+fmt.Sprint(action.ConnectionA), + "--dst-port", action.PortB, + "--src-port", action.PortA, + "--src-channel", "channel-"+fmt.Sprint(action.ChannelA), ) executeCommand(chanOpenTryCmd, "transferChanOpenTry") //#nosec G204 -- Bypass linter warning for spawning subprocess with chanOpenAckCmd arguments. - chanOpenAckCmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "hermes", + chanOpenAckCmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "hermes", "tx", "chan-open-ack", - "--dst-chain", string(tr.chainConfigs[action.chainA].chainId), - "--src-chain", string(tr.chainConfigs[action.chainB].chainId), - "--dst-connection", "connection-"+fmt.Sprint(action.connectionA), - "--dst-port", action.portA, - "--src-port", action.portB, - "--dst-channel", "channel-"+fmt.Sprint(action.channelA), - "--src-channel", "channel-"+fmt.Sprint(action.channelB), + "--dst-chain", string(tr.chainConfigs[action.ChainA].ChainId), + "--src-chain", string(tr.chainConfigs[action.ChainB].ChainId), + "--dst-connection", "connection-"+fmt.Sprint(action.ConnectionA), + "--dst-port", action.PortA, + "--src-port", action.PortB, + "--dst-channel", "channel-"+fmt.Sprint(action.ChannelA), + "--src-channel", "channel-"+fmt.Sprint(action.ChannelB), ) executeCommand(chanOpenAckCmd, "transferChanOpenAck") //#nosec G204 -- Bypass linter warning for spawning subprocess with chanOpenConfirmCmd arguments. - chanOpenConfirmCmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "hermes", + chanOpenConfirmCmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "hermes", "tx", "chan-open-confirm", - "--dst-chain", string(tr.chainConfigs[action.chainB].chainId), - "--src-chain", string(tr.chainConfigs[action.chainA].chainId), - "--dst-connection", "connection-"+fmt.Sprint(action.connectionA), - "--dst-port", action.portB, - "--src-port", action.portA, - "--dst-channel", "channel-"+fmt.Sprint(action.channelB), - "--src-channel", "channel-"+fmt.Sprint(action.channelA), + "--dst-chain", string(tr.chainConfigs[action.ChainB].ChainId), + "--src-chain", string(tr.chainConfigs[action.ChainA].ChainId), + "--dst-connection", "connection-"+fmt.Sprint(action.ConnectionA), + "--dst-port", action.PortB, + "--src-port", action.PortA, + "--dst-channel", "channel-"+fmt.Sprint(action.ChannelB), + "--src-channel", "channel-"+fmt.Sprint(action.ChannelA), ) executeCommand(chanOpenConfirmCmd, "transferChanOpenConfirm") } @@ -1271,10 +1278,10 @@ func executeCommand(cmd *exec.Cmd, cmdName string) { } type relayPacketsAction struct { - chainA chainID - chainB chainID - port string - channel uint + ChainA ChainID + ChainB ChainID + Port string + Channel uint } func (tr TestRun) relayPackets( @@ -1292,13 +1299,13 @@ func (tr TestRun) relayPacketsGorelayer( action relayPacketsAction, verbose bool, ) { - pathName := tr.GetPathNameForGorelayer(action.chainA, action.chainB) + pathName := tr.GetPathNameForGorelayer(action.ChainA, action.ChainB) // rly transact relay-packets [path-name] --channel [channel-id] //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "rly", "transact", "flush", + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "rly", "transact", "flush", pathName, - "channel-"+fmt.Sprint(action.channel), + "channel-"+fmt.Sprint(action.Channel), ) if verbose { log.Println("relayPackets cmd:", cmd.String()) @@ -1308,8 +1315,8 @@ func (tr TestRun) relayPacketsGorelayer( log.Fatal(err, "\n", string(bz)) } - tr.waitBlocks(action.chainA, 1, 30*time.Second) - tr.waitBlocks(action.chainB, 1, 30*time.Second) + tr.waitBlocks(action.ChainA, 1, 30*time.Second) + tr.waitBlocks(action.ChainB, 1, 30*time.Second) } func (tr TestRun) relayPacketsHermes( @@ -1318,10 +1325,10 @@ func (tr TestRun) relayPacketsHermes( ) { // hermes clear packets ibc0 transfer channel-13 //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "hermes", "clear", "packets", - "--chain", string(tr.chainConfigs[action.chainA].chainId), - "--port", action.port, - "--channel", "channel-"+fmt.Sprint(action.channel), + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "hermes", "clear", "packets", + "--chain", string(tr.chainConfigs[action.ChainA].ChainId), + "--port", action.Port, + "--channel", "channel-"+fmt.Sprint(action.Channel), ) if verbose { log.Println("relayPackets cmd:", cmd.String()) @@ -1332,58 +1339,58 @@ func (tr TestRun) relayPacketsHermes( log.Fatal(err, "\n", string(bz)) } - tr.waitBlocks(action.chainA, 1, 30*time.Second) - tr.waitBlocks(action.chainB, 1, 30*time.Second) + tr.waitBlocks(action.ChainA, 1, 30*time.Second) + tr.waitBlocks(action.ChainB, 1, 30*time.Second) } type relayRewardPacketsToProviderAction struct { - consumerChain chainID - providerChain chainID - port string - channel uint + ConsumerChain ChainID + ProviderChain ChainID + Port string + Channel uint } func (tr TestRun) relayRewardPacketsToProvider( action relayRewardPacketsToProviderAction, verbose bool, ) { - blockPerDistribution, _ := strconv.ParseUint(strings.Trim(tr.getParam(action.consumerChain, Param{Subspace: "ccvconsumer", Key: "BlocksPerDistributionTransmission"}), "\""), 10, 64) - currentBlock := uint64(tr.getBlockHeight(action.consumerChain)) + blockPerDistribution, _ := strconv.ParseUint(strings.Trim(tr.getParam(action.ConsumerChain, Param{Subspace: "ccvconsumer", Key: "BlocksPerDistributionTransmission"}), "\""), 10, 64) + currentBlock := uint64(tr.getBlockHeight(action.ConsumerChain)) if currentBlock <= blockPerDistribution { - tr.waitBlocks(action.consumerChain, uint(blockPerDistribution-currentBlock+1), 60*time.Second) + tr.waitBlocks(action.ConsumerChain, uint(blockPerDistribution-currentBlock+1), 60*time.Second) } - tr.relayPackets(relayPacketsAction{chainA: action.consumerChain, chainB: action.providerChain, port: action.port, channel: action.channel}, verbose) - tr.waitBlocks(action.providerChain, 1, 10*time.Second) + tr.relayPackets(relayPacketsAction{ChainA: action.ConsumerChain, ChainB: action.ProviderChain, Port: action.Port, Channel: action.Channel}, verbose) + tr.waitBlocks(action.ProviderChain, 1, 10*time.Second) } type delegateTokensAction struct { - chain chainID - from validatorID - to validatorID - amount uint + Chain ChainID + From ValidatorID + To ValidatorID + Amount uint } func (tr TestRun) delegateTokens( action delegateTokensAction, verbose bool, ) { - toValCfg := tr.validatorConfigs[action.to] - delegateAddr := toValCfg.valoperAddress - if action.chain != chainID("provi") && toValCfg.useConsumerKey { - delegateAddr = toValCfg.consumerValoperAddress + toValCfg := tr.validatorConfigs[action.To] + delegateAddr := toValCfg.ValoperAddress + if action.Chain != ChainID("provi") && toValCfg.UseConsumerKey { + delegateAddr = toValCfg.ConsumerValoperAddress } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "tx", "staking", "delegate", delegateAddr, - fmt.Sprint(action.amount)+`stake`, + fmt.Sprint(action.Amount)+`stake`, - `--from`, `validator`+fmt.Sprint(action.from), - `--chain-id`, string(tr.chainConfigs[action.chain].chainId), - `--home`, tr.getValidatorHome(action.chain, action.from), - `--node`, tr.getValidatorNode(action.chain, action.from), + `--from`, `validator`+fmt.Sprint(action.From), + `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), + `--home`, tr.getValidatorHome(action.Chain, action.From), + `--node`, tr.getValidatorNode(action.Chain, action.From), `--keyring-backend`, `test`, `-y`, ) @@ -1398,36 +1405,36 @@ func (tr TestRun) delegateTokens( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.chain, 2, 10*time.Second) + tr.waitBlocks(action.Chain, 2, 10*time.Second) } type unbondTokensAction struct { - chain chainID - sender validatorID - unbondFrom validatorID - amount uint + Chain ChainID + Sender ValidatorID + UnbondFrom ValidatorID + Amount uint } func (tr TestRun) unbondTokens( action unbondTokensAction, verbose bool, ) { - unbondFrom := tr.validatorConfigs[action.unbondFrom].valoperAddress - if tr.validatorConfigs[action.unbondFrom].useConsumerKey { - unbondFrom = tr.validatorConfigs[action.unbondFrom].consumerValoperAddress + unbondFrom := tr.validatorConfigs[action.UnbondFrom].ValoperAddress + if tr.validatorConfigs[action.UnbondFrom].UseConsumerKey { + unbondFrom = tr.validatorConfigs[action.UnbondFrom].ConsumerValoperAddress } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "tx", "staking", "unbond", unbondFrom, - fmt.Sprint(action.amount)+`stake`, + fmt.Sprint(action.Amount)+`stake`, - `--from`, `validator`+fmt.Sprint(action.sender), - `--chain-id`, string(tr.chainConfigs[action.chain].chainId), - `--home`, tr.getValidatorHome(action.chain, action.sender), - `--node`, tr.getValidatorNode(action.chain, action.sender), + `--from`, `validator`+fmt.Sprint(action.Sender), + `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), + `--home`, tr.getValidatorHome(action.Chain, action.Sender), + `--node`, tr.getValidatorNode(action.Chain, action.Sender), `--gas`, "900000", `--keyring-backend`, `test`, `-y`, @@ -1443,33 +1450,33 @@ func (tr TestRun) unbondTokens( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.chain, 2, 20*time.Second) + tr.waitBlocks(action.Chain, 2, 20*time.Second) } type cancelUnbondTokensAction struct { - chain chainID - delegator validatorID - validator validatorID - amount uint + Chain ChainID + Delegator ValidatorID + Validator ValidatorID + Amount uint } func (tr TestRun) cancelUnbondTokens( action cancelUnbondTokensAction, verbose bool, ) { - validator := tr.validatorConfigs[action.validator].valoperAddress - if tr.validatorConfigs[action.validator].useConsumerKey { - validator = tr.validatorConfigs[action.validator].consumerValoperAddress + validator := tr.validatorConfigs[action.Validator].ValoperAddress + if tr.validatorConfigs[action.Validator].UseConsumerKey { + validator = tr.validatorConfigs[action.Validator].ConsumerValoperAddress } // get creation-height from state //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "q", "staking", "unbonding-delegation", - tr.validatorConfigs[action.delegator].delAddress, + tr.validatorConfigs[action.Delegator].DelAddress, validator, - `--home`, tr.getValidatorHome(action.chain, action.delegator), - `--node`, tr.getValidatorNode(action.chain, action.delegator), + `--home`, tr.getValidatorHome(action.Chain, action.Delegator), + `--node`, tr.getValidatorNode(action.Chain, action.Delegator), `-o`, `json`, ) if verbose { @@ -1486,15 +1493,15 @@ func (tr TestRun) cancelUnbondTokens( } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd = exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, + cmd = exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "tx", "staking", "cancel-unbond", validator, - fmt.Sprint(action.amount)+`stake`, + fmt.Sprint(action.Amount)+`stake`, fmt.Sprint(creationHeight), - `--from`, `validator`+fmt.Sprint(action.delegator), - `--chain-id`, string(tr.chainConfigs[action.chain].chainId), - `--home`, tr.getValidatorHome(action.chain, action.delegator), - `--node`, tr.getValidatorNode(action.chain, action.delegator), + `--from`, `validator`+fmt.Sprint(action.Delegator), + `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), + `--home`, tr.getValidatorHome(action.Chain, action.Delegator), + `--node`, tr.getValidatorNode(action.Chain, action.Delegator), `--gas`, "900000", `--keyring-backend`, `test`, `-o`, `json`, @@ -1511,43 +1518,43 @@ func (tr TestRun) cancelUnbondTokens( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.chain, 2, 20*time.Second) + tr.waitBlocks(action.Chain, 2, 20*time.Second) } type redelegateTokensAction struct { - chain chainID - src validatorID - dst validatorID - txSender validatorID - amount uint + Chain ChainID + Src ValidatorID + Dst ValidatorID + TxSender ValidatorID + Amount uint } func (tr TestRun) redelegateTokens(action redelegateTokensAction, verbose bool) { - srcCfg := tr.validatorConfigs[action.src] - dstCfg := tr.validatorConfigs[action.dst] + srcCfg := tr.validatorConfigs[action.Src] + dstCfg := tr.validatorConfigs[action.Dst] - redelegateSrc := srcCfg.valoperAddress - if action.chain != chainID("provi") && srcCfg.useConsumerKey { - redelegateSrc = srcCfg.consumerValoperAddress + redelegateSrc := srcCfg.ValoperAddress + if action.Chain != ChainID("provi") && srcCfg.UseConsumerKey { + redelegateSrc = srcCfg.ConsumerValoperAddress } - redelegateDst := dstCfg.valoperAddress - if action.chain != chainID("provi") && dstCfg.useConsumerKey { - redelegateDst = dstCfg.consumerValoperAddress + redelegateDst := dstCfg.ValoperAddress + if action.Chain != ChainID("provi") && dstCfg.UseConsumerKey { + redelegateDst = dstCfg.ConsumerValoperAddress } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. cmd := exec.Command("docker", "exec", - tr.containerConfig.instanceName, - tr.chainConfigs[action.chain].binaryName, + tr.containerConfig.InstanceName, + tr.chainConfigs[action.Chain].BinaryName, "tx", "staking", "redelegate", redelegateSrc, redelegateDst, - fmt.Sprint(action.amount)+`stake`, - `--from`, `validator`+fmt.Sprint(action.txSender), - `--chain-id`, string(tr.chainConfigs[action.chain].chainId), - `--home`, tr.getValidatorHome(action.chain, action.txSender), - `--node`, tr.getValidatorNode(action.chain, action.txSender), + fmt.Sprint(action.Amount)+`stake`, + `--from`, `validator`+fmt.Sprint(action.TxSender), + `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), + `--home`, tr.getValidatorHome(action.Chain, action.TxSender), + `--node`, tr.getValidatorNode(action.Chain, action.TxSender), // Need to manually set gas limit past default (200000), since redelegate has a lot of operations `--gas`, "900000", `--keyring-backend`, `test`, @@ -1564,12 +1571,12 @@ func (tr TestRun) redelegateTokens(action redelegateTokensAction, verbose bool) } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.chain, 2, 10*time.Second) + tr.waitBlocks(action.Chain, 2, 10*time.Second) } type downtimeSlashAction struct { - chain chainID - validator validatorID + Chain ChainID + Validator ValidatorID } // takes a string representation of the private key like @@ -1588,15 +1595,15 @@ func (tr TestRun) getValidatorKeyAddressFromString(keystring string) string { func (tr TestRun) invokeDowntimeSlash(action downtimeSlashAction, verbose bool) { // Bring validator down - tr.setValidatorDowntime(action.chain, action.validator, true, verbose) + tr.setValidatorDowntime(action.Chain, action.Validator, true, verbose) // Wait appropriate amount of blocks for validator to be slashed - tr.waitBlocks(action.chain, 10, 3*time.Minute) + tr.waitBlocks(action.Chain, 10, 3*time.Minute) // Bring validator back up - tr.setValidatorDowntime(action.chain, action.validator, false, verbose) + tr.setValidatorDowntime(action.Chain, action.Validator, false, verbose) } // Sets validator downtime by setting the virtual ethernet interface of a node to "up" or "down" -func (tr TestRun) setValidatorDowntime(chain chainID, validator validatorID, down, verbose bool) { +func (tr TestRun) setValidatorDowntime(chain ChainID, validator ValidatorID, down, verbose bool) { var lastArg string if down { lastArg = "down" @@ -1621,7 +1628,7 @@ func (tr TestRun) setValidatorDowntime(chain chainID, validator validatorID, dow cmd := exec.Command( "docker", "exec", - tr.containerConfig.instanceName, + tr.containerConfig.InstanceName, "ip", "link", "set", @@ -1639,16 +1646,16 @@ func (tr TestRun) setValidatorDowntime(chain chainID, validator validatorID, dow } } -func (tr TestRun) GetValidatorPrivateKeyAddress(chain chainID, validator validatorID) string { +func (tr TestRun) GetValidatorPrivateKeyAddress(chain ChainID, validator ValidatorID) string { var validatorPrivateKeyAddress string - if chain == chainID("provi") { - validatorPrivateKeyAddress = tr.getValidatorKeyAddressFromString(tr.validatorConfigs[validator].privValidatorKey) + if chain == ChainID("provi") { + validatorPrivateKeyAddress = tr.getValidatorKeyAddressFromString(tr.validatorConfigs[validator].PrivValidatorKey) } else { var valAddressString string - if tr.validatorConfigs[validator].useConsumerKey { - valAddressString = tr.validatorConfigs[validator].consumerPrivValidatorKey + if tr.validatorConfigs[validator].UseConsumerKey { + valAddressString = tr.validatorConfigs[validator].ConsumerPrivValidatorKey } else { - valAddressString = tr.validatorConfigs[validator].privValidatorKey + valAddressString = tr.validatorConfigs[validator].PrivValidatorKey } validatorPrivateKeyAddress = tr.getValidatorKeyAddressFromString(valAddressString) } @@ -1656,8 +1663,8 @@ func (tr TestRun) GetValidatorPrivateKeyAddress(chain chainID, validator validat } type unjailValidatorAction struct { - provider chainID - validator validatorID + Provider ChainID + Validator ValidatorID } // Sends an unjail transaction to the provider chain @@ -1667,14 +1674,14 @@ func (tr TestRun) unjailValidator(action unjailValidatorAction, verbose bool) { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. cmd := exec.Command("docker", "exec", - tr.containerConfig.instanceName, - tr.chainConfigs[action.provider].binaryName, + tr.containerConfig.InstanceName, + tr.chainConfigs[action.Provider].BinaryName, "tx", "slashing", "unjail", // Validator is sender here - `--from`, `validator`+fmt.Sprint(action.validator), - `--chain-id`, string(tr.chainConfigs[action.provider].chainId), - `--home`, tr.getValidatorHome(action.provider, action.validator), - `--node`, tr.getValidatorNode(action.provider, action.validator), + `--from`, `validator`+fmt.Sprint(action.Validator), + `--chain-id`, string(tr.chainConfigs[action.Provider].ChainId), + `--home`, tr.getValidatorHome(action.Provider, action.Validator), + `--node`, tr.getValidatorNode(action.Provider, action.Validator), `--gas`, "900000", `--keyring-backend`, `test`, `-y`, @@ -1691,13 +1698,13 @@ func (tr TestRun) unjailValidator(action unjailValidatorAction, verbose bool) { // wait for 1 blocks to make sure that tx got included // in a block and packets committed before proceeding - tr.waitBlocks(action.provider, 2, time.Minute) + tr.waitBlocks(action.Provider, 2, time.Minute) } type registerRepresentativeAction struct { - chain chainID - representatives []validatorID - stakes []uint + Chain ChainID + Representatives []ValidatorID + Stakes []uint } func (tr TestRun) registerRepresentative( @@ -1705,16 +1712,16 @@ func (tr TestRun) registerRepresentative( verbose bool, ) { var wg sync.WaitGroup - for i, val := range action.representatives { + for i, val := range action.Representatives { wg.Add(1) - stake := action.stakes[i] - go func(val validatorID, stake uint) { + stake := action.Stakes[i] + go func(val ValidatorID, stake uint) { defer wg.Done() //#nosec G204 -- Bypass linter warning for spawning subprocess with pubKeycmd arguments. - pubKeycmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, + pubKeycmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "tendermint", "show-validator", - `--home`, tr.getValidatorHome(action.chain, val), + `--home`, tr.getValidatorHome(action.Chain, val), ) bzPubKey, err := pubKeycmd.CombinedOutput() @@ -1723,7 +1730,7 @@ func (tr TestRun) registerRepresentative( } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName, "tx", "staking", "create-validator", `--amount`, fmt.Sprint(stake)+"stake", `--pubkey`, string(bzPubKey), @@ -1733,9 +1740,9 @@ func (tr TestRun) registerRepresentative( `--commission-max-change-rate`, "0.01", `--min-self-delegation`, "1", `--from`, `validator`+fmt.Sprint(val), - `--chain-id`, string(tr.chainConfigs[action.chain].chainId), - `--home`, tr.getValidatorHome(action.chain, val), - `--node`, tr.getValidatorNode(action.chain, val), + `--chain-id`, string(tr.chainConfigs[action.Chain].ChainId), + `--home`, tr.getValidatorHome(action.Chain, val), + `--node`, tr.getValidatorNode(action.Chain, val), `--keyring-backend`, `test`, `-y`, ).CombinedOutput() @@ -1744,7 +1751,7 @@ func (tr TestRun) registerRepresentative( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.chain, 1, 10*time.Second) + tr.waitBlocks(action.Chain, 1, 10*time.Second) }(val, stake) } @@ -1752,23 +1759,23 @@ func (tr TestRun) registerRepresentative( } type submitChangeRewardDenomsProposalAction struct { - denom string - deposit uint - from validatorID + Denom string + Deposit uint + From ValidatorID } func (tr TestRun) submitChangeRewardDenomsProposal(action submitChangeRewardDenomsProposalAction, verbose bool) { - providerChain := tr.chainConfigs[chainID("provi")] + providerChain := tr.chainConfigs[ChainID("provi")] prop := client.ChangeRewardDenomsProposalJSON{ Summary: "Change reward denoms", ChangeRewardDenomsProposal: types.ChangeRewardDenomsProposal{ Title: "Change reward denoms", Description: "Change reward denoms", - DenomsToAdd: []string{action.denom}, + DenomsToAdd: []string{action.Denom}, DenomsToRemove: []string{"stake"}, }, - Deposit: fmt.Sprint(action.deposit) + `stake`, + Deposit: fmt.Sprint(action.Deposit) + `stake`, } bz, err := json.Marshal(prop) @@ -1782,7 +1789,7 @@ func (tr TestRun) submitChangeRewardDenomsProposal(action submitChangeRewardDeno } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/change-reward-denoms-proposal.json")).CombinedOutput() if err != nil { @@ -1791,12 +1798,12 @@ func (tr TestRun) submitChangeRewardDenomsProposal(action submitChangeRewardDeno //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. // CHANGE REWARDS DENOM PROPOSAL - bz, err = exec.Command("docker", "exec", tr.containerConfig.instanceName, providerChain.binaryName, + bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, providerChain.BinaryName, "tx", "gov", "submit-legacy-proposal", "change-reward-denoms", "/change-reward-denoms-proposal.json", - `--from`, `validator`+fmt.Sprint(action.from), - `--chain-id`, string(providerChain.chainId), - `--home`, tr.getValidatorHome(providerChain.chainId, action.from), - `--node`, tr.getValidatorNode(providerChain.chainId, action.from), + `--from`, `validator`+fmt.Sprint(action.From), + `--chain-id`, string(providerChain.ChainId), + `--home`, tr.getValidatorHome(providerChain.ChainId, action.From), + `--node`, tr.getValidatorNode(providerChain.ChainId, action.From), `--gas`, "9000000", `--keyring-backend`, `test`, `-y`, @@ -1807,7 +1814,7 @@ func (tr TestRun) submitChangeRewardDenomsProposal(action submitChangeRewardDeno } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(chainID("provi"), 2, 30*time.Second) + tr.waitBlocks(ChainID("provi"), 2, 30*time.Second) } // Creates an additional node on selected chain @@ -1821,9 +1828,9 @@ func (tr TestRun) submitChangeRewardDenomsProposal(action submitChangeRewardDeno // - start the new node // Double sign should be registered within couple blocks. type doublesignSlashAction struct { - // start another node for this validator - validator validatorID - chain chainID + // start another node for this Validator + Validator ValidatorID + Chain ChainID } func (tr TestRun) invokeDoublesignSlash( @@ -1831,25 +1838,25 @@ func (tr TestRun) invokeDoublesignSlash( verbose bool, ) { if !tr.useCometmock { - chainConfig := tr.chainConfigs[action.chain] + chainConfig := tr.chainConfigs[action.Chain] //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, "/bin/bash", - "/testnet-scripts/cause-doublesign.sh", chainConfig.binaryName, string(action.validator), - string(chainConfig.chainId), chainConfig.ipPrefix).CombinedOutput() + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "/bin/bash", + "/testnet-scripts/cause-doublesign.sh", chainConfig.BinaryName, string(action.Validator), + string(chainConfig.ChainId), chainConfig.IpPrefix).CombinedOutput() if err != nil { log.Fatal(err, "\n", string(bz)) } tr.waitBlocks("provi", 10, 2*time.Minute) } else { // tr.useCometMock - validatorPrivateKeyAddress := tr.GetValidatorPrivateKeyAddress(action.chain, action.validator) + validatorPrivateKeyAddress := tr.GetValidatorPrivateKeyAddress(action.Chain, action.Validator) method := "cause_double_sign" params := fmt.Sprintf(`{"private_key_address":"%s"}`, validatorPrivateKeyAddress) - address := tr.getQueryNodeRPCAddress(action.chain) + address := tr.getQueryNodeRPCAddress(action.Chain) tr.curlJsonRPCRequest(method, params, address) - tr.waitBlocks(action.chain, 1, 10*time.Second) + tr.waitBlocks(action.Chain, 1, 10*time.Second) return } } @@ -1859,15 +1866,15 @@ func (tr TestRun) invokeDoublesignSlash( // See https://github.com/cometbft/cometbft/tree/main/spec/light-client/accountability // for more information about light client attacks. type lightClientEquivocationAttackAction struct { - validator validatorID - chain chainID + Validator ValidatorID + Chain ChainID } func (tr TestRun) lightClientEquivocationAttack( action lightClientEquivocationAttackAction, verbose bool, ) { - tr.lightClientAttack(action.validator, action.chain, LightClientEquivocationAttack) + tr.lightClientAttack(action.Validator, action.Chain, LightClientEquivocationAttack) } // Cause light client attack evidence for a certain validator to appear on the given chain. @@ -1875,15 +1882,15 @@ func (tr TestRun) lightClientEquivocationAttack( // See https://github.com/cometbft/cometbft/tree/main/spec/light-client/accountability // for more information about light client attacks. type lightClientAmnesiaAttackAction struct { - validator validatorID - chain chainID + Validator ValidatorID + Chain ChainID } func (tr TestRun) lightClientAmnesiaAttack( action lightClientAmnesiaAttackAction, verbose bool, ) { - tr.lightClientAttack(action.validator, action.chain, LightClientAmnesiaAttack) + tr.lightClientAttack(action.Validator, action.Chain, LightClientAmnesiaAttack) } // Cause light client attack evidence for a certain validator to appear on the given chain. @@ -1891,15 +1898,15 @@ func (tr TestRun) lightClientAmnesiaAttack( // See https://github.com/cometbft/cometbft/tree/main/spec/light-client/accountability // for more information about light client attacks. type lightClientLunaticAttackAction struct { - validator validatorID - chain chainID + Validator ValidatorID + Chain ChainID } func (tr TestRun) lightClientLunaticAttack( action lightClientLunaticAttackAction, verbose bool, ) { - tr.lightClientAttack(action.validator, action.chain, LightClientLunaticAttack) + tr.lightClientAttack(action.Validator, action.Chain, LightClientLunaticAttack) } type LightClientAttackType string @@ -1911,8 +1918,8 @@ const ( ) func (tr TestRun) lightClientAttack( - validator validatorID, - chain chainID, + validator ValidatorID, + chain ChainID, attackType LightClientAttackType, ) { if !tr.useCometmock { @@ -1930,18 +1937,18 @@ func (tr TestRun) lightClientAttack( } type assignConsumerPubKeyAction struct { - chain chainID - validator validatorID - consumerPubkey string - // reconfigureNode will change keys the node uses and restart - reconfigureNode bool + Chain ChainID + Validator ValidatorID + ConsumerPubkey string + // ReconfigureNode will change keys the node uses and restart + ReconfigureNode bool // executing the action should raise an error - expectError bool - expectedError string + ExpectError bool + ExpectedError string } func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbose bool) { - valCfg := tr.validatorConfigs[action.validator] + valCfg := tr.validatorConfigs[action.Validator] // Note: to get error response reported back from this command '--gas auto' needs to be set. gas := "auto" @@ -1951,19 +1958,19 @@ func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbos } assignKey := fmt.Sprintf( `%s tx provider assign-consensus-key %s '%s' --from validator%s --chain-id %s --home %s --node %s --gas %s --keyring-backend test -y -o json`, - tr.chainConfigs[chainID("provi")].binaryName, - string(tr.chainConfigs[action.chain].chainId), - action.consumerPubkey, - action.validator, - tr.chainConfigs[chainID("provi")].chainId, - tr.getValidatorHome(chainID("provi"), action.validator), - tr.getValidatorNode(chainID("provi"), action.validator), + tr.chainConfigs[ChainID("provi")].BinaryName, + string(tr.chainConfigs[action.Chain].ChainId), + action.ConsumerPubkey, + action.Validator, + tr.chainConfigs[ChainID("provi")].ChainId, + tr.getValidatorHome(ChainID("provi"), action.Validator), + tr.getValidatorNode(ChainID("provi"), action.Validator), gas, ) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. cmd := exec.Command("docker", "exec", - tr.containerConfig.instanceName, + tr.containerConfig.InstanceName, "/bin/bash", "-c", assignKey, ) @@ -1973,13 +1980,13 @@ func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbos } bz, err := cmd.CombinedOutput() - if err != nil && !action.expectError { + if err != nil && !action.ExpectError { log.Fatalf("unexpected error during key assignment - output: %s, err: %s", string(bz), err) } - if action.expectError && !tr.useCometmock { // error report ony works with --gas auto, which does not work with CometMock, so ignore - if err == nil || !strings.Contains(string(bz), action.expectedError) { - log.Fatalf("expected error not raised: expected: '%s', got '%s'", action.expectedError, (bz)) + if action.ExpectError && !tr.useCometmock { // error report ony works with --gas auto, which does not work with CometMock, so ignore + if err == nil || !strings.Contains(string(bz), action.ExpectedError) { + log.Fatalf("expected error not raised: expected: '%s', got '%s'", action.ExpectedError, (bz)) } if verbose { @@ -1989,14 +1996,14 @@ func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbos // node was started with provider key // we swap the nodes's keys for consumer keys and restart it - if action.reconfigureNode { + if action.ReconfigureNode { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - configureNodeCmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "/bin/bash", - "/testnet-scripts/reconfigure-node.sh", tr.chainConfigs[action.chain].binaryName, - string(action.validator), string(action.chain), - tr.chainConfigs[action.chain].ipPrefix, valCfg.ipSuffix, - valCfg.consumerMnemonic, valCfg.consumerPrivValidatorKey, - valCfg.consumerNodeKey, + configureNodeCmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "/bin/bash", + "/testnet-scripts/reconfigure-node.sh", tr.chainConfigs[action.Chain].BinaryName, + string(action.Validator), string(action.Chain), + tr.chainConfigs[action.Chain].IpPrefix, valCfg.IpSuffix, + valCfg.ConsumerMnemonic, valCfg.ConsumerPrivValidatorKey, + valCfg.ConsumerNodeKey, ) if verbose { @@ -2032,54 +2039,54 @@ func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbos // make the validator use consumer key // @POfftermatt I am currently using this for downtime slashing with cometmock // (I need to find the currently used validator key address)Í - valCfg.useConsumerKey = true - tr.validatorConfigs[action.validator] = valCfg + valCfg.UseConsumerKey = true + tr.validatorConfigs[action.Validator] = valCfg } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(chainID("provi"), 2, 30*time.Second) + tr.waitBlocks(ChainID("provi"), 2, 30*time.Second) } // slashThrottleDequeue polls slash queue sizes until nextQueueSize is achieved type slashThrottleDequeue struct { - chain chainID - currentQueueSize int - nextQueueSize int - // panic if timeout is exceeded - timeout time.Duration + Chain ChainID + CurrentQueueSize int + NextQueueSize int + // panic if Timeout is exceeded + Timeout time.Duration } func (tr TestRun) waitForSlashThrottleDequeue( action slashThrottleDequeue, verbose bool, ) { - timeout := time.Now().Add(action.timeout) + timeout := time.Now().Add(action.Timeout) initialGlobalQueueSize := int(tr.getGlobalSlashQueueSize()) - if initialGlobalQueueSize != action.currentQueueSize { - panic(fmt.Sprintf("wrong initial queue size: %d - expected global queue: %d\n", initialGlobalQueueSize, action.currentQueueSize)) + if initialGlobalQueueSize != action.CurrentQueueSize { + panic(fmt.Sprintf("wrong initial queue size: %d - expected global queue: %d\n", initialGlobalQueueSize, action.CurrentQueueSize)) } for { globalQueueSize := int(tr.getGlobalSlashQueueSize()) - chainQueueSize := int(tr.getConsumerChainPacketQueueSize(action.chain)) + chainQueueSize := int(tr.getConsumerChainPacketQueueSize(action.Chain)) if verbose { - fmt.Printf("waiting for packed queue size to reach: %d - current: %d\n", action.nextQueueSize, globalQueueSize) + fmt.Printf("waiting for packed queue size to reach: %d - current: %d\n", action.NextQueueSize, globalQueueSize) } // check if global queue size is equal to chain queue size - if globalQueueSize == chainQueueSize && globalQueueSize == action.nextQueueSize { //nolint:gocritic // this is the comparison that we want here. + if globalQueueSize == chainQueueSize && globalQueueSize == action.NextQueueSize { //nolint:gocritic // this is the comparison that we want here. break } if time.Now().After(timeout) { - panic(fmt.Sprintf("\n\n\nwaitForSlashThrottleDequeuemethod has timed out after: %s\n\n", action.timeout)) + panic(fmt.Sprintf("\n\n\nwaitForSlashThrottleDequeuemethod has timed out after: %s\n\n", action.Timeout)) } time.Sleep(500 * time.Millisecond) } // wair for 2 blocks to be created // allowing the jailing to be incorporated into voting power - tr.waitBlocks(action.chain, 2, time.Minute) + tr.waitBlocks(action.Chain, 2, time.Minute) } func uintPointer(i uint) *uint { @@ -2089,7 +2096,7 @@ func uintPointer(i uint) *uint { // GetPathNameForGorelayer returns the name of the path between two given chains used by Gorelayer. // Since paths are bidirectional, we need either chain to be able to be provided as first or second argument // and still return the same name, so we sort the chain names alphabetically. -func (tr TestRun) GetPathNameForGorelayer(chainA, chainB chainID) string { +func (tr TestRun) GetPathNameForGorelayer(chainA, chainB ChainID) string { var pathName string if string(chainA) < string(chainB) { pathName = string(chainA) + "-" + string(chainB) @@ -2121,7 +2128,7 @@ func (tr *TestRun) WaitTime(duration time.Duration) { } } -func (tr TestRun) AdvanceTimeForChain(chain chainID, duration time.Duration) { +func (tr TestRun) AdvanceTimeForChain(chain ChainID, duration time.Duration) { // cometmock avoids sleeping, and instead advances time for all chains method := "advance_time" params := fmt.Sprintf(`{"duration_in_seconds": "%d"}`, int(math.Ceil(duration.Seconds()))) diff --git a/tests/e2e/actions_sovereign_chain.go b/tests/e2e/actions_sovereign_chain.go index cf2d6288e8..88aa8bf03d 100644 --- a/tests/e2e/actions_sovereign_chain.go +++ b/tests/e2e/actions_sovereign_chain.go @@ -10,10 +10,10 @@ import ( ) type StartSovereignChainAction struct { - chain chainID - validators []StartChainValidator + Chain ChainID + Validators []StartChainValidator // Genesis changes specific to this action, appended to genesis changes defined in chain config - genesisChanges string + GenesisChanges string } // calls a simplified startup script (start-sovereign.sh) and runs a validator node @@ -38,20 +38,20 @@ func (tr TestRun) startSovereignChain( } var validators []jsonValAttrs - for _, val := range action.validators { + for _, val := range action.Validators { validators = append(validators, jsonValAttrs{ - Mnemonic: tr.validatorConfigs[val.id].mnemonic, - NodeKey: tr.validatorConfigs[val.id].nodeKey, - ValId: fmt.Sprint(val.id), - PrivValidatorKey: tr.validatorConfigs[val.id].privValidatorKey, - Allocation: fmt.Sprint(val.allocation) + "stake", - Stake: fmt.Sprint(val.stake) + "stake", - IpSuffix: tr.validatorConfigs[val.id].ipSuffix, - - ConsumerMnemonic: tr.validatorConfigs[val.id].consumerMnemonic, - ConsumerPrivValidatorKey: tr.validatorConfigs[val.id].consumerPrivValidatorKey, + Mnemonic: tr.validatorConfigs[val.Id].Mnemonic, + NodeKey: tr.validatorConfigs[val.Id].NodeKey, + ValId: fmt.Sprint(val.Id), + PrivValidatorKey: tr.validatorConfigs[val.Id].PrivValidatorKey, + Allocation: fmt.Sprint(val.Allocation) + "stake", + Stake: fmt.Sprint(val.Stake) + "stake", + IpSuffix: tr.validatorConfigs[val.Id].IpSuffix, + + ConsumerMnemonic: tr.validatorConfigs[val.Id].ConsumerMnemonic, + ConsumerPrivValidatorKey: tr.validatorConfigs[val.Id].ConsumerPrivValidatorKey, // if true node will be started with consumer key for each consumer chain - StartWithConsumerKey: tr.validatorConfigs[val.id].useConsumerKey, + StartWithConsumerKey: tr.validatorConfigs[val.Id].UseConsumerKey, }) } @@ -62,16 +62,16 @@ func (tr TestRun) startSovereignChain( // Concat genesis changes defined in chain config, with any custom genesis changes for this chain instantiation var genesisChanges string - if action.genesisChanges != "" { - genesisChanges = chainConfig.genesisChanges + " | " + action.genesisChanges + if action.GenesisChanges != "" { + genesisChanges = chainConfig.GenesisChanges + " | " + action.GenesisChanges } else { - genesisChanges = chainConfig.genesisChanges + genesisChanges = chainConfig.GenesisChanges } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "/bin/bash", - "/testnet-scripts/start-sovereign.sh", chainConfig.binaryName, string(vals), - string(chainConfig.chainId), chainConfig.ipPrefix, genesisChanges, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "/bin/bash", + "/testnet-scripts/start-sovereign.sh", chainConfig.BinaryName, string(vals), + string(chainConfig.ChainId), chainConfig.IpPrefix, genesisChanges, tr.tendermintConfigOverride, ) @@ -100,16 +100,16 @@ func (tr TestRun) startSovereignChain( log.Fatal(err) } tr.addChainToRelayer(addChainToRelayerAction{ - chain: action.chain, - validator: action.validators[0].id, + Chain: action.Chain, + Validator: action.Validators[0].Id, }, verbose) } type LegacyUpgradeProposalAction struct { - chainID chainID - upgradeTitle string - proposer validatorID - upgradeHeight uint64 + ChainID ChainID + UpgradeTitle string + Proposer ValidatorID + UpgradeHeight uint64 } func (tr *TestRun) submitLegacyUpgradeProposal(action LegacyUpgradeProposalAction, verbose bool) { @@ -128,18 +128,18 @@ func (tr *TestRun) submitLegacyUpgradeProposal(action LegacyUpgradeProposalActio --node %s \ --no-validate \ -y`, - tr.chainConfigs[chainID("sover")].binaryName, - action.upgradeTitle, - action.upgradeTitle, - fmt.Sprint(action.upgradeHeight), - action.proposer, - tr.chainConfigs[chainID("sover")].chainId, - tr.getValidatorHome(chainID("sover"), action.proposer), - tr.getValidatorNode(chainID("sover"), action.proposer), + tr.chainConfigs[ChainID("sover")].BinaryName, + action.UpgradeTitle, + action.UpgradeTitle, + fmt.Sprint(action.UpgradeHeight), + action.Proposer, + tr.chainConfigs[ChainID("sover")].ChainId, + tr.getValidatorHome(ChainID("sover"), action.Proposer), + tr.getValidatorNode(ChainID("sover"), action.Proposer), ) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. cmd := exec.Command("docker", "exec", - tr.containerConfig.instanceName, + tr.containerConfig.InstanceName, "/bin/bash", "-c", submit, ) @@ -153,16 +153,16 @@ func (tr *TestRun) submitLegacyUpgradeProposal(action LegacyUpgradeProposalActio log.Fatal(err, "\n", string(bz)) } - tr.waitBlocks(action.chainID, 1, 15*time.Second) + tr.waitBlocks(action.ChainID, 1, 15*time.Second) } type waitUntilBlockAction struct { - block uint - chain chainID + Block uint + Chain ChainID } func (tr *TestRun) waitUntilBlockOnChain(action waitUntilBlockAction) { - fmt.Println("waitUntilBlockOnChain is waiting for block:", action.block) - tr.waitUntilBlock(action.chain, action.block, 120*time.Second) - fmt.Println("waitUntilBlockOnChain done waiting for block:", action.block) + fmt.Println("waitUntilBlockOnChain is waiting for block:", action.Block) + tr.waitUntilBlock(action.Chain, action.Block, 120*time.Second) + fmt.Println("waitUntilBlockOnChain done waiting for block:", action.Block) } diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 373281162d..6726ab2304 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -8,55 +8,55 @@ import ( // TODO: Determine if user defined type (wrapping a primitive string) is desired in long run type ( - chainID string - validatorID string + ChainID string + ValidatorID string ) // Attributes that are unique to a validator. Allows us to map (part of) // the set of strings defined above to a set of viable validators type ValidatorConfig struct { - mnemonic string - delAddress string - valoperAddress string - valconsAddress string - privValidatorKey string - nodeKey string + Mnemonic string + DelAddress string + ValoperAddress string + ValconsAddress string + PrivValidatorKey string + NodeKey string // Must be an integer greater than 0 and less than 253 - ipSuffix string + IpSuffix string // consumer chain key assignment data // keys are used on a new node - consumerMnemonic string - consumerDelAddress string - consumerValoperAddress string - consumerValconsAddress string - consumerValPubKey string - consumerPrivValidatorKey string - consumerNodeKey string - useConsumerKey bool // if true the validator node will start with consumer key + ConsumerMnemonic string + ConsumerDelAddress string + ConsumerValoperAddress string + ConsumerValconsAddress string + ConsumerValPubKey string + ConsumerPrivValidatorKey string + ConsumerNodeKey string + UseConsumerKey bool // if true the validator node will start with consumer key } // Attributes that are unique to a chain. Allows us to map (part of) // the set of strings defined above to a set of viable chains type ChainConfig struct { - chainId chainID + ChainId ChainID // Must be unique per chain - ipPrefix string - votingWaitTime uint + IpPrefix string + VotingWaitTime uint // Any transformations to apply to the genesis file of all chains instantiated with this chain config, as a jq string. // Example: ".app_state.gov.params.voting_period = \"5s\" | .app_state.slashing.params.signed_blocks_window = \"2\" | .app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\"" - genesisChanges string - binaryName string + GenesisChanges string + BinaryName string // binary to use after upgrade height - upgradeBinary string + UpgradeBinary string } type ContainerConfig struct { - containerName string - instanceName string - ccvVersion string - now time.Time + ContainerName string + InstanceName string + CcvVersion string + Now time.Time } // TODO: Split out TestRun and system wide config like localsdkpath @@ -64,8 +64,8 @@ type TestRun struct { // These are the non altered values during a typical test run, where multiple test runs can exist // to validate different action sequences and corresponding state checks. containerConfig ContainerConfig - validatorConfigs map[validatorID]ValidatorConfig - chainConfigs map[chainID]ChainConfig + validatorConfigs map[ValidatorID]ValidatorConfig + chainConfigs map[ChainID]ChainConfig // override config.toml parameters // usually used to override timeout_commit // having shorter timeout_commit reduces the test runtime because blocks are produced faster @@ -77,7 +77,7 @@ type TestRun struct { useGorelayer bool // if false, Hermes is used as the relayer gaiaTag string // chains which are running, i.e. producing blocks, at the moment - runningChains map[chainID]bool + runningChains map[ChainID]bool // Used with CometMock. The time by which chains have been advanced. Used to keep chains in sync: when a new chain is started, advance its time by this value to keep chains in sync. timeOffset time.Duration @@ -86,67 +86,67 @@ type TestRun struct { // Initialize initializes the TestRun instance by setting the runningChains field to an empty map. func (tr *TestRun) Initialize() { - tr.runningChains = make(map[chainID]bool) + tr.runningChains = make(map[ChainID]bool) } -func getDefaultValidators() map[validatorID]ValidatorConfig { - return map[validatorID]ValidatorConfig{ - validatorID("alice"): { - mnemonic: "pave immune ethics wrap gain ceiling always holiday employ earth tumble real ice engage false unable carbon equal fresh sick tattoo nature pupil nuclear", - delAddress: "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", - valoperAddress: "cosmosvaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtrgtng", - valconsAddress: "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", - privValidatorKey: `{"address":"06C0F3E47CC5C748269088DC2F36411D3AAA27C6","pub_key":{"type":"tendermint/PubKeyEd25519","value":"RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uX+ZpDMg89a6gtqs/+MQpCTSqlkZ0nJQJOhLlCJvwvdGtyVDP1siGQjL+B8vjzmDc9gx6IiS7ip6jj3nvztfXQ=="}}`, - nodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"fjw4/DAhyRPnwKgXns5SV7QfswRSXMWJpHS7TyULDmJ8ofUc5poQP8dgr8bZRbCV5RV8cPqDq3FPdqwpmUbmdA=="}}`, - ipSuffix: "4", +func getDefaultValidators() map[ValidatorID]ValidatorConfig { + return map[ValidatorID]ValidatorConfig{ + ValidatorID("alice"): { + Mnemonic: "pave immune ethics wrap gain ceiling always holiday employ earth tumble real ice engage false unable carbon equal fresh sick tattoo nature pupil nuclear", + DelAddress: "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", + ValoperAddress: "cosmosvaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtrgtng", + ValconsAddress: "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", + PrivValidatorKey: `{"address":"06C0F3E47CC5C748269088DC2F36411D3AAA27C6","pub_key":{"type":"tendermint/PubKeyEd25519","value":"RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uX+ZpDMg89a6gtqs/+MQpCTSqlkZ0nJQJOhLlCJvwvdGtyVDP1siGQjL+B8vjzmDc9gx6IiS7ip6jj3nvztfXQ=="}}`, + NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"fjw4/DAhyRPnwKgXns5SV7QfswRSXMWJpHS7TyULDmJ8ofUc5poQP8dgr8bZRbCV5RV8cPqDq3FPdqwpmUbmdA=="}}`, + IpSuffix: "4", // consumer chain assigned key - consumerMnemonic: "exile install vapor thing little toss immune notable lounge december final easy strike title end program interest quote cloth forget forward job october twenty", - consumerDelAddress: "cosmos1eeeggku6dzk3mv7wph3zq035rhtd890sjswszd", - consumerValoperAddress: "cosmosvaloper1eeeggku6dzk3mv7wph3zq035rhtd890shy69w7", - consumerValconsAddress: "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", - consumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="}`, - consumerPrivValidatorKey: `{"address":"DF090A4880B54CD57B2A79E64D9E969BD7514B09","pub_key":{"type":"tendermint/PubKeyEd25519","value":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TRJgf7lkTjs/sj43pyweEOanyV7H7fhnVivOi0A4yjW6NjXgCCilX3TshiA8CT/nHxz3brtLh9B/z2fJ4I9N6w=="}}`, - consumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"F966RL9pi20aXRzEBe4D0xRQJtZt696Xxz44XUON52cFc83FMn1WXJbP6arvA2JPyn2LA3DLKCFHSgALrCGXGA=="}}`, - useConsumerKey: false, + ConsumerMnemonic: "exile install vapor thing little toss immune notable lounge december final easy strike title end program interest quote cloth forget forward job october twenty", + ConsumerDelAddress: "cosmos1eeeggku6dzk3mv7wph3zq035rhtd890sjswszd", + ConsumerValoperAddress: "cosmosvaloper1eeeggku6dzk3mv7wph3zq035rhtd890shy69w7", + ConsumerValconsAddress: "cosmosvalcons1muys5jyqk4xd27e208nym85kn0t4zjcfeu63fe", + ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="}`, + ConsumerPrivValidatorKey: `{"address":"DF090A4880B54CD57B2A79E64D9E969BD7514B09","pub_key":{"type":"tendermint/PubKeyEd25519","value":"ujY14AgopV907IYgPAk/5x8c9267S4fQf89nyeCPTes="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TRJgf7lkTjs/sj43pyweEOanyV7H7fhnVivOi0A4yjW6NjXgCCilX3TshiA8CT/nHxz3brtLh9B/z2fJ4I9N6w=="}}`, + ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"F966RL9pi20aXRzEBe4D0xRQJtZt696Xxz44XUON52cFc83FMn1WXJbP6arvA2JPyn2LA3DLKCFHSgALrCGXGA=="}}`, + UseConsumerKey: false, }, - validatorID("bob"): { - mnemonic: "glass trip produce surprise diamond spin excess gaze wash drum human solve dress minor artefact canoe hard ivory orange dinner hybrid moral potato jewel", - delAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", - valoperAddress: "cosmosvaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9qakmjnw", - valconsAddress: "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - privValidatorKey: `{"address":"99BD3A72EF12CD024E7584B3AC900AE3743C6ADF","pub_key":{"type":"tendermint/PubKeyEd25519","value":"mAN6RXYxSM4MNGSIriYiS7pHuwAcOHDQAy9/wnlSzOI="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"QePcwfWtOavNK7pBJrtoLMzarHKn6iBWfWPFeyV+IdmYA3pFdjFIzgw0ZIiuJiJLuke7ABw4cNADL3/CeVLM4g=="}}`, - nodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TQ4vHcO/vKdzGtWpelkX53WdMQd4kTsWGFrdcatdXFvWyO215Rewn5IRP0FszPLWr2DqPzmuH8WvxYGk5aeOXw=="}}`, - ipSuffix: "5", + ValidatorID("bob"): { + Mnemonic: "glass trip produce surprise diamond spin excess gaze wash drum human solve dress minor artefact canoe hard ivory orange dinner hybrid moral potato jewel", + DelAddress: "cosmos1dkas8mu4kyhl5jrh4nzvm65qz588hy9qcz08la", + ValoperAddress: "cosmosvaloper1dkas8mu4kyhl5jrh4nzvm65qz588hy9qakmjnw", + ValconsAddress: "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", + PrivValidatorKey: `{"address":"99BD3A72EF12CD024E7584B3AC900AE3743C6ADF","pub_key":{"type":"tendermint/PubKeyEd25519","value":"mAN6RXYxSM4MNGSIriYiS7pHuwAcOHDQAy9/wnlSzOI="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"QePcwfWtOavNK7pBJrtoLMzarHKn6iBWfWPFeyV+IdmYA3pFdjFIzgw0ZIiuJiJLuke7ABw4cNADL3/CeVLM4g=="}}`, + NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"TQ4vHcO/vKdzGtWpelkX53WdMQd4kTsWGFrdcatdXFvWyO215Rewn5IRP0FszPLWr2DqPzmuH8WvxYGk5aeOXw=="}}`, + IpSuffix: "5", // consumer chain assigned key - consumerMnemonic: "grunt list hour endless observe better spoil penalty lab duck only layer vague fantasy satoshi record demise topple space shaft solar practice donor sphere", - consumerDelAddress: "cosmos1q90l6j6lzzgt460ehjj56azknlt5yrd4s38n97", - consumerValoperAddress: "cosmosvaloper1q90l6j6lzzgt460ehjj56azknlt5yrd449nxfd", - consumerValconsAddress: "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", - consumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, - consumerPrivValidatorKey: `{"address":"E73388E246EC9945E5E70A94FE4072BD937415C4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"OFR4w+FC6EMw5fAGTrHVexyPrjzQ7QfqgZOMgVf0izlCUb6Jh7oDJim9jXP1E0koJWUfXhD+pLPgSMZ0YKu7eg=="}}`, - consumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uhPCqnL2KE8m/8OFNLQ5bN3CJr6mds+xfBi0E4umT/s2uWiJhet+vbYx88DHSdof3gGFNTIzAIxSppscBKX96w=="}}`, - useConsumerKey: false, + ConsumerMnemonic: "grunt list hour endless observe better spoil penalty lab duck only layer vague fantasy satoshi record demise topple space shaft solar practice donor sphere", + ConsumerDelAddress: "cosmos1q90l6j6lzzgt460ehjj56azknlt5yrd4s38n97", + ConsumerValoperAddress: "cosmosvaloper1q90l6j6lzzgt460ehjj56azknlt5yrd449nxfd", + ConsumerValconsAddress: "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", + ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, + ConsumerPrivValidatorKey: `{"address":"E73388E246EC9945E5E70A94FE4072BD937415C4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"OFR4w+FC6EMw5fAGTrHVexyPrjzQ7QfqgZOMgVf0izlCUb6Jh7oDJim9jXP1E0koJWUfXhD+pLPgSMZ0YKu7eg=="}}`, + ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"uhPCqnL2KE8m/8OFNLQ5bN3CJr6mds+xfBi0E4umT/s2uWiJhet+vbYx88DHSdof3gGFNTIzAIxSppscBKX96w=="}}`, + UseConsumerKey: false, }, - validatorID("carol"): { - mnemonic: "sight similar better jar bitter laptop solve fashion father jelly scissors chest uniform play unhappy convince silly clump another conduct behave reunion marble animal", - delAddress: "cosmos19hz4m226ztankqramvt4a7t0shejv4dc79gp9u", - valoperAddress: "cosmosvaloper19hz4m226ztankqramvt4a7t0shejv4dcm3u5f0", - valconsAddress: "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", - privValidatorKey: `{"address":"C888306A908A217B9A943D1DAD8790044D0947A4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"IHo4QEikWZfIKmM0X+N+BjKttz8HOzGs2npyjiba3Xk="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"z08bmSB91uFVpVmR3t2ewd/bDjZ/AzwQpe5rKjWiPG0gejhASKRZl8gqYzRf434GMq23Pwc7MazaenKOJtrdeQ=="}}`, - nodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"WLTcHEjbwB24Wp3z5oBSYTvtGQonz/7IQabOFw85BN0UkkyY5HDf38o8oHlFxVI26f+DFVeICuLbe9aXKGnUeg=="}}`, - ipSuffix: "6", + ValidatorID("carol"): { + Mnemonic: "sight similar better jar bitter laptop solve fashion father jelly scissors chest uniform play unhappy convince silly clump another conduct behave reunion marble animal", + DelAddress: "cosmos19hz4m226ztankqramvt4a7t0shejv4dc79gp9u", + ValoperAddress: "cosmosvaloper19hz4m226ztankqramvt4a7t0shejv4dcm3u5f0", + ValconsAddress: "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + PrivValidatorKey: `{"address":"C888306A908A217B9A943D1DAD8790044D0947A4","pub_key":{"type":"tendermint/PubKeyEd25519","value":"IHo4QEikWZfIKmM0X+N+BjKttz8HOzGs2npyjiba3Xk="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"z08bmSB91uFVpVmR3t2ewd/bDjZ/AzwQpe5rKjWiPG0gejhASKRZl8gqYzRf434GMq23Pwc7MazaenKOJtrdeQ=="}}`, + NodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"WLTcHEjbwB24Wp3z5oBSYTvtGQonz/7IQabOFw85BN0UkkyY5HDf38o8oHlFxVI26f+DFVeICuLbe9aXKGnUeg=="}}`, + IpSuffix: "6", // consumer chain assigned key - consumerMnemonic: "clip choose cake west range gun slam cry village receive juice galaxy lend ritual range provide ritual can since verify breeze vacant play dragon", - consumerDelAddress: "cosmos1sx6j9g2rh324a342a5f0rnx7me34r9nwgf0mc7", - consumerValoperAddress: "cosmosvaloper1sx6j9g2rh324a342a5f0rnx7me34r9nwdamw5d", - consumerValconsAddress: "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", - consumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, - consumerPrivValidatorKey: `{"address":"B41C3A40142963AA5B12DDD1C4E5890C0B3926B1","pub_key":{"type":"tendermint/PubKeyEd25519","value":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"3YaBAZLA+sl/E73lLfbFbG0u6DYm33ayr/0UpCt/vFBSLkZ/X6a1ZR0fy7fGWbN0ogP4Xc8rSx9dnvcZnqrqKw=="}}`, - consumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"rxBzFedtD3pqgfJQblbxGusKOr47oBfr8ba0Iz14gobtDRZQZlSZ/UGP4pSHkVf+4vtkrkO1vRHBYJobuiP+7A=="}}`, - useConsumerKey: true, + ConsumerMnemonic: "clip choose cake west range gun slam cry village receive juice galaxy lend ritual range provide ritual can since verify breeze vacant play dragon", + ConsumerDelAddress: "cosmos1sx6j9g2rh324a342a5f0rnx7me34r9nwgf0mc7", + ConsumerValoperAddress: "cosmosvaloper1sx6j9g2rh324a342a5f0rnx7me34r9nwdamw5d", + ConsumerValconsAddress: "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", + ConsumerValPubKey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, + ConsumerPrivValidatorKey: `{"address":"B41C3A40142963AA5B12DDD1C4E5890C0B3926B1","pub_key":{"type":"tendermint/PubKeyEd25519","value":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="},"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"3YaBAZLA+sl/E73lLfbFbG0u6DYm33ayr/0UpCt/vFBSLkZ/X6a1ZR0fy7fGWbN0ogP4Xc8rSx9dnvcZnqrqKw=="}}`, + ConsumerNodeKey: `{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"rxBzFedtD3pqgfJQblbxGusKOr47oBfr8ba0Iz14gobtDRZQZlSZ/UGP4pSHkVf+4vtkrkO1vRHBYJobuiP+7A=="}}`, + UseConsumerKey: true, }, } } @@ -155,19 +155,19 @@ func SlashThrottleTestRun() TestRun { tr := TestRun{ name: "slash-throttling", containerConfig: ContainerConfig{ - containerName: "interchain-security-slash-container", - instanceName: "interchain-security-slash-instance", - ccvVersion: "1", - now: time.Now(), + ContainerName: "interchain-security-slash-container", + InstanceName: "interchain-security-slash-instance", + CcvVersion: "1", + Now: time.Now(), }, validatorConfigs: getDefaultValidators(), - chainConfigs: map[chainID]ChainConfig{ - chainID("provi"): { - chainId: chainID("provi"), - binaryName: "interchain-security-pd", - ipPrefix: "7.7.7", - votingWaitTime: 20, - genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + chainConfigs: map[ChainID]ChainConfig{ + ChainID("provi"): { + ChainId: ChainID("provi"), + BinaryName: "interchain-security-pd", + IpPrefix: "7.7.7", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + // Custom slashing parameters for testing validator downtime functionality // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking ".app_state.slashing.params.signed_blocks_window = \"10\" | " + @@ -177,12 +177,12 @@ func SlashThrottleTestRun() TestRun { ".app_state.provider.params.slash_meter_replenish_fraction = \"0.10\" | " + ".app_state.provider.params.slash_meter_replenish_period = \"20s\"", }, - chainID("consu"): { - chainId: chainID("consu"), - binaryName: "interchain-security-cd", - ipPrefix: "7.7.8", - votingWaitTime: 20, - genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ChainID("consu"): { + ChainId: ChainID("consu"), + BinaryName: "interchain-security-cd", + IpPrefix: "7.7.8", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + ".app_state.slashing.params.signed_blocks_window = \"15\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + @@ -200,19 +200,19 @@ func DefaultTestRun() TestRun { tr := TestRun{ name: "default", containerConfig: ContainerConfig{ - containerName: "interchain-security-container", - instanceName: "interchain-security-instance", - ccvVersion: "1", - now: time.Now(), + ContainerName: "interchain-security-container", + InstanceName: "interchain-security-instance", + CcvVersion: "1", + Now: time.Now(), }, validatorConfigs: getDefaultValidators(), - chainConfigs: map[chainID]ChainConfig{ - chainID("provi"): { - chainId: chainID("provi"), - binaryName: "interchain-security-pd", - ipPrefix: "7.7.7", - votingWaitTime: 20, - genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + chainConfigs: map[ChainID]ChainConfig{ + ChainID("provi"): { + ChainId: ChainID("provi"), + BinaryName: "interchain-security-pd", + IpPrefix: "7.7.7", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + // Custom slashing parameters for testing validator downtime functionality // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking ".app_state.slashing.params.signed_blocks_window = \"10\" | " + @@ -222,12 +222,12 @@ func DefaultTestRun() TestRun { ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\"", }, - chainID("consu"): { - chainId: chainID("consu"), - binaryName: "interchain-security-cd", - ipPrefix: "7.7.8", - votingWaitTime: 20, - genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ChainID("consu"): { + ChainId: ChainID("consu"), + BinaryName: "interchain-security-cd", + IpPrefix: "7.7.8", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + ".app_state.slashing.params.signed_blocks_window = \"15\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + @@ -257,19 +257,19 @@ func DemocracyTestRun(allowReward bool) TestRun { tr := TestRun{ name: "democracy", containerConfig: ContainerConfig{ - containerName: "interchain-security-democ-container", - instanceName: "interchain-security-democ-instance", - ccvVersion: "1", - now: time.Now(), + ContainerName: "interchain-security-democ-container", + InstanceName: "interchain-security-democ-instance", + CcvVersion: "1", + Now: time.Now(), }, validatorConfigs: getDefaultValidators(), - chainConfigs: map[chainID]ChainConfig{ - chainID("provi"): { - chainId: chainID("provi"), - binaryName: "interchain-security-pd", - ipPrefix: "7.7.7", - votingWaitTime: 20, - genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + chainConfigs: map[ChainID]ChainConfig{ + ChainID("provi"): { + ChainId: ChainID("provi"), + BinaryName: "interchain-security-pd", + IpPrefix: "7.7.7", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + // Custom slashing parameters for testing validator downtime functionality // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking ".app_state.slashing.params.signed_blocks_window = \"10\" | " + @@ -278,12 +278,12 @@ func DemocracyTestRun(allowReward bool) TestRun { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling }, - chainID("democ"): { - chainId: chainID("democ"), - binaryName: "interchain-security-cdd", - ipPrefix: "7.7.9", - votingWaitTime: 20, - genesisChanges: consumerGenChanges, + ChainID("democ"): { + ChainId: ChainID("democ"), + BinaryName: "interchain-security-cdd", + IpPrefix: "7.7.9", + VotingWaitTime: 20, + GenesisChanges: consumerGenChanges, }, }, tendermintConfigOverride: `s/timeout_commit = "5s"/timeout_commit = "1s"/;` + @@ -297,19 +297,19 @@ func MultiConsumerTestRun() TestRun { tr := TestRun{ name: "multi-consumer", containerConfig: ContainerConfig{ - containerName: "interchain-security-multic-container", - instanceName: "interchain-security-multic-instance", - ccvVersion: "1", - now: time.Now(), + ContainerName: "interchain-security-multic-container", + InstanceName: "interchain-security-multic-instance", + CcvVersion: "1", + Now: time.Now(), }, validatorConfigs: getDefaultValidators(), - chainConfigs: map[chainID]ChainConfig{ - chainID("provi"): { - chainId: chainID("provi"), - binaryName: "interchain-security-pd", - ipPrefix: "7.7.7", - votingWaitTime: 20, - genesisChanges: ".app_state.gov.params.voting_period = \"30s\" | " + + chainConfigs: map[ChainID]ChainConfig{ + ChainID("provi"): { + ChainId: ChainID("provi"), + BinaryName: "interchain-security-pd", + IpPrefix: "7.7.7", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"30s\" | " + // Custom slashing parameters for testing validator downtime functionality // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking ".app_state.slashing.params.signed_blocks_window = \"10\" | " + @@ -318,23 +318,23 @@ func MultiConsumerTestRun() TestRun { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling }, - chainID("consu"): { - chainId: chainID("consu"), - binaryName: "interchain-security-cd", - ipPrefix: "7.7.8", - votingWaitTime: 20, - genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ChainID("consu"): { + ChainId: ChainID("consu"), + BinaryName: "interchain-security-cd", + IpPrefix: "7.7.8", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + ".app_state.slashing.params.signed_blocks_window = \"10\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"", }, - chainID("densu"): { - chainId: chainID("densu"), - binaryName: "interchain-security-cd", - ipPrefix: "7.7.9", - votingWaitTime: 20, - genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ChainID("densu"): { + ChainId: ChainID("densu"), + BinaryName: "interchain-security-cd", + IpPrefix: "7.7.9", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + ".app_state.slashing.params.signed_blocks_window = \"10\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + @@ -352,19 +352,19 @@ func ChangeoverTestRun() TestRun { tr := TestRun{ name: "changeover", containerConfig: ContainerConfig{ - containerName: "interchain-security-changeover-container", - instanceName: "interchain-security-changeover-instance", - ccvVersion: "1", - now: time.Now(), + ContainerName: "interchain-security-changeover-container", + InstanceName: "interchain-security-changeover-instance", + CcvVersion: "1", + Now: time.Now(), }, validatorConfigs: getDefaultValidators(), - chainConfigs: map[chainID]ChainConfig{ - chainID("provi"): { - chainId: chainID("provi"), - binaryName: "interchain-security-pd", - ipPrefix: "7.7.7", - votingWaitTime: 20, - genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + chainConfigs: map[ChainID]ChainConfig{ + ChainID("provi"): { + ChainId: ChainID("provi"), + BinaryName: "interchain-security-pd", + IpPrefix: "7.7.7", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + // Custom slashing parameters for testing validator downtime functionality // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking ".app_state.slashing.params.signed_blocks_window = \"10\" | " + @@ -374,13 +374,13 @@ func ChangeoverTestRun() TestRun { ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\"", }, - chainID("sover"): { - chainId: chainID("sover"), - binaryName: "interchain-security-sd", - upgradeBinary: "interchain-security-cdd", - ipPrefix: "7.7.8", - votingWaitTime: 20, - genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ChainID("sover"): { + ChainId: ChainID("sover"), + BinaryName: "interchain-security-sd", + UpgradeBinary: "interchain-security-cdd", + IpPrefix: "7.7.8", + VotingWaitTime: 20, + GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + ".app_state.slashing.params.signed_blocks_window = \"15\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + @@ -430,7 +430,7 @@ func (s *TestRun) validateStringLiterals() { panic("validator id string literal must be 5 char or less") } - ipSuffix, err := strconv.Atoi(valConfig.ipSuffix) + ipSuffix, err := strconv.Atoi(valConfig.IpSuffix) if err != nil { panic(fmt.Sprintf("ip suffix must be an int: %v\n", err)) } @@ -453,7 +453,7 @@ func (s *TestRun) validateStringLiterals() { panic("chain id string literal must be 5 char or less") } - if chainID != chainConfig.chainId { + if chainID != chainConfig.ChainId { panic("chain config is mapped to a chain id that is different than what's stored in the config") } } diff --git a/tests/e2e/json_marshal_test.go b/tests/e2e/json_marshal_test.go new file mode 100644 index 0000000000..5ee91dcb66 --- /dev/null +++ b/tests/e2e/json_marshal_test.go @@ -0,0 +1,189 @@ +package main + +import ( + "encoding/json" + "reflect" + "strings" + "testing" + + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + "github.com/davecgh/go-spew/spew" +) + +func TestProposalUnmarshal(t *testing.T) { + proposalAndTypeString := `{ + "Type": "main.ConsumerAdditionProposal", + "RawProposal": { + "Deposit": 10000001, + "Chain": "consu", + "SpawnTime": 0, + "InitialHeight": { + "revision_height": 1 + }, + "Status": "PROPOSAL_STATUS_PASSED" + } + }` + + expectedProposal := ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_PASSED", + } + + type ProposalAndType struct { + RawProposal json.RawMessage + Type string + } + + propAndType := &ProposalAndType{} + err := json.Unmarshal([]byte(proposalAndTypeString), propAndType) + if err != nil { + t.Errorf("Unexpected error while unmarshalling: %v", err) + } + + actualProposal, err := UnmarshalProposalWithType(propAndType.RawProposal, propAndType.Type) + if err != nil { + t.Errorf("Unexpected error while unmarshalling\n error: %v\n Raw proposal: %v\n Type: %v", err, spew.Sdump(propAndType.RawProposal), propAndType.Type) + } + + if !reflect.DeepEqual(actualProposal, expectedProposal) { + t.Errorf("Expected proposal: %v, but got: %v", spew.Sdump(expectedProposal), spew.Sdump(actualProposal)) + } +} + +type ChainStateTestCase struct { + name string + jsonBytes []byte + chainState ChainState + expectedUnmarshalErrorText string +} + +var testCases = []ChainStateTestCase{ + { + name: "valid JSON with proposals", + jsonBytes: []byte(`{ + "ValBalances": { + "alice": 9500000000, + "bob": 9500000000, + "carol": 9500000000 + }, + "Proposals": { + "1": { + "Type": "main.ConsumerAdditionProposal", + "RawProposal": { + "Deposit": 10000001, + "Chain": "consu", + "SpawnTime": 0, + "InitialHeight": { + "revision_height": 1 + }, + "Status": "PROPOSAL_STATUS_PASSED" + } + } + } + }`), + chainState: ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9500000000, + ValidatorID("bob"): 9500000000, + ValidatorID("carol"): 9500000000, + }, + Proposals: &map[uint]Proposal{ + 1: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Status: "PROPOSAL_STATUS_PASSED", + }, + }, + }, + expectedUnmarshalErrorText: "", + }, + { + name: "invalid JSON", + jsonBytes: []byte(`thisisnotagoodjsonstring`), + expectedUnmarshalErrorText: "invalid json", + }, + { + name: "unknown proposal type", + jsonBytes: []byte(`{ + "ValBalances": { + "alice": 9500000000, + "bob": 9500000000, + "carol": 9500000000 + }, + "Proposals": { + "1": { + "Type": "main.NotAProposalTypeProposal", + "RawProposal": { + "Deposit": 10000001, + "Chain": "consu", + "SpawnTime": 0, + "InitialHeight": { + "revision_height": 1 + }, + "Status": "PROPOSAL_STATUS_PASSED" + } + } + }, + }`), + expectedUnmarshalErrorText: "not a known proposal type", + }, +} + +func TestUnmarshalJSON(t *testing.T) { + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + var result ChainState + err := result.UnmarshalJSON(tc.jsonBytes) + if err != nil && tc.expectedUnmarshalErrorText == "" { + t.Errorf("Test case %v: Unexpected error: %v", tc.name, err) + } + + if err == nil && tc.expectedUnmarshalErrorText != "" { + t.Errorf("Test case %v: Expected error to contain: %v, but got no error", tc.name, tc.expectedUnmarshalErrorText) + } + + if err != nil && tc.expectedUnmarshalErrorText != "" && strings.Contains(err.Error(), tc.expectedUnmarshalErrorText) { + t.Errorf("Test case %v: Expected error to contain: %v, but got: %v", tc.name, tc.expectedUnmarshalErrorText, err) + } + + if !reflect.DeepEqual(result, tc.chainState) { + t.Errorf("Test case %v: Expected ChainState: %v, but got: %v", tc.name, tc.chainState, result) + } + }) + } +} + +func TestMarshalJSON(t *testing.T) { + // checks that marshalling and unmarshalling is the identity + // would optimally check that the marshalled JSON is the same as the expected JSON, + // but the marshalled JSON will specifically list null fields + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + result, err := tc.chainState.MarshalJSON() + if err != nil { + t.Errorf("Test case %v: Unexpected error while marshalling: %v", tc.name, err) + } + + if tc.expectedUnmarshalErrorText != "" { + // unmarshalling to compare does not make sense, since we expect it to + // fail, so just test that marshalling works and continue + return + } + + unmarshalledResult := ChainState{} + err = unmarshalledResult.UnmarshalJSON(result) + if err != nil { + t.Errorf("Test case %v: Unexpected error while unmarshalling: %v", tc.name, err) + } + + if !reflect.DeepEqual(unmarshalledResult, tc.chainState) { + t.Errorf("Test case %v: Expected: %v, but got: %v", tc.name, string(tc.jsonBytes), string(result)) + } + }) + } +} diff --git a/tests/e2e/json_parser.go b/tests/e2e/json_parser.go new file mode 100644 index 0000000000..9dfcbb494b --- /dev/null +++ b/tests/e2e/json_parser.go @@ -0,0 +1,35 @@ +package main + +import ( + "encoding/json" + "os" + "path/filepath" +) + +// TraceParser provides an interface for parsers that read sequences of Steps from files. +type TraceParser interface { + ReadTraceFromFile(filepath string) ([]Step, error) +} + +// JSONParser is a simple parser that reads steps by unmarshalling from a file. +type JSONParser struct{} + +var GlobalJSONParser = JSONParser{} + +func (parser JSONParser) ReadTraceFromFile(path string) ([]Step, error) { + // Open the JSON file and read into a bite array + jsonData, err := os.ReadFile(filepath.Clean(path)) + if err != nil { + return nil, err + } + + // Unmarshal the JSON into a slice of Step structs + var steps []Step + + err = json.Unmarshal(jsonData, &steps) + if err != nil { + return nil, err + } + + return steps, nil +} diff --git a/tests/e2e/json_utils.go b/tests/e2e/json_utils.go new file mode 100644 index 0000000000..77304dda9c --- /dev/null +++ b/tests/e2e/json_utils.go @@ -0,0 +1,448 @@ +package main + +import ( + "encoding/json" + "fmt" + "reflect" +) + +// MarshalJSON marshals a step into JSON while including the type of the action. +func (step Step) MarshalJSON() ([]byte, error) { + actionType := reflect.TypeOf(step.Action) + + result := struct { + ActionType string + Action interface{} + State State + }{ + ActionType: actionType.String(), + Action: step.Action, + State: step.State, + } + + return json.Marshal(result) +} + +// UnmarshalJSON unmarshals a step from JSON while including the type of the action. +func (step *Step) UnmarshalJSON(data []byte) error { + var tmp struct { + ActionType string + Action json.RawMessage + State State + } + if err := json.Unmarshal(data, &tmp); err != nil { + return err + } + + action, err := UnmarshalMapToActionType(tmp.Action, tmp.ActionType) + if err != nil { + return err + } + + step.Action = action + step.State = tmp.State + return nil +} + +// UnmarshalMapToActionType takes a JSON object and an action type and marshals into an object of the corresponding action. +func UnmarshalMapToActionType(rawAction json.RawMessage, actionTypeString string) (interface{}, error) { + switch actionTypeString { + case "main.submitConsumerAdditionProposalAction": + var a submitConsumerAdditionProposalAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.SendTokensAction": + var a SendTokensAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.StartChainAction": + var a StartChainAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.submitTextProposalAction": + var a submitTextProposalAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.submitConsumerRemovalProposalAction": + var a submitConsumerRemovalProposalAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.submitEquivocationProposalAction": + var a submitEquivocationProposalAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.submitParamChangeLegacyProposalAction": + var a submitParamChangeLegacyProposalAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.voteGovProposalAction": + var a voteGovProposalAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.startConsumerChainAction": + var a startConsumerChainAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.addChainToRelayerAction": + var a addChainToRelayerAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.addIbcConnectionAction": + var a addIbcConnectionAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.addIbcChannelAction": + var a addIbcChannelAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.transferChannelCompleteAction": + var a transferChannelCompleteAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.unjailValidatorAction": + var a unjailValidatorAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.assignConsumerPubKeyAction": + var a assignConsumerPubKeyAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.delegateTokensAction": + var a delegateTokensAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.relayPacketsAction": + var a relayPacketsAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.registerRepresentativeAction": + var a registerRepresentativeAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.relayRewardPacketsToProviderAction": + var a relayRewardPacketsToProviderAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.submitChangeRewardDenomsProposalAction": + var a submitChangeRewardDenomsProposalAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.downtimeSlashAction": + var a downtimeSlashAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.unbondTokensAction": + var a unbondTokensAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.cancelUnbondTokensAction": + var a cancelUnbondTokensAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.redelegateTokensAction": + var a redelegateTokensAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.doublesignSlashAction": + var a doublesignSlashAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.startRelayerAction": + var a startRelayerAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.slashThrottleDequeue": + var a slashThrottleDequeue + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.createIbcClientsAction": + var a createIbcClientsAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.LegacyUpgradeProposalAction": + var a LegacyUpgradeProposalAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.waitUntilBlockAction": + var a waitUntilBlockAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.ChangeoverChainAction": + var a ChangeoverChainAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.StartSovereignChainAction": + var a StartSovereignChainAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.lightClientEquivocationAttackAction": + var a lightClientEquivocationAttackAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.lightClientAmnesiaAttackAction": + var a lightClientAmnesiaAttackAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + case "main.lightClientLunaticAttackAction": + var a lightClientLunaticAttackAction + err := json.Unmarshal(rawAction, &a) + if err != nil { + return nil, err + } + return a, nil + default: + return nil, fmt.Errorf("unknown action name: %s", actionTypeString) + } +} + +// custom marshal and unmarshal functions for the chainstate that convert proposals to/from the auxiliary type with type info + +// transform the ChainState into a ChainStateWithProposalTypes by adding type info to the proposals +func (c ChainState) MarshalJSON() ([]byte, error) { + type ProposalAndType struct { + RawProposal interface{} + Type string + } + + type ChainStateWithProposalTypes struct { + ValBalances *map[ValidatorID]uint + ValPowers *map[ValidatorID]uint + RepresentativePowers *map[ValidatorID]uint + Params *[]Param + Rewards *Rewards + ConsumerChains *map[ChainID]bool + AssignedKeys *map[ValidatorID]string + ProviderKeys *map[ValidatorID]string + ConsumerChainQueueSizes *map[ChainID]uint + GlobalSlashQueueSize *uint + RegisteredConsumerRewardDenoms *[]string + Proposals *map[uint]ProposalAndType // the only thing changed from the real ChainState + } + + chainStateWithProposalTypes := ChainStateWithProposalTypes{ + ValBalances: c.ValBalances, + ValPowers: c.ValPowers, + RepresentativePowers: c.RepresentativePowers, + Params: c.Params, + Rewards: c.Rewards, + ConsumerChains: c.ConsumerChains, + AssignedKeys: c.AssignedKeys, + ProviderKeys: c.ProviderKeys, + ConsumerChainQueueSizes: c.ConsumerChainQueueSizes, + GlobalSlashQueueSize: c.GlobalSlashQueueSize, + RegisteredConsumerRewardDenoms: c.RegisteredConsumerRewardDenoms, + } + if c.Proposals != nil { + proposalsWithTypes := make(map[uint]ProposalAndType) + for k, v := range *c.Proposals { + proposalsWithTypes[k] = ProposalAndType{v, reflect.TypeOf(v).String()} + } + chainStateWithProposalTypes.Proposals = &proposalsWithTypes + } + return json.Marshal(chainStateWithProposalTypes) +} + +// unmarshal the ChainStateWithProposalTypes into a ChainState by removing the type info from the proposals and getting back standard proposals +func (c *ChainState) UnmarshalJSON(data []byte) error { + type ProposalAndType struct { + RawProposal json.RawMessage + Type string + } + + type ChainStateWithProposalTypes struct { + ValBalances *map[ValidatorID]uint + ValPowers *map[ValidatorID]uint + RepresentativePowers *map[ValidatorID]uint + Params *[]Param + Rewards *Rewards + ConsumerChains *map[ChainID]bool + AssignedKeys *map[ValidatorID]string + ProviderKeys *map[ValidatorID]string + ConsumerChainQueueSizes *map[ChainID]uint + GlobalSlashQueueSize *uint + RegisteredConsumerRewardDenoms *[]string + Proposals *map[uint]ProposalAndType // the only thing changed from the real ChainState + } + + chainStateWithProposalTypes := ChainStateWithProposalTypes{} + err := json.Unmarshal(data, &chainStateWithProposalTypes) + if err != nil { + return err + } + c.ValBalances = chainStateWithProposalTypes.ValBalances + c.ValPowers = chainStateWithProposalTypes.ValPowers + c.RepresentativePowers = chainStateWithProposalTypes.RepresentativePowers + c.Params = chainStateWithProposalTypes.Params + c.Rewards = chainStateWithProposalTypes.Rewards + c.ConsumerChains = chainStateWithProposalTypes.ConsumerChains + c.AssignedKeys = chainStateWithProposalTypes.AssignedKeys + c.ProviderKeys = chainStateWithProposalTypes.ProviderKeys + c.ConsumerChainQueueSizes = chainStateWithProposalTypes.ConsumerChainQueueSizes + c.GlobalSlashQueueSize = chainStateWithProposalTypes.GlobalSlashQueueSize + c.RegisteredConsumerRewardDenoms = chainStateWithProposalTypes.RegisteredConsumerRewardDenoms + + if chainStateWithProposalTypes.Proposals != nil { + proposals := make(map[uint]Proposal) + for k, v := range *chainStateWithProposalTypes.Proposals { + proposal, err := UnmarshalProposalWithType(v.RawProposal, v.Type) + if err != nil { + return err + } + proposals[k] = proposal + } + c.Proposals = &proposals + } + return nil +} + +// UnmarshalProposalWithType takes a JSON object and a proposal type and marshals into an object of the corresponding proposal. +func UnmarshalProposalWithType(inputMap json.RawMessage, proposalType string) (Proposal, error) { + switch proposalType { + case "main.TextProposal": + prop := TextProposal{} + err := json.Unmarshal(inputMap, &prop) + if err != nil { + return nil, err + } + return prop, nil + case "main.ConsumerAdditionProposal": + prop := ConsumerAdditionProposal{} + err := json.Unmarshal(inputMap, &prop) + if err != nil { + return nil, err + } + return prop, nil + case "main.UpgradeProposal": + prop := UpgradeProposal{} + err := json.Unmarshal(inputMap, &prop) + if err != nil { + return nil, err + } + return prop, nil + case "main.ConsumerRemovalProposal": + prop := ConsumerRemovalProposal{} + err := json.Unmarshal(inputMap, &prop) + if err != nil { + return nil, err + } + return prop, nil + case "main.EquivocationProposal": + prop := EquivocationProposal{} + err := json.Unmarshal(inputMap, &prop) + if err != nil { + return nil, err + } + return prop, nil + case "main.ParamsProposal": + prop := ParamsProposal{} + err := json.Unmarshal(inputMap, &prop) + if err != nil { + return nil, err + } + return prop, nil + default: + return nil, fmt.Errorf("%s is not a known proposal type", proposalType) + } +} diff --git a/tests/e2e/json_writer.go b/tests/e2e/json_writer.go new file mode 100644 index 0000000000..97a01a47cd --- /dev/null +++ b/tests/e2e/json_writer.go @@ -0,0 +1,30 @@ +package main + +import ( + "encoding/json" + "os" +) + +// TraceWriter is an interface for writers that write steps to files. +type TraceWriter interface { + WriteTraceToFile(filepath string, trace []Step) error +} + +// JSONWriter is a simple writer that simply marshals the array of Step objects. +// To identify which type of action is being used, we add a field to the Step struct. +type JSONWriter struct{} + +var GlobalJSONWriter = JSONWriter{} + +func (writer JSONWriter) WriteTraceToFile(filepath string, trace []Step) error { + // collect missing action types, if any. this way, we can provide a more helpful error message. + + // workaround: we would keep a set, but go doesn't have sets. + jsonobj, err := json.Marshal(trace) + if err != nil { + panic(err) + } + + err = os.WriteFile(filepath, jsonobj, 0o600) + return err +} diff --git a/tests/e2e/main.go b/tests/e2e/main.go index baf2db05da..b2d3ef8baf 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -13,6 +13,7 @@ import ( "time" "github.com/kylelemons/godebug/pretty" + "golang.org/x/exp/slices" ) // The list of test cases to be executed @@ -49,29 +50,71 @@ var ( ) var ( - testSelection TestSet - testMap map[string]*testRunWithSteps = map[string]*testRunWithSteps{ - "happy-path-short": { - testRun: DefaultTestRun(), steps: shortHappyPathSteps, - description: `This is like the happy path, but skips steps -that involve starting or stopping nodes for the same chain outside of the chain setup or teardown. -This is suited for CometMock+Gorelayer testing`, - }, - "light-client-attack": { - testRun: DefaultTestRun(), steps: lightClientAttackSteps, - description: `This is like the short happy path, but will slash validators for LightClientAttackEvidence instead of DuplicateVoteEvidence. -This is suited for CometMock+Gorelayer testing, but currently does not work with CometBFT, -since causing light client attacks is not implemented.`, - }, - "happy-path": {testRun: DefaultTestRun(), steps: happyPathSteps, description: "happy path tests"}, - "changeover": {testRun: ChangeoverTestRun(), steps: changeoverSteps, description: "changeover tests"}, - "democracy-reward": {testRun: DemocracyTestRun(true), steps: democracySteps, description: "democracy tests allowing rewards"}, - "democracy": {testRun: DemocracyTestRun(false), steps: rewardDenomConsumerSteps, description: "democracy tests"}, - "slash-throttle": {testRun: SlashThrottleTestRun(), steps: slashThrottleSteps, description: "slash throttle tests"}, - "multiconsumer": {testRun: MultiConsumerTestRun(), steps: multipleConsumers, description: "multi consumer tests"}, + selectedTests TestSet + testRuns = map[string]TestRunChoice{ + "default": {name: "default", testRun: DefaultTestRun(), description: "default test run"}, + "changeover": {name: "changeover", testRun: ChangeoverTestRun(), description: "changeover test run"}, + "democracy": {name: "democracy", testRun: DemocracyTestRun(false), description: "democracy test run"}, + "democracy-reward": {name: "democracy-reward", testRun: DemocracyTestRun(true), description: "democracy test run with rewards"}, + "slash-throttle": {name: "slash-throttle", testRun: SlashThrottleTestRun(), description: "slash throttle test run"}, + "multiconsumer": {name: "multiconsumer", testRun: MultiConsumerTestRun(), description: "multi consumer test run"}, } + // helper function to get the test run choices by matching test runs ) +var selectedTestfiles TestSet + +var stepChoices = map[string]StepChoice{ + "happy-path-short": { + name: "happy-path-short", + steps: shortHappyPathSteps, + description: `This is like the happy path, but skips steps that involve starting or stopping nodes for the same chain outside of the chain setup or teardown. This is suited for CometMock+Gorelayer testing`, + testRuns: []string{"default"}, + }, + "light-client-attack": { + name: "light-client-attack", + steps: lightClientAttackSteps, + description: `This is like the short happy path, but will slash validators for LightClientAttackEvidence instead of DuplicateVoteEvidence. This is suited for CometMock+Gorelayer testing, but currently does not work with CometBFT, since causing light client attacks is not implemented`, + testRuns: []string{"default"}, + }, + "happy-path": { + name: "happy-path", + steps: happyPathSteps, + description: "happy path tests", + testRuns: []string{"default"}, + }, + "changeover": { + name: "changeover", + steps: changeoverSteps, + description: "changeover tests", + testRuns: []string{"changeover"}, + }, + "democracy-reward": { + name: "democracy-reward", + steps: democracyRewardsSteps, + description: "democracy tests allowing rewards", + testRuns: []string{"democracy-reward"}, + }, + "democracy": { + name: "democracy", + steps: democracySteps, + description: "democracy tests", + testRuns: []string{"democracy"}, + }, + "slash-throttle": { + name: "slash-throttle", + steps: slashThrottleSteps, + description: "slash throttle tests", + testRuns: []string{"slash-throttle"}, + }, + "multiconsumer": { + name: "multiconsumer", + steps: multipleConsumers, + description: "multi consumer tests", + testRuns: []string{"multiconsumer"}, + }, +} + func executeTests(tests []testRunWithSteps) (err error) { if parallel != nil && *parallel { fmt.Println("=============== running all tests in parallel ===============") @@ -97,57 +140,147 @@ func executeTests(tests []testRunWithSteps) (err error) { return } +func getTestCaseUsageString() string { + var builder strings.Builder + + // Test case selection + builder.WriteString("This flag is used to reference existing, defined test cases to be run.") + builder.WriteString("Test case selection:\nSelection of test steps to be executed:\n") + for _, stepChoice := range stepChoices { + builder.WriteString(fmt.Sprintf("- %s : %s. Compatible with test runners: %s\n", stepChoice.name, stepChoice.description, strings.Join(stepChoice.testRuns, ","))) + } + builder.WriteString("\n") + + // Test runner selection + builder.WriteString("Test runner selection:\nSelection of test runners to be executed:\n") + for _, testRunChoice := range testRuns { + builder.WriteString(fmt.Sprintf("- %s : %s\n", testRunChoice.name, testRunChoice.description)) + } + builder.WriteString("\n") + + // Example + builder.WriteString("Example: -tc multiconsumer::multiconsumer -tc happy-path::default") + + return builder.String() +} + +func getTestFileUsageString() string { + var builder strings.Builder + + builder.WriteString("This flag is used to reference files containing step traces to be run.\n") + builder.WriteString("Each filename should be separated by '::' from the test runner name.\n") + + // Test runner selection + builder.WriteString("Test runner selection:\nSelection of test runners to be executed:\n") + for _, testRunChoice := range testRuns { + builder.WriteString(fmt.Sprintf("- %s : %s\n", testRunChoice.name, testRunChoice.description)) + } + builder.WriteString("\n") + + // Example + builder.WriteString("Example: -test-file awesome-trace.json::default -test-file other-trace.json::default") + + return builder.String() +} + func parseArguments() (err error) { - flag.Var(&testSelection, "tc", - fmt.Sprintf("Selection of test cases to be executed:\n%s,\n%s", - func() string { - var keys []string - for k, v := range testMap { - keys = append(keys, fmt.Sprintf("- %s : %s", k, v.description)) - } - return strings.Join(keys, "\n") - }(), - "Example: -tc multiconsumer -tc happy-path ")) + flag.Var(&selectedTests, "tc", + getTestCaseUsageString()) + + flag.Var(&selectedTestfiles, "test-file", + getTestFileUsageString()) flag.Parse() // Enforce go-relayer in case of cometmock as hermes is not yet supported if useCometmock != nil && *useCometmock && (useGorelayer == nil || !*useGorelayer) { fmt.Println("Enforcing go-relayer as cometmock is requested") if err = flag.Set("use-gorelayer", "true"); err != nil { - return - } - } - // check if specified test case exists - for _, tc := range testSelection { - if _, hasKey := testMap[tc]; !hasKey { - err := fmt.Errorf("unknown test case '%s'", tc) return err } } - return + return nil } -func getTestCases(selection TestSet) (tests []testRunWithSteps) { +type testRunWithSteps struct { + testRun TestRun + steps []Step +} + +func getTestCases(selectedPredefinedTests, selectedTestFiles TestSet) (tests []testRunWithSteps) { // Run default tests if no test cases were selected - if len(selection) == 0 { - selection = TestSet{ - "changeover", "happy-path", - "democracy-reward", "democracy", "slash-throttle", + if len(selectedPredefinedTests) == 0 && len(selectedTestFiles) == 0 { + selectedPredefinedTests = TestSet{ + "changeover::changeover", "happy-path::default", + "democracy-reward::democracy-reward", "democracy::democracy", "slash-throttle::slash-throttle", } if includeMultiConsumer != nil && *includeMultiConsumer { - selection = append(selection, "multiconsumer") + selectedPredefinedTests = append(selectedPredefinedTests, "multiconsumer::multiconsumer") } } - // Get tests from selection tests = []testRunWithSteps{} - for _, tc := range selection { - if _, exists := testMap[tc]; !exists { - log.Fatalf("Test case '%s' not found", tc) + // Get predefined from selection + for _, tc := range selectedPredefinedTests { + // first part of tc is the steps, second part is the test runner + splitTcString := strings.Split(tc, "::") + if len(splitTcString) != 2 { + log.Fatalf("Test case '%s' is invalid.\nsee usage info:\n%s", tc, getTestCaseUsageString()) } - tests = append(tests, *testMap[tc]) + stepsName := splitTcString[0] + testRunnerName := splitTcString[1] + + if _, exists := stepChoices[stepsName]; !exists { + log.Fatalf("Step choice '%s' not found.\nsee usage info:\n%s", tc, getTestCaseUsageString()) + } + + stepChoice := stepChoices[stepsName] + + if _, exists := testRuns[testRunnerName]; !exists { + log.Fatalf("Test runner '%s' not found.\nsee usage info:\n%s", testRunnerName, getTestCaseUsageString()) + } + + testRunChoice := testRuns[testRunnerName] + + if !slices.Contains(stepChoice.testRuns, testRunChoice.name) { + log.Fatalf("Step choice '%s' is not compatible with test runner '%s'. compatible test runs: %s", stepsName, testRunnerName, strings.Join(stepChoice.testRuns, ",")) + } + + tests = append(tests, testRunWithSteps{ + testRun: testRunChoice.testRun, + steps: stepChoice.steps, + }, + ) } - return + + // get test cases from files + for _, testFile := range selectedTestFiles { + // first part is the file, second part is the test runner + splitTcString := strings.Split(testFile, "::") + if len(splitTcString) != 2 { + log.Fatalf("Test file '%s' is invalid.\nsee usage info:\n%s", testFile, getTestFileUsageString()) + } + + testFileName := splitTcString[0] + testRunnerName := splitTcString[1] + + if _, exists := testRuns[testRunnerName]; !exists { + log.Fatalf("Test runner '%s' not found.\nsee usage info:\n%s", testRunnerName, getTestFileUsageString()) + } + + testRunChoice := testRuns[testRunnerName] + + testCase, err := GlobalJSONParser.ReadTraceFromFile(testFileName) + if err != nil { + log.Fatalf("Error reading test file '%s': %s", testFileName, err) + } + + tests = append(tests, testRunWithSteps{ + testRun: testRunChoice.testRun, + steps: testCase, + }) + } + + return tests } // runs E2E tests @@ -159,7 +292,7 @@ func main() { log.Fatalf("Error parsing command arguments %s\n", err) } - testCases := getTestCases(testSelection) + testCases := getTestCases(selectedTests, selectedTestfiles) start := time.Now() err := executeTests(testCases) @@ -182,14 +315,22 @@ func (tr *TestRun) Run(steps []Step, localSdkPath string, useGaia bool, gaiaTag tr.teardownDocker() } -type testRunWithSteps struct { - testRun TestRun +type StepChoice struct { + name string steps []Step description string + // contains the names of the test runs that are compatible with this step choice + testRuns []string +} + +type TestRunChoice struct { + name string + testRun TestRun + description string } func (tr *TestRun) runStep(step Step, verbose bool) { - switch action := step.action.(type) { + switch action := step.Action.(type) { case StartChainAction: tr.startChain(action, verbose) case StartSovereignChainAction: @@ -264,13 +405,13 @@ func (tr *TestRun) runStep(step Step, verbose bool) { log.Fatalf("unknown action in testRun %s: %#v", tr.name, action) } - modelState := step.state - actualState := tr.getState(step.state) + modelState := step.State + actualState := tr.getState(step.State) // Check state if !reflect.DeepEqual(actualState, modelState) { fmt.Printf("=============== %s FAILED ===============\n", tr.name) - fmt.Println("FAILED action", reflect.TypeOf(step.action).Name()) + fmt.Println("FAILED action", reflect.TypeOf(step.Action).Name()) pretty.Print("actual state", actualState) pretty.Print("model state", modelState) log.Fatal(`actual state (-) not equal to model state (+): ` + pretty.Compare(actualState, modelState)) @@ -285,7 +426,7 @@ func (tr *TestRun) executeSteps(steps []Step) { for i, step := range steps { // print something the show the test is alive fmt.Printf("running %s: step %d == %s \n", - tr.name, i+1, reflect.TypeOf(step.action).Name()) + tr.name, i+1, reflect.TypeOf(step.Action).Name()) tr.runStep(step, *verbose) } @@ -315,8 +456,8 @@ func (tr *TestRun) startDocker() { } scriptStr := fmt.Sprintf( "tests/e2e/testnet-scripts/start-docker.sh %s %s %s %s %s", - tr.containerConfig.containerName, - tr.containerConfig.instanceName, + tr.containerConfig.ContainerName, + tr.containerConfig.InstanceName, localSdk, useGaia, gaiaTag, @@ -359,7 +500,7 @@ func (tr *TestRun) startDocker() { func (tr *TestRun) teardownDocker() { fmt.Printf("=============== tearing down %s testRun ===============\n", tr.name) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "kill", tr.containerConfig.instanceName) + cmd := exec.Command("docker", "kill", tr.containerConfig.InstanceName) bz, err := cmd.CombinedOutput() if err != nil { diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 8cc343ef00..f6beb3445c 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -14,19 +14,19 @@ import ( "gopkg.in/yaml.v2" ) -type State map[chainID]ChainState +type State map[ChainID]ChainState type ChainState struct { - ValBalances *map[validatorID]uint + ValBalances *map[ValidatorID]uint Proposals *map[uint]Proposal - ValPowers *map[validatorID]uint - RepresentativePowers *map[validatorID]uint + ValPowers *map[ValidatorID]uint + RepresentativePowers *map[ValidatorID]uint Params *[]Param Rewards *Rewards - ConsumerChains *map[chainID]bool - AssignedKeys *map[validatorID]string - ProviderKeys *map[validatorID]string // validatorID: validator provider key - ConsumerChainQueueSizes *map[chainID]uint + ConsumerChains *map[ChainID]bool + AssignedKeys *map[ValidatorID]string + ProviderKeys *map[ValidatorID]string // validatorID: validator provider key + ConsumerChainQueueSizes *map[ChainID]uint GlobalSlashQueueSize *uint RegisteredConsumerRewardDenoms *[]string } @@ -45,7 +45,7 @@ func (p TextProposal) isProposal() {} type ConsumerAdditionProposal struct { Deposit uint - Chain chainID + Chain ChainID SpawnTime int InitialHeight clienttypes.Height Status string @@ -66,7 +66,7 @@ func (p ConsumerAdditionProposal) isProposal() {} type ConsumerRemovalProposal struct { Deposit uint - Chain chainID + Chain ChainID StopTime int Status string } @@ -84,7 +84,7 @@ type EquivocationProposal struct { func (p EquivocationProposal) isProposal() {} type Rewards struct { - IsRewarded map[validatorID]bool + IsRewarded map[ValidatorID]bool // if true it will calculate if the validator/delegator is rewarded between 2 successive blocks, // otherwise it will calculate if it received any rewards since the 1st block IsIncrementalReward bool @@ -119,7 +119,7 @@ func (tr TestRun) getState(modelState State) State { return systemState } -func (tr TestRun) getChainState(chain chainID, modelState ChainState) ChainState { +func (tr TestRun) getChainState(chain ChainID, modelState ChainState) ChainState { chainState := ChainState{} if modelState.ValBalances != nil { @@ -174,7 +174,7 @@ func (tr TestRun) getChainState(chain chainID, modelState ChainState) ChainState } if modelState.ConsumerChainQueueSizes != nil { - consumerChainQueueSizes := map[chainID]uint{} + consumerChainQueueSizes := map[ChainID]uint{} for c := range *modelState.ConsumerChainQueueSizes { consumerChainQueueSizes[c] = tr.getConsumerChainPacketQueueSize(c) } @@ -195,9 +195,9 @@ func (tr TestRun) getChainState(chain chainID, modelState ChainState) ChainState var blockHeightRegex = regexp.MustCompile(`block_height: "(\d+)"`) -func (tr TestRun) getBlockHeight(chain chainID) uint { +func (tr TestRun) getBlockHeight(chain ChainID) uint { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chain].binaryName, + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, "query", "tendermint-validator-set", @@ -215,7 +215,7 @@ func (tr TestRun) getBlockHeight(chain chainID) uint { return uint(blockHeight) } -func (tr TestRun) waitBlocks(chain chainID, blocks uint, timeout time.Duration) { +func (tr TestRun) waitBlocks(chain ChainID, blocks uint, timeout time.Duration) { if tr.useCometmock { // call advance_blocks method on cometmock // curl -H 'Content-Type: application/json' -H 'Accept:application/json' --data '{"jsonrpc":"2.0","method":"advance_blocks","params":{"num_blocks": "36000000"},"id":1}' 127.0.0.1:22331 @@ -241,7 +241,7 @@ func (tr TestRun) waitBlocks(chain chainID, blocks uint, timeout time.Duration) } } -func (tr TestRun) waitUntilBlock(chain chainID, block uint, timeout time.Duration) { +func (tr TestRun) waitUntilBlock(chain ChainID, block uint, timeout time.Duration) { start := time.Now() for { thisBlock := tr.getBlockHeight(chain) @@ -255,8 +255,8 @@ func (tr TestRun) waitUntilBlock(chain chainID, block uint, timeout time.Duratio } } -func (tr TestRun) getBalances(chain chainID, modelState map[validatorID]uint) map[validatorID]uint { - actualState := map[validatorID]uint{} +func (tr TestRun) getBalances(chain ChainID, modelState map[ValidatorID]uint) map[ValidatorID]uint { + actualState := map[ValidatorID]uint{} for k := range modelState { actualState[k] = tr.getBalance(chain, k) } @@ -264,7 +264,7 @@ func (tr TestRun) getBalances(chain chainID, modelState map[validatorID]uint) ma return actualState } -func (tr TestRun) getProposals(chain chainID, modelState map[uint]Proposal) map[uint]Proposal { +func (tr TestRun) getProposals(chain ChainID, modelState map[uint]Proposal) map[uint]Proposal { actualState := map[uint]Proposal{} for k := range modelState { actualState[k] = tr.getProposal(chain, k) @@ -273,8 +273,8 @@ func (tr TestRun) getProposals(chain chainID, modelState map[uint]Proposal) map[ return actualState } -func (tr TestRun) getValPowers(chain chainID, modelState map[validatorID]uint) map[validatorID]uint { - actualState := map[validatorID]uint{} +func (tr TestRun) getValPowers(chain ChainID, modelState map[ValidatorID]uint) map[ValidatorID]uint { + actualState := map[ValidatorID]uint{} for k := range modelState { actualState[k] = tr.getValPower(chain, k) } @@ -282,8 +282,8 @@ func (tr TestRun) getValPowers(chain chainID, modelState map[validatorID]uint) m return actualState } -func (tr TestRun) getRepresentativePowers(chain chainID, modelState map[validatorID]uint) map[validatorID]uint { - actualState := map[validatorID]uint{} +func (tr TestRun) getRepresentativePowers(chain ChainID, modelState map[ValidatorID]uint) map[ValidatorID]uint { + actualState := map[ValidatorID]uint{} for k := range modelState { actualState[k] = tr.getRepresentativePower(chain, k) } @@ -291,7 +291,7 @@ func (tr TestRun) getRepresentativePowers(chain chainID, modelState map[validato return actualState } -func (tr TestRun) getParams(chain chainID, modelState []Param) []Param { +func (tr TestRun) getParams(chain ChainID, modelState []Param) []Param { actualState := []Param{} for _, p := range modelState { actualState = append(actualState, Param{Subspace: p.Subspace, Key: p.Key, Value: tr.getParam(chain, p)}) @@ -300,8 +300,8 @@ func (tr TestRun) getParams(chain chainID, modelState []Param) []Param { return actualState } -func (tr TestRun) getRewards(chain chainID, modelState Rewards) Rewards { - receivedRewards := map[validatorID]bool{} +func (tr TestRun) getRewards(chain ChainID, modelState Rewards) Rewards { + receivedRewards := map[ValidatorID]bool{} currentBlock := tr.getBlockHeight(chain) tr.waitBlocks(chain, 1, 10*time.Second) @@ -318,13 +318,13 @@ func (tr TestRun) getRewards(chain chainID, modelState Rewards) Rewards { return Rewards{IsRewarded: receivedRewards, IsIncrementalReward: modelState.IsIncrementalReward, IsNativeDenom: modelState.IsNativeDenom} } -func (tr TestRun) getReward(chain chainID, validator validatorID, blockHeight uint, isNativeDenom bool) float64 { - delAddresss := tr.validatorConfigs[validator].delAddress - if chain != chainID("provi") && tr.validatorConfigs[validator].useConsumerKey { - delAddresss = tr.validatorConfigs[validator].consumerDelAddress +func (tr TestRun) getReward(chain ChainID, validator ValidatorID, blockHeight uint, isNativeDenom bool) float64 { + delAddresss := tr.validatorConfigs[validator].DelAddress + if chain != ChainID("provi") && tr.validatorConfigs[validator].UseConsumerKey { + delAddresss = tr.validatorConfigs[validator].ConsumerDelAddress } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chain].binaryName, + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, "query", "distribution", "rewards", delAddresss, @@ -345,15 +345,15 @@ func (tr TestRun) getReward(chain chainID, validator validatorID, blockHeight ui return gjson.Get(string(bz), denomCondition).Float() } -func (tr TestRun) getBalance(chain chainID, validator validatorID) uint { +func (tr TestRun) getBalance(chain ChainID, validator ValidatorID) uint { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - valDelAddress := tr.validatorConfigs[validator].delAddress - if chain != chainID("provi") && tr.validatorConfigs[validator].useConsumerKey { - valDelAddress = tr.validatorConfigs[validator].consumerDelAddress + valDelAddress := tr.validatorConfigs[validator].DelAddress + if chain != ChainID("provi") && tr.validatorConfigs[validator].UseConsumerKey { + valDelAddress = tr.validatorConfigs[validator].ConsumerDelAddress } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chain].binaryName, + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, "query", "bank", "balances", valDelAddress, @@ -373,9 +373,9 @@ func (tr TestRun) getBalance(chain chainID, validator validatorID) uint { var noProposalRegex = regexp.MustCompile(`doesn't exist: key not found`) // interchain-securityd query gov proposals -func (tr TestRun) getProposal(chain chainID, proposal uint) Proposal { +func (tr TestRun) getProposal(chain ChainID, proposal uint) Proposal { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chain].binaryName, + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, "query", "gov", "proposal", fmt.Sprint(proposal), @@ -411,11 +411,11 @@ func (tr TestRun) getProposal(chain chainID, proposal uint) Proposal { } case "/interchain_security.ccv.provider.v1.ConsumerAdditionProposal": chainId := gjson.Get(string(bz), `messages.0.content.chain_id`).String() - spawnTime := gjson.Get(string(bz), `messages.0.content.spawn_time`).Time().Sub(tr.containerConfig.now) + spawnTime := gjson.Get(string(bz), `messages.0.content.spawn_time`).Time().Sub(tr.containerConfig.Now) - var chain chainID + var chain ChainID for i, conf := range tr.chainConfigs { - if string(conf.chainId) == chainId { + if string(conf.ChainId) == chainId { chain = i break } @@ -443,11 +443,11 @@ func (tr TestRun) getProposal(chain chainID, proposal uint) Proposal { } case "/interchain_security.ccv.provider.v1.ConsumerRemovalProposal": chainId := gjson.Get(string(bz), `messages.0.content.chain_id`).String() - stopTime := gjson.Get(string(bz), `messages.0.content.stop_time`).Time().Sub(tr.containerConfig.now) + stopTime := gjson.Get(string(bz), `messages.0.content.stop_time`).Time().Sub(tr.containerConfig.Now) - var chain chainID + var chain ChainID for i, conf := range tr.chainConfigs { - if string(conf.chainId) == chainId { + if string(conf.ChainId) == chainId { chain = i break } @@ -497,12 +497,12 @@ type ValPubKey struct { Value string `yaml:"value"` } -func (tr TestRun) getValPower(chain chainID, validator validatorID) uint { +func (tr TestRun) getValPower(chain ChainID, validator ValidatorID) uint { if *verbose { log.Println("getting validator power for chain: ", chain, " validator: ", validator) } //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - command := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chain].binaryName, + command := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, "query", "tendermint-validator-set", @@ -531,8 +531,8 @@ func (tr TestRun) getValPower(chain chainID, validator validatorID) uint { } for _, val := range valset.Validators { - if val.Address == tr.validatorConfigs[validator].valconsAddress || - val.Address == tr.validatorConfigs[validator].consumerValconsAddress { + if val.Address == tr.validatorConfigs[validator].ValconsAddress || + val.Address == tr.validatorConfigs[validator].ConsumerValconsAddress { votingPower, err := strconv.Atoi(val.VotingPower) if err != nil { @@ -547,12 +547,12 @@ func (tr TestRun) getValPower(chain chainID, validator validatorID) uint { return 0 } -func (tr TestRun) getRepresentativePower(chain chainID, validator validatorID) uint { +func (tr TestRun) getRepresentativePower(chain ChainID, validator ValidatorID) uint { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chain].binaryName, + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, "query", "staking", "validator", - tr.validatorConfigs[validator].valoperAddress, + tr.validatorConfigs[validator].ValoperAddress, `--node`, tr.getQueryNode(chain), `-o`, `json`, @@ -566,9 +566,9 @@ func (tr TestRun) getRepresentativePower(chain chainID, validator validatorID) u return uint(amount.Uint()) } -func (tr TestRun) getParam(chain chainID, param Param) string { +func (tr TestRun) getParam(chain ChainID, param Param) string { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chain].binaryName, + bz, err := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, "query", "params", "subspace", param.Subspace, @@ -588,9 +588,9 @@ func (tr TestRun) getParam(chain chainID, param Param) string { // getConsumerChains returns a list of consumer chains that're being secured by the provider chain, // determined by querying the provider chain. -func (tr TestRun) getConsumerChains(chain chainID) map[chainID]bool { +func (tr TestRun) getConsumerChains(chain ChainID) map[ChainID]bool { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chain].binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, "query", "provider", "list-consumer-chains", `--node`, tr.getQueryNode(chain), @@ -603,17 +603,17 @@ func (tr TestRun) getConsumerChains(chain chainID) map[chainID]bool { } arr := gjson.Get(string(bz), "chains").Array() - chains := make(map[chainID]bool) + chains := make(map[ChainID]bool) for _, c := range arr { id := c.Get("chain_id").String() - chains[chainID(id)] = true + chains[ChainID(id)] = true } return chains } -func (tr TestRun) getConsumerAddresses(chain chainID, modelState map[validatorID]string) map[validatorID]string { - actualState := map[validatorID]string{} +func (tr TestRun) getConsumerAddresses(chain ChainID, modelState map[ValidatorID]string) map[ValidatorID]string { + actualState := map[ValidatorID]string{} for k := range modelState { actualState[k] = tr.getConsumerAddress(chain, k) } @@ -621,8 +621,8 @@ func (tr TestRun) getConsumerAddresses(chain chainID, modelState map[validatorID return actualState } -func (tr TestRun) getProviderAddresses(chain chainID, modelState map[validatorID]string) map[validatorID]string { - actualState := map[validatorID]string{} +func (tr TestRun) getProviderAddresses(chain ChainID, modelState map[ValidatorID]string) map[ValidatorID]string { + actualState := map[ValidatorID]string{} for k := range modelState { actualState[k] = tr.getProviderAddressFromConsumer(chain, k) } @@ -630,13 +630,13 @@ func (tr TestRun) getProviderAddresses(chain chainID, modelState map[validatorID return actualState } -func (tr TestRun) getConsumerAddress(consumerChain chainID, validator validatorID) string { +func (tr TestRun) getConsumerAddress(consumerChain ChainID, validator ValidatorID) string { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chainID("provi")].binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[ChainID("provi")].BinaryName, "query", "provider", "validator-consumer-key", - string(consumerChain), tr.validatorConfigs[validator].valconsAddress, - `--node`, tr.getQueryNode(chainID("provi")), + string(consumerChain), tr.validatorConfigs[validator].ValconsAddress, + `--node`, tr.getQueryNode(ChainID("provi")), `-o`, `json`, ) bz, err := cmd.CombinedOutput() @@ -648,13 +648,13 @@ func (tr TestRun) getConsumerAddress(consumerChain chainID, validator validatorI return addr } -func (tr TestRun) getProviderAddressFromConsumer(consumerChain chainID, validator validatorID) string { +func (tr TestRun) getProviderAddressFromConsumer(consumerChain ChainID, validator ValidatorID) string { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chainID("provi")].binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[ChainID("provi")].BinaryName, "query", "provider", "validator-provider-key", - string(consumerChain), tr.validatorConfigs[validator].consumerValconsAddress, - `--node`, tr.getQueryNode(chainID("provi")), + string(consumerChain), tr.validatorConfigs[validator].ConsumerValconsAddress, + `--node`, tr.getQueryNode(ChainID("provi")), `-o`, `json`, ) @@ -669,10 +669,10 @@ func (tr TestRun) getProviderAddressFromConsumer(consumerChain chainID, validato func (tr TestRun) getGlobalSlashQueueSize() uint { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chainID("provi")].binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[ChainID("provi")].BinaryName, "query", "provider", "throttle-state", - `--node`, tr.getQueryNode(chainID("provi")), + `--node`, tr.getQueryNode(ChainID("provi")), `-o`, `json`, ) bz, err := cmd.CombinedOutput() @@ -684,13 +684,13 @@ func (tr TestRun) getGlobalSlashQueueSize() uint { return uint(len(packets)) } -func (tr TestRun) getConsumerChainPacketQueueSize(consumerChain chainID) uint { +func (tr TestRun) getConsumerChainPacketQueueSize(consumerChain ChainID) uint { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chainID("provi")].binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[ChainID("provi")].BinaryName, "query", "provider", "throttled-consumer-packet-data", string(consumerChain), - `--node`, tr.getQueryNode(chainID("provi")), + `--node`, tr.getQueryNode(ChainID("provi")), `-o`, `json`, ) bz, err := cmd.CombinedOutput() @@ -702,9 +702,9 @@ func (tr TestRun) getConsumerChainPacketQueueSize(consumerChain chainID) uint { return uint(size) } -func (tr TestRun) getRegisteredConsumerRewardDenoms(chain chainID) []string { +func (tr TestRun) getRegisteredConsumerRewardDenoms(chain ChainID) []string { //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chain].binaryName, + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[chain].BinaryName, "query", "provider", "registered-consumer-reward-denoms", `--node`, tr.getQueryNode(chain), @@ -724,7 +724,7 @@ func (tr TestRun) getRegisteredConsumerRewardDenoms(chain chainID) []string { return rewardDenoms } -func (tr TestRun) getValidatorNode(chain chainID, validator validatorID) string { +func (tr TestRun) getValidatorNode(chain ChainID, validator ValidatorID) string { // for CometMock, validatorNodes are all the same address as the query node (which is CometMocks address) if tr.useCometmock { return tr.getQueryNode(chain) @@ -733,41 +733,41 @@ func (tr TestRun) getValidatorNode(chain chainID, validator validatorID) string return "tcp://" + tr.getValidatorIP(chain, validator) + ":26658" } -func (tr TestRun) getValidatorIP(chain chainID, validator validatorID) string { - return tr.chainConfigs[chain].ipPrefix + "." + tr.validatorConfigs[validator].ipSuffix +func (tr TestRun) getValidatorIP(chain ChainID, validator ValidatorID) string { + return tr.chainConfigs[chain].IpPrefix + "." + tr.validatorConfigs[validator].IpSuffix } -func (tr TestRun) getValidatorHome(chain chainID, validator validatorID) string { - return `/` + string(tr.chainConfigs[chain].chainId) + `/validator` + fmt.Sprint(validator) +func (tr TestRun) getValidatorHome(chain ChainID, validator ValidatorID) string { + return `/` + string(tr.chainConfigs[chain].ChainId) + `/validator` + fmt.Sprint(validator) } // getQueryNode returns query node tcp address on chain. -func (tr TestRun) getQueryNode(chain chainID) string { +func (tr TestRun) getQueryNode(chain ChainID) string { return fmt.Sprintf("tcp://%s", tr.getQueryNodeRPCAddress(chain)) } -func (tr TestRun) getQueryNodeRPCAddress(chain chainID) string { +func (tr TestRun) getQueryNodeRPCAddress(chain ChainID) string { return fmt.Sprintf("%s:26658", tr.getQueryNodeIP(chain)) } // getQueryNodeIP returns query node IP for chain, // ipSuffix is hardcoded to be 253 on all query nodes // except for "sover" chain where there's only one node -func (tr TestRun) getQueryNodeIP(chain chainID) string { - if chain == chainID("sover") { +func (tr TestRun) getQueryNodeIP(chain ChainID) string { + if chain == ChainID("sover") { // return address of first and only validator return fmt.Sprintf("%s.%s", - tr.chainConfigs[chain].ipPrefix, - tr.validatorConfigs[validatorID("alice")].ipSuffix) + tr.chainConfigs[chain].IpPrefix, + tr.validatorConfigs[ValidatorID("alice")].IpSuffix) } - return fmt.Sprintf("%s.253", tr.chainConfigs[chain].ipPrefix) + return fmt.Sprintf("%s.253", tr.chainConfigs[chain].IpPrefix) } func (tr TestRun) curlJsonRPCRequest(method, params, address string) { cmd_template := `curl -H 'Content-Type: application/json' -H 'Accept:application/json' --data '{"jsonrpc":"2.0","method":"%s","params":%s,"id":1}' %s` //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. - cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, "bash", "-c", fmt.Sprintf(cmd_template, method, params, address)) + cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, "bash", "-c", fmt.Sprintf(cmd_template, method, params, address)) verbosity := false executeCommandWithVerbosity(cmd, "curlJsonRPCRequest", verbosity) diff --git a/tests/e2e/state_rapid_test.go b/tests/e2e/state_rapid_test.go new file mode 100644 index 0000000000..d8bb33c121 --- /dev/null +++ b/tests/e2e/state_rapid_test.go @@ -0,0 +1,232 @@ +package main + +import ( + "testing" + + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + "pgregory.net/rapid" +) + +func TestChainStateMarshalling(t *testing.T) { + rapid.Check(t, func(t *rapid.T) { + chainState := GetChainStateGen().Draw(t, "ChainState") + err := MarshalAndUnmarshalChainState(chainState) + if err != nil { + t.Fatalf("error marshalling and unmarshalling chain state: %v", err) + } + }) +} + +func GetStateGen() *rapid.Generator[State] { + return rapid.Custom(func(t *rapid.T) State { + return rapid.MapOf(GetChainIDGen(), GetChainStateGen()).Draw(t, "State") + }) +} + +func GetChainStateGen() *rapid.Generator[ChainState] { + return rapid.Custom( + func(t *rapid.T) ChainState { + valBalances := GetValBalancesGen().Draw(t, "ValBalances") + proposals := GetProposalsGen().Draw(t, "Proposals") + valPowers := GetValPowersGen().Draw(t, "ValPowers") + representativePowers := GetRepresentativePowersGen().Draw(t, "RepresentativePowers") + params := GetParamsGen().Draw(t, "Params") + rewards := GetRewardsGen().Draw(t, "Rewards") + consumerChains := GetConsumerChainsGen().Draw(t, "ConsumerChains") + assignedKeys := GetAssignedKeysGen().Draw(t, "AssignedKeys") + providerKeys := GetProviderKeysGen().Draw(t, "ProviderKeys") + consumerChainQueueSizes := GetConsumerChainQueueSizesGen().Draw(t, "ConsumerChainQueueSizes") + globalSlashQueueSize := rapid.Uint().Draw(t, "GlobalSlashQueueSize") + + return ChainState{ + ValBalances: &valBalances, + Proposals: &proposals, + ValPowers: &valPowers, + RepresentativePowers: &representativePowers, + Params: ¶ms, + Rewards: &rewards, + ConsumerChains: &consumerChains, + AssignedKeys: &assignedKeys, + ProviderKeys: &providerKeys, + ConsumerChainQueueSizes: &consumerChainQueueSizes, + GlobalSlashQueueSize: &globalSlashQueueSize, + } + }) +} + +func GetConsumerChainQueueSizesGen() *rapid.Generator[map[ChainID]uint] { + return rapid.Custom(func(t *rapid.T) map[ChainID]uint { + return rapid.MapOf(GetChainIDGen(), rapid.Uint()).Draw(t, "ConsumerChainQueueSizes") + }) +} + +func GetProviderKeysGen() *rapid.Generator[map[ValidatorID]string] { + return rapid.Custom(func(t *rapid.T) map[ValidatorID]string { + return rapid.MapOf(GetValidatorIDGen(), rapid.String()).Draw(t, "ProviderKeys") + }) +} + +func GetAssignedKeysGen() *rapid.Generator[map[ValidatorID]string] { + return rapid.Custom(func(t *rapid.T) map[ValidatorID]string { + return rapid.MapOf(GetValidatorIDGen(), rapid.String()).Draw(t, "AssignedKeys") + }) +} + +func GetChainIDGen() *rapid.Generator[ChainID] { + return rapid.Custom(func(t *rapid.T) ChainID { + return ChainID(rapid.String().Draw(t, "ChainID")) + }) +} + +func GetConsumerChainsGen() *rapid.Generator[map[ChainID]bool] { + return rapid.Custom(func(t *rapid.T) map[ChainID]bool { + return rapid.MapOf(GetChainIDGen(), rapid.Bool()).Draw(t, "ConsumerChains") + }) +} + +func GetRewardsGen() *rapid.Generator[Rewards] { + return rapid.Custom(func(t *rapid.T) Rewards { + return Rewards{ + IsIncrementalReward: rapid.Bool().Draw(t, "IsIncrementalReward"), + IsNativeDenom: rapid.Bool().Draw(t, "IsNativeDenom"), + IsRewarded: rapid.MapOf(GetValidatorIDGen(), rapid.Bool()).Draw(t, "IsRewarded"), + } + }) +} + +func GetParamsGen() *rapid.Generator[[]Param] { + return rapid.Custom(func(t *rapid.T) []Param { + return rapid.SliceOf(GetParamGen()).Draw(t, "Params") + }) +} + +func GetParamGen() *rapid.Generator[Param] { + return rapid.Custom(func(t *rapid.T) Param { + return Param{ + Key: rapid.String().Draw(t, "Key"), + Value: rapid.String().Draw(t, "Value"), + } + }) +} + +func GetRepresentativePowersGen() *rapid.Generator[map[ValidatorID]uint] { + return rapid.Custom(func(t *rapid.T) map[ValidatorID]uint { + return rapid.MapOf( + GetValidatorIDGen(), + rapid.Uint(), + ).Draw(t, "RepresentativePowers") + }) +} + +func GetValPowersGen() *rapid.Generator[map[ValidatorID]uint] { + return rapid.Custom(func(t *rapid.T) map[ValidatorID]uint { + return rapid.MapOf( + GetValidatorIDGen(), + rapid.Uint(), + ).Draw(t, "ValPowers") + }) +} + +func GetValBalancesGen() *rapid.Generator[map[ValidatorID]uint] { + return rapid.Custom(func(t *rapid.T) map[ValidatorID]uint { + return rapid.MapOf( + GetValidatorIDGen(), + rapid.Uint(), + ).Draw(t, "ValBalances") + }) +} + +func GetValidatorIDGen() *rapid.Generator[ValidatorID] { + return rapid.Custom(func(t *rapid.T) ValidatorID { + return ValidatorID(rapid.String().Draw(t, "ValidatorID")) + }) +} + +func GetProposalsGen() *rapid.Generator[map[uint]Proposal] { + return rapid.Custom(func(t *rapid.T) map[uint]Proposal { + return rapid.MapOf( + rapid.Uint(), + GetProposalGen(), + ).Draw(t, "Proposals") + }) +} + +func GetProposalGen() *rapid.Generator[Proposal] { + return rapid.Custom(func(t *rapid.T) Proposal { + gen := rapid.OneOf( + GetConsumerAdditionProposalGen().AsAny(), + GetConsumerRemovalProposalGen().AsAny(), + GetEquivocationProposalGen().AsAny(), + GetTextProposalGen().AsAny(), + GetParamsProposalGen().AsAny(), + ) + return gen.Draw(t, "Proposal").(Proposal) + }) +} + +func GetConsumerAdditionProposalGen() *rapid.Generator[ConsumerAdditionProposal] { + return rapid.Custom(func(t *rapid.T) ConsumerAdditionProposal { + return ConsumerAdditionProposal{ + Deposit: rapid.Uint().Draw(t, "Deposit"), + Chain: GetChainIDGen().Draw(t, "Chain"), + SpawnTime: rapid.Int().Draw(t, "SpawnTime"), + InitialHeight: GetHeightGen().Draw(t, "InitialHeight"), + Status: rapid.String().Draw(t, "Status"), + } + }) +} + +func GetConsumerRemovalProposalGen() *rapid.Generator[ConsumerRemovalProposal] { + return rapid.Custom(func(t *rapid.T) ConsumerRemovalProposal { + return ConsumerRemovalProposal{ + Deposit: rapid.Uint().Draw(t, "Deposit"), + Chain: GetChainIDGen().Draw(t, "Chain"), + StopTime: rapid.Int().Draw(t, "StopTime"), + Status: rapid.String().Draw(t, "Status"), + } + }) +} + +func GetEquivocationProposalGen() *rapid.Generator[EquivocationProposal] { + return rapid.Custom(func(t *rapid.T) EquivocationProposal { + return EquivocationProposal{ + Power: rapid.Uint().Draw(t, "Power"), + Height: rapid.Uint().Draw(t, "Height"), + ConsensusAddress: rapid.String().Draw(t, "ConesnsuAddress"), + Deposit: rapid.Uint().Draw(t, "Deposit"), + Status: rapid.String().Draw(t, "Status"), + } + }) +} + +func GetTextProposalGen() *rapid.Generator[TextProposal] { + return rapid.Custom(func(t *rapid.T) TextProposal { + return TextProposal{ + Title: rapid.String().Draw(t, "Title"), + Description: rapid.String().Draw(t, "Description"), + Deposit: rapid.Uint().Draw(t, "Deposit"), + Status: rapid.String().Draw(t, "Status"), + } + }) +} + +func GetParamsProposalGen() *rapid.Generator[ParamsProposal] { + return rapid.Custom(func(t *rapid.T) ParamsProposal { + return ParamsProposal{ + Subspace: rapid.String().Draw(t, "Subspace"), + Key: rapid.String().Draw(t, "Key"), + Value: rapid.String().Draw(t, "Value"), + Deposit: rapid.Uint().Draw(t, "Deposit"), + Status: rapid.String().Draw(t, "Status"), + } + }) +} + +func GetHeightGen() *rapid.Generator[clienttypes.Height] { + return rapid.Custom(func(t *rapid.T) clienttypes.Height { + return clienttypes.Height{ + RevisionNumber: rapid.Uint64().Draw(t, "RevisionNumber"), + RevisionHeight: rapid.Uint64().Draw(t, "RevisionHeight"), + } + }) +} diff --git a/tests/e2e/step_delegation.go b/tests/e2e/step_delegation.go index b6e7c8ad76..fc3208dbac 100644 --- a/tests/e2e/step_delegation.go +++ b/tests/e2e/step_delegation.go @@ -4,76 +4,76 @@ package main func stepsDelegate(consumerName string) []Step { return []Step{ { - action: delegateTokensAction{ - chain: chainID("provi"), - from: validatorID("alice"), - to: validatorID("alice"), - amount: 11000000, - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + Action: delegateTokensAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + To: ValidatorID("alice"), + Amount: 11000000, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 500, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 500, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: SendTokensAction{ - chain: chainID(consumerName), - from: validatorID("alice"), - to: validatorID("bob"), - amount: 1, - }, - state: State{ - chainID(consumerName): ChainState{ + Action: SendTokensAction{ + Chain: ChainID(consumerName), + From: ValidatorID("alice"), + To: ValidatorID("bob"), + Amount: 1, + }, + State: State{ + ChainID(consumerName): ChainState{ // Tx should not go through, ICS channel is not setup until first VSC packet has been relayed to consumer - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 10000000000, - validatorID("bob"): 10000000000, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 10000000000, + ValidatorID("bob"): 10000000000, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: SendTokensAction{ - chain: chainID(consumerName), - from: validatorID("alice"), - to: validatorID("bob"), - amount: 1, - }, - state: State{ - chainID(consumerName): ChainState{ + Action: SendTokensAction{ + Chain: ChainID(consumerName), + From: ValidatorID("alice"), + To: ValidatorID("bob"), + Amount: 1, + }, + State: State{ + ChainID(consumerName): ChainState{ // Now tx should execute - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9999999999, - validatorID("bob"): 10000000001, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9999999999, + ValidatorID("bob"): 10000000001, }, }, }, @@ -85,43 +85,43 @@ func stepsDelegate(consumerName string) []Step { func stepsUnbond(consumerName string) []Step { return []Step{ { - action: unbondTokensAction{ - chain: chainID("provi"), - unbondFrom: validatorID("alice"), - sender: validatorID("alice"), - amount: 1000000, - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, - validatorID("bob"): 500, - validatorID("carol"): 500, + Action: unbondTokensAction{ + Chain: ChainID("provi"), + UnbondFrom: ValidatorID("alice"), + Sender: ValidatorID("alice"), + Amount: 1000000, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID("consu"): ChainState{ - ValPowers: &map[validatorID]uint{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Voting power on consumer should not be affected yet - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID("consu"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, - validatorID("bob"): 500, - validatorID("carol"): 500, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, @@ -134,85 +134,85 @@ func stepsUnbond(consumerName string) []Step { func stepsCancelUnbond(consumerName string) []Step { return []Step{ { - action: unbondTokensAction{ - chain: chainID("provi"), - unbondFrom: validatorID("alice"), - sender: validatorID("alice"), - amount: 1000000, - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 500, + Action: unbondTokensAction{ + Chain: ChainID("provi"), + UnbondFrom: ValidatorID("alice"), + Sender: ValidatorID("alice"), + Amount: 1000000, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID("consu"): ChainState{ - ValPowers: &map[validatorID]uint{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Voting power on consumer should not be affected yet - validatorID("alice"): 510, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValidatorID("alice"): 510, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID("consu"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 500, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: cancelUnbondTokensAction{ - chain: chainID("provi"), - delegator: validatorID("alice"), - validator: validatorID("alice"), - amount: 1000000, // cancel unbonding the full amount - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, // power restored - validatorID("bob"): 500, - validatorID("carol"): 500, + Action: cancelUnbondTokensAction{ + Chain: ChainID("provi"), + Delegator: ValidatorID("alice"), + Validator: ValidatorID("alice"), + Amount: 1000000, // cancel unbonding the full amount + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, // power restored + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID("consu"): ChainState{ - ValPowers: &map[validatorID]uint{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Voting power on consumer should not be affected yet - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID("consu"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, // power restored on consumer - validatorID("bob"): 500, - validatorID("carol"): 500, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("consu"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, // power restored on consumer + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, @@ -226,45 +226,45 @@ func stepsCancelUnbond(consumerName string) []Step { func stepsRedelegateForOptOut(consumerName string) []Step { return []Step{ { - action: redelegateTokensAction{ - chain: chainID("provi"), - src: validatorID("alice"), - dst: validatorID("carol"), - txSender: validatorID("alice"), - amount: 450000000, - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 60, - validatorID("bob"): 500, - validatorID("carol"): 950, + Action: redelegateTokensAction{ + Chain: ChainID("provi"), + Src: ValidatorID("alice"), + Dst: ValidatorID("carol"), + TxSender: ValidatorID("alice"), + Amount: 450000000, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 60, + ValidatorID("bob"): 500, + ValidatorID("carol"): 950, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Voting power changes not seen by consumer yet - validatorID("alice"): 510, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValidatorID("alice"): 510, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Now power changes are seen by consumer - validatorID("alice"): 60, - validatorID("bob"): 500, - validatorID("carol"): 950, + ValidatorID("alice"): 60, + ValidatorID("bob"): 500, + ValidatorID("carol"): 950, }, }, }, @@ -276,48 +276,48 @@ func stepsRedelegateForOptOut(consumerName string) []Step { func stepsRedelegate(consumerName string) []Step { return []Step{ { - action: redelegateTokensAction{ - chain: chainID("provi"), - src: validatorID("carol"), - dst: validatorID("alice"), - txSender: validatorID("carol"), + Action: redelegateTokensAction{ + Chain: ChainID("provi"), + Src: ValidatorID("carol"), + Dst: ValidatorID("alice"), + TxSender: ValidatorID("carol"), // redelegate s.t. alice has majority stake so non-faulty validators maintain more than // 2/3 voting power during downtime tests below, avoiding chain halt - amount: 449000000, + Amount: 449000000, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // carol always uses a consumer assigned key - validatorID("carol"): 501, + ValidatorID("carol"): 501, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Voting power changes not seen by consumer yet - validatorID("alice"): 60, - validatorID("bob"): 500, - validatorID("carol"): 950, + ValidatorID("alice"): 60, + ValidatorID("bob"): 500, + ValidatorID("carol"): 950, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Now power changes are seen by consumer - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, }, @@ -329,48 +329,48 @@ func stepsRedelegate(consumerName string) []Step { func stepsRedelegateShort(consumerName string) []Step { return []Step{ { - action: redelegateTokensAction{ - chain: chainID("provi"), - src: validatorID("alice"), - dst: validatorID("carol"), - txSender: validatorID("alice"), + Action: redelegateTokensAction{ + Chain: ChainID("provi"), + Src: ValidatorID("alice"), + Dst: ValidatorID("carol"), + TxSender: ValidatorID("alice"), // Leave alice with majority stake so non-faulty validators maintain more than // 2/3 voting power during downtime tests below, avoiding chain halt - amount: 1000000, + Amount: 1000000, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // carol always uses a consumer assigned key - validatorID("carol"): 501, + ValidatorID("carol"): 501, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Voting power changes not seen by consumer yet - validatorID("alice"): 510, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValidatorID("alice"): 510, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Now power changes are seen by consumer - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, }, diff --git a/tests/e2e/step_rapid_test.go b/tests/e2e/step_rapid_test.go new file mode 100644 index 0000000000..dde5f2f465 --- /dev/null +++ b/tests/e2e/step_rapid_test.go @@ -0,0 +1,51 @@ +package main + +import ( + "log" + "os" + "path/filepath" + "testing" + + "pgregory.net/rapid" +) + +// TestReadAndWriteTrace uses rapid to do property based testing +// of reading and writing traces. +// It generates a random trace, writes it to a file, then reads it back. +// It then compares the original trace to the read trace. +// If the traces are not equal, rapid will generate a minimal example +// that causes the test to fail. +func TestReadAndWriteTrace(t *testing.T) { + parser := JSONParser{} + writer := JSONWriter{} + + dir, err := os.MkdirTemp("", "example") + if err != nil { + log.Fatal(err) + } + defer os.RemoveAll(dir) // clean up + + rapid.Check(t, func(t *rapid.T) { + trace := GetTraceGen().Draw(t, "Trace") + filename := filepath.Join(dir, "trace.json") + err := WriteAndReadTrace(parser, writer, trace, filename) + if err != nil { + t.Fatalf("error writing and reading trace: %v", err) + } + }) +} + +// This can be used to test writing and parsing traces, but does not make much sense +// for testing trace execution, since the generated traces are almost guaranteed to be nonsensical. +func GetTraceGen() *rapid.Generator[[]Step] { + return rapid.SliceOf(GetStepGen()) +} + +func GetStepGen() *rapid.Generator[Step] { + return rapid.Custom(func(t *rapid.T) Step { + return Step{ + Action: GetActionGen().Draw(t, "Action"), + State: GetStateGen().Draw(t, "State"), + } + }) +} diff --git a/tests/e2e/steps.go b/tests/e2e/steps.go index 6fb284c07a..21db55e3b7 100644 --- a/tests/e2e/steps.go +++ b/tests/e2e/steps.go @@ -1,8 +1,8 @@ package main type Step struct { - action interface{} - state State + Action interface{} + State State } func concatSteps(steps ...[]Step) []Step { @@ -66,7 +66,7 @@ var slashThrottleSteps = concatSteps( stepsStopChain("consu", 2), ) -var democracySteps = concatSteps( +var democracyRewardsSteps = concatSteps( // democracySteps requires a transfer channel stepsStartChains([]string{"democ"}, true), // delegation needs to happen so the first VSC packet can be delivered @@ -74,7 +74,7 @@ var democracySteps = concatSteps( stepsDemocracy("democ"), ) -var rewardDenomConsumerSteps = concatSteps( +var democracySteps = concatSteps( // democracySteps requires a transfer channel stepsStartChains([]string{"democ"}, true), // delegation needs to happen so the first VSC packet can be delivered diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index 85e9e8cbd7..9779ce45bc 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -5,22 +5,22 @@ const consumerRewardDenom = "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821 func stepsDemocracy(consumerName string) []Step { return []Step{ { - action: registerRepresentativeAction{ - chain: chainID(consumerName), - representatives: []validatorID{validatorID("alice"), validatorID("bob")}, - stakes: []uint{100000000, 40000000}, + Action: registerRepresentativeAction{ + Chain: ChainID(consumerName), + Representatives: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, + Stakes: []uint{100000000, 40000000}, }, - state: State{ - chainID(consumerName): ChainState{ - RepresentativePowers: &map[validatorID]uint{ - validatorID("alice"): 100000000, - validatorID("bob"): 40000000, + State: State{ + ChainID(consumerName): ChainState{ + RepresentativePowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100000000, + ValidatorID("bob"): 40000000, }, Rewards: &Rewards{ - IsRewarded: map[validatorID]bool{ - validatorID("alice"): true, - validatorID("bob"): true, - validatorID("carol"): false, + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): true, + ValidatorID("bob"): true, + ValidatorID("carol"): false, }, IsIncrementalReward: true, IsNativeDenom: true, @@ -29,31 +29,31 @@ func stepsDemocracy(consumerName string) []Step { }, }, { - action: delegateTokensAction{ - chain: chainID(consumerName), - from: validatorID("carol"), - to: validatorID("alice"), - amount: 500000, + Action: delegateTokensAction{ + Chain: ChainID(consumerName), + From: ValidatorID("carol"), + To: ValidatorID("alice"), + Amount: 500000, }, - state: State{ - chainID(consumerName): ChainState{ + State: State{ + ChainID(consumerName): ChainState{ // Check that delegators on gov-consumer chain can change representative powers - RepresentativePowers: &map[validatorID]uint{ - validatorID("alice"): 100500000, - validatorID("bob"): 40000000, + RepresentativePowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100500000, + ValidatorID("bob"): 40000000, }, // Check that delegating on gov-consumer does not change validator powers - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, // Check that tokens are minted and distributed to representatives and their delegators Rewards: &Rewards{ - IsRewarded: map[validatorID]bool{ - validatorID("alice"): true, - validatorID("bob"): true, - validatorID("carol"): true, + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): true, + ValidatorID("bob"): true, + ValidatorID("carol"): true, }, IsIncrementalReward: true, IsNativeDenom: true, @@ -63,19 +63,19 @@ func stepsDemocracy(consumerName string) []Step { }, { // whitelisted legacy proposal can only handle ibctransfer.SendEnabled/ReceiveEnabled - action: submitParamChangeLegacyProposalAction{ - chain: chainID(consumerName), - from: validatorID("alice"), - deposit: 10000001, - subspace: "transfer", - key: "SendEnabled", - value: true, + Action: submitParamChangeLegacyProposalAction{ + Chain: ChainID(consumerName), + From: ValidatorID("alice"), + Deposit: 10000001, + Subspace: "transfer", + Key: "SendEnabled", + Value: true, }, - state: State{ - chainID(consumerName): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9889999998, - validatorID("bob"): 9960000001, + State: State{ + ChainID(consumerName): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9889999998, + ValidatorID("bob"): 9960000001, }, Proposals: &map[uint]Proposal{ 1: ParamsProposal{ @@ -91,17 +91,17 @@ func stepsDemocracy(consumerName string) []Step { }, { // Have accounts vote on something on the gov-consumer chain - action: voteGovProposalAction{ - chain: chainID(consumerName), - from: []validatorID{validatorID("alice"), validatorID("bob")}, - vote: []string{"yes", "no"}, - propNumber: 1, + Action: voteGovProposalAction{ + Chain: ChainID(consumerName), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, + Vote: []string{"yes", "no"}, + PropNumber: 1, }, - state: State{ - chainID(consumerName): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9889999998, - validatorID("bob"): 9960000001, + State: State{ + ChainID(consumerName): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9889999998, + ValidatorID("bob"): 9960000001, }, // Check that the parameter is changed on gov-consumer chain Params: &([]Param{{Subspace: "transfer", Key: "SendEnabled", Value: "true"}}), @@ -109,20 +109,20 @@ func stepsDemocracy(consumerName string) []Step { }, }, { - action: relayRewardPacketsToProviderAction{ - consumerChain: chainID(consumerName), - providerChain: chainID("provi"), - port: "transfer", - channel: 1, + Action: relayRewardPacketsToProviderAction{ + ConsumerChain: ChainID(consumerName), + ProviderChain: ChainID("provi"), + Port: "transfer", + Channel: 1, }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ // Check that tokens are not distributed before the denom has been registered Rewards: &Rewards{ - IsRewarded: map[validatorID]bool{ - validatorID("alice"): false, - validatorID("bob"): false, - validatorID("carol"): false, + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): false, + ValidatorID("bob"): false, + ValidatorID("carol"): false, }, IsIncrementalReward: false, IsNativeDenom: false, @@ -133,47 +133,47 @@ func stepsDemocracy(consumerName string) []Step { }, }, { - action: submitChangeRewardDenomsProposalAction{ - denom: consumerRewardDenom, - deposit: 10000001, - from: validatorID("bob"), + Action: submitChangeRewardDenomsProposalAction{ + Denom: consumerRewardDenom, + Deposit: 10000001, + From: ValidatorID("bob"), }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ // Denom not yet registered, gov prop needs to pass first RegisteredConsumerRewardDenoms: &[]string{}, }, }, }, { - action: voteGovProposalAction{ - chain: chainID("provi"), - from: []validatorID{validatorID("alice"), validatorID("bob"), validatorID("carol")}, - vote: []string{"yes", "yes", "yes"}, - propNumber: 2, + Action: voteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, + Vote: []string{"yes", "yes", "yes"}, + PropNumber: 2, }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ // Check that the denom is registered on provider chain RegisteredConsumerRewardDenoms: &[]string{consumerRewardDenom}, }, }, }, { - action: relayRewardPacketsToProviderAction{ - consumerChain: chainID(consumerName), - providerChain: chainID("provi"), - port: "transfer", - channel: 1, + Action: relayRewardPacketsToProviderAction{ + ConsumerChain: ChainID(consumerName), + ProviderChain: ChainID("provi"), + Port: "transfer", + Channel: 1, }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ // Check that tokens are minted and sent to provider chain and distributed to validators and their delegators on provider chain Rewards: &Rewards{ - IsRewarded: map[validatorID]bool{ - validatorID("alice"): true, - validatorID("bob"): true, - validatorID("carol"): true, + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): true, + ValidatorID("bob"): true, + ValidatorID("carol"): true, }, IsIncrementalReward: false, IsNativeDenom: false, @@ -182,49 +182,49 @@ func stepsDemocracy(consumerName string) []Step { }, }, { - action: downtimeSlashAction{ - chain: chainID(consumerName), - validator: validatorID("bob"), + Action: downtimeSlashAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("bob"), }, - state: State{ + State: State{ // validator should be slashed on consumer, powers not affected on either chain yet - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, // Downtime jailing and corresponding voting power change are processed by provider - validatorID("bob"): 0, - validatorID("carol"): 500, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, @@ -232,63 +232,63 @@ func stepsDemocracy(consumerName string) []Step { // A block is incremented each action, hence why VSC is committed on provider, // and can now be relayed as packet to consumer { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, // VSC now seen on consumer - validatorID("bob"): 0, - validatorID("carol"): 500, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, }, }, }, }, { - action: unjailValidatorAction{ - provider: chainID("provi"), - validator: validatorID("bob"), + Action: unjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("bob"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 0, - validatorID("carol"): 500, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, // Check that slashing on the gov-consumer chain does not result in slashing for the representatives or their delegators - RepresentativePowers: &map[validatorID]uint{ - validatorID("alice"): 100500000, - validatorID("bob"): 40000000, + RepresentativePowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100500000, + ValidatorID("bob"): 40000000, }, }, }, diff --git a/tests/e2e/steps_double_sign.go b/tests/e2e/steps_double_sign.go index c007fa5c1c..4d69569b29 100644 --- a/tests/e2e/steps_double_sign.go +++ b/tests/e2e/steps_double_sign.go @@ -5,49 +5,49 @@ func stepsDoubleSignOnProviderAndConsumer(consumerName string) []Step { return []Step{ { // provider double sign - action: doublesignSlashAction{ - chain: chainID("provi"), - validator: validatorID("carol"), + Action: doublesignSlashAction{ + Chain: ChainID("provi"), + Validator: ValidatorID("carol"), }, - state: State{ + State: State{ // slash on provider - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, // from 500 to 0 + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, // from 500 to 0 }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, // not tombstoned on consumerName yet + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, // not tombstoned on consumerName yet }, }, }, }, { // relay power change to consumerName - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, // consumerName channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, // consumerName channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, // tombstoning visible on consumerName + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, // tombstoning visible on consumerName }, }, }, @@ -56,72 +56,72 @@ func stepsDoubleSignOnProviderAndConsumer(consumerName string) []Step { // consumer double sign // provider will only log the double sign slash // stepsSubmitEquivocationProposal will cause the double sign slash to be executed - action: doublesignSlashAction{ - chain: chainID("consu"), - validator: validatorID("bob"), + Action: doublesignSlashAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("bob"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // not tombstoned + ValidatorID("carol"): 0, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // not tombstoned + ValidatorID("carol"): 0, }, }, }, }, { // consumer learns about the double sign - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // not tombstoned + ValidatorID("carol"): 0, }, }, }, diff --git a/tests/e2e/steps_downtime.go b/tests/e2e/steps_downtime.go index e6d320bec1..08054f9089 100644 --- a/tests/e2e/steps_downtime.go +++ b/tests/e2e/steps_downtime.go @@ -15,49 +15,49 @@ import "time" func stepsDowntime(consumerName string) []Step { return []Step{ { - action: downtimeSlashAction{ - chain: chainID(consumerName), - validator: validatorID("bob"), + Action: downtimeSlashAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("bob"), }, - state: State{ + State: State{ // validator should be slashed on consumer, powers not affected on either chain yet - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, // Downtime jailing and corresponding voting power change are processed by provider - validatorID("bob"): 0, - validatorID("carol"): 501, + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, }, @@ -65,144 +65,144 @@ func stepsDowntime(consumerName string) []Step { // A block is incremented each action, hence why VSC is committed on provider, // and can now be relayed as packet to consumer { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, // VSC now seen on consumer - validatorID("bob"): 0, - validatorID("carol"): 501, + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, }, }, }, }, { - action: unjailValidatorAction{ - provider: chainID("provi"), - validator: validatorID("bob"), - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, + Action: unjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("bob"), + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, // bob's stake should not be slashed // since the slash was initiated from consumer - validatorID("bob"): 500, - validatorID("carol"): 501, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 0, - validatorID("carol"): 501, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, // bob's stake should not be slashed // since the slash was initiated from consumer - validatorID("bob"): 500, - validatorID("carol"): 501, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, }, }, // Now we test provider initiated downtime/slashing { - action: downtimeSlashAction{ - chain: chainID("provi"), - validator: validatorID("carol"), + Action: downtimeSlashAction{ + Chain: ChainID("provi"), + Validator: ValidatorID("carol"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Non faulty validators still maintain just above 2/3 power here - validatorID("alice"): 509, - validatorID("bob"): 500, + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // Carol's stake should be slashed and jailed // downtime slash was initiated from provider - validatorID("carol"): 0, + ValidatorID("carol"): 0, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, }, }, { - action: unjailValidatorAction{ - provider: chainID("provi"), - validator: validatorID("carol"), + Action: unjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("carol"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, }, }, }, @@ -217,49 +217,49 @@ func stepsDowntime(consumerName string) []Step { func stepsDowntimeWithOptOut(consumerName string) []Step { return []Step{ { - action: downtimeSlashAction{ - chain: chainID(consumerName), - validator: validatorID("alice"), + Action: downtimeSlashAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("alice"), }, - state: State{ + State: State{ // powers not affected on either chain - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 60, - validatorID("bob"): 500, - validatorID("carol"): 950, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 60, + ValidatorID("bob"): 500, + ValidatorID("carol"): 950, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 60, - validatorID("bob"): 500, - validatorID("carol"): 950, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 60, + ValidatorID("bob"): 500, + ValidatorID("carol"): 950, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ // alice is not slashed or jailed due to soft opt out - validatorID("alice"): 60, - validatorID("bob"): 500, - validatorID("carol"): 950, + ValidatorID("alice"): 60, + ValidatorID("bob"): 500, + ValidatorID("carol"): 950, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 60, - validatorID("bob"): 500, - validatorID("carol"): 950, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 60, + ValidatorID("bob"): 500, + ValidatorID("carol"): 950, }, }, }, @@ -273,24 +273,24 @@ func stepsDowntimeWithOptOut(consumerName string) []Step { func stepsThrottledDowntime(consumerName string) []Step { return []Step{ { - action: downtimeSlashAction{ - chain: chainID(consumerName), - validator: validatorID("bob"), + Action: downtimeSlashAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("bob"), }, - state: State{ + State: State{ // slash packet queued on consumer, but powers not affected on either chain yet - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, @@ -299,115 +299,115 @@ func stepsThrottledDowntime(consumerName string) []Step { // and consumer receives ack that provider recv the downtime slash. // The latter is necessary for the consumer to send the second downtime slash. { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 0, // bob is jailed - validatorID("carol"): 500, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 0, // bob is jailed + ValidatorID("carol"): 500, }, // no provider throttling engaged yet GlobalSlashQueueSize: uintPointer(0), - ConsumerChainQueueSizes: &map[chainID]uint{ - chainID(consumerName): uint(0), + ConsumerChainQueueSizes: &map[ChainID]uint{ + ChainID(consumerName): uint(0), }, }, - chainID(consumerName): ChainState{ + ChainID(consumerName): ChainState{ // VSC packet applying jailing is not yet relayed to consumer - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: downtimeSlashAction{ - chain: chainID(consumerName), - validator: validatorID("carol"), + Action: downtimeSlashAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("carol"), }, - state: State{ + State: State{ // powers not affected on either chain yet - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 0, - validatorID("carol"): 500, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ + ChainID(consumerName): ChainState{ // VSC packet applying jailing is not yet relayed to consumer - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 0, - validatorID("carol"): 500, // not slashed due to throttling + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, // not slashed due to throttling }, GlobalSlashQueueSize: uintPointer(1), // carol's slash request is throttled - ConsumerChainQueueSizes: &map[chainID]uint{ - chainID(consumerName): uint(1), + ConsumerChainQueueSizes: &map[ChainID]uint{ + ChainID(consumerName): uint(1), }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 0, - validatorID("carol"): 500, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, }, }, }, }, { - action: slashThrottleDequeue{ - chain: chainID(consumerName), - currentQueueSize: 1, - nextQueueSize: 0, + Action: slashThrottleDequeue{ + Chain: ChainID(consumerName), + CurrentQueueSize: 1, + NextQueueSize: 0, // Slash meter replenish fraction is set to 10%, replenish period is 20 seconds, see config.go // Meter is initially at 10%, decremented to -23% from bob being jailed. It'll then take three replenishments // for meter to become positive again. 3*20 = 60 seconds + buffer = 80 seconds - timeout: 80 * time.Second, + Timeout: 80 * time.Second, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 0, - validatorID("carol"): 0, // Carol is jailed upon packet being handled on provider + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 0, + ValidatorID("carol"): 0, // Carol is jailed upon packet being handled on provider }, GlobalSlashQueueSize: uintPointer(0), // slash packets dequeued - ConsumerChainQueueSizes: &map[chainID]uint{ - chainID(consumerName): 0, + ConsumerChainQueueSizes: &map[ChainID]uint{ + ChainID(consumerName): 0, }, }, - chainID(consumerName): ChainState{ + ChainID(consumerName): ChainState{ // no updates received on consumer - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 0, - validatorID("carol"): 500, + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, }, }, }, @@ -415,30 +415,30 @@ func stepsThrottledDowntime(consumerName string) []Step { // A block is incremented each action, hence why VSC is committed on provider, // and can now be relayed as packet to consumer { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, - }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 0, - validatorID("carol"): 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, + }, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 0, + ValidatorID("carol"): 0, }, GlobalSlashQueueSize: uintPointer(0), - ConsumerChainQueueSizes: &map[chainID]uint{ - chainID(consumerName): 0, + ConsumerChainQueueSizes: &map[ChainID]uint{ + ChainID(consumerName): 0, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, // throttled update gets to consumer - validatorID("bob"): 0, - validatorID("carol"): 0, + ValidatorID("bob"): 0, + ValidatorID("carol"): 0, }, }, }, diff --git a/tests/e2e/steps_light_client_attack.go b/tests/e2e/steps_light_client_attack.go index f00d5f5bd6..284b3fafea 100644 --- a/tests/e2e/steps_light_client_attack.go +++ b/tests/e2e/steps_light_client_attack.go @@ -4,124 +4,124 @@ package main func stepsLightClientAttackOnProviderAndConsumer(consumerName string) []Step { return []Step{ { - // provider double sign - action: lightClientEquivocationAttackAction{ - chain: chainID("provi"), - validator: validatorID("carol"), + // Provider double sign + Action: lightClientEquivocationAttackAction{ + Chain: ChainID("provi"), + Validator: ValidatorID("carol"), }, - state: State{ - // slash on provider - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, // from 500 to 0 + State: State{ + // Slash on provider + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, // from 500 to 0 }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, // not tombstoned on consumerName yet + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, // not tombstoned on consumerName yet }, }, }, }, { - // relay power change to consumerName - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, // consumerName channel + // Relay power change to consumerName + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, // consumerName channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, // tombstoning visible on consumerName + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, // tombstoning visible on consumerName }, }, }, }, { - // consumer double sign - // provider will only log the double sign slash + // Consumer double sign + // Provider will only log the double sign slash // stepsSubmitEquivocationProposal will cause the double sign slash to be executed - action: lightClientEquivocationAttackAction{ - chain: chainID(consumerName), - validator: validatorID("bob"), + Action: lightClientEquivocationAttackAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("bob"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // not tombstoned + ValidatorID("carol"): 0, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // not tombstoned + ValidatorID("carol"): 0, }, }, }, }, { - // consumer learns about the double sign - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + // Consumer learns about the double sign + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // not tombstoned + ValidatorID("carol"): 0, }, }, }, diff --git a/tests/e2e/steps_multi_consumer_delegation.go b/tests/e2e/steps_multi_consumer_delegation.go index 45536c0679..67368e277c 100644 --- a/tests/e2e/steps_multi_consumer_delegation.go +++ b/tests/e2e/steps_multi_consumer_delegation.go @@ -5,96 +5,96 @@ func stepsMultiConsumerDelegate(consumer1, consumer2 string) []Step { return []Step{ { // changes not visible on any consumer - action: delegateTokensAction{ - chain: chainID("provi"), - from: validatorID("alice"), - to: validatorID("alice"), - amount: 11000000, + Action: delegateTokensAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + To: ValidatorID("alice"), + Amount: 11000000, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, // this changes from 500 - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, // this changes from 500 + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 500, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 500, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 500, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 500, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { // relay changes to consumer1 - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer1), - port: "provider", - channel: 0, // consumer1 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer1), + Port: "provider", + Channel: 0, // consumer1 Channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, // changed - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, // changed + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 500, // unchanged - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 500, // unchanged + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { // relay changes to consumer2 - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer2), - port: "provider", - channel: 1, // consumer2 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer2), + Port: "provider", + Channel: 1, // consumer2 Channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, // changed - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, // changed + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, @@ -107,96 +107,96 @@ func stepsMultiConsumerDelegate(consumer1, consumer2 string) []Step { func stepsMultiConsumerUnbond(consumer1, consumer2 string) []Step { return []Step{ { - action: unbondTokensAction{ - chain: chainID("provi"), - unbondFrom: validatorID("alice"), - sender: validatorID("alice"), - amount: 1000000, + Action: unbondTokensAction{ + Chain: ChainID("provi"), + UnbondFrom: ValidatorID("alice"), + Sender: ValidatorID("alice"), + Amount: 1000000, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, // change from 511 - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, // change from 511 + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, // no change - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, // no change + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, // no change - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, // no change + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { // relay to consumer1 - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer1), - port: "provider", - channel: 0, // consumer1 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer1), + Port: "provider", + Channel: 0, // consumer1 Channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, // change from 511 - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, // change from 511 + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, // no change - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, // no change + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { // relay to consumer2 - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer2), - port: "provider", - channel: 1, // consumer2 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer2), + Port: "provider", + Channel: 1, // consumer2 Channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, // change from 511 - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, // change from 511 + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, @@ -209,35 +209,35 @@ func stepsMultiConsumerUnbond(consumer1, consumer2 string) []Step { func stepsMultiConsumerRedelegate(consumer1, consumer2 string) []Step { return []Step{ { - action: redelegateTokensAction{ - chain: chainID("provi"), - src: validatorID("alice"), - dst: validatorID("carol"), - txSender: validatorID("alice"), + Action: redelegateTokensAction{ + Chain: ChainID("provi"), + Src: ValidatorID("alice"), + Dst: ValidatorID("carol"), + TxSender: ValidatorID("alice"), // Leave alice with majority stake so non-faulty validators maintain more than // 2/3 voting power during downtime tests below, avoiding chain halt - amount: 1000000, + Amount: 1000000, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, // no change - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, // no change + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, // no change - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, // no change + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, @@ -245,64 +245,64 @@ func stepsMultiConsumerRedelegate(consumer1, consumer2 string) []Step { { // relay to consumer1 - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer1), - port: "provider", - channel: 0, // consumer1 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer1), + Port: "provider", + Channel: 0, // consumer1 Channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, // change from 510 - validatorID("bob"): 500, - validatorID("carol"): 501, // change from 500 + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, // change from 510 + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, // change from 500 }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, // no change - validatorID("bob"): 500, - validatorID("carol"): 500, // no change + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, // no change + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, // no change }, }, }, }, { // relay to consumer2 - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer2), - port: "provider", - channel: 1, // consumer1 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer2), + Port: "provider", + Channel: 1, // consumer1 Channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, // change from 510 - validatorID("bob"): 500, - validatorID("carol"): 501, // change from 500 + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, // change from 510 + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, // change from 500 }, }, }, diff --git a/tests/e2e/steps_multi_consumer_double_sign.go b/tests/e2e/steps_multi_consumer_double_sign.go index d12eb37eff..9327ea0b48 100644 --- a/tests/e2e/steps_multi_consumer_double_sign.go +++ b/tests/e2e/steps_multi_consumer_double_sign.go @@ -13,95 +13,95 @@ func stepsMultiConsumerDoubleSign(consumer1, consumer2 string) []Step { return []Step{ { // provider double sign - action: doublesignSlashAction{ - chain: chainID("provi"), - validator: validatorID("carol"), + Action: doublesignSlashAction{ + Chain: ChainID("provi"), + Validator: ValidatorID("carol"), }, - state: State{ + State: State{ // slash on provider - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, // from 500 to 0 + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, // from 500 to 0 }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, // not tombstoned on consumer1 yet + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, // not tombstoned on consumer1 yet }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, // not tombstoned on consumer2 yet + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, // not tombstoned on consumer2 yet }, }, }, }, { // relay power change to consumer1 - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer1), - port: "provider", - channel: 0, // consumer1 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer1), + Port: "provider", + Channel: 0, // consumer1 Channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, // tombstoning visible on consumer1 + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, // tombstoning visible on consumer1 }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, // tombstoning NOT YET visible on consumer2 + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, // tombstoning NOT YET visible on consumer2 }, }, }, }, { // relay power change to consumer2 - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer2), - port: "provider", - channel: 1, // consumer2 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer2), + Port: "provider", + Channel: 1, // consumer2 Channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, // tombstoned on consumer2 + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, // tombstoned on consumer2 }, }, }, @@ -109,118 +109,118 @@ func stepsMultiConsumerDoubleSign(consumer1, consumer2 string) []Step { { // consumer double sign // nothing should happen - double sign from consumer is dropped - action: doublesignSlashAction{ - chain: chainID("consu"), - validator: validatorID("bob"), + Action: doublesignSlashAction{ + Chain: ChainID("consu"), + Validator: ValidatorID("bob"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer1), - port: "provider", - channel: 0, // consumer1 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer1), + Port: "provider", + Channel: 0, // consumer1 Channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // not tombstoned + ValidatorID("carol"): 0, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // not tombstoned + ValidatorID("carol"): 0, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // not tombstoned + ValidatorID("carol"): 0, }, }, }, }, { // consumer1 learns about the double sign - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer1), - port: "provider", - channel: 0, // consumer1 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer1), + Port: "provider", + Channel: 0, // consumer1 Channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // not tombstoned + ValidatorID("carol"): 0, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // not tombstoned - validatorID("carol"): 0, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // not tombstoned + ValidatorID("carol"): 0, }, }, }, }, { // consumer2 learns about the double sign - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer2), - port: "provider", - channel: 1, // consumer2 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer2), + Port: "provider", + Channel: 1, // consumer2 Channel }, - state: State{ - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, - }, - }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, + }, + }, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, }, diff --git a/tests/e2e/steps_multi_consumer_downtime.go b/tests/e2e/steps_multi_consumer_downtime.go index ce6cbdff59..eba44ed361 100644 --- a/tests/e2e/steps_multi_consumer_downtime.go +++ b/tests/e2e/steps_multi_consumer_downtime.go @@ -7,31 +7,31 @@ package main func stepsMultiConsumerDowntimeFromConsumer(consumer1, consumer2 string) []Step { return []Step{ { - action: downtimeSlashAction{ - chain: chainID(consumer1), - validator: validatorID("bob"), + Action: downtimeSlashAction{ + Chain: ChainID(consumer1), + Validator: ValidatorID("bob"), }, - state: State{ + State: State{ // validator should be slashed on consumer, powers not affected on either chain yet - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, }, @@ -39,32 +39,32 @@ func stepsMultiConsumerDowntimeFromConsumer(consumer1, consumer2 string) []Step { // Downtime jailing and corresponding voting power change are processed by provider // Validator powers are unchanged on consumer chains - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer1), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer1), + Port: "provider", + Channel: 0, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 0, - validatorID("carol"): 501, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, }, @@ -73,149 +73,149 @@ func stepsMultiConsumerDowntimeFromConsumer(consumer1, consumer2 string) []Step // A block is incremented each action, hence why VSC is committed on provider, // and can now be relayed as packet to consumer // consumer1 will now see the validator power changes - consumer2 will not (had not been relayed) - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer1), - port: "provider", - channel: 0, // consumer1 chan + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer1), + Port: "provider", + Channel: 0, // consumer1 chan }, - state: State{ + State: State{ // change propagated to consumer1 - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, // VSC now seen on consumer1 - validatorID("bob"): 0, - validatorID("carol"): 501, + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, // VSC has not arrived to on consumer2 - validatorID("bob"): 500, - validatorID("carol"): 501, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, }, }, { // both consumer1 and consumer will now see the validator power changes - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer2), - port: "provider", - channel: 1, // consumer2 chan + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer2), + Port: "provider", + Channel: 1, // consumer2 chan }, - state: State{ - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 0, // both consumers see the change - validatorID("carol"): 501, + State: State{ + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 0, // both consumers see the change + ValidatorID("carol"): 501, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 0, // both consumers see the change - validatorID("carol"): 501, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 0, // both consumers see the change + ValidatorID("carol"): 501, }, }, }, }, { - action: unjailValidatorAction{ - provider: chainID("provi"), - validator: validatorID("bob"), + Action: unjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("bob"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, // bob's stake should not be slashed since slash comes from consumer1 - validatorID("bob"): 500, - validatorID("carol"): 501, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, // change is not visible on consumer1 - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 0, - validatorID("carol"): 501, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, }, }, // change is not visible on consumer2 - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 0, - validatorID("carol"): 501, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 0, + ValidatorID("carol"): 501, }, }, }, }, { // relay to consumer 1 - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer1), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer1), + Port: "provider", + Channel: 0, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // change has arrived to consumer1 (no slashing) - validatorID("carol"): 501, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // change has arrived to consumer1 (no slashing) + ValidatorID("carol"): 501, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 0, // change has not arrived to consumer2 - validatorID("carol"): 501, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 0, // change has not arrived to consumer2 + ValidatorID("carol"): 501, }, }, }, }, { // relay to consumer2 - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer2), - port: "provider", - channel: 1, // consumer2 chan + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer2), + Port: "provider", + Channel: 1, // consumer2 chan }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // change has arrived to consumer1 (no slashing) - validatorID("carol"): 501, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // change has arrived to consumer1 (no slashing) + ValidatorID("carol"): 501, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // change has arrived to consumer2 (no slashing) - validatorID("carol"): 501, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // change has arrived to consumer2 (no slashing) + ValidatorID("carol"): 501, }, }, }, @@ -229,190 +229,190 @@ func stepsMultiConsumerDowntimeFromProvider(consumer1, consumer2 string) []Step return []Step{ // Now we test provider initiated downtime/slashing { - action: downtimeSlashAction{ - chain: chainID("provi"), - validator: validatorID("carol"), + Action: downtimeSlashAction{ + Chain: ChainID("provi"), + Validator: ValidatorID("carol"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Non faulty validators still maintain just above 2/3 power here - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer1), - port: "provider", - channel: 0, // consumer 1 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer1), + Port: "provider", + Channel: 0, // consumer 1 channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Non faulty validators still maintain just above 2/3 power here - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, // powers now changed - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, // not relayed yet - powers unchanged - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 501, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 501, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer2), - port: "provider", - channel: 1, // consumer2 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer2), + Port: "provider", + Channel: 1, // consumer2 channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Non faulty validators still maintain just above 2/3 power here - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, // powers now changed - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, }, }, { - action: unjailValidatorAction{ - provider: chainID("provi"), - validator: validatorID("carol"), + Action: unjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("carol"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, // slashed because infraction was committed on provider + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, // slashed because infraction was committed on provider }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer1), - port: "provider", - channel: 0, // consumer1 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer1), + Port: "provider", + Channel: 0, // consumer1 channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, }, }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, }, }, // not relayed yet - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumer2), - port: "provider", - channel: 1, // consumer2 channel + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumer2), + Port: "provider", + Channel: 1, // consumer2 channel }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, - }, - }, - chainID(consumer1): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, - }, - }, - chainID(consumer2): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, + }, + }, + ChainID(consumer1): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, + }, + }, + ChainID(consumer2): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, }, }, }, diff --git a/tests/e2e/steps_reward_denom.go b/tests/e2e/steps_reward_denom.go index cc9934f3f8..125f3dd401 100644 --- a/tests/e2e/steps_reward_denom.go +++ b/tests/e2e/steps_reward_denom.go @@ -3,22 +3,22 @@ package main func stepsRewardDenomConsumer(consumerName string) []Step { return []Step{ { - action: registerRepresentativeAction{ - chain: chainID(consumerName), - representatives: []validatorID{validatorID("alice"), validatorID("bob")}, - stakes: []uint{100000000, 40000000}, + Action: registerRepresentativeAction{ + Chain: ChainID(consumerName), + Representatives: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, + Stakes: []uint{100000000, 40000000}, }, - state: State{ - chainID(consumerName): ChainState{ - RepresentativePowers: &map[validatorID]uint{ - validatorID("alice"): 100000000, - validatorID("bob"): 40000000, + State: State{ + ChainID(consumerName): ChainState{ + RepresentativePowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100000000, + ValidatorID("bob"): 40000000, }, Rewards: &Rewards{ - IsRewarded: map[validatorID]bool{ - validatorID("alice"): true, - validatorID("bob"): true, - validatorID("carol"): false, + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): true, + ValidatorID("bob"): true, + ValidatorID("carol"): false, }, IsIncrementalReward: true, IsNativeDenom: true, @@ -27,31 +27,31 @@ func stepsRewardDenomConsumer(consumerName string) []Step { }, }, { - action: delegateTokensAction{ - chain: chainID(consumerName), - from: validatorID("carol"), - to: validatorID("alice"), - amount: 500000, + Action: delegateTokensAction{ + Chain: ChainID(consumerName), + From: ValidatorID("carol"), + To: ValidatorID("alice"), + Amount: 500000, }, - state: State{ - chainID(consumerName): ChainState{ + State: State{ + ChainID(consumerName): ChainState{ // Check that delegators on gov-consumer chain can change representative powers - RepresentativePowers: &map[validatorID]uint{ - validatorID("alice"): 100500000, - validatorID("bob"): 40000000, + RepresentativePowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100500000, + ValidatorID("bob"): 40000000, }, // Check that delegating on gov-consumer does not change validator powers - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, // Check that tokens are minted and distributed to representatives and their delegators Rewards: &Rewards{ - IsRewarded: map[validatorID]bool{ - validatorID("alice"): true, - validatorID("bob"): true, - validatorID("carol"): true, + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): true, + ValidatorID("bob"): true, + ValidatorID("carol"): true, }, IsIncrementalReward: true, IsNativeDenom: true, @@ -61,19 +61,19 @@ func stepsRewardDenomConsumer(consumerName string) []Step { }, { // whitelisted legacy proposal can only handle ibctransfer.SendEnabled/ReceiveEnabled - action: submitParamChangeLegacyProposalAction{ - chain: chainID(consumerName), - from: validatorID("alice"), - deposit: 10000001, - subspace: "transfer", - key: "SendEnabled", - value: true, + Action: submitParamChangeLegacyProposalAction{ + Chain: ChainID(consumerName), + From: ValidatorID("alice"), + Deposit: 10000001, + Subspace: "transfer", + Key: "SendEnabled", + Value: true, }, - state: State{ - chainID(consumerName): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9889999998, - validatorID("bob"): 9960000001, + State: State{ + ChainID(consumerName): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9889999998, + ValidatorID("bob"): 9960000001, }, Proposals: &map[uint]Proposal{ 1: ParamsProposal{ @@ -89,17 +89,17 @@ func stepsRewardDenomConsumer(consumerName string) []Step { }, { // Have accounts vote on something on the gov-consumer chain - action: voteGovProposalAction{ - chain: chainID(consumerName), - from: []validatorID{validatorID("alice"), validatorID("bob")}, - vote: []string{"yes", "no"}, - propNumber: 1, + Action: voteGovProposalAction{ + Chain: ChainID(consumerName), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob")}, + Vote: []string{"yes", "no"}, + PropNumber: 1, }, - state: State{ - chainID(consumerName): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9889999998, - validatorID("bob"): 9960000001, + State: State{ + ChainID(consumerName): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9889999998, + ValidatorID("bob"): 9960000001, }, // Check that the parameter is changed on gov-consumer chain Params: &([]Param{{Subspace: "transfer", Key: "SendEnabled", Value: "true"}}), @@ -107,20 +107,20 @@ func stepsRewardDenomConsumer(consumerName string) []Step { }, }, { - action: relayRewardPacketsToProviderAction{ - consumerChain: chainID(consumerName), - providerChain: chainID("provi"), - port: "transfer", - channel: 1, + Action: relayRewardPacketsToProviderAction{ + ConsumerChain: ChainID(consumerName), + ProviderChain: ChainID("provi"), + Port: "transfer", + Channel: 1, }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ // Check that tokens are not distributed before the denom has been registered Rewards: &Rewards{ - IsRewarded: map[validatorID]bool{ - validatorID("alice"): false, - validatorID("bob"): false, - validatorID("carol"): false, + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): false, + ValidatorID("bob"): false, + ValidatorID("carol"): false, }, IsIncrementalReward: false, IsNativeDenom: false, @@ -131,47 +131,47 @@ func stepsRewardDenomConsumer(consumerName string) []Step { }, }, { - action: submitChangeRewardDenomsProposalAction{ - denom: "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9", - deposit: 10000001, - from: validatorID("bob"), + Action: submitChangeRewardDenomsProposalAction{ + Denom: "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9", + Deposit: 10000001, + From: ValidatorID("bob"), }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ // Denom not yet registered, gov prop needs to pass first RegisteredConsumerRewardDenoms: &[]string{}, }, }, }, { - action: voteGovProposalAction{ - chain: chainID("provi"), - from: []validatorID{validatorID("alice"), validatorID("bob"), validatorID("carol")}, - vote: []string{"yes", "yes", "yes"}, - propNumber: 2, + Action: voteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, + Vote: []string{"yes", "yes", "yes"}, + PropNumber: 2, }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ // Check that the denom is registered on provider chain RegisteredConsumerRewardDenoms: &[]string{"ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9"}, }, }, }, { - action: relayRewardPacketsToProviderAction{ - consumerChain: chainID(consumerName), - providerChain: chainID("provi"), - port: "transfer", - channel: 1, + Action: relayRewardPacketsToProviderAction{ + ConsumerChain: ChainID(consumerName), + ProviderChain: ChainID("provi"), + Port: "transfer", + Channel: 1, }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ // Check that tokens are not minted and sent to provider chain and distributed to validators and their delegators on provider chain Rewards: &Rewards{ - IsRewarded: map[validatorID]bool{ - validatorID("alice"): false, - validatorID("bob"): false, - validatorID("carol"): false, + IsRewarded: map[ValidatorID]bool{ + ValidatorID("alice"): false, + ValidatorID("bob"): false, + ValidatorID("carol"): false, }, IsIncrementalReward: false, IsNativeDenom: false, @@ -180,113 +180,113 @@ func stepsRewardDenomConsumer(consumerName string) []Step { }, }, { - action: downtimeSlashAction{ - chain: chainID(consumerName), - validator: validatorID("bob"), + Action: downtimeSlashAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("bob"), }, - state: State{ + State: State{ // validator should be slashed on consumer, powers not affected on either chain yet - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, // Downtime jailing and corresponding voting power change are processed by provider - validatorID("bob"): 0, - validatorID("carol"): 500, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, - // A block is incremented each action, hence why VSC is committed on provider, + // A block is incremented each Action, hence why VSC is committed on provider, // and can now be relayed as packet to consumer { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, // VSC now seen on consumer - validatorID("bob"): 0, - validatorID("carol"): 500, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, }, }, }, }, { - action: unjailValidatorAction{ - provider: chainID("provi"), - validator: validatorID("bob"), + Action: unjailValidatorAction{ + Provider: ChainID("provi"), + Validator: ValidatorID("bob"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 0, - validatorID("carol"): 500, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 0, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, // Check that slashing on the gov-consumer chain does not result in slashing for the representatives or their delegators - RepresentativePowers: &map[validatorID]uint{ - validatorID("alice"): 100500000, - validatorID("bob"): 40000000, + RepresentativePowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 100500000, + ValidatorID("bob"): 40000000, }, }, }, diff --git a/tests/e2e/steps_sovereign_changeover.go b/tests/e2e/steps_sovereign_changeover.go index c02b2c4d43..8c053299cc 100644 --- a/tests/e2e/steps_sovereign_changeover.go +++ b/tests/e2e/steps_sovereign_changeover.go @@ -10,24 +10,24 @@ import clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" func stepsSovereignTransferChan() []Step { return []Step{ { - action: createIbcClientsAction{ - chainA: chainID("sover"), - chainB: chainID("provi"), + Action: createIbcClientsAction{ + ChainA: ChainID("sover"), + ChainB: ChainID("provi"), }, - state: State{}, + State: State{}, }, { // this will create channel-0 connection end on both chain - action: addIbcChannelAction{ - chainA: chainID("sover"), - chainB: chainID("provi"), - connectionA: 0, - portA: "transfer", - portB: "transfer", - order: "unordered", - version: "ics20-1", + Action: addIbcChannelAction{ + ChainA: ChainID("sover"), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "transfer", + PortB: "transfer", + Order: "unordered", + Version: "ics20-1", }, - state: State{}, + State: State{}, }, } } @@ -36,29 +36,29 @@ func stepsSovereignTransferChan() []Step { func stepsChangeoverToConsumer(consumerName string) []Step { s := []Step{ { - action: submitConsumerAdditionProposalAction{ - preCCV: true, - chain: chainID("provi"), - from: validatorID("alice"), - deposit: 10000001, - consumerChain: chainID(consumerName), + Action: submitConsumerAdditionProposalAction{ + PreCCV: true, + Chain: ChainID("provi"), + From: ValidatorID("alice"), + Deposit: 10000001, + ConsumerChain: ChainID(consumerName), // chain-0 is the transfer channelID that gets created in stepsSovereignTransferChan // the consumer chain will use this channel to send rewards to the provider chain // there is no need to create a new channel for rewards distribution - distributionChannel: "channel-0", - spawnTime: 0, - initialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, // 1 block after upgrade !important + DistributionChannel: "channel-0", + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, // 1 block after upgrade !important }, - state: State{ - chainID("provi"): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9489999999, - validatorID("bob"): 9500000000, + State: State{ + ChainID("provi"): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9489999999, + ValidatorID("bob"): 9500000000, }, Proposals: &map[uint]Proposal{ 1: ConsumerAdditionProposal{ Deposit: 10000001, - Chain: chainID(consumerName), + Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, Status: "PROPOSAL_STATUS_VOTING_PERIOD", @@ -68,78 +68,78 @@ func stepsChangeoverToConsumer(consumerName string) []Step { }, }, { - action: voteGovProposalAction{ - chain: chainID("provi"), - from: []validatorID{validatorID("alice"), validatorID("bob"), validatorID("carol")}, - vote: []string{"yes", "yes", "yes"}, - propNumber: 1, + Action: voteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, + Vote: []string{"yes", "yes", "yes"}, + PropNumber: 1, }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ Proposals: &map[uint]Proposal{ 1: ConsumerAdditionProposal{ Deposit: 10000001, - Chain: chainID(consumerName), + Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, Status: "PROPOSAL_STATUS_PASSED", }, }, - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9500000000, - validatorID("bob"): 9500000000, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9500000000, + ValidatorID("bob"): 9500000000, }, }, }, }, { - action: ChangeoverChainAction{ - sovereignChain: chainID(consumerName), - providerChain: chainID("provi"), - validators: []StartChainValidator{ - {id: validatorID("alice"), stake: 500000000, allocation: 10000000000}, - {id: validatorID("bob"), stake: 500000000, allocation: 10000000000}, - {id: validatorID("carol"), stake: 500000000, allocation: 10000000000}, + Action: ChangeoverChainAction{ + SovereignChain: ChainID(consumerName), + ProviderChain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 500000000, Allocation: 10000000000}, + {Id: ValidatorID("bob"), Stake: 500000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 500000000, Allocation: 10000000000}, }, - genesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", + GenesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 500, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 500, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ // uses val powers from consumer - validatorID("alice"): 500, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValidatorID("alice"): 500, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: addIbcConnectionAction{ - chainA: chainID(consumerName), - chainB: chainID("provi"), - clientA: 1, - clientB: 1, + Action: addIbcConnectionAction{ + ChainA: ChainID(consumerName), + ChainB: ChainID("provi"), + ClientA: 1, + ClientB: 1, }, - state: State{}, + State: State{}, }, { - action: addIbcChannelAction{ - chainA: chainID(consumerName), - chainB: chainID("provi"), - connectionA: 1, - portA: "consumer", - portB: "provider", - order: "ordered", + Action: addIbcChannelAction{ + ChainA: ChainID(consumerName), + ChainB: ChainID("provi"), + ConnectionA: 1, + PortA: "consumer", + PortB: "provider", + Order: "ordered", }, - state: State{}, + State: State{}, }, } @@ -154,33 +154,33 @@ func stepsChangeoverToConsumer(consumerName string) []Step { func stepRunSovereignChain() []Step { return []Step{ { - action: StartSovereignChainAction{ - chain: chainID("sover"), - validators: []StartChainValidator{ - {id: validatorID("alice"), stake: 500000000, allocation: 10000000000}, + Action: StartSovereignChainAction{ + Chain: ChainID("sover"), + Validators: []StartChainValidator{ + {Id: ValidatorID("alice"), Stake: 500000000, Allocation: 10000000000}, }, }, - state: State{ - chainID("sover"): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9500000000, + State: State{ + ChainID("sover"): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9500000000, }, }, }, }, { - action: delegateTokensAction{ - chain: chainID("sover"), - from: validatorID("alice"), - to: validatorID("alice"), - amount: 11000000, + Action: delegateTokensAction{ + Chain: ChainID("sover"), + From: ValidatorID("alice"), + To: ValidatorID("alice"), + Amount: 11000000, }, - state: State{ - chainID("sover"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 0, // does not exist on pre-ccv sover - validatorID("carol"): 0, // does not exist on pre-ccv sover + State: State{ + ChainID("sover"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 0, // does not exist on pre-ccv sover + ValidatorID("carol"): 0, // does not exist on pre-ccv sover }, }, }, @@ -192,14 +192,14 @@ func stepRunSovereignChain() []Step { func stepsUpgradeChain() []Step { return []Step{ { - action: LegacyUpgradeProposalAction{ - chainID: chainID("sover"), - upgradeTitle: "sovereign-changeover", - proposer: validatorID("alice"), - upgradeHeight: 110, + Action: LegacyUpgradeProposalAction{ + ChainID: ChainID("sover"), + UpgradeTitle: "sovereign-changeover", + Proposer: ValidatorID("alice"), + UpgradeHeight: 110, }, - state: State{ - chainID("sover"): ChainState{ + State: State{ + ChainID("sover"): ChainState{ Proposals: &map[uint]Proposal{ 1: UpgradeProposal{ Title: "sovereign-changeover", @@ -213,14 +213,14 @@ func stepsUpgradeChain() []Step { }, }, { - action: voteGovProposalAction{ - chain: chainID("sover"), - from: []validatorID{validatorID("alice")}, - vote: []string{"yes"}, - propNumber: 1, + Action: voteGovProposalAction{ + Chain: ChainID("sover"), + From: []ValidatorID{ValidatorID("alice")}, + Vote: []string{"yes"}, + PropNumber: 1, }, - state: State{ - chainID("sover"): ChainState{ + State: State{ + ChainID("sover"): ChainState{ Proposals: &map[uint]Proposal{ 1: UpgradeProposal{ Deposit: 10000000, @@ -234,11 +234,11 @@ func stepsUpgradeChain() []Step { }, }, { - action: waitUntilBlockAction{ - chain: chainID("sover"), - block: 110, + Action: waitUntilBlockAction{ + Chain: ChainID("sover"), + Block: 110, }, - state: State{}, + State: State{}, }, } } @@ -249,116 +249,116 @@ func stepsUpgradeChain() []Step { func stepsPostChangeoverDelegate(consumerName string) []Step { return []Step{ { - action: SendTokensAction{ - chain: chainID(consumerName), - from: validatorID("alice"), - to: validatorID("bob"), - amount: 100, + Action: SendTokensAction{ + Chain: ChainID(consumerName), + From: ValidatorID("alice"), + To: ValidatorID("bob"), + Amount: 100, }, - state: State{ - chainID(consumerName): ChainState{ + State: State{ + ChainID(consumerName): ChainState{ // Tx should not go through, ICS channel is not setup until first VSC packet has been relayed to consumer - ValBalances: &map[validatorID]uint{ - validatorID("bob"): 0, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("bob"): 0, }, }, }, }, { - action: delegateTokensAction{ - chain: chainID("provi"), - from: validatorID("alice"), - to: validatorID("alice"), - amount: 11000000, + Action: delegateTokensAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + To: ValidatorID("alice"), + Amount: 11000000, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 500, - validatorID("bob"): 500, - validatorID("carol"): 500, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 500, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 1, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 1, }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: SendTokensAction{ - chain: chainID(consumerName), - from: validatorID("alice"), - to: validatorID("bob"), - amount: 100, + Action: SendTokensAction{ + Chain: ChainID(consumerName), + From: ValidatorID("alice"), + To: ValidatorID("bob"), + Amount: 100, }, - state: State{ - chainID(consumerName): ChainState{ + State: State{ + ChainID(consumerName): ChainState{ // Tx should go through, ICS channel is setup - ValBalances: &map[validatorID]uint{ - validatorID("bob"): 100, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("bob"): 100, }, }, }, }, { - action: unbondTokensAction{ - chain: chainID("provi"), - unbondFrom: validatorID("alice"), - sender: validatorID("alice"), - amount: 1000000, + Action: unbondTokensAction{ + Chain: ChainID("provi"), + UnbondFrom: ValidatorID("alice"), + Sender: ValidatorID("alice"), + Amount: 1000000, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ // Voting power on consumer should not be affected yet - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 1, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 1, }, - state: State{ - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 510, - validatorID("bob"): 500, - validatorID("carol"): 500, + State: State{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 510, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, }, diff --git a/tests/e2e/steps_start_chains.go b/tests/e2e/steps_start_chains.go index 6017a22641..ace3d6c255 100644 --- a/tests/e2e/steps_start_chains.go +++ b/tests/e2e/steps_start_chains.go @@ -7,20 +7,20 @@ import ( func stepStartProviderChain() []Step { return []Step{ { - action: StartChainAction{ - chain: chainID("provi"), - validators: []StartChainValidator{ - {id: validatorID("bob"), stake: 500000000, allocation: 10000000000}, - {id: validatorID("alice"), stake: 500000000, allocation: 10000000000}, - {id: validatorID("carol"), stake: 500000000, allocation: 10000000000}, + Action: StartChainAction{ + Chain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("bob"), Stake: 500000000, Allocation: 10000000000}, + {Id: ValidatorID("alice"), Stake: 500000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 500000000, Allocation: 10000000000}, }, }, - state: State{ - chainID("provi"): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9500000000, - validatorID("bob"): 9500000000, - validatorID("carol"): 9500000000, + State: State{ + ChainID("provi"): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9500000000, + ValidatorID("bob"): 9500000000, + ValidatorID("carol"): 9500000000, }, }, }, @@ -31,24 +31,24 @@ func stepStartProviderChain() []Step { func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint, setupTransferChans bool) []Step { s := []Step{ { - action: submitConsumerAdditionProposalAction{ - chain: chainID("provi"), - from: validatorID("alice"), - deposit: 10000001, - consumerChain: chainID(consumerName), - spawnTime: 0, - initialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + Action: submitConsumerAdditionProposalAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + Deposit: 10000001, + ConsumerChain: ChainID(consumerName), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, }, - state: State{ - chainID("provi"): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9489999999, - validatorID("bob"): 9500000000, + State: State{ + ChainID("provi"): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9489999999, + ValidatorID("bob"): 9500000000, }, Proposals: &map[uint]Proposal{ proposalIndex: ConsumerAdditionProposal{ Deposit: 10000001, - Chain: chainID(consumerName), + Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, Status: "PROPOSAL_STATUS_VOTING_PERIOD", @@ -60,155 +60,155 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint // add a consumer key before the chain starts // the key will be present in consumer genesis initial_val_set { - action: assignConsumerPubKeyAction{ - chain: chainID(consumerName), - validator: validatorID("carol"), - consumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, + Action: assignConsumerPubKeyAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("carol"), + ConsumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, // consumer chain has not started // we don't need to reconfigure the node // since it will start with consumer key - reconfigureNode: false, + ReconfigureNode: false, }, - state: State{ - chainID(consumerName): ChainState{ - AssignedKeys: &map[validatorID]string{ - validatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", + State: State{ + ChainID(consumerName): ChainState{ + AssignedKeys: &map[ValidatorID]string{ + ValidatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", }, - ProviderKeys: &map[validatorID]string{ - validatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + ProviderKeys: &map[ValidatorID]string{ + ValidatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", }, }, }, }, { // op should fail - key already assigned by the same validator - action: assignConsumerPubKeyAction{ - chain: chainID(consumerName), - validator: validatorID("carol"), - consumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, - reconfigureNode: false, - expectError: true, - expectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator", + Action: assignConsumerPubKeyAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("carol"), + ConsumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, + ReconfigureNode: false, + ExpectError: true, + ExpectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator", }, - state: State{}, + State: State{}, }, { // op should fail - key already assigned by another validator - action: assignConsumerPubKeyAction{ - chain: chainID(consumerName), - validator: validatorID("bob"), + Action: assignConsumerPubKeyAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("bob"), // same pub key as carol - consumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, - reconfigureNode: false, - expectError: true, - expectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator", + ConsumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}`, + ReconfigureNode: false, + ExpectError: true, + ExpectedError: "a validator has assigned the consumer key already: consumer key is already in use by a validator", }, - state: State{ - chainID(consumerName): ChainState{ - AssignedKeys: &map[validatorID]string{ - validatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", - validatorID("bob"): "", + State: State{ + ChainID(consumerName): ChainState{ + AssignedKeys: &map[ValidatorID]string{ + ValidatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", + ValidatorID("bob"): "", }, - ProviderKeys: &map[validatorID]string{ - validatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + ProviderKeys: &map[ValidatorID]string{ + ValidatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", }, }, }, }, { - action: voteGovProposalAction{ - chain: chainID("provi"), - from: []validatorID{validatorID("alice"), validatorID("bob"), validatorID("carol")}, - vote: []string{"yes", "yes", "yes"}, - propNumber: proposalIndex, + Action: voteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, + Vote: []string{"yes", "yes", "yes"}, + PropNumber: proposalIndex, }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ Proposals: &map[uint]Proposal{ proposalIndex: ConsumerAdditionProposal{ Deposit: 10000001, - Chain: chainID(consumerName), + Chain: ChainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, Status: "PROPOSAL_STATUS_PASSED", }, }, - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9500000000, - validatorID("bob"): 9500000000, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9500000000, + ValidatorID("bob"): 9500000000, }, }, }, }, { - action: startConsumerChainAction{ - consumerChain: chainID(consumerName), - providerChain: chainID("provi"), - validators: []StartChainValidator{ - {id: validatorID("bob"), stake: 500000000, allocation: 10000000000}, - {id: validatorID("alice"), stake: 500000000, allocation: 10000000000}, - {id: validatorID("carol"), stake: 500000000, allocation: 10000000000}, + Action: startConsumerChainAction{ + ConsumerChain: ChainID(consumerName), + ProviderChain: ChainID("provi"), + Validators: []StartChainValidator{ + {Id: ValidatorID("bob"), Stake: 500000000, Allocation: 10000000000}, + {Id: ValidatorID("alice"), Stake: 500000000, Allocation: 10000000000}, + {Id: ValidatorID("carol"), Stake: 500000000, Allocation: 10000000000}, }, // For consumers that're launching with the provider being on an earlier version // of ICS before the soft opt-out threshold was introduced, we need to set the // soft opt-out threshold to 0.05 in the consumer genesis to ensure that the // consumer binary doesn't panic. Sdk requires that all params are set to valid // values from the genesis file. - genesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", + GenesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"", }, - state: State{ - chainID("provi"): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 9500000000, - validatorID("bob"): 9500000000, - validatorID("carol"): 9500000000, + State: State{ + ChainID("provi"): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9500000000, + ValidatorID("bob"): 9500000000, + ValidatorID("carol"): 9500000000, }, }, - chainID(consumerName): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("alice"): 10000000000, - validatorID("bob"): 10000000000, - validatorID("carol"): 10000000000, + ChainID(consumerName): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 10000000000, + ValidatorID("bob"): 10000000000, + ValidatorID("carol"): 10000000000, }, }, }, }, { - action: addIbcConnectionAction{ - chainA: chainID(consumerName), - chainB: chainID("provi"), - clientA: 0, - clientB: chainIndex, + Action: addIbcConnectionAction{ + ChainA: ChainID(consumerName), + ChainB: ChainID("provi"), + ClientA: 0, + ClientB: chainIndex, }, - state: State{}, + State: State{}, }, { - action: addIbcChannelAction{ - chainA: chainID(consumerName), - chainB: chainID("provi"), - connectionA: 0, - portA: "consumer", // TODO: check port mapping - portB: "provider", - order: "ordered", + Action: addIbcChannelAction{ + ChainA: ChainID(consumerName), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "consumer", // TODO: check port mapping + PortB: "provider", + Order: "ordered", }, - state: State{}, + State: State{}, }, } // currently only used in democracy tests if setupTransferChans { s = append(s, Step{ - action: transferChannelCompleteAction{ - chainA: chainID(consumerName), - chainB: chainID("provi"), - connectionA: 0, - portA: "transfer", - portB: "transfer", - order: "unordered", - channelA: 1, - channelB: 1, + Action: transferChannelCompleteAction{ + ChainA: ChainID(consumerName), + ChainB: ChainID("provi"), + ConnectionA: 0, + PortA: "transfer", + PortB: "transfer", + Order: "unordered", + ChannelA: 1, + ChannelB: 1, }, - state: State{}, + State: State{}, }) } return s @@ -228,75 +228,75 @@ func stepsStartChains(consumerNames []string, setupTransferChans bool) []Step { func stepsAssignConsumerKeyOnStartedChain(consumerName, validator string) []Step { return []Step{ { - action: assignConsumerPubKeyAction{ - chain: chainID(consumerName), - validator: validatorID("bob"), + Action: assignConsumerPubKeyAction{ + Chain: ChainID(consumerName), + Validator: ValidatorID("bob"), // reconfigure the node -> validator was using provider key // until this point -> key matches config.consumerValPubKey for "bob" - consumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, - reconfigureNode: true, + ConsumerPubkey: `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o="}`, + ReconfigureNode: true, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ // this happens after some delegations // so that the chain does not halt if 1/3 of power is offline - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ // this happens after some delegations // so that the chain does not halt if 1/3 of power is offline - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, - AssignedKeys: &map[validatorID]string{ - validatorID("bob"): "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", - validatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", + AssignedKeys: &map[ValidatorID]string{ + ValidatorID("bob"): "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", + ValidatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", }, - ProviderKeys: &map[validatorID]string{ - validatorID("bob"): "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - validatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + ProviderKeys: &map[ValidatorID]string{ + ValidatorID("bob"): "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", + ValidatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", }, }, }, }, { - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ // this happens after some delegations // so that the chain does not halt if 1/3 of power is offline - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ // this happens after some delegations // so that the chain does not halt if 1/3 of power is offline - validatorID("alice"): 511, - validatorID("bob"): 500, - validatorID("carol"): 500, + ValidatorID("alice"): 511, + ValidatorID("bob"): 500, + ValidatorID("carol"): 500, }, - AssignedKeys: &map[validatorID]string{ - validatorID("bob"): "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", - validatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", + AssignedKeys: &map[ValidatorID]string{ + ValidatorID("bob"): "cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm", + ValidatorID("carol"): "cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk", }, - ProviderKeys: &map[validatorID]string{ - validatorID("bob"): "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", - validatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", + ProviderKeys: &map[ValidatorID]string{ + ValidatorID("bob"): "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", + ValidatorID("carol"): "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", }, }, }, diff --git a/tests/e2e/steps_stop_chain.go b/tests/e2e/steps_stop_chain.go index 9cef49a9ea..0841086417 100644 --- a/tests/e2e/steps_stop_chain.go +++ b/tests/e2e/steps_stop_chain.go @@ -6,8 +6,8 @@ import "time" func stepsStartRelayer() []Step { return []Step{ { - action: startRelayerAction{}, - state: State{}, + Action: startRelayerAction{}, + State: State{}, }, } } @@ -16,51 +16,51 @@ func stepsStartRelayer() []Step { func stepsStopChain(consumerName string, propNumber uint) []Step { s := []Step{ { - action: submitConsumerRemovalProposalAction{ - chain: chainID("provi"), - from: validatorID("bob"), - deposit: 10000001, - consumerChain: chainID(consumerName), - stopTimeOffset: 0 * time.Millisecond, + Action: submitConsumerRemovalProposalAction{ + Chain: ChainID("provi"), + From: ValidatorID("bob"), + Deposit: 10000001, + ConsumerChain: ChainID(consumerName), + StopTimeOffset: 0 * time.Millisecond, }, - state: State{ - chainID("provi"): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("bob"): 9489999999, + State: State{ + ChainID("provi"): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("bob"): 9489999999, }, Proposals: &map[uint]Proposal{ propNumber: ConsumerRemovalProposal{ Deposit: 10000001, - Chain: chainID(consumerName), + Chain: ChainID(consumerName), StopTime: 0, Status: "PROPOSAL_STATUS_VOTING_PERIOD", }, }, - ConsumerChains: &map[chainID]bool{"consu": true}, // consumer chain not yet removed + ConsumerChains: &map[ChainID]bool{"consu": true}, // consumer chain not yet removed }, }, }, { - action: voteGovProposalAction{ - chain: chainID("provi"), - from: []validatorID{validatorID("alice"), validatorID("bob"), validatorID("carol")}, - vote: []string{"yes", "yes", "yes"}, - propNumber: propNumber, + Action: voteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, + Vote: []string{"yes", "yes", "yes"}, + PropNumber: propNumber, }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ Proposals: &map[uint]Proposal{ propNumber: ConsumerRemovalProposal{ Deposit: 10000001, - Chain: chainID(consumerName), + Chain: ChainID(consumerName), StopTime: 0, Status: "PROPOSAL_STATUS_PASSED", }, }, - ValBalances: &map[validatorID]uint{ - validatorID("bob"): 9500000000, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("bob"): 9500000000, }, - ConsumerChains: &map[chainID]bool{}, // Consumer chain is now removed + ConsumerChains: &map[ChainID]bool{}, // Consumer chain is now removed }, }, }, @@ -74,51 +74,51 @@ func stepsStopChain(consumerName string, propNumber uint) []Step { func stepsConsumerRemovalPropNotPassing(consumerName string, propNumber uint) []Step { s := []Step{ { - action: submitConsumerRemovalProposalAction{ - chain: chainID("provi"), - from: validatorID("bob"), - deposit: 10000001, - consumerChain: chainID(consumerName), - stopTimeOffset: 0 * time.Millisecond, + Action: submitConsumerRemovalProposalAction{ + Chain: ChainID("provi"), + From: ValidatorID("bob"), + Deposit: 10000001, + ConsumerChain: ChainID(consumerName), + StopTimeOffset: 0 * time.Millisecond, }, - state: State{ - chainID("provi"): ChainState{ - ValBalances: &map[validatorID]uint{ - validatorID("bob"): 9489999999, + State: State{ + ChainID("provi"): ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("bob"): 9489999999, }, Proposals: &map[uint]Proposal{ propNumber: ConsumerRemovalProposal{ Deposit: 10000001, - Chain: chainID(consumerName), + Chain: ChainID(consumerName), StopTime: 0, Status: "PROPOSAL_STATUS_VOTING_PERIOD", }, }, - ConsumerChains: &map[chainID]bool{"consu": true}, // consumer chain not removed + ConsumerChains: &map[ChainID]bool{"consu": true}, // consumer chain not removed }, }, }, { - action: voteGovProposalAction{ - chain: chainID("provi"), - from: []validatorID{validatorID("alice"), validatorID("bob"), validatorID("carol")}, - vote: []string{"no", "no", "no"}, - propNumber: propNumber, + Action: voteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, + Vote: []string{"no", "no", "no"}, + PropNumber: propNumber, }, - state: State{ - chainID("provi"): ChainState{ + State: State{ + ChainID("provi"): ChainState{ Proposals: &map[uint]Proposal{ propNumber: ConsumerRemovalProposal{ Deposit: 10000001, - Chain: chainID(consumerName), + Chain: ChainID(consumerName), StopTime: 0, Status: "PROPOSAL_STATUS_REJECTED", }, }, - ValBalances: &map[validatorID]uint{ - validatorID("bob"): 9500000000, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("bob"): 9500000000, }, - ConsumerChains: &map[chainID]bool{"consu": true}, // consumer chain not removed + ConsumerChains: &map[ChainID]bool{"consu": true}, // consumer chain not removed }, }, }, diff --git a/tests/e2e/steps_submit_equivocation_proposal.go b/tests/e2e/steps_submit_equivocation_proposal.go index 8af1d2464d..243c01f04d 100644 --- a/tests/e2e/steps_submit_equivocation_proposal.go +++ b/tests/e2e/steps_submit_equivocation_proposal.go @@ -7,35 +7,35 @@ func stepsRejectEquivocationProposal(consumerName string, propNumber uint) []Ste return []Step{ { // bob submits a proposal to slash himself - action: submitEquivocationProposalAction{ - chain: chainID("consu"), - from: validatorID("bob"), - deposit: 10000001, - height: 10, - time: time.Now(), - power: 500, - validator: validatorID("bob"), + Action: submitEquivocationProposalAction{ + Chain: ChainID("consu"), + From: ValidatorID("bob"), + Deposit: 10000001, + Height: 10, + Time: time.Now(), + Power: 500, + Validator: ValidatorID("bob"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, }, - ValBalances: &map[validatorID]uint{ - validatorID("bob"): 9500000000, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("bob"): 9500000000, }, Proposals: &map[uint]Proposal{ // proposal does not exist propNumber: TextProposal{}, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 495, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, }, }, }, @@ -48,24 +48,24 @@ func stepsSubmitEquivocationProposal(consumerName string, propNumber uint) []Ste s := []Step{ { // bob submits a proposal to slash himself - action: submitEquivocationProposalAction{ - chain: chainID("consu"), - from: validatorID("bob"), - deposit: 10000001, - height: 10, - time: time.Now(), // not sure what time in equivocations means - power: 500, - validator: validatorID("bob"), + Action: submitEquivocationProposalAction{ + Chain: ChainID("consu"), + From: ValidatorID("bob"), + Deposit: 10000001, + Height: 10, + Time: time.Now(), // not sure what time in equivocations means + Power: 500, + Validator: ValidatorID("bob"), }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, - ValBalances: &map[validatorID]uint{ - validatorID("bob"): 9489999999, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("bob"): 9489999999, }, Proposals: &map[uint]Proposal{ propNumber: EquivocationProposal{ @@ -77,28 +77,28 @@ func stepsSubmitEquivocationProposal(consumerName string, propNumber uint) []Ste }, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, - validatorID("carol"): 0, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, }, }, }, }, { - action: voteGovProposalAction{ - chain: chainID("provi"), - from: []validatorID{validatorID("alice"), validatorID("bob"), validatorID("carol")}, - vote: []string{"yes", "yes", "yes"}, - propNumber: propNumber, + Action: voteGovProposalAction{ + Chain: ChainID("provi"), + From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, + Vote: []string{"yes", "yes", "yes"}, + PropNumber: propNumber, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 0, // bob is tombstoned after proposal passes - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 0, // bob is tombstoned after proposal passes + ValidatorID("carol"): 0, }, Proposals: &map[uint]Proposal{ propNumber: EquivocationProposal{ @@ -110,36 +110,36 @@ func stepsSubmitEquivocationProposal(consumerName string, propNumber uint) []Ste }, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 500, // slash not reflected in consumer chain - validatorID("carol"): 0, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, // slash not reflected in consumer chain + ValidatorID("carol"): 0, }, }, }, }, { // relay power change to consumer1 - action: relayPacketsAction{ - chainA: chainID("provi"), - chainB: chainID(consumerName), - port: "provider", - channel: 0, + Action: relayPacketsAction{ + ChainA: ChainID("provi"), + ChainB: ChainID(consumerName), + Port: "provider", + Channel: 0, }, - state: State{ - chainID("provi"): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 0, - validatorID("carol"): 0, + State: State{ + ChainID("provi"): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 0, + ValidatorID("carol"): 0, }, }, - chainID(consumerName): ChainState{ - ValPowers: &map[validatorID]uint{ - validatorID("alice"): 509, - validatorID("bob"): 0, // slash relayed to consumer chain - validatorID("carol"): 0, + ChainID(consumerName): ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 0, // slash relayed to consumer chain + ValidatorID("carol"): 0, }, }, }, diff --git a/tests/e2e/trace_handlers_test.go b/tests/e2e/trace_handlers_test.go new file mode 100644 index 0000000000..cb568b1ecc --- /dev/null +++ b/tests/e2e/trace_handlers_test.go @@ -0,0 +1,242 @@ +package main + +import ( + "encoding/json" + "fmt" + "log" + "os" + "path/filepath" + "testing" + + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + "github.com/google/go-cmp/cmp" +) + +// an isolated test case for a proposal submission +var proposalSubmissionSteps = []Step{ + {submitTextProposalAction{Title: "Proposal 1", Description: "Description 1"}, State{}}, +} + +// an isolated test case for a state check involving a proposal +var proposalInStateSteps = []Step{ + { + Action: submitConsumerRemovalProposalAction{}, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerRemovalProposal{ + Deposit: 10000001, + Chain: ChainID("foo"), + StopTime: 0, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + }, + }, + }, + }, + }, +} + +// Checks that writing, then parsing a trace results in the same trace. +func TestWriterThenParser(t *testing.T) { + tests := map[string]struct { + trace []Step + }{ + "proposalSubmission": {proposalSubmissionSteps}, + "proposalInState": {proposalInStateSteps}, + "start_provider_chain": {stepStartProviderChain()}, + "happyPath": {happyPathSteps}, + "democracy": {democracySteps}, + "slashThrottle": {slashThrottleSteps}, + "multipleConsumers": {multipleConsumers}, + "shorthappy": {shortHappyPathSteps}, + "democracyRewardsSteps": {democracyRewardsSteps}, + "changeover": {changeoverSteps}, + } + + dir, err := os.MkdirTemp("", "example") + if err != nil { + log.Fatal(err) + } + defer os.RemoveAll(dir) // clean up + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + filename := filepath.Join(dir, "trace.json") + err := WriteAndReadTrace(GlobalJSONParser, GlobalJSONWriter, tc.trace, filename) + if err != nil { + t.Fatalf("in testcase %v, got error writing trace to file: %v", name, err) + } + + got, err := GlobalJSONParser.ReadTraceFromFile(filename) + if err != nil { + t.Fatalf("in testcase %v, got error reading trace from file: %v", name, err) + } + diff := cmp.Diff(tc.trace, got, cmp.AllowUnexported(Step{})) + if diff != "" { + t.Log("Got a difference for testcase " + name) + t.Errorf("(-want +got):\n%s", diff) + } + }) + } +} + +// Checks that writing a trace does not result in an error. +func TestWriteExamples(t *testing.T) { + tests := map[string]struct { + trace []Step + }{ + "start_provider_chain": {stepStartProviderChain()}, + "happyPath": {happyPathSteps}, + "democracy": {democracySteps}, + "slashThrottle": {slashThrottleSteps}, + "multipleConsumers": {multipleConsumers}, + "shorthappy": {shortHappyPathSteps}, + "democracyRewardsSteps": {democracyRewardsSteps}, + "changeover": {changeoverSteps}, + } + + dir := "tracehandler_testdata" + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + filename := filepath.Join(dir, name+".json") + err := GlobalJSONWriter.WriteTraceToFile(filename, tc.trace) + if err != nil { + t.Fatalf("error writing trace to file: %v", err) + } + }) + } +} + +func TestMarshalAndUnmarshalChainState(t *testing.T) { + tests := map[string]struct { + chainState ChainState + }{ + "consumer addition proposal": {ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9489999999, + ValidatorID("bob"): 9500000000, + }, + Proposals: &map[uint]Proposal{ + 2: ConsumerAdditionProposal{ + Deposit: 10000001, + Chain: ChainID("test"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 5, RevisionHeight: 5}, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + }, + }, + }}, + "params-proposal": {ChainState{ + ValBalances: &map[ValidatorID]uint{ + ValidatorID("alice"): 9889999998, + ValidatorID("bob"): 9960000001, + }, + Proposals: &map[uint]Proposal{ + 1: ParamsProposal{ + Deposit: 10000001, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + Subspace: "staking", + Key: "MaxValidators", + Value: "105", + }, + }, + }}, + "consuemr removal proposal": {ChainState{ + Proposals: &map[uint]Proposal{ + 5: ConsumerRemovalProposal{ + Deposit: 10000001, + Chain: ChainID("test123"), + StopTime: 5000000000, + Status: "PROPOSAL_STATUS_PASSED", + }, + }, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("bob"): 9500000000, + }, + ConsumerChains: &map[ChainID]bool{}, // Consumer chain is now removed + }}, + "text-proposal": {ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 495, + }, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("bob"): 9500000000, + }, + Proposals: &map[uint]Proposal{ + // proposal does not exist + 10: TextProposal{}, + }, + }}, + "equivocation-proposal": {ChainState{ + ValPowers: &map[ValidatorID]uint{ + ValidatorID("alice"): 509, + ValidatorID("bob"): 500, + ValidatorID("carol"): 0, + }, + ValBalances: &map[ValidatorID]uint{ + ValidatorID("bob"): 9489999999, + }, + Proposals: &map[uint]Proposal{ + 5: EquivocationProposal{ + Deposit: 10000001, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + ConsensusAddress: "cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39", + Power: 500, + Height: 10, + }, + }, + }}, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + err := MarshalAndUnmarshalChainState(tc.chainState) + if err != nil { + t.Fatalf(err.Error()) + } + }) + } +} + +func MarshalAndUnmarshalChainState(chainState ChainState) error { + jsonobj, err := json.Marshal(chainState) + if err != nil { + return fmt.Errorf("error marshalling chain state: %v", err) + } + + var got *ChainState + err = json.Unmarshal(jsonobj, &got) + if err != nil { + return fmt.Errorf("error unmarshalling chain state: %v", err) + } + + diff := cmp.Diff(chainState, *got) + if diff != "" { + log.Print(string(jsonobj)) + return fmt.Errorf(diff) + } + + return nil +} + +func WriteAndReadTrace(parser TraceParser, writer TraceWriter, trace []Step, tmp_filepath string) error { + err := writer.WriteTraceToFile(tmp_filepath, trace) + if err != nil { + return fmt.Errorf("error writing trace to file: %v", err) + } + + got, err := parser.ReadTraceFromFile(tmp_filepath) + if err != nil { + return fmt.Errorf("error reading trace from file: %v", err) + } + + diff := cmp.Diff(trace, got, cmp.AllowUnexported(Step{})) + if diff != "" { + return fmt.Errorf(diff) + } + + return nil +} diff --git a/tests/e2e/tracehandler_testdata/changeover.json b/tests/e2e/tracehandler_testdata/changeover.json new file mode 100644 index 0000000000..83cf264bfc --- /dev/null +++ b/tests/e2e/tracehandler_testdata/changeover.json @@ -0,0 +1 @@ +[{"ActionType":"main.StartSovereignChainAction","Action":{"Chain":"sover","Validators":[{"Id":"alice","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":""},"State":{"sover":{"ValBalances":{"alice":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"sover","From":"alice","To":"alice","Amount":11000000},"State":{"sover":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.StartChainAction","Action":{"Chain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":"","SkipGentx":false},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.createIbcClientsAction","Action":{"ChainA":"sover","ChainB":"provi"},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"sover","ChainB":"provi","ConnectionA":0,"PortA":"transfer","PortB":"transfer","Order":"unordered","Version":"ics20-1"},"State":{}},{"ActionType":"main.LegacyUpgradeProposalAction","Action":{"ChainID":"sover","UpgradeTitle":"sovereign-changeover","Proposer":"alice","UpgradeHeight":110},"State":{"sover":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Title":"sovereign-changeover","Description":"","UpgradeHeight":110,"Type":"/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal","Deposit":10000000,"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.UpgradeProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"sover","From":["alice"],"Vote":["yes"],"PropNumber":1},"State":{"sover":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Title":"sovereign-changeover","Description":"","UpgradeHeight":110,"Type":"/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal","Deposit":10000000,"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.UpgradeProposal"}}}}},{"ActionType":"main.waitUntilBlockAction","Action":{"Block":110,"Chain":"sover"},"State":{}},{"ActionType":"main.submitConsumerAdditionProposalAction","Action":{"PreCCV":true,"Chain":"provi","From":"alice","Deposit":10000001,"ConsumerChain":"sover","SpawnTime":0,"InitialHeight":{"revision_height":111},"DistributionChannel":"channel-0"},"State":{"provi":{"ValBalances":{"alice":9489999999,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"sover","SpawnTime":0,"InitialHeight":{"revision_height":111},"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":1},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"sover","SpawnTime":0,"InitialHeight":{"revision_height":111},"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.ChangeoverChainAction","Action":{"SovereignChain":"sover","ProviderChain":"provi","Validators":[{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\""},"State":{"provi":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"sover":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.addIbcConnectionAction","Action":{"ChainA":"sover","ChainB":"provi","ClientA":1,"ClientB":1},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"sover","ChainB":"provi","ConnectionA":1,"PortA":"consumer","PortB":"provider","Order":"ordered","Version":""},"State":{}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"sover","From":"alice","To":"bob","Amount":100},"State":{"sover":{"ValBalances":{"bob":0},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"provi","From":"alice","To":"alice","Amount":11000000},"State":{"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"sover":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"sover","Port":"provider","Channel":1},"State":{"sover":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"sover","From":"alice","To":"bob","Amount":100},"State":{"sover":{"ValBalances":{"bob":100},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unbondTokensAction","Action":{"Chain":"provi","Sender":"alice","UnbondFrom":"alice","Amount":1000000},"State":{"provi":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"sover":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"sover","Port":"provider","Channel":1},"State":{"sover":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}}] \ No newline at end of file diff --git a/tests/e2e/tracehandler_testdata/democracy.json b/tests/e2e/tracehandler_testdata/democracy.json new file mode 100644 index 0000000000..b078d6f87e --- /dev/null +++ b/tests/e2e/tracehandler_testdata/democracy.json @@ -0,0 +1 @@ +[{"ActionType":"main.StartChainAction","Action":{"Chain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":"","SkipGentx":false},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitConsumerAdditionProposalAction","Action":{"PreCCV":false,"Chain":"provi","From":"alice","Deposit":10000001,"ConsumerChain":"democ","SpawnTime":0,"InitialHeight":{"revision_height":1},"DistributionChannel":""},"State":{"provi":{"ValBalances":{"alice":9489999999,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"democ","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"democ","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":false,"ExpectedError":""},"State":{"democ":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"democ","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"democ","Validator":"bob","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{"democ":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"bob":"","carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":1},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"democ","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.startConsumerChainAction","Action":{"ConsumerChain":"democ","ProviderChain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\""},"State":{"democ":{"ValBalances":{"alice":10000000000,"bob":10000000000,"carol":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.addIbcConnectionAction","Action":{"ChainA":"democ","ChainB":"provi","ClientA":0,"ClientB":0},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"democ","ChainB":"provi","ConnectionA":0,"PortA":"consumer","PortB":"provider","Order":"ordered","Version":""},"State":{}},{"ActionType":"main.transferChannelCompleteAction","Action":{"ChainA":"democ","ChainB":"provi","ConnectionA":0,"PortA":"transfer","PortB":"transfer","Order":"unordered","ChannelA":1,"ChannelB":1},"State":{}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"provi","From":"alice","To":"alice","Amount":11000000},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"democ","From":"alice","To":"bob","Amount":1},"State":{"democ":{"ValBalances":{"alice":10000000000,"bob":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"democ","Port":"provider","Channel":0},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"democ","From":"alice","To":"bob","Amount":1},"State":{"democ":{"ValBalances":{"alice":9999999999,"bob":10000000001},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.registerRepresentativeAction","Action":{"Chain":"democ","Representatives":["alice","bob"],"Stakes":[100000000,40000000]},"State":{"democ":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":{"alice":100000000,"bob":40000000},"Params":null,"Rewards":{"IsRewarded":{"alice":true,"bob":true,"carol":false},"IsIncrementalReward":true,"IsNativeDenom":true},"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"democ","From":"carol","To":"alice","Amount":500000},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":{"alice":100500000,"bob":40000000},"Params":null,"Rewards":{"IsRewarded":{"alice":true,"bob":true,"carol":true},"IsIncrementalReward":true,"IsNativeDenom":true},"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitParamChangeLegacyProposalAction","Action":{"Chain":"democ","From":"alice","Deposit":10000001,"Subspace":"transfer","Key":"SendEnabled","Value":true},"State":{"democ":{"ValBalances":{"alice":9889999998,"bob":9960000001},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Status":"PROPOSAL_STATUS_VOTING_PERIOD","Subspace":"transfer","Key":"SendEnabled","Value":"true"},"Type":"main.ParamsProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"democ","From":["alice","bob"],"Vote":["yes","no"],"PropNumber":1},"State":{"democ":{"ValBalances":{"alice":9889999998,"bob":9960000001},"ValPowers":null,"RepresentativePowers":null,"Params":[{"Subspace":"transfer","Key":"SendEnabled","Value":"true"}],"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayRewardPacketsToProviderAction","Action":{"ConsumerChain":"democ","ProviderChain":"provi","Port":"transfer","Channel":1},"State":{"provi":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":{"IsRewarded":{"alice":false,"bob":false,"carol":false},"IsIncrementalReward":false,"IsNativeDenom":false},"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":[],"Proposals":null}}},{"ActionType":"main.submitChangeRewardDenomsProposalAction","Action":{"Denom":"ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9","Deposit":10000001,"From":"bob"},"State":{"provi":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":[],"Proposals":null}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":2},"State":{"provi":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":["ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9"],"Proposals":null}}},{"ActionType":"main.relayRewardPacketsToProviderAction","Action":{"ConsumerChain":"democ","ProviderChain":"provi","Port":"transfer","Channel":1},"State":{"provi":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":{"IsRewarded":{"alice":true,"bob":true,"carol":true},"IsIncrementalReward":false,"IsNativeDenom":false},"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"democ","Validator":"bob"},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"democ","Port":"provider","Channel":0},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"democ","Port":"provider","Channel":0},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unjailValidatorAction","Action":{"Provider":"provi","Validator":"bob"},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"democ","Port":"provider","Channel":0},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":{"alice":100500000,"bob":40000000},"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}}] \ No newline at end of file diff --git a/tests/e2e/tracehandler_testdata/happyPath.json b/tests/e2e/tracehandler_testdata/happyPath.json new file mode 100644 index 0000000000..dd33a2a98c --- /dev/null +++ b/tests/e2e/tracehandler_testdata/happyPath.json @@ -0,0 +1 @@ +[{"ActionType":"main.StartChainAction","Action":{"Chain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":"","SkipGentx":false},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitConsumerAdditionProposalAction","Action":{"PreCCV":false,"Chain":"provi","From":"alice","Deposit":10000001,"ConsumerChain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"DistributionChannel":""},"State":{"provi":{"ValBalances":{"alice":9489999999,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":false,"ExpectedError":""},"State":{"consu":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"bob","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{"consu":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"bob":"","carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":1},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.startConsumerChainAction","Action":{"ConsumerChain":"consu","ProviderChain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\""},"State":{"consu":{"ValBalances":{"alice":10000000000,"bob":10000000000,"carol":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.addIbcConnectionAction","Action":{"ChainA":"consu","ChainB":"provi","ClientA":0,"ClientB":0},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"consu","ChainB":"provi","ConnectionA":0,"PortA":"consumer","PortB":"provider","Order":"ordered","Version":""},"State":{}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"provi","From":"alice","To":"alice","Amount":11000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"consu","From":"alice","To":"bob","Amount":1},"State":{"consu":{"ValBalances":{"alice":10000000000,"bob":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"consu","From":"alice","To":"bob","Amount":1},"State":{"consu":{"ValBalances":{"alice":9999999999,"bob":10000000001},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"bob","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"QlG+iYe6AyYpvY1z9RNJKCVlH14Q/qSz4EjGdGCru3o=\"}","ReconfigureNode":true,"ExpectError":false,"ExpectedError":""},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"bob":"cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm","carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"bob":"cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39","carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"bob":"cosmosvalcons1uuec3cjxajv5te08p220usrjhkfhg9wyvqn0tm","carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"bob":"cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39","carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unbondTokensAction","Action":{"Chain":"provi","Sender":"alice","UnbondFrom":"alice","Amount":1000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unbondTokensAction","Action":{"Chain":"provi","Sender":"alice","UnbondFrom":"alice","Amount":1000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.cancelUnbondTokensAction","Action":{"Chain":"provi","Delegator":"alice","Validator":"alice","Amount":1000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.redelegateTokensAction","Action":{"Chain":"provi","Src":"alice","Dst":"carol","TxSender":"alice","Amount":450000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":60,"bob":500,"carol":950},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":60,"bob":500,"carol":950},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"consu","Validator":"alice"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":60,"bob":500,"carol":950},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":60,"bob":500,"carol":950},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":60,"bob":500,"carol":950},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":60,"bob":500,"carol":950},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.redelegateTokensAction","Action":{"Chain":"provi","Src":"carol","Dst":"alice","TxSender":"carol","Amount":449000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":60,"bob":500,"carol":950},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"consu","Validator":"bob"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unjailValidatorAction","Action":{"Provider":"provi","Validator":"bob"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"provi","Validator":"carol"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unjailValidatorAction","Action":{"Provider":"provi","Validator":"carol"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitEquivocationProposalAction","Action":{"Chain":"consu","Height":10,"Time":"2023-09-13T15:21:09.858003+02:00","Power":500,"Validator":"bob","Deposit":10000001,"From":"bob"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":{"bob":9500000000},"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"2":{"RawProposal":{"Title":"","Description":"","Deposit":0,"Status":""},"Type":"main.TextProposal"}}}}},{"ActionType":"main.doublesignSlashAction","Action":{"Validator":"carol","Chain":"provi"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.doublesignSlashAction","Action":{"Validator":"bob","Chain":"consu"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitEquivocationProposalAction","Action":{"Chain":"consu","Height":10,"Time":"2023-09-13T15:21:09.858006+02:00","Power":500,"Validator":"bob","Deposit":10000001,"From":"bob"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":{"bob":9489999999},"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"2":{"RawProposal":{"Height":10,"Power":500,"ConsensusAddress":"cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39","Deposit":10000001,"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.EquivocationProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":2},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"2":{"RawProposal":{"Height":10,"Power":500,"ConsensusAddress":"cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39","Deposit":10000001,"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.EquivocationProposal"}}}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.startRelayerAction","Action":{},"State":{}},{"ActionType":"main.submitConsumerRemovalProposalAction","Action":{"Chain":"provi","From":"bob","Deposit":10000001,"ConsumerChain":"consu","StopTimeOffset":0},"State":{"provi":{"ValBalances":{"bob":9489999999},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{"consu":true},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"3":{"RawProposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerRemovalProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["no","no","no"],"PropNumber":3},"State":{"provi":{"ValBalances":{"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{"consu":true},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"3":{"RawProposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_REJECTED"},"Type":"main.ConsumerRemovalProposal"}}}}},{"ActionType":"main.submitConsumerRemovalProposalAction","Action":{"Chain":"provi","From":"bob","Deposit":10000001,"ConsumerChain":"consu","StopTimeOffset":0},"State":{"provi":{"ValBalances":{"bob":9489999999},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{"consu":true},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"4":{"RawProposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerRemovalProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":4},"State":{"provi":{"ValBalances":{"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"4":{"RawProposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerRemovalProposal"}}}}}] \ No newline at end of file diff --git a/tests/e2e/tracehandler_testdata/multipleConsumers.json b/tests/e2e/tracehandler_testdata/multipleConsumers.json new file mode 100644 index 0000000000..ebdc4a673a --- /dev/null +++ b/tests/e2e/tracehandler_testdata/multipleConsumers.json @@ -0,0 +1 @@ +[{"ActionType":"main.StartChainAction","Action":{"Chain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":"","SkipGentx":false},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitConsumerAdditionProposalAction","Action":{"PreCCV":false,"Chain":"provi","From":"alice","Deposit":10000001,"ConsumerChain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"DistributionChannel":""},"State":{"provi":{"ValBalances":{"alice":9489999999,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":false,"ExpectedError":""},"State":{"consu":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"bob","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{"consu":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"bob":"","carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":1},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.startConsumerChainAction","Action":{"ConsumerChain":"consu","ProviderChain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\""},"State":{"consu":{"ValBalances":{"alice":10000000000,"bob":10000000000,"carol":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.addIbcConnectionAction","Action":{"ChainA":"consu","ChainB":"provi","ClientA":0,"ClientB":0},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"consu","ChainB":"provi","ConnectionA":0,"PortA":"consumer","PortB":"provider","Order":"ordered","Version":""},"State":{}},{"ActionType":"main.submitConsumerAdditionProposalAction","Action":{"PreCCV":false,"Chain":"provi","From":"alice","Deposit":10000001,"ConsumerChain":"densu","SpawnTime":0,"InitialHeight":{"revision_height":1},"DistributionChannel":""},"State":{"provi":{"ValBalances":{"alice":9489999999,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"2":{"RawProposal":{"Deposit":10000001,"Chain":"densu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"densu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":false,"ExpectedError":""},"State":{"densu":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"densu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"densu","Validator":"bob","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{"densu":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"bob":"","carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":2},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"2":{"RawProposal":{"Deposit":10000001,"Chain":"densu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.startConsumerChainAction","Action":{"ConsumerChain":"densu","ProviderChain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\""},"State":{"densu":{"ValBalances":{"alice":10000000000,"bob":10000000000,"carol":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.addIbcConnectionAction","Action":{"ChainA":"densu","ChainB":"provi","ClientA":0,"ClientB":1},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"densu","ChainB":"provi","ConnectionA":0,"PortA":"consumer","PortB":"provider","Order":"ordered","Version":""},"State":{}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"provi","From":"alice","To":"alice","Amount":11000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"densu","Port":"provider","Channel":1},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unbondTokensAction","Action":{"Chain":"provi","Sender":"alice","UnbondFrom":"alice","Amount":1000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"densu","Port":"provider","Channel":1},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.redelegateTokensAction","Action":{"Chain":"provi","Src":"alice","Dst":"carol","TxSender":"alice","Amount":1000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"densu","Port":"provider","Channel":1},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"consu","Validator":"bob"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"densu","Port":"provider","Channel":1},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unjailValidatorAction","Action":{"Provider":"provi","Validator":"bob"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"densu","Port":"provider","Channel":1},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"provi","Validator":"carol"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"densu","Port":"provider","Channel":1},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unjailValidatorAction","Action":{"Provider":"provi","Validator":"carol"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"densu","Port":"provider","Channel":1},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.doublesignSlashAction","Action":{"Validator":"carol","Chain":"provi"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"densu","Port":"provider","Channel":1},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.doublesignSlashAction","Action":{"Validator":"bob","Chain":"consu"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"densu","Port":"provider","Channel":1},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"densu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}}] \ No newline at end of file diff --git a/tests/e2e/tracehandler_testdata/rewardDenomConsumer.json b/tests/e2e/tracehandler_testdata/rewardDenomConsumer.json new file mode 100644 index 0000000000..62f242418a --- /dev/null +++ b/tests/e2e/tracehandler_testdata/rewardDenomConsumer.json @@ -0,0 +1 @@ +[{"ActionType":"main.StartChainAction","Action":{"Chain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":"","SkipGentx":false},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitConsumerAdditionProposalAction","Action":{"PreCCV":false,"Chain":"provi","From":"alice","Deposit":10000001,"ConsumerChain":"democ","SpawnTime":0,"InitialHeight":{"revision_height":1},"DistributionChannel":""},"State":{"provi":{"ValBalances":{"alice":9489999999,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"democ","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"democ","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":false,"ExpectedError":""},"State":{"democ":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"democ","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"democ","Validator":"bob","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{"democ":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"bob":"","carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":1},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"democ","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.startConsumerChainAction","Action":{"ConsumerChain":"democ","ProviderChain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\""},"State":{"democ":{"ValBalances":{"alice":10000000000,"bob":10000000000,"carol":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.addIbcConnectionAction","Action":{"ChainA":"democ","ChainB":"provi","ClientA":0,"ClientB":0},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"democ","ChainB":"provi","ConnectionA":0,"PortA":"consumer","PortB":"provider","Order":"ordered","Version":""},"State":{}},{"ActionType":"main.transferChannelCompleteAction","Action":{"ChainA":"democ","ChainB":"provi","ConnectionA":0,"PortA":"transfer","PortB":"transfer","Order":"unordered","ChannelA":1,"ChannelB":1},"State":{}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"provi","From":"alice","To":"alice","Amount":11000000},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"democ","From":"alice","To":"bob","Amount":1},"State":{"democ":{"ValBalances":{"alice":10000000000,"bob":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"democ","Port":"provider","Channel":0},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"democ","From":"alice","To":"bob","Amount":1},"State":{"democ":{"ValBalances":{"alice":9999999999,"bob":10000000001},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.registerRepresentativeAction","Action":{"Chain":"democ","Representatives":["alice","bob"],"Stakes":[100000000,40000000]},"State":{"democ":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":{"alice":100000000,"bob":40000000},"Params":null,"Rewards":{"IsRewarded":{"alice":true,"bob":true,"carol":false},"IsIncrementalReward":true,"IsNativeDenom":true},"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"democ","From":"carol","To":"alice","Amount":500000},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":{"alice":100500000,"bob":40000000},"Params":null,"Rewards":{"IsRewarded":{"alice":true,"bob":true,"carol":true},"IsIncrementalReward":true,"IsNativeDenom":true},"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitParamChangeLegacyProposalAction","Action":{"Chain":"democ","From":"alice","Deposit":10000001,"Subspace":"transfer","Key":"SendEnabled","Value":true},"State":{"democ":{"ValBalances":{"alice":9889999998,"bob":9960000001},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Status":"PROPOSAL_STATUS_VOTING_PERIOD","Subspace":"transfer","Key":"SendEnabled","Value":"true"},"Type":"main.ParamsProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"democ","From":["alice","bob"],"Vote":["yes","no"],"PropNumber":1},"State":{"democ":{"ValBalances":{"alice":9889999998,"bob":9960000001},"ValPowers":null,"RepresentativePowers":null,"Params":[{"Subspace":"transfer","Key":"SendEnabled","Value":"true"}],"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayRewardPacketsToProviderAction","Action":{"ConsumerChain":"democ","ProviderChain":"provi","Port":"transfer","Channel":1},"State":{"provi":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":{"IsRewarded":{"alice":false,"bob":false,"carol":false},"IsIncrementalReward":false,"IsNativeDenom":false},"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":[],"Proposals":null}}},{"ActionType":"main.submitChangeRewardDenomsProposalAction","Action":{"Denom":"ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9","Deposit":10000001,"From":"bob"},"State":{"provi":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":[],"Proposals":null}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":2},"State":{"provi":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":["ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9"],"Proposals":null}}},{"ActionType":"main.relayRewardPacketsToProviderAction","Action":{"ConsumerChain":"democ","ProviderChain":"provi","Port":"transfer","Channel":1},"State":{"provi":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":{"IsRewarded":{"alice":false,"bob":false,"carol":false},"IsIncrementalReward":false,"IsNativeDenom":false},"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"democ","Validator":"bob"},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"democ","Port":"provider","Channel":0},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"democ","Port":"provider","Channel":0},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unjailValidatorAction","Action":{"Provider":"provi","Validator":"bob"},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"democ","Port":"provider","Channel":0},"State":{"democ":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":{"alice":100500000,"bob":40000000},"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}}] \ No newline at end of file diff --git a/tests/e2e/tracehandler_testdata/shorthappy.json b/tests/e2e/tracehandler_testdata/shorthappy.json new file mode 100644 index 0000000000..43f0372a73 --- /dev/null +++ b/tests/e2e/tracehandler_testdata/shorthappy.json @@ -0,0 +1 @@ +[{"ActionType":"main.StartChainAction","Action":{"Chain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":"","SkipGentx":false},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitConsumerAdditionProposalAction","Action":{"PreCCV":false,"Chain":"provi","From":"alice","Deposit":10000001,"ConsumerChain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"DistributionChannel":""},"State":{"provi":{"ValBalances":{"alice":9489999999,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":false,"ExpectedError":""},"State":{"consu":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"bob","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{"consu":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"bob":"","carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":1},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.startConsumerChainAction","Action":{"ConsumerChain":"consu","ProviderChain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\""},"State":{"consu":{"ValBalances":{"alice":10000000000,"bob":10000000000,"carol":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.addIbcConnectionAction","Action":{"ChainA":"consu","ChainB":"provi","ClientA":0,"ClientB":0},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"consu","ChainB":"provi","ConnectionA":0,"PortA":"consumer","PortB":"provider","Order":"ordered","Version":""},"State":{}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"provi","From":"alice","To":"alice","Amount":11000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"consu","From":"alice","To":"bob","Amount":1},"State":{"consu":{"ValBalances":{"alice":10000000000,"bob":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"consu","From":"alice","To":"bob","Amount":1},"State":{"consu":{"ValBalances":{"alice":9999999999,"bob":10000000001},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unbondTokensAction","Action":{"Chain":"provi","Sender":"alice","UnbondFrom":"alice","Amount":1000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.redelegateTokensAction","Action":{"Chain":"provi","Src":"alice","Dst":"carol","TxSender":"alice","Amount":1000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"consu","Validator":"bob"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unjailValidatorAction","Action":{"Provider":"provi","Validator":"bob"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"provi","Validator":"carol"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":501},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unjailValidatorAction","Action":{"Provider":"provi","Validator":"carol"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitEquivocationProposalAction","Action":{"Chain":"consu","Height":10,"Time":"2023-09-13T15:21:09.858029+02:00","Power":500,"Validator":"bob","Deposit":10000001,"From":"bob"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":{"bob":9500000000},"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"2":{"RawProposal":{"Title":"","Description":"","Deposit":0,"Status":""},"Type":"main.TextProposal"}}}}},{"ActionType":"main.doublesignSlashAction","Action":{"Validator":"carol","Chain":"provi"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":495},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.doublesignSlashAction","Action":{"Validator":"bob","Chain":"consu"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitEquivocationProposalAction","Action":{"Chain":"consu","Height":10,"Time":"2023-09-13T15:21:09.858031+02:00","Power":500,"Validator":"bob","Deposit":10000001,"From":"bob"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":{"bob":9489999999},"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"2":{"RawProposal":{"Height":10,"Power":500,"ConsensusAddress":"cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39","Deposit":10000001,"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.EquivocationProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":2},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":500,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"2":{"RawProposal":{"Height":10,"Power":500,"ConsensusAddress":"cosmosvalcons1nx7n5uh0ztxsynn4sje6eyq2ud6rc6klc96w39","Deposit":10000001,"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.EquivocationProposal"}}}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":509,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.startRelayerAction","Action":{},"State":{}},{"ActionType":"main.submitConsumerRemovalProposalAction","Action":{"Chain":"provi","From":"bob","Deposit":10000001,"ConsumerChain":"consu","StopTimeOffset":0},"State":{"provi":{"ValBalances":{"bob":9489999999},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{"consu":true},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"3":{"RawProposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerRemovalProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["no","no","no"],"PropNumber":3},"State":{"provi":{"ValBalances":{"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{"consu":true},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"3":{"RawProposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_REJECTED"},"Type":"main.ConsumerRemovalProposal"}}}}},{"ActionType":"main.submitConsumerRemovalProposalAction","Action":{"Chain":"provi","From":"bob","Deposit":10000001,"ConsumerChain":"consu","StopTimeOffset":0},"State":{"provi":{"ValBalances":{"bob":9489999999},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{"consu":true},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"4":{"RawProposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerRemovalProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":4},"State":{"provi":{"ValBalances":{"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"4":{"RawProposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerRemovalProposal"}}}}}] \ No newline at end of file diff --git a/tests/e2e/tracehandler_testdata/slashThrottle.json b/tests/e2e/tracehandler_testdata/slashThrottle.json new file mode 100644 index 0000000000..f44effb891 --- /dev/null +++ b/tests/e2e/tracehandler_testdata/slashThrottle.json @@ -0,0 +1 @@ +[{"ActionType":"main.StartChainAction","Action":{"Chain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":"","SkipGentx":false},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitConsumerAdditionProposalAction","Action":{"PreCCV":false,"Chain":"provi","From":"alice","Deposit":10000001,"ConsumerChain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"DistributionChannel":""},"State":{"provi":{"ValBalances":{"alice":9489999999,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":false,"ExpectedError":""},"State":{"consu":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"bob","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true,"ExpectedError":"a validator has assigned the consumer key already: consumer key is already in use by a validator"},"State":{"consu":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"bob":"","carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":1},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.startConsumerChainAction","Action":{"ConsumerChain":"consu","ProviderChain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\""},"State":{"consu":{"ValBalances":{"alice":10000000000,"bob":10000000000,"carol":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.addIbcConnectionAction","Action":{"ChainA":"consu","ChainB":"provi","ClientA":0,"ClientB":0},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"consu","ChainB":"provi","ConnectionA":0,"PortA":"consumer","PortB":"provider","Order":"ordered","Version":""},"State":{}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"provi","From":"alice","To":"alice","Amount":11000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"consu","From":"alice","To":"bob","Amount":1},"State":{"consu":{"ValBalances":{"alice":10000000000,"bob":10000000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"consu","From":"alice","To":"bob","Amount":1},"State":{"consu":{"ValBalances":{"alice":9999999999,"bob":10000000001},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"consu","Validator":"bob"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":{"consu":0},"GlobalSlashQueueSize":0,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"consu","Validator":"carol"},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":{"consu":1},"GlobalSlashQueueSize":1,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.slashThrottleDequeue","Action":{"Chain":"consu","CurrentQueueSize":1,"NextQueueSize":0,"Timeout":80000000000},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":{"consu":0},"GlobalSlashQueueSize":0,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"consu","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":{"consu":0},"GlobalSlashQueueSize":0,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.submitConsumerRemovalProposalAction","Action":{"Chain":"provi","From":"bob","Deposit":10000001,"ConsumerChain":"consu","StopTimeOffset":0},"State":{"provi":{"ValBalances":{"bob":9489999999},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{"consu":true},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"2":{"RawProposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerRemovalProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":2},"State":{"provi":{"ValBalances":{"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"2":{"RawProposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerRemovalProposal"}}}}}] \ No newline at end of file diff --git a/tests/e2e/tracehandler_testdata/slashThrottleSteps.json b/tests/e2e/tracehandler_testdata/slashThrottleSteps.json new file mode 100644 index 0000000000..c06c4b4bb6 --- /dev/null +++ b/tests/e2e/tracehandler_testdata/slashThrottleSteps.json @@ -0,0 +1 @@ +[{"ActionType":"main.StartChainAction","Action":{"Chain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":"","SkipGentx":false},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"Proposals":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.submitConsumerAdditionProposalAction","Action":{"Chain":"provi","From":"alice","Deposit":10000001,"ConsumerChain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1}},"State":{"provi":{"ValBalances":{"alice":9489999999,"bob":9500000000},"Proposals":{"1":{"ProposalType":"main.ConsumerAdditionProposal","Proposal":{"Deposit":10000001,"Chain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_VOTING_PERIOD"}}},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":false},"State":{"consu":{"ValBalances":null,"Proposals":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"carol","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true},"State":{}},{"ActionType":"main.assignConsumerPubKeyAction","Action":{"Chain":"consu","Validator":"bob","ConsumerPubkey":"{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is=\"}","ReconfigureNode":false,"ExpectError":true},"State":{"consu":{"ValBalances":null,"Proposals":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":{"bob":"","carol":"cosmosvalcons1kswr5sq599365kcjmhgufevfps9njf43e4lwdk"},"ProviderKeys":{"carol":"cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6"},"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":1},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000},"Proposals":{"1":{"ProposalType":"main.ConsumerAdditionProposal","Proposal":{"Deposit":10000001,"Chain":"consu","SpawnTime":0,"InitialHeight":{"revision_height":1},"Status":"PROPOSAL_STATUS_PASSED"}}},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.startConsumerChainAction","Action":{"ConsumerChain":"consu","ProviderChain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\""},"State":{"consu":{"ValBalances":{"alice":10000000000,"bob":10000000000,"carol":10000000000},"Proposals":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null},"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"Proposals":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.addIbcConnectionAction","Action":{"ChainA":"consu","ChainB":"provi","ClientA":0,"ClientB":0},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"consu","ChainB":"provi","ConnectionA":0,"PortA":"consumer","PortB":"provider","Order":"ordered"},"State":{}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"provi","From":"alice","To":"alice","Amount":11000000},"State":{"consu":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null},"provi":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"consu","From":"alice","To":"bob","Amount":1},"State":{"consu":{"ValBalances":{"alice":10000000000,"bob":10000000000},"Proposals":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.relayPacketsAction","Action":{"Chain":"provi","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"consu","From":"alice","To":"bob","Amount":1},"State":{"consu":{"ValBalances":{"alice":9999999999,"bob":10000000001},"Proposals":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"consu","Validator":"bob"},"State":{"consu":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null},"provi":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.downtimeSlashAction","Action":{"Chain":"consu","Validator":"carol"},"State":{"consu":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null},"provi":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.relayPacketsAction","Action":{"Chain":"provi","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null},"provi":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":0,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":{"consu":1},"GlobalSlashQueueSize":1}}},{"ActionType":"main.slashThrottleDequeue","Action":{"Chain":"consu","CurrentQueueSize":1,"NextQueueSize":0,"Timeout":80000000000},"State":{"consu":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null},"provi":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":{"consu":0},"GlobalSlashQueueSize":0}}},{"ActionType":"main.relayPacketsAction","Action":{"Chain":"provi","Port":"provider","Channel":0},"State":{"consu":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null},"provi":{"ValBalances":null,"Proposals":null,"ValPowers":{"alice":511,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":{"consu":0},"GlobalSlashQueueSize":0}}},{"ActionType":"main.submitConsumerRemovalProposalAction","Action":{"Chain":"provi","From":"bob","Deposit":10000001,"ConsumerChain":"consu","StopTimeOffset":0},"State":{"provi":{"ValBalances":{"bob":9489999999},"Proposals":{"2":{"ProposalType":"main.ConsumerRemovalProposal","Proposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_VOTING_PERIOD"}}},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{"consu":true},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":2},"State":{"provi":{"ValBalances":{"bob":9500000000},"Proposals":{"2":{"ProposalType":"main.ConsumerRemovalProposal","Proposal":{"Deposit":10000001,"Chain":"consu","StopTime":0,"Status":"PROPOSAL_STATUS_PASSED"}}},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":{},"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null}}}] \ No newline at end of file diff --git a/tests/e2e/tracehandler_testdata/start_provider_chain.json b/tests/e2e/tracehandler_testdata/start_provider_chain.json new file mode 100644 index 0000000000..7093324566 --- /dev/null +++ b/tests/e2e/tracehandler_testdata/start_provider_chain.json @@ -0,0 +1 @@ +[{"ActionType":"main.StartChainAction","Action":{"Chain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":"","SkipGentx":false},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}}] \ No newline at end of file