Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: unit and e2e tests to ibc-quota #1738

Merged
merged 112 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from 102 commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
6ed9e1f
WIP: add ibc rate limit middleware to ibc transfer
gsk967 Nov 7, 2022
4ce49c9
Merge main
gsk967 Nov 9, 2022
aada85f
WIP: add cll tx,query cmds
gsk967 Nov 9, 2022
08e3d08
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 10, 2022
16b50cd
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 11, 2022
57870ca
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 11, 2022
8412c70
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 12, 2022
9a4d380
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 12, 2022
28e2422
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 12, 2022
8e24765
WIP: add check rate limits for ibc denom
gsk967 Nov 14, 2022
4ad23eb
remove ibc-rate-limits and move rate limits into ibctransfer module
gsk967 Nov 14, 2022
9bf0109
move the umme ibctransfer into ics20 folder
gsk967 Nov 14, 2022
a87ff0d
fix: fix the lint
gsk967 Nov 14, 2022
bdeaec3
refactor: change the module structure to 'authz' type of cosmos-sdk
gsk967 Nov 15, 2022
aba25e0
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 15, 2022
7981d0d
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 16, 2022
37b15b3
remove inflow_limit in rate limits
gsk967 Nov 16, 2022
ea1316e
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 16, 2022
ac8381c
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Nov 16, 2022
a8206d3
chore: check the rate limits by exchange rate
gsk967 Nov 17, 2022
990db76
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 17, 2022
49c2bbb
add denom exponent to calculate amount in USD
gsk967 Nov 17, 2022
b5435b1
calculating the sent amount with exponent of registerd token
gsk967 Nov 17, 2022
3143115
fix: fix the amount calculation
gsk967 Nov 17, 2022
db358cf
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 17, 2022
0b30201
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 19, 2022
bce7a99
Merge main
gsk967 Nov 22, 2022
30bbdfc
fix: fix the rate-limit reset issue
gsk967 Nov 22, 2022
c2d0bc5
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 23, 2022
01ce260
refactor: update the params
gsk967 Nov 23, 2022
223f094
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 24, 2022
7b55068
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 28, 2022
c4b7de8
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Nov 29, 2022
b27ff0d
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 5, 2022
e75b6f9
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 23, 2022
90f82b5
fix: fix the build
gsk967 Dec 23, 2022
47f09be
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 27, 2022
ff6239a
chore: update the limits and quota interval
gsk967 Dec 27, 2022
ecacc9e
chore: fix the lint issues
gsk967 Dec 27, 2022
6968250
chore: fix the lint issues
gsk967 Dec 27, 2022
0e2ef16
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 27, 2022
eea2115
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 29, 2022
be02147
chore: addree the pr comments
gsk967 Dec 29, 2022
e9a8717
chore: remove the param subspace from uibc
gsk967 Dec 29, 2022
be8bc11
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Dec 30, 2022
267e958
refactor: refactor the proto and logic
gsk967 Dec 30, 2022
1aeb647
chore: address the pr comments
gsk967 Dec 30, 2022
b952683
fix: fix the buf lint
gsk967 Dec 30, 2022
1b119c7
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 2, 2023
1db2900
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 10, 2023
aa1daea
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 11, 2023
c5bfd75
chore: get the exchange price from TokenValue of leverage
gsk967 Jan 11, 2023
860795b
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Jan 11, 2023
b28f8f4
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 11, 2023
e485b2a
chore: convert uToken to baseToken in ibc-transfer quota checking
gsk967 Jan 11, 2023
3ae43d4
chore: add typed events for emit events
gsk967 Jan 12, 2023
f1d1e54
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 12, 2023
64600ef
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 16, 2023
4da6298
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 16, 2023
85e7486
address the review comments
gsk967 Jan 16, 2023
16e6488
refactor the code
gsk967 Jan 17, 2023
db8e103
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 17, 2023
a3f01de
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 18, 2023
07d05c5
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 23, 2023
14cdcd3
address the pr comments
gsk967 Jan 23, 2023
1dee0e7
chore: fix the build issue
gsk967 Jan 23, 2023
8f052ec
chore: add tests for params
gsk967 Jan 23, 2023
ef2acf4
add cli query test
gsk967 Jan 23, 2023
93cbbba
Merge branch 'main' into sai/ibc_quota_test
gsk967 Jan 23, 2023
0d71fd2
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 23, 2023
07fe9b4
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 24, 2023
e834de0
WIP: adding more tests
gsk967 Jan 24, 2023
1eda531
Merge remote-tracking branch 'origin/sai/ibc_quota_test' into sai/ibc…
gsk967 Jan 24, 2023
8f1cbe9
fix: fix the update quota params
gsk967 Jan 24, 2023
14c2558
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Jan 24, 2023
cf6507c
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 24, 2023
d5e92ae
add grpc tests and experimental unit test to workflows
gsk967 Jan 24, 2023
aef58c5
experimental unit test to git workflows
gsk967 Jan 24, 2023
a3c1e58
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 24, 2023
97ad447
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 24, 2023
0cfc87a
add quota test
gsk967 Jan 24, 2023
14badea
chore: address the pr comments
gsk967 Jan 24, 2023
1cbed41
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 24, 2023
78184a5
chore: fix the lint
gsk967 Jan 24, 2023
81123a5
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 24, 2023
22cc925
using assert from testtools
gsk967 Jan 24, 2023
e7ca80f
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 27, 2023
6e8cde5
address the pr comments++
gsk967 Jan 27, 2023
200e867
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 27, 2023
d558dc9
Merge branch 'main' into sai/ibc-rate-limit
gsk967 Jan 30, 2023
85f352d
address the pr comments
gsk967 Jan 30, 2023
b62b3db
address the pr comments
gsk967 Jan 30, 2023
9cc1660
Merge remote-tracking branch 'origin' into sai/ibc-rate-limit
gsk967 Jan 30, 2023
afcf52a
Merge remote-tracking branch 'origin/sai/ibc-rate-limit' into sai/ibc…
gsk967 Jan 30, 2023
16642e6
update reset quota
robert-zaremba Jan 30, 2023
f0ecf0a
move to Marshal to MustMarshal in uibc
gsk967 Jan 30, 2023
5fa2416
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 30, 2023
87d72ae
add TODO for ibc middleware acknowledgement
gsk967 Jan 30, 2023
8d178a2
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 30, 2023
8feec2a
add comment to outflow_sum
gsk967 Jan 30, 2023
f23c60b
Merge branch 'sai/ibc-rate-limit' into sai/ibc_quota_test
gsk967 Jan 30, 2023
8eb3b13
fix: fix the unit tests
gsk967 Jan 30, 2023
a438b15
merge main
gsk967 Jan 30, 2023
809e638
fix: fix the unit test
gsk967 Jan 30, 2023
2c09775
Merge branch 'main' into sai/ibc_quota_test
gsk967 Jan 31, 2023
d640a3a
Merge branch 'main' into sai/ibc_quota_test
gsk967 Jan 31, 2023
4ec2966
move from suite to gotest tools
gsk967 Jan 31, 2023
a28e70b
Merge branch 'main' into sai/ibc_quota_test
gsk967 Feb 1, 2023
97239b5
refactor the cli test
gsk967 Feb 1, 2023
c1957bf
++
gsk967 Feb 1, 2023
7ebca4a
fix the tests
gsk967 Feb 1, 2023
af5a02a
remove unused newmsg func
gsk967 Feb 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,24 @@ jobs:
run: |
sleep 1m
./contrib/scripts/test_localnet_liveness.sh 50 5 50 localhost:26657

