From bc799aa32d5dae1aeb1320ff585090b5b132af7d Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Fri, 14 Feb 2025 15:02:54 -0800 Subject: [PATCH 01/12] unordered tx test --- tests/systemtests/go.mod | 6 +-- tests/systemtests/go.sum | 3 +- tests/systemtests/unordered_tx_test.go | 52 ++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 tests/systemtests/unordered_tx_test.go diff --git a/tests/systemtests/go.mod b/tests/systemtests/go.mod index 365cd1d7a1ad..289b11b0229b 100644 --- a/tests/systemtests/go.mod +++ b/tests/systemtests/go.mod @@ -4,9 +4,11 @@ go 1.23 toolchain go1.24.0 +replace cosmossdk.io/systemtests => ../../systemtests + require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect - github.com/cosmos/cosmos-sdk v0.50.11 + github.com/cosmos/cosmos-sdk v0.50.11 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/gogoproto v1.7.0 // indirect github.com/cosmos/iavl v1.2.2 // indirect @@ -174,5 +176,3 @@ require ( pgregory.net/rapid v1.1.0 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) - -replace cosmossdk.io/systemtests => ../../systemtests diff --git a/tests/systemtests/go.sum b/tests/systemtests/go.sum index 2636600c3b78..30bc2dc18e84 100644 --- a/tests/systemtests/go.sum +++ b/tests/systemtests/go.sum @@ -135,8 +135,7 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft v0.38.15 h1:5veFd8k1uXM27PBg9sMO3hAfRJ3vbh4OmmLf6cVrqXg= -github.com/cometbft/cometbft v0.38.15/go.mod h1:+wh6ap6xctVG+JOHwbl8pPKZ0GeqdPYqISu7F4b43cQ= +github.com/cometbft/cometbft v0.38.17 h1:FkrQNbAjiFqXydeAO81FUzriL4Bz0abYxN/eOHrQGOk= github.com/cometbft/cometbft v0.38.17/go.mod h1:5l0SkgeLRXi6bBfQuevXjKqML1jjfJJlvI1Ulp02/o4= github.com/cometbft/cometbft-db v0.14.1 h1:SxoamPghqICBAIcGpleHbmoPqy+crij/++eZz3DlerQ= github.com/cometbft/cometbft-db v0.14.1/go.mod h1:KHP1YghilyGV/xjD5DP3+2hyigWx0WTp9X+0Gnx0RxQ= diff --git a/tests/systemtests/unordered_tx_test.go b/tests/systemtests/unordered_tx_test.go new file mode 100644 index 000000000000..46069326c706 --- /dev/null +++ b/tests/systemtests/unordered_tx_test.go @@ -0,0 +1,52 @@ +//go:build system_test + +package systemtests + +import ( + "fmt" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + systest "cosmossdk.io/systemtests" +) + +func TestUnorderedTXDuplicate(t *testing.T) { + // TODO: remove once unordered tx handling is working in v2 + t.Skip("The unordered tx handling is not wired in v2") + + // scenario: test unordered tx duplicate + // given a running chain with a tx in the unordered tx pool + // when a new tx with the same hash is broadcasted + // then the new tx should be rejected + + systest.Sut.ResetChain(t) + cli := systest.NewCLIWrapper(t, systest.Sut, systest.Verbose) + // add genesis account with some tokens + account1Addr := cli.AddKey("account1") + account2Addr := cli.AddKey("account2") + systest.Sut.ModifyGenesisCLI(t, + []string{"genesis", "add-genesis-account", account1Addr, "10000000stake"}, + ) + + systest.Sut.StartChain(t) + + timeoutTimestamp := time.Now().Add(time.Minute) + // send tokens + rsp1 := cli.Run("tx", "bank", "send", account1Addr, account2Addr, "5000stake", "--from="+account1Addr, "--fees=1stake", fmt.Sprintf("--timeout-timestamp=%v", timeoutTimestamp.Unix()), "--unordered", "--sequence=1", "--note=1") + systest.RequireTxSuccess(t, rsp1) + + assertDuplicateErr := func(xt assert.TestingT, gotErr error, gotOutputs ...interface{}) bool { + require.Len(t, gotOutputs, 1) + assert.Contains(t, gotOutputs[0], "is duplicated: invalid request") + return false // always abort + } + rsp2 := cli.WithRunErrorMatcher(assertDuplicateErr).Run("tx", "bank", "send", account1Addr, account2Addr, "5000stake", "--from="+account1Addr, "--fees=1stake", fmt.Sprintf("--timeout-timestamp=%v", timeoutTimestamp.Unix()), "--unordered", "--sequence=1") + systest.RequireTxFailure(t, rsp2) + + require.Eventually(t, func() bool { + return cli.QueryBalance(account2Addr, "stake") == 5000 + }, 10*systest.Sut.BlockTime(), 200*time.Millisecond, "TX was not executed before timeout") +} From 5e72a40a5c874aa7d5c86891216e3e5696be525a Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Mon, 24 Feb 2025 12:58:23 -0800 Subject: [PATCH 02/12] Merge branch 'technicallyty/STA-118/timeout_height_time_based' into technicallyty/STA-102/backport-unordered-tx-systemtest From 524c871fad166c9e780aa14503aa6305f5aab0de Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Mon, 24 Feb 2025 13:05:07 -0800 Subject: [PATCH 03/12] update go mod and unskip test --- tests/systemtests/go.mod | 25 +++++++-------- tests/systemtests/go.sum | 42 +++++++++++--------------- tests/systemtests/unordered_tx_test.go | 3 -- 3 files changed, 31 insertions(+), 39 deletions(-) diff --git a/tests/systemtests/go.mod b/tests/systemtests/go.mod index 5d174300fcc5..6028849ef100 100644 --- a/tests/systemtests/go.mod +++ b/tests/systemtests/go.mod @@ -4,7 +4,10 @@ go 1.23 toolchain go1.24.0 -replace cosmossdk.io/systemtests => ../../systemtests +replace ( + cosmossdk.io/api => ../../api + cosmossdk.io/systemtests => ../../systemtests +) require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect @@ -33,8 +36,6 @@ require ( ) require ( - buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 // indirect - buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 // indirect cosmossdk.io/api v0.8.2 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core v0.11.0 // indirect @@ -158,16 +159,16 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/arch v0.13.0 // indirect - golang.org/x/crypto v0.32.0 // indirect + golang.org/x/crypto v0.33.0 // indirect golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect - golang.org/x/net v0.34.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.29.0 // indirect - golang.org/x/term v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250122153221-138b5a5a4fd4 // indirect - google.golang.org/protobuf v1.36.4 // indirect + golang.org/x/net v0.35.0 // indirect + golang.org/x/sync v0.11.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/term v0.29.0 // indirect + golang.org/x/text v0.22.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b // indirect + google.golang.org/protobuf v1.36.5 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect diff --git a/tests/systemtests/go.sum b/tests/systemtests/go.sum index de88951f5cc8..2a35e90bd544 100644 --- a/tests/systemtests/go.sum +++ b/tests/systemtests/go.sum @@ -1,11 +1,5 @@ -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1 h1:lcvKfPJ0GTMLh1Ib9n9b3Hx/U2lXj27rb5pujo3EKko= -buf.build/gen/go/cometbft/cometbft/protocolbuffers/go v1.36.4-20241120201313-68e42a58b301.1/go.mod h1:dW1kItnxv+SgI6SBjokdyIZqKl2uhOJahkOqIXDNDC8= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1 h1:xn+yVpC5XMvaSQWjfRWmitcYemPznXR7Y65rIMTxoiU= -buf.build/gen/go/cosmos/gogo-proto/protocolbuffers/go v1.36.4-20240130113600-88ef6483f90f.1/go.mod h1:9oTVKh0Ppx5zXStsybi9Zb//6TuLreQxSZqBDE25JGo= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cosmossdk.io/api v0.8.2 h1:klzA1RODd9tTawJ2CbBd/34RV/cB9qtd9oJN6rcRqqg= -cosmossdk.io/api v0.8.2/go.mod h1:XJUwQrihIDjErzs3+jm1zO/9KRzKf4HMjRzXC+l+Cio= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= @@ -794,8 +788,8 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus= +golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= @@ -844,8 +838,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= +golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -857,8 +851,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -914,20 +908,20 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= -golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU= +golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -974,10 +968,10 @@ google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a h1:OAiGFfOiA0v9MRYsSidp3ubZaBnteRUyn3xB2ZQ5G/E= -google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a/go.mod h1:jehYqy3+AhJU9ve55aNOaSml7wUXjF9x6z2LcCfpAhY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250122153221-138b5a5a4fd4 h1:yrTuav+chrF0zF/joFGICKTzYv7mh/gr9AgEXrVU8ao= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250122153221-138b5a5a4fd4/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= +google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b h1:i+d0RZa8Hs2L/MuaOQYI+krthcxdEbEM2N+Tf3kJ4zk= +google.golang.org/genproto/googleapis/api v0.0.0-20250212204824-5a70512c5d8b/go.mod h1:iYONQfRdizDB8JJBybql13nArx91jcUk7zCXEsOofM4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b h1:FQtJ1MxbXoIIrZHZ33M+w5+dAP9o86rgpjoKr/ZmT7k= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250212204824-5a70512c5d8b/go.mod h1:8BS3B93F/U1juMFq9+EDk+qOT5CO1R9IzXxG3PTqiRk= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1012,8 +1006,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM= -google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= +google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/tests/systemtests/unordered_tx_test.go b/tests/systemtests/unordered_tx_test.go index 46069326c706..0141d4f3cd82 100644 --- a/tests/systemtests/unordered_tx_test.go +++ b/tests/systemtests/unordered_tx_test.go @@ -14,9 +14,6 @@ import ( ) func TestUnorderedTXDuplicate(t *testing.T) { - // TODO: remove once unordered tx handling is working in v2 - t.Skip("The unordered tx handling is not wired in v2") - // scenario: test unordered tx duplicate // given a running chain with a tx in the unordered tx pool // when a new tx with the same hash is broadcasted From 3b4d4bbb57c522cbd735d7b434e123830b052db8 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Mon, 24 Feb 2025 14:24:55 -0800 Subject: [PATCH 04/12] remove crisis --- simapp/app.go | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index 2ac2772d7aec..a017fa1f55ff 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -11,11 +11,8 @@ import ( abci "github.com/cometbft/cometbft/abci/types" dbm "github.com/cosmos/cosmos-db" - "github.com/cosmos/cosmos-sdk/x/crisis" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" "github.com/cosmos/gogoproto/proto" - crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" "github.com/spf13/cast" "github.com/cosmos/cosmos-sdk/x/auth" @@ -104,9 +101,6 @@ import ( "github.com/cosmos/cosmos-sdk/x/consensus" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/params" @@ -158,7 +152,6 @@ type SimApp struct { BankKeeper bankkeeper.BaseKeeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper - CrisisKeeper *crisiskeeper.Keeper MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper GovKeeper govkeeper.Keeper @@ -792,7 +785,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) paramsKeeper.Subspace(govtypes.ModuleName) - paramsKeeper.Subspace(crisistypes.ModuleName) return paramsKeeper } @@ -821,18 +813,3 @@ func BlockedAddresses() map[string]bool { return modAccAddrs } - -// initParamsKeeper init params keeper and its subspaces -func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { - paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - - paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) - paramsKeeper.Subspace(stakingtypes.ModuleName) - paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName) - - return paramsKeeper -} From 2cf505fa8a0b3ff623c2a7d7af03d427e8542ca1 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Mon, 24 Feb 2025 14:32:08 -0800 Subject: [PATCH 05/12] simplify ante thing --- simapp/ante.go | 3 +-- simapp/app.go | 12 ++++++------ simapp/app_di.go | 12 ++++++------ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/simapp/ante.go b/simapp/ante.go index 997e688a586a..bc2a76705cae 100644 --- a/simapp/ante.go +++ b/simapp/ante.go @@ -14,7 +14,6 @@ import ( type HandlerOptions struct { ante.HandlerOptions CircuitKeeper circuitante.CircuitBreaker - TxManager *unorderedtx.Manager } // NewAnteHandler returns an AnteHandler that checks and increments sequence @@ -39,7 +38,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), ante.NewValidateBasicDecorator(), ante.NewTxTimeoutHeightDecorator(), - ante.NewUnorderedTxDecorator(unorderedtx.DefaultMaxTimeoutDuration, options.TxManager, ante.DefaultSha256Cost), + ante.NewUnorderedTxDecorator(unorderedtx.DefaultMaxTimeoutDuration, options.UnorderedTxManager, ante.DefaultSha256Cost), ante.NewValidateMemoDecorator(options.AccountKeeper), ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), diff --git a/simapp/app.go b/simapp/app.go index a017fa1f55ff..fe42beea5605 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -576,14 +576,14 @@ func (app *SimApp) setAnteHandler(txConfig client.TxConfig) { anteHandler, err := NewAnteHandler( HandlerOptions{ ante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, - BankKeeper: app.BankKeeper, - SignModeHandler: txConfig.SignModeHandler(), - FeegrantKeeper: app.FeeGrantKeeper, - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, + SignModeHandler: txConfig.SignModeHandler(), + FeegrantKeeper: app.FeeGrantKeeper, + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + UnorderedTxManager: app.UnorderedTxManager, }, &app.CircuitKeeper, - app.UnorderedTxManager, }, ) if err != nil { diff --git a/simapp/app_di.go b/simapp/app_di.go index 6df94f37c908..8b6264f7ab72 100644 --- a/simapp/app_di.go +++ b/simapp/app_di.go @@ -297,14 +297,14 @@ func (app *SimApp) setAnteHandler(txConfig client.TxConfig) { anteHandler, err := NewAnteHandler( HandlerOptions{ ante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, - BankKeeper: app.BankKeeper, - SignModeHandler: txConfig.SignModeHandler(), - FeegrantKeeper: app.FeeGrantKeeper, - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, + SignModeHandler: txConfig.SignModeHandler(), + FeegrantKeeper: app.FeeGrantKeeper, + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + UnorderedTxManager: app.UnorderedTxManager, }, &app.CircuitKeeper, - app.UnorderedTxManager, }, ) if err != nil { From 81b874d26e4c8f6c69586ee3526d96f0f356e427 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Mon, 24 Feb 2025 15:31:28 -0800 Subject: [PATCH 06/12] make non-di app canonical --- simapp/app.go | 4 +--- simapp/app_di.go | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index fe42beea5605..0c1c0c6a3613 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -1,5 +1,3 @@ -//go:build app_v1 - package simapp import ( @@ -375,7 +373,7 @@ func NewSimApp( app.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( - // register the governance hooks + // register the governance hooks ), ) diff --git a/simapp/app_di.go b/simapp/app_di.go index 8b6264f7ab72..2c8fd7cceac7 100644 --- a/simapp/app_di.go +++ b/simapp/app_di.go @@ -1,4 +1,4 @@ -//go:build !app_v1 +//go:build app_di package simapp From 2f602469dcba8b23f95a02e63745dc369a7db358 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Mon, 24 Feb 2025 15:58:41 -0800 Subject: [PATCH 07/12] that works. --- tests/systemtests/unordered_tx_test.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/systemtests/unordered_tx_test.go b/tests/systemtests/unordered_tx_test.go index 0141d4f3cd82..528bf3bd33a8 100644 --- a/tests/systemtests/unordered_tx_test.go +++ b/tests/systemtests/unordered_tx_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/tidwall/gjson" systest "cosmossdk.io/systemtests" ) @@ -32,15 +33,19 @@ func TestUnorderedTXDuplicate(t *testing.T) { timeoutTimestamp := time.Now().Add(time.Minute) // send tokens - rsp1 := cli.Run("tx", "bank", "send", account1Addr, account2Addr, "5000stake", "--from="+account1Addr, "--fees=1stake", fmt.Sprintf("--timeout-timestamp=%v", timeoutTimestamp.Unix()), "--unordered", "--sequence=1", "--note=1") + cmd := []string{"tx", "bank", "send", account1Addr, account2Addr, "5000stake", "--from=" + account1Addr, "--fees=1stake", fmt.Sprintf("--timeout-timestamp=%v", timeoutTimestamp.Unix()), "--unordered", "--sequence=1", "--note=1"} + rsp1 := cli.Run(cmd...) systest.RequireTxSuccess(t, rsp1) assertDuplicateErr := func(xt assert.TestingT, gotErr error, gotOutputs ...interface{}) bool { require.Len(t, gotOutputs, 1) - assert.Contains(t, gotOutputs[0], "is duplicated: invalid request") - return false // always abort + output := gotOutputs[0].(string) + code := gjson.Get(output, "code") + require.True(t, code.Exists()) + require.Equal(t, int64(19), code.Int()) // 19 == already in mempool. + return false // always abort } - rsp2 := cli.WithRunErrorMatcher(assertDuplicateErr).Run("tx", "bank", "send", account1Addr, account2Addr, "5000stake", "--from="+account1Addr, "--fees=1stake", fmt.Sprintf("--timeout-timestamp=%v", timeoutTimestamp.Unix()), "--unordered", "--sequence=1") + rsp2 := cli.WithRunErrorMatcher(assertDuplicateErr).Run(cmd...) systest.RequireTxFailure(t, rsp2) require.Eventually(t, func() bool { From 17939e0b5e1219c38f38bc0b14b5a4fe204e54de Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Tue, 25 Feb 2025 09:20:07 -0800 Subject: [PATCH 08/12] systemtest workflow --- .github/workflows/test.yml | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e3ce7365469..f667663441c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,6 +114,46 @@ jobs: name: "${{ github.sha }}-integration-coverage" path: ./tests/integration-profile.out + test-system: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-tags: true + - uses: actions/setup-go@v5 + with: + go-version: "1.24" + check-latest: true + cache: true + cache-dependency-path: | + simapp/go.sum + systemtest/go.sum + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + **/*.go + go.mod + go.sum + **/go.mod + **/go.sum + **/Makefile + Makefile + - name: Install musl lib for simd (docker) binary + if: env.GIT_DIFF + run: | + sudo apt-get install -y musl + - name: system tests + if: env.GIT_DIFF + run: | + make test-system + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: "testnet-setup" + path: ./systemtests/testnet/ + retention-days: 3 + repo-analysis: runs-on: depot-ubuntu-22.04-4 needs: [tests, test-integration] From f6ff5028ad19021fc6461fdee0670d62c9d8f7b5 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Tue, 25 Feb 2025 09:47:53 -0800 Subject: [PATCH 09/12] fix makefile, fix text build tags --- tests/systemtests/Makefile | 2 +- tests/systemtests/main_test.go | 2 ++ tests/systemtests/staking_test.go | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/systemtests/Makefile b/tests/systemtests/Makefile index 7acb110254a7..6680e826ce60 100644 --- a/tests/systemtests/Makefile +++ b/tests/systemtests/Makefile @@ -5,7 +5,7 @@ WAIT_TIME ?= 45s all: test format test: - go test -mod=readonly -failfast -timeout=15m -tags='system_test' ./... --wait-time=$(WAIT_TIME) + go test -mod=readonly -failfast -timeout=15m -tags='system_test' ./... --wait-time=$(WAIT_TIME) --verbose format: find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w diff --git a/tests/systemtests/main_test.go b/tests/systemtests/main_test.go index ecded617cc18..9bb4b2277083 100644 --- a/tests/systemtests/main_test.go +++ b/tests/systemtests/main_test.go @@ -1,3 +1,5 @@ +//go:build system_test + package systemtests import ( diff --git a/tests/systemtests/staking_test.go b/tests/systemtests/staking_test.go index 144febc49c66..4e07bf220fa3 100644 --- a/tests/systemtests/staking_test.go +++ b/tests/systemtests/staking_test.go @@ -1,3 +1,5 @@ +//go:build system_test + package systemtests import ( From 51ab51f78d0ff1a54b0ab7b9293f7b5f655cfe39 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Tue, 25 Feb 2025 10:26:28 -0800 Subject: [PATCH 10/12] maybe lower go-version --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f667663441c2..69b8a58a3590 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -122,7 +122,7 @@ jobs: fetch-tags: true - uses: actions/setup-go@v5 with: - go-version: "1.24" + go-version: "1.23" check-latest: true cache: true cache-dependency-path: | From 0f60688efe4de32e45ea97cf709f7a91cc634488 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Tue, 25 Feb 2025 10:35:36 -0800 Subject: [PATCH 11/12] ok remove for now --- .github/workflows/test.yml | 40 ------------------------------------- systemtests/system.go | 9 --------- systemtests/testnet_init.go | 20 ++----------------- 3 files changed, 2 insertions(+), 67 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 69b8a58a3590..6e3ce7365469 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -114,46 +114,6 @@ jobs: name: "${{ github.sha }}-integration-coverage" path: ./tests/integration-profile.out - test-system: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-tags: true - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - check-latest: true - cache: true - cache-dependency-path: | - simapp/go.sum - systemtest/go.sum - - uses: technote-space/get-diff-action@v6.1.2 - id: git_diff - with: - PATTERNS: | - **/*.go - go.mod - go.sum - **/go.mod - **/go.sum - **/Makefile - Makefile - - name: Install musl lib for simd (docker) binary - if: env.GIT_DIFF - run: | - sudo apt-get install -y musl - - name: system tests - if: env.GIT_DIFF - run: | - make test-system - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: "testnet-setup" - path: ./systemtests/testnet/ - retention-days: 3 - repo-analysis: runs-on: depot-ubuntu-22.04-4 needs: [tests, test-integration] diff --git a/systemtests/system.go b/systemtests/system.go index ccbc9e05f5a4..bf6d50a0cee1 100644 --- a/systemtests/system.go +++ b/systemtests/system.go @@ -22,7 +22,6 @@ import ( client "github.com/cometbft/cometbft/rpc/client/http" ctypes "github.com/cometbft/cometbft/rpc/core/types" tmtypes "github.com/cometbft/cometbft/types" - "github.com/creachadair/tomledit" "github.com/stretchr/testify/require" "github.com/tidwall/sjson" @@ -733,14 +732,6 @@ func (s *SystemUnderTest) AddFullnode(t *testing.T, beforeStart ...func(nodeNumb configFile := filepath.Join(configPath, tomlFile) _ = os.Remove(configFile) _ = MustCopyFile(filepath.Join(WorkDir, s.nodePath(0), "config", tomlFile), configFile) - if tomlFile == "app.toml" && IsV2() { - file := filepath.Join(WorkDir, s.nodePath(nodeNumber), "config", tomlFile) - EditToml(file, func(doc *tomledit.Document) { - SetValue(doc, fmt.Sprintf("%s:%d", node.IP, DefaultApiPort+nodeNumber), "grpc-gateway", "address") - SetValue(doc, fmt.Sprintf("%s:%d", node.IP, DefaultRestPort+nodeNumber), "rest", "address") - SetValue(doc, fmt.Sprintf("%s:%d", node.IP, DefaultTelemetryPort+nodeNumber), "telemetry", "address") - }) - } } peers := make([]string, len(allNodes)-1) for i, n := range allNodes[0 : len(allNodes)-1] { diff --git a/systemtests/testnet_init.go b/systemtests/testnet_init.go index 1e7b41378220..6a74d92ca663 100644 --- a/systemtests/testnet_init.go +++ b/systemtests/testnet_init.go @@ -13,12 +13,6 @@ import ( "github.com/creachadair/tomledit/parser" ) -// IsV2 checks if the tests run with simapp v2 -func IsV2() bool { - buildOptions := os.Getenv("COSMOS_BUILD_OPTIONS") - return strings.Contains(buildOptions, "v2") -} - // SingleHostTestnetCmdInitializer default testnet cmd that supports the --single-host param type SingleHostTestnetCmdInitializer struct { execBinary string @@ -75,12 +69,7 @@ func (s SingleHostTestnetCmdInitializer) Initialize() { "--keyring-backend=test", "--commit-timeout=" + s.commitTimeout.String(), "--single-host", - } - - if IsV2() { - args = append(args, "--server.minimum-gas-prices="+s.minGasPrice) - } else { - args = append(args, "--minimum-gas-prices="+s.minGasPrice) + "--minimum-gas-prices=" + s.minGasPrice, } s.log(fmt.Sprintf("+++ %s %s\n", s.execBinary, strings.Join(args, " "))) @@ -127,12 +116,7 @@ func (s ModifyConfigYamlInitializer) Initialize() { "--output-dir=" + s.outputDir, "--v=" + strconv.Itoa(s.initialNodesCount), "--keyring-backend=test", - } - - if IsV2() { - args = append(args, "--server.minimum-gas-prices="+s.minGasPrice) - } else { - args = append(args, "--minimum-gas-prices="+s.minGasPrice) + "--minimum-gas-prices=" + s.minGasPrice, } s.log(fmt.Sprintf("+++ %s %s\n", s.execBinary, strings.Join(args, " "))) From c5e5162b3d697f4b7d6248771bc96d7f16abe326 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Tue, 25 Feb 2025 10:59:57 -0800 Subject: [PATCH 12/12] fix linting --- scripts/go-lint-all.bash | 7 +++++-- scripts/go-lint-changes.bash | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/go-lint-all.bash b/scripts/go-lint-all.bash index c8bb1ea50dae..a94b513659a8 100755 --- a/scripts/go-lint-all.bash +++ b/scripts/go-lint-all.bash @@ -2,6 +2,9 @@ set -e -o pipefail +LINT_TAGS="e2e,ledger,test_ledger_mock,system_test" +export LINT_TAGS + REPO_ROOT="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )" export REPO_ROOT @@ -10,7 +13,7 @@ lint_module() { shift cd "$(dirname "$root")" && echo "linting $(grep "^module" go.mod) [$(date -Iseconds -u)]" && - golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --new-from-rev=HEAD~ + golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --new-from-rev=HEAD~ --build-tags=${LINT_TAGS} } export -f lint_module @@ -31,7 +34,7 @@ else for f in $(dirname $(echo "$GIT_DIFF" | tr -d "'") | uniq); do echo "linting $f [$(date -Iseconds -u)]" && cd $f && - golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --new-from-rev=HEAD~ && + golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --new-from-rev=HEAD~ --build-tags=${LINT_TAGS} && cd $REPO_ROOT done fi \ No newline at end of file diff --git a/scripts/go-lint-changes.bash b/scripts/go-lint-changes.bash index c8bb1ea50dae..ce60b0bd6fe9 100755 --- a/scripts/go-lint-changes.bash +++ b/scripts/go-lint-changes.bash @@ -2,6 +2,10 @@ set -e -o pipefail + +LINT_TAGS="e2e,ledger,test_ledger_mock,system_test" +export LINT_TAGS + REPO_ROOT="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )" export REPO_ROOT @@ -10,7 +14,7 @@ lint_module() { shift cd "$(dirname "$root")" && echo "linting $(grep "^module" go.mod) [$(date -Iseconds -u)]" && - golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --new-from-rev=HEAD~ + golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --new-from-rev=HEAD~ --build-tags=${LINT_TAGS} } export -f lint_module @@ -31,7 +35,7 @@ else for f in $(dirname $(echo "$GIT_DIFF" | tr -d "'") | uniq); do echo "linting $f [$(date -Iseconds -u)]" && cd $f && - golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --new-from-rev=HEAD~ && + golangci-lint run ./... -c "${REPO_ROOT}/.golangci.yml" "$@" --new-from-rev=HEAD~ --build-tags=${LINT_TAGS} && cd $REPO_ROOT done fi \ No newline at end of file