Skip to content

Commit 3058d8f

Browse files
kioqqYurist-85
andauthored
fix: add amino register and change proto for ucdao module (#333)
* fix: add amino register and change proto for ucdao module * test: integration tests now run twice to test direct and legacy amino sing modes on txs * chore: add upgrade handler, bump app version * chore: update swagger --------- Co-authored-by: Yuri Surbashev <[email protected]>
1 parent 31c96a3 commit 3058d8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+923
-10319
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ DIFF_TAG=$(shell git rev-list --tags="v*" --max-count=1 --not $(shell git rev-li
66
DEFAULT_TAG=$(shell git rev-list --tags="v*" --max-count=1)
77
# VERSION ?= $(shell echo $(shell git describe --tags $(or $(DIFF_TAG), $(DEFAULT_TAG))) | sed 's/^v//')
88

9-
VERSION := "1.7.7"
9+
VERSION := "1.7.8"
1010
CBFTVERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')
1111
COMMIT := $(shell git log -1 --format='%H')
1212
LEDGER_ENABLED ?= true

app/ante/cosmos/fees_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"cosmossdk.io/math"
88
sdktestutil "github.com/cosmos/cosmos-sdk/testutil/testdata"
99
sdk "github.com/cosmos/cosmos-sdk/types"
10+
"github.com/cosmos/cosmos-sdk/types/tx/signing"
1011
"github.com/cosmos/cosmos-sdk/x/feegrant"
1112

1213
cosmosante "github.com/haqq-network/haqq/app/ante/cosmos"
@@ -311,7 +312,7 @@ func (suite *AnteTestSuite) TestDeductFeeDecorator() {
311312
suite.ctx = suite.ctx.WithIsCheckTx(tc.checkTx)
312313

313314
// Create a transaction out of the message
314-
tx, err := testutiltx.PrepareCosmosTx(suite.ctx, suite.app, args)
315+
tx, err := testutiltx.PrepareCosmosTx(suite.ctx, suite.app, args, signing.SignMode_SIGN_MODE_DIRECT)
315316
suite.Require().NoError(err, "failed to create transaction")
316317

317318
// run the ante handler

app/ante/integration_test.go

+13-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
sdkmath "cosmossdk.io/math"
1010
sdk "github.com/cosmos/cosmos-sdk/types"
11+
"github.com/cosmos/cosmos-sdk/types/tx/signing"
1112
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
1213

1314
"github.com/haqq-network/haqq/crypto/ethsecp256k1"
@@ -16,13 +17,17 @@ import (
1617
"github.com/haqq-network/haqq/utils"
1718
)
1819

19-
var _ = Describe("when sending a Cosmos transaction", func() {
20+
var _ = DescribeTableSubtree("when sending a Cosmos transaction", func(signMode signing.SignMode) {
2021
var (
2122
addr sdk.AccAddress
2223
priv *ethsecp256k1.PrivKey
2324
msg sdk.Msg
2425
)
2526

27+
BeforeEach(func() {
28+
s.SetupTest()
29+
})
30+
2631
Context("and the sender account has enough balance to pay for the transaction cost", Ordered, func() {
2732
var (
2833
rewardsAmt = sdk.NewInt(1e5)
@@ -48,7 +53,7 @@ var _ = Describe("when sending a Cosmos transaction", func() {
4853
})
4954

5055
It("should succeed & not withdraw any staking rewards", func() {
51-
res, err := testutil.DeliverTx(s.ctx, s.app, priv, nil, msg)
56+
res, err := testutil.DeliverTx(s.ctx, s.app, priv, nil, signMode, msg)
5257
Expect(err).To(BeNil())
5358
Expect(res.IsOK()).To(BeTrue())
5459

@@ -83,7 +88,7 @@ var _ = Describe("when sending a Cosmos transaction", func() {
8388
})
8489

8590
It("should fail", func() {
86-
res, err := testutil.DeliverTx(s.ctx, s.app, priv, nil, msg)
91+
res, err := testutil.DeliverTx(s.ctx, s.app, priv, nil, signMode, msg)
8792
Expect(res.IsOK()).To(BeTrue())
8893
Expect(err).To(HaveOccurred())
8994
})
@@ -126,9 +131,12 @@ var _ = Describe("when sending a Cosmos transaction", func() {
126131
balance := s.app.BankKeeper.GetBalance(s.ctx, addr, utils.BaseDenom)
127132
Expect(balance.Amount).To(Equal(sdk.NewInt(0)))
128133

129-
res, err := testutil.DeliverTx(s.ctx, s.app, priv, nil, msg)
134+
res, err := testutil.DeliverTx(s.ctx, s.app, priv, nil, signMode, msg)
130135
Expect(res.IsOK()).To(BeTrue())
131136
Expect(err).To(BeNil())
132137
})
133138
})
134-
})
139+
},
140+
Entry("Direct sign mode", signing.SignMode_SIGN_MODE_DIRECT),
141+
Entry("Legacy Amino JSON sign mode", signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON),
142+
)

app/app.go

+7-65
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,6 @@ import (
160160
vestingkeeper "github.com/haqq-network/haqq/x/vesting/keeper"
161161
vestingtypes "github.com/haqq-network/haqq/x/vesting/types"
162162

163-
v160 "github.com/haqq-network/haqq/app/upgrades/v1.6.0"
164-
v161 "github.com/haqq-network/haqq/app/upgrades/v1.6.1"
165-
v162 "github.com/haqq-network/haqq/app/upgrades/v1.6.2"
166-
v163 "github.com/haqq-network/haqq/app/upgrades/v1.6.3"
167-
v164 "github.com/haqq-network/haqq/app/upgrades/v1.6.4"
168163
v170 "github.com/haqq-network/haqq/app/upgrades/v1.7.0"
169164
v171 "github.com/haqq-network/haqq/app/upgrades/v1.7.1"
170165
v172 "github.com/haqq-network/haqq/app/upgrades/v1.7.2"
@@ -173,6 +168,7 @@ import (
173168
v175 "github.com/haqq-network/haqq/app/upgrades/v1.7.5"
174169
v176 "github.com/haqq-network/haqq/app/upgrades/v1.7.6"
175170
v177 "github.com/haqq-network/haqq/app/upgrades/v1.7.7"
171+
v178 "github.com/haqq-network/haqq/app/upgrades/v1.7.8"
176172

177173
// NOTE: override ICS20 keeper to support IBC transfers of ERC20 tokens
178174
"github.com/haqq-network/haqq/x/ibc/transfer"
@@ -1196,60 +1192,6 @@ func initParamsKeeper(
11961192
}
11971193

11981194
func (app *Haqq) setupUpgradeHandlers() {
1199-
// v1.6.0 Security upgrade
1200-
app.UpgradeKeeper.SetUpgradeHandler(
1201-
v160.UpgradeName,
1202-
v160.CreateUpgradeHandler(
1203-
app.mm,
1204-
app.configurator,
1205-
app.AccountKeeper,
1206-
app.StakingKeeper,
1207-
app.SlashingKeeper,
1208-
app.BankKeeper,
1209-
),
1210-
)
1211-
1212-
// v1.6.1 Security upgrade
1213-
app.UpgradeKeeper.SetUpgradeHandler(
1214-
v161.UpgradeName,
1215-
v161.CreateUpgradeHandler(
1216-
app.mm,
1217-
app.configurator,
1218-
app.AccountKeeper,
1219-
),
1220-
)
1221-
1222-
// v1.6.2 Evergreen fix
1223-
app.UpgradeKeeper.SetUpgradeHandler(
1224-
v162.UpgradeName,
1225-
v162.CreateUpgradeHandler(
1226-
app.mm,
1227-
app.configurator,
1228-
app.AccountKeeper,
1229-
app.BankKeeper,
1230-
app.DistrKeeper,
1231-
),
1232-
)
1233-
1234-
// v1.6.3 RPC Balances fix
1235-
app.UpgradeKeeper.SetUpgradeHandler(
1236-
v163.UpgradeName,
1237-
v163.CreateUpgradeHandler(app.mm, app.configurator),
1238-
)
1239-
1240-
// v1.6.4 Coinomics v2
1241-
app.UpgradeKeeper.SetUpgradeHandler(
1242-
v164.UpgradeName,
1243-
v164.CreateUpgradeHandler(
1244-
app.mm,
1245-
app.configurator,
1246-
app.GetKey(coinomicstypes.StoreKey),
1247-
app.GetKey(paramstypes.StoreKey),
1248-
app.DistrKeeper,
1249-
app.CoinomicsKeeper,
1250-
),
1251-
)
1252-
12531195
// v1.7.0 Upgrade SDK, CometBFT and IBC
12541196
app.UpgradeKeeper.SetUpgradeHandler(
12551197
v170.UpgradeName,
@@ -1305,6 +1247,12 @@ func (app *Haqq) setupUpgradeHandlers() {
13051247
v177.CreateUpgradeHandler(app.mm, app.configurator),
13061248
)
13071249

1250+
// v1.7.8 Fix Amino codec in United Contributors DAO module and improve integration tests
1251+
app.UpgradeKeeper.SetUpgradeHandler(
1252+
v178.UpgradeName,
1253+
v178.CreateUpgradeHandler(app.mm, app.configurator),
1254+
)
1255+
13081256
// When a planned update height is reached, the old binary will panic
13091257
// writing on disk the height and name of the update that triggered it
13101258
// This will read that value, and execute the preparations for the upgrade.
@@ -1320,12 +1268,6 @@ func (app *Haqq) setupUpgradeHandlers() {
13201268
var storeUpgrades *storetypes.StoreUpgrades
13211269

13221270
switch upgradeInfo.Name {
1323-
case v160.UpgradeName:
1324-
storeUpgrades = &storetypes.StoreUpgrades{
1325-
Added: []string{
1326-
icahosttypes.SubModuleName,
1327-
},
1328-
}
13291271
case v170.UpgradeName:
13301272
storeUpgrades = &storetypes.StoreUpgrades{
13311273
Added: []string{

0 commit comments

Comments
 (0)