Skip to content

Commit

Permalink
Merge branch 'main' into adam/interest
Browse files Browse the repository at this point in the history
  • Loading branch information
toteki authored Jan 19, 2024
2 parents 96da528 + 631eefe commit 9b471c8
Show file tree
Hide file tree
Showing 24 changed files with 354 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependencies-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: "Dependency Review"
uses: actions/dependency-review-action@v3
uses: actions/dependency-review-action@v4
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ jobs:
with:
fetch-depth: 0
# lint only changed files
- uses: tj-actions/changed-files@v41
- uses: tj-actions/changed-files@v42
id: changed-files
with:
files: "**/*.md"
separator: ","
- uses: DavidAnson/markdownlint-cli2-action@v14
- uses: DavidAnson/markdownlint-cli2-action@v15
if: steps.changed-files.outputs.any_changed == 'true'
with:
globs: ${{ steps.changed-files.outputs.all_changed_files }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/simulations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- name: Install runsim
run: export GO111MODULE="on" && go install github.com/cosmos/tools/cmd/[email protected]
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
with:
go-version: "1.21"
cache: true
- uses: actions/cache@v3
- uses: actions/cache@v4
if: env.GIT_DIFF
with:
path: ~/go/bin
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
with:
go-version: "1.21"
cache: true
- uses: actions/cache@v3
- uses: actions/cache@v4
if: env.GIT_DIFF
with:
path: ~/go/bin
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
with:
go-version: "1.21"
cache: true
- uses: actions/cache@v3
- uses: actions/cache@v4
if: env.GIT_DIFF
with:
path: ~/go/bin
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: "1.21"
- uses: actions/cache@v3
- uses: actions/cache@v4
id: cache-go-tparse
with:
path: ~/go/bin
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v4
- name: Cache binaries
id: cache-binaries
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./cmd/umeed/umeed
key: umeed-${{ matrix.targetos }}-${{ matrix.arch }}
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
- name: Cache updated version binary
id: cache-binaries
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./cmd/umeed/umeed
key: umeed-linux-amd64
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ linters-settings:
- name: unreachable-code
- name: unused-parameter
- name: var-declaration
- name: var-naming
- name: var-naming
57 changes: 46 additions & 11 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ import (
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

packetforward "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward"
packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/keeper"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
Expand Down Expand Up @@ -203,6 +206,7 @@ func init() {
wasm.AppModuleBasic{},
incentivemodule.AppModuleBasic{},
metokenmodule.AppModuleBasic{},
packetforward.AppModuleBasic{},
}
// if Experimental {}

Expand Down Expand Up @@ -269,15 +273,16 @@ type UmeeApp struct {
NFTKeeper nftkeeper.Keeper
WasmKeeper wasmkeeper.Keeper

IBCTransferKeeper ibctransferkeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
ICAHostKeeper icahostkeeper.Keeper
LeverageKeeper leveragekeeper.Keeper
IncentiveKeeper incentivekeeper.Keeper
OracleKeeper oraclekeeper.Keeper
UIbcQuotaKeeperB uibcquota.KeeperBuilder
UGovKeeperB ugovkeeper.Builder
MetokenKeeperB metokenkeeper.Builder
IBCTransferKeeper ibctransferkeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
PacketForwardKeeper *packetforwardkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
LeverageKeeper leveragekeeper.Keeper
IncentiveKeeper incentivekeeper.Keeper
OracleKeeper oraclekeeper.Keeper
UIbcQuotaKeeperB uibcquota.KeeperBuilder
UGovKeeperB ugovkeeper.Builder
MetokenKeeperB metokenkeeper.Builder

// make scoped keepers public for testing purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -338,7 +343,7 @@ func New(
evidencetypes.StoreKey, capabilitytypes.StoreKey,
authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey,
ibcexported.StoreKey, ibctransfertypes.StoreKey, icahosttypes.StoreKey,
leveragetypes.StoreKey, oracletypes.StoreKey,
leveragetypes.StoreKey, oracletypes.StoreKey, packetforwardtypes.StoreKey,
uibc.StoreKey, ugov.StoreKey,
wasmtypes.StoreKey,
incentive.StoreKey,
Expand Down Expand Up @@ -559,11 +564,15 @@ func New(
* SendPacket, originates from the application to an IBC channel:
transferKeeper.SendPacket -> uibcquota.SendPacket -> channel.SendPacket
* RecvPacket, message that originates from an IBC channel and goes down to app, the flow is the other way
channel.RecvPacket -> uibcquota.OnRecvPacket -> transfer.OnRecvPacket
channel.RecvPacket -> uibcquota.OnRecvPacket -> forward.OnRecvPacket -> transfer.OnRecvPacket
* Note that the forward middleware is only integrated on the "receive" direction.
It can be safely skipped when sending.
* transfer stack contains (from top to bottom):
- Umee IBC Transfer
- IBC Rate Limit Middleware
- Packet Forward Middleware
**********/

quotaICS4 := uics20.NewICS4(app.IBCKeeper.ChannelKeeper, app.UIbcQuotaKeeperB)
Expand All @@ -577,10 +586,30 @@ func New(
app.AccountKeeper, app.BankKeeper, app.ScopedTransferKeeper,
)

// Packet Forward Middleware
// Initialize packet forward middleware router
app.PacketForwardKeeper = packetforwardkeeper.NewKeeper(
appCodec,
keys[packetforwardtypes.StoreKey],
app.IBCTransferKeeper,
app.IBCKeeper.ChannelKeeper,
app.DistrKeeper,
app.BankKeeper,
quotaICS4, // ISC4 Wrapper: fee IBC middleware
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

// create IBC module from bottom to top of stack
var transferStack ibcporttypes.IBCModule
transferStack = ibctransfer.NewIBCModule(app.IBCTransferKeeper)
// transferStack = ibcfee.NewIBCMiddleware(transferStack, app.IBCFeeKeeper)
transferStack = packetforward.NewIBCMiddleware(
transferStack,
app.PacketForwardKeeper,
0, // retries on timeout
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, // forward timeout
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, // refund timeout
)
transferStack = uics20.NewICS20Module(transferStack, appCodec,
app.UIbcQuotaKeeperB,
leveragekeeper.NewMsgServerImpl(app.LeverageKeeper))
Expand Down Expand Up @@ -712,6 +741,7 @@ func New(
leverage.NewAppModule(appCodec, app.LeverageKeeper, app.AccountKeeper, app.BankKeeper),
oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper),
uibcmodule.NewAppModule(appCodec, app.UIbcQuotaKeeperB),
packetforward.NewAppModule(app.PacketForwardKeeper, app.GetSubspace(packetforwardtypes.ModuleName)),
ugovmodule.NewAppModule(appCodec, app.UGovKeeperB),
wasm.NewAppModule(app.appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)), //nolint: lll
incentivemodule.NewAppModule(appCodec, app.IncentiveKeeper, app.BankKeeper, app.LeverageKeeper),
Expand Down Expand Up @@ -752,6 +782,7 @@ func New(
metoken.ModuleName,
oracletypes.ModuleName,
uibc.ModuleName,
packetforwardtypes.ModuleName,
ugov.ModuleName,
wasmtypes.ModuleName,
incentive.ModuleName,
Expand All @@ -770,6 +801,7 @@ func New(
icatypes.ModuleName, // ibcfeetypes.ModuleName,
leveragetypes.ModuleName,
uibc.ModuleName,
packetforwardtypes.ModuleName,
ugov.ModuleName,
wasmtypes.ModuleName,
incentive.ModuleName,
Expand All @@ -793,6 +825,7 @@ func New(
oracletypes.ModuleName,
leveragetypes.ModuleName,
uibc.ModuleName,
packetforwardtypes.ModuleName,
ugov.ModuleName,
wasmtypes.ModuleName,
incentive.ModuleName,
Expand All @@ -809,6 +842,7 @@ func New(
oracletypes.ModuleName,
leveragetypes.ModuleName,
uibc.ModuleName,
packetforwardtypes.ModuleName,
ugov.ModuleName,
wasmtypes.ModuleName,
incentive.ModuleName,
Expand Down Expand Up @@ -1138,6 +1172,7 @@ func initParamsKeeper(
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable())
paramsKeeper.Subspace(leveragetypes.ModuleName)
paramsKeeper.Subspace(oracletypes.ModuleName)
paramsKeeper.Subspace(wasmtypes.ModuleName)
Expand Down
4 changes: 4 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ func NewClient(
}, nil
}

func (c Client) IncAccSeq() {
c.Client.Tx.IncAccSeq()
}

func (c Client) SetAccSeq(seq uint64) {
c.Client.Tx.SetAccSeq(seq)
}
Expand Down
12 changes: 7 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ go 1.21

require (
cosmossdk.io/api v0.3.1
cosmossdk.io/errors v1.0.0
cosmossdk.io/errors v1.0.1
cosmossdk.io/math v1.2.0
cosmossdk.io/tools/rosetta v0.2.1
github.com/CosmWasm/wasmd v0.43.0
github.com/CosmWasm/wasmvm v1.5.0
github.com/CosmWasm/wasmvm v1.5.2
github.com/cometbft/cometbft v0.37.4
github.com/cometbft/cometbft-db v0.9.1
github.com/cosmos/cosmos-proto v1.0.0-beta.2 // NOTE: v1.0.0-beta.2+ is not compatible with sdk v0.47
github.com/cosmos/cosmos-sdk v0.47.8-0.20231226160248-5d406c19b204
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.4.10 // NOTE: v1.4.11+ is not compatible with sdk v0.47
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.1
github.com/cosmos/ibc-go/v7 v7.3.1
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.6.0
Expand All @@ -32,7 +33,7 @@ require (
github.com/spf13/viper v1.16.0 // must be v1.16.0 otherwise it will update golang.org/x/exp to new version v0.0.0-20230905200255-921286631fa9
github.com/stretchr/testify v1.8.4
golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // must be v0.0.0-20230711153332-06a737ee72cb for gogoproto v1.4.10
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f
google.golang.org/grpc v1.60.1
google.golang.org/protobuf v1.32.0
gopkg.in/yaml.v3 v3.0.1
Expand Down Expand Up @@ -197,6 +198,7 @@ require (
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/iancoleman/orderedmap v0.2.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
Expand Down Expand Up @@ -333,8 +335,8 @@ require (
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.153.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
honnef.co/go/tools v0.4.6 // indirect
Expand Down
24 changes: 14 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI=
cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE=
cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc=
cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU=
cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04=
cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0=
cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0=
cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U=
cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk=
cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4=
cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig=
Expand Down Expand Up @@ -237,8 +237,8 @@ github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRr
github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4=
github.com/CosmWasm/wasmd v0.43.0 h1:4xQAiNf6Ej+TuYe4PXwrtVJ9C+xyFrbsdqHH/kU9Vxk=
github.com/CosmWasm/wasmd v0.43.0/go.mod h1:gpri8YvkRErBz+qDme5jOThGZmSlHfyN532bWibXOl4=
github.com/CosmWasm/wasmvm v1.5.0 h1:3hKeT9SfwfLhxTGKH3vXaKFzBz1yuvP8SlfwfQXbQfw=
github.com/CosmWasm/wasmvm v1.5.0/go.mod h1:fXB+m2gyh4v9839zlIXdMZGeLAxqUdYdFQqYsTha2hc=
github.com/CosmWasm/wasmvm v1.5.2 h1:+pKB1Mz9GZVt1vadxB+EDdD1FOz3dMNjIKq/58/lrag=
github.com/CosmWasm/wasmvm v1.5.2/go.mod h1:Q0bSEtlktzh7W2hhEaifrFp1Erx11ckQZmjq8FLCyys=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
Expand Down Expand Up @@ -475,6 +475,8 @@ github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoK
github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek=
github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg=
github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A=
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.1 h1:PqIK9vTr6zxCdQmrDZwxwL4KMAqg/GRGsiMEiaMP4wA=
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.1/go.mod h1:UvDmcGIWJPIytq+Q78/ff5NTOsuX/7IrNgEugTW5i0s=
github.com/cosmos/ibc-go/v7 v7.3.1 h1:bil1IjnHdyWDASFYKfwdRiNtFP6WK3osW7QFEAgU4I8=
github.com/cosmos/ibc-go/v7 v7.3.1/go.mod h1:wvx4pPBofe5ZdMNV3OFRxSI4auEP5Qfqf8JXLLNV04g=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
Expand Down Expand Up @@ -954,6 +956,8 @@ github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXM
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y=
github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o=
github.com/iancoleman/orderedmap v0.2.0 h1:sq1N/TFpYH++aViPcaKjys3bDClUEU7s5B+z6jq8pNA=
github.com/iancoleman/orderedmap v0.2.0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
Expand Down Expand Up @@ -2205,12 +2209,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw
google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM=
google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM=
google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s=
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ=
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY=
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo=
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f h1:ultW7fxlIvee4HYrtnaRPon9HpEgFk5zYpmfMgtKB5I=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc=
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 h1:1hfbdAfFbkmpg41000wDVqr7jUpK/Yo+LPnIxxGzmkg=
google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3/go.mod h1:5RBcpGRxr25RbDzY5w+dmaqpSEvl8Gwl1x2CICf60ic=
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f h1:2yNACc1O40tTnrsbk9Cv6oxiW8pxI/pXj0wRtdlYmgY=
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f/go.mod h1:Uy9bTZJqmfrw2rIBxgGLnamc78euZULUBrLZ9XTITKI=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 h1:/jFB8jK5R3Sq3i/lmeZO0cATSzFfZaJq1J2Euan3XKU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA=
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=
Expand Down
19 changes: 16 additions & 3 deletions sdkclient/tx/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func (c *Client) initTxFactory() {
c.txFactory = &f
}

// Broadcasts transaction. On success, increments the client sequence number.
func (c *Client) BroadcastTx(idx int, msgs ...sdk.Msg) (*sdk.TxResponse, error) {
var err error
r := c.keyringRecord[idx]
Expand All @@ -135,12 +136,24 @@ func (c *Client) BroadcastTx(idx int, msgs ...sdk.Msg) (*sdk.TxResponse, error)
c.logger.Fatalln("can't get keyring record, idx=", idx, err)
}
f := c.txFactory.WithFromName(r.Name)
return BroadcastTx(cctx, f, msgs...)
resp, err := BroadcastTx(cctx, f, msgs...)
if err == nil {
c.SetAccSeq(0)
// c.IncAccSeq()
}
return resp, err

Check warning on line 144 in sdkclient/tx/client.go

View check run for this annotation

Codecov / codecov/patch

sdkclient/tx/client.go#L129-L144

Added lines #L129 - L144 were not covered by tests
}

func (c *Client) GetAccSeq() uint64 {
return c.txFactory.Sequence()

Check warning on line 148 in sdkclient/tx/client.go

View check run for this annotation

Codecov / codecov/patch

sdkclient/tx/client.go#L147-L148

Added lines #L147 - L148 were not covered by tests
}

func (c *Client) IncAccSeq() {
c.SetAccSeq(c.txFactory.Sequence() + 1)

Check warning on line 152 in sdkclient/tx/client.go

View check run for this annotation

Codecov / codecov/patch

sdkclient/tx/client.go#L151-L152

Added lines #L151 - L152 were not covered by tests
}

func (c *Client) SetAccSeq(seq uint64) {
// *c.txFactory = c.txFactory.WithSequence(seq)
c.txFactory.WithSequence(seq)
*c.txFactory = c.txFactory.WithSequence(seq)
}

func (c *Client) WithAsyncBlock() *Client {
Expand Down
Loading

0 comments on commit 9b471c8

Please sign in to comment.