experimental-test-unit:
runs-on: ubuntu-latest
needs: install-tparse
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/setup-go@v3
if: env.GIT_DIFF
with:
go-version: 1.19
cache: true
- name: Test the experimental features
if: env.GIT_DIFF
run: |
EXPERIMENTAL=true make test-unit
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ test-unit-cover: ARGS=-timeout=10m -tags='$(UNIT_TEST_TAGS)' -coverprofile=$(TES
test-unit-cover: TEST_PACKAGES=$(PACKAGES_UNIT)
test-race: ARGS=-timeout=10m -race -tags='$(TEST_RACE_TAGS)'
test-race: TEST_PACKAGES=$(PACKAGES_UNIT)
test-e2e: ARGS=-timeout=25m -v --tags='$(TEST_E2E_TAGS)'
test-e2e: ARGS=-timeout=25m -v -tags='$(TEST_E2E_TAGS)'
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
test-e2e: TEST_PACKAGES=$(PACKAGES_E2E)
$(TEST_TARGETS): run-tests

Expand Down
103 changes: 77 additions & 26 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,20 @@ import (
appparams "github.com/umee-network/umee/v4/app/params"
"github.com/umee-network/umee/v4/swagger"
"github.com/umee-network/umee/v4/util/genmap"
uibctransfer "github.com/umee-network/umee/v4/x/ibctransfer"
uibctransferkeeper "github.com/umee-network/umee/v4/x/ibctransfer/keeper"
"github.com/umee-network/umee/v4/x/leverage"
leveragekeeper "github.com/umee-network/umee/v4/x/leverage/keeper"
leveragetypes "github.com/umee-network/umee/v4/x/leverage/types"
"github.com/umee-network/umee/v4/x/oracle"
oraclekeeper "github.com/umee-network/umee/v4/x/oracle/keeper"
oracletypes "github.com/umee-network/umee/v4/x/oracle/types"

// umee ibc-transfer and quota for ibc-transfer
"github.com/umee-network/umee/v4/x/uibc"
uics20transfer "github.com/umee-network/umee/v4/x/uibc/ics20"
uibctransferkeeper "github.com/umee-network/umee/v4/x/uibc/ics20/keeper"
uibcmodule "github.com/umee-network/umee/v4/x/uibc/module"
uibcquota "github.com/umee-network/umee/v4/x/uibc/quota"
uibcquotakeeper "github.com/umee-network/umee/v4/x/uibc/quota/keeper"
)

var (
Expand Down Expand Up @@ -174,7 +180,7 @@ func init() {
}

if Experimental {
moduleBasics = append(moduleBasics, wasm.AppModuleBasic{})
moduleBasics = append(moduleBasics, wasm.AppModuleBasic{}, uibcmodule.AppModuleBasic{})
}

ModuleBasics = module.NewBasicManager(moduleBasics...)
Expand All @@ -196,6 +202,7 @@ func init() {

if Experimental {
maccPerms[wasm.ModuleName] = []string{authtypes.Burner}
maccPerms[uibc.ModuleName] = nil
}
}

Expand Down Expand Up @@ -241,6 +248,7 @@ type UmeeApp struct {
LeverageKeeper leveragekeeper.Keeper
OracleKeeper oraclekeeper.Keeper
bech32IbcKeeper bech32ibckeeper.Keeper
UIbcQuotaKeeper uibcquotakeeper.Keeper

// make scoped keepers public for testing purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
Expand Down Expand Up @@ -300,12 +308,11 @@ func New(
govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, capabilitytypes.StoreKey,
authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey,
ibchost.StoreKey, ibctransfertypes.StoreKey,
gravitytypes.StoreKey,
ibchost.StoreKey, ibctransfertypes.StoreKey, gravitytypes.StoreKey,
leveragetypes.StoreKey, oracletypes.StoreKey, bech32ibctypes.StoreKey,
}
if Experimental {
storeKeys = append(storeKeys, wasm.StoreKey)
storeKeys = append(storeKeys, wasm.StoreKey, uibc.StoreKey)
}

keys := sdk.NewKVStoreKeys(storeKeys...)
Expand Down Expand Up @@ -442,18 +449,14 @@ func New(
app.StakingKeeper,
distrtypes.ModuleName,
)
var err error
app.LeverageKeeper, err = leveragekeeper.NewKeeper(
app.LeverageKeeper = leveragekeeper.NewKeeper(
appCodec,
keys[leveragetypes.ModuleName],
app.GetSubspace(leveragetypes.ModuleName),
app.BankKeeper,
app.OracleKeeper,
cast.ToBool(appOpts.Get(leveragetypes.FlagEnableLiquidatorQuery)),
)
if err != nil {
panic(err)
}
app.LeverageKeeper = *app.LeverageKeeper.SetHooks(
leveragetypes.NewMultiHooks(
app.OracleKeeper.Hooks(),
Expand Down Expand Up @@ -494,13 +497,35 @@ func New(
// If evidence needs to be handled for the app, set routes in router here and seal
app.EvidenceKeeper = *evidenceKeeper

app.IBCKeeper = ibckeeper.NewKeeper(
appCodec,
keys[ibchost.StoreKey],
app.GetSubspace(ibchost.ModuleName),
*app.StakingKeeper,
app.UpgradeKeeper,
app.ScopedIBCKeeper,
)

var ics4Wrapper ibcporttypes.ICS4Wrapper
if Experimental {
app.UIbcQuotaKeeper = uibcquotakeeper.NewKeeper(
appCodec,
keys[uibc.StoreKey],
app.IBCKeeper.ChannelKeeper, app.LeverageKeeper,
)
ics4Wrapper = app.UIbcQuotaKeeper
} else {
ics4Wrapper = app.IBCKeeper.ChannelKeeper
}

// Middleware Stacks
// Create an original ICS-20 transfer keeper and AppModule and then use it to
// created an Umee wrapped ICS-20 transfer keeper and AppModule.
ibcTransferKeeper := ibctransferkeeper.NewKeeper(
appCodec,
keys[ibctransfertypes.StoreKey],
app.GetSubspace(ibctransfertypes.ModuleName),
app.IBCKeeper.ChannelKeeper,
ics4Wrapper, // ISC4 Wrapper: IBC Rate Limit middleware
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
app.AccountKeeper,
Expand All @@ -509,15 +534,34 @@ func New(
)

app.UIBCTransferKeeper = uibctransferkeeper.New(ibcTransferKeeper, app.BankKeeper)
ibcTransferModule := ibctransfer.NewAppModule(ibcTransferKeeper)
uibcTransferIBCModule := uibctransfer.NewIBCModule(
ibctransfer.NewIBCModule(ibcTransferKeeper), app.UIBCTransferKeeper,

// Create Transfer Stack
// SendPacket, since it is originating from the application to core IBC:
// transferKeeper.SendPacket -> uibcquota.SendPacket -> channel.SendPacket

// RecvPacket, message that originates from core IBC and goes down to app, the flow is the other way
// channel.RecvPacket -> uibcquota.OnRecvPacket -> transfer.OnRecvPacket

// transfer stack contains (from top to bottom):
// - Umee IBC Transfer
// - IBC Rate Limit Middleware

// create IBC module from bottom to top of stack
var transferStack ibcporttypes.IBCModule
transferStack = uics20transfer.NewIBCModule(
ibctransfer.NewIBCModule(ibcTransferKeeper),
app.UIBCTransferKeeper,
)

if Experimental {
transferStack = uibcquota.NewIBCMiddleware(transferStack, app.UIbcQuotaKeeper)
}

// Create IBC Router
// create static IBC router, add transfer route, then set and seal it
ibcRouter := ibcporttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, uibcTransferIBCModule)

// Add transfer stack to IBC Router
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack)
ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper))
app.IBCKeeper.SetRouter(ibcRouter)

Expand Down Expand Up @@ -593,15 +637,18 @@ func New(
groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),

ibcTransferModule,
ibctransfer.NewAppModule(ibcTransferKeeper),
gravity.NewAppModule(app.GravityKeeper, app.BankKeeper),
leverage.NewAppModule(appCodec, app.LeverageKeeper, app.AccountKeeper, app.BankKeeper),
oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper),
bech32ibc.NewAppModule(appCodec, app.bech32IbcKeeper),
}
if Experimental {
appModules = append(appModules,
wasm.NewAppModule(app.appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper))
appModules = append(
appModules,
wasm.NewAppModule(app.appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
uibcmodule.NewAppModule(appCodec, app.UIbcQuotaKeeper),
)
}

app.mm = module.NewManager(appModules...)
Expand All @@ -626,6 +673,7 @@ func New(
gravitytypes.ModuleName,
bech32ibctypes.ModuleName,
}

endBlockers := []string{
crisistypes.ModuleName,
oracletypes.ModuleName, // must be before gov and staking
Expand Down Expand Up @@ -661,6 +709,7 @@ func New(
gravitytypes.ModuleName,
bech32ibctypes.ModuleName,
}

orderMigrations := []string{
capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName,
stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName,
Expand All @@ -676,10 +725,10 @@ func New(
}

if Experimental {
beginBlockers = append(beginBlockers, wasm.ModuleName)
endBlockers = append(endBlockers, wasm.ModuleName)
initGenesis = append(initGenesis, wasm.ModuleName)
orderMigrations = append(orderMigrations, wasm.ModuleName)
beginBlockers = append(beginBlockers, wasm.ModuleName, uibc.ModuleName)
endBlockers = append(endBlockers, wasm.ModuleName, uibc.ModuleName)
initGenesis = append(initGenesis, wasm.ModuleName, uibc.ModuleName)
orderMigrations = append(orderMigrations, wasm.ModuleName, uibc.ModuleName)
}

app.mm.SetOrderBeginBlockers(beginBlockers...)
Expand All @@ -704,8 +753,10 @@ func New(
authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts),
}

simStateModules := genmap.Pick(app.mm.Modules,
[]string{stakingtypes.ModuleName, authtypes.ModuleName, oracletypes.ModuleName})
simStateModules := genmap.Pick(
app.mm.Modules,
[]string{stakingtypes.ModuleName, authtypes.ModuleName, oracletypes.ModuleName},
)
// TODO: Ensure x/leverage implements simulator and add it here:
simTestModules := genmap.Pick(simStateModules, []string{oracletypes.ModuleName})

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ require (
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gotest.tools v2.2.0+incompatible
honnef.co/go/tools v0.3.3 // indirect
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,7 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
Expand Down
17 changes: 17 additions & 0 deletions proto/umee/uibc/v1/events.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";
package umee.uibc.v1;

import "gogoproto/gogo.proto";

option go_package = "github.com/umee-network/umee/v4/x/uibc";
option (gogoproto.goproto_getters_all) = false;

// EventBadRevert is emitted on failure of ibc-transfer quota.
message EventBadRevert {
// module name
string module = 1;
// failure event type
string failure_type = 2;
// ibc packet data
string packet = 3;
}
29 changes: 29 additions & 0 deletions proto/umee/uibc/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto3";
package umee.uibc.v1;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "google/protobuf/timestamp.proto";
import "umee/uibc/v1/quota.proto";

option go_package = "github.com/umee-network/umee/v4/x/uibc";
option (gogoproto.goproto_getters_all) = false;

// GenesisState defines the uibc module's genesis state.
message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
repeated Quota quotas = 2 [(gogoproto.nullable) = false];
// total_outflow_sum defines the total outflow sum of ibc-transfer in USD
string total_outflow_sum = 3 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// quota_expires defines quota expires for ibc-transfer denom in seconds
google.protobuf.Timestamp quota_expires = 4 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true,
(gogoproto.jsontag) = "quota_duration,omitempty",
(gogoproto.moretags) = "yaml:\"quota_expires\""
];
}
44 changes: 44 additions & 0 deletions proto/umee/uibc/v1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
syntax = "proto3";
package umee.uibc.v1;

import "google/api/annotations.proto";
import "gogoproto/gogo.proto";
import "umee/uibc/v1/quota.proto";

option go_package = "github.com/umee-network/umee/v4/x/uibc";

option (gogoproto.goproto_getters_all) = false;

// Query defines the gRPC querier service.
service Query {
// Params queries the parameters of the x/uibc module.
rpc Params(QueryParams) returns (QueryParamsResponse) {
option (google.api.http).get = "/umee/uibc/v1/params";
}

// Quota queries the rate limits of ibc denoms.
// If denom is empty, returns quota for all tokens.
rpc Quota(QueryQuota) returns (QueryQuotaResponse) {
option (google.api.http).get = "/umee/uibc/v1/quota/{denom}";
}
}

// QueryParams defines the request structure for the Params gRPC service
// handler.
message QueryParams {}

// QueryParamsResponse defines the response structure for the Params gRPC
// service handler.
message QueryParamsResponse {
Params params = 1 [(gogoproto.nullable) = false];
}

// QueryQuota defines request type for query the quota of denoms
message QueryQuota {
string denom = 1;
}

// QueryQuotaResponse defines response type of Query/Quota
message QueryQuotaResponse {
repeated Quota quota = 1 [(gogoproto.nullable) = false];
}
Loading