-
Notifications
You must be signed in to change notification settings - Fork 616
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
IBC Rate Limit - integration and tests #2410
Closed
Closed
Changes from all commits
Commits
Show all changes
246 commits
Select commit
Hold shift + click to select a range
8fe23ab
added initial rate limiting contract
nicolaslara 0ed673a
added expiration
nicolaslara e61ab68
fixed integration test
nicolaslara 187b49c
added initial middleware
nicolaslara d53529e
simple test to debug weirdness in ibctesting
nicolaslara b6947a0
using helpers
nicolaslara 38cfe4d
Merge branch 'main' into ibc-rate-limit-weird-tests
nicolaslara 773ea2b
testing with test changes from PR##2274
nicolaslara 7c23a31
fixed tests and updated requirement to match cosmos-sdk fork branch w…
nicolaslara 2c7dd18
updated to latest commit
nicolaslara a4b8dc2
using branch of the sdk fork that allows for ibc tests
nicolaslara cd950ce
Merge branch 'ibc-rate-limit-weird-tests' into ibc-rate-limit
nicolaslara 8069131
Merge branch 'main' into supply-offset-changes-on-sdk-fork
nicolaslara bef2500
using the latest sdk fork changes with a new constructor
nicolaslara ef44407
Merge branch 'supply-offset-changes-on-sdk-fork' into ibc-rate-limit
nicolaslara 2b2ba93
initial ibctest setup
nicolaslara 19d9c94
propperly sending the package for testing
nicolaslara 574b109
Initialize app before tests and add default genesis state
nicolaslara c423f12
initial middleware with working testing framework
nicolaslara 2791d6a
improved testing framework
nicolaslara d45a830
can test both send and recv for success and failure
nicolaslara 64a5ef0
cleanner testing framework
nicolaslara 875214b
added contract instantiation
nicolaslara 23ad652
working wasm integration
nicolaslara c1d52d9
added params for contract config
nicolaslara 3cbcafe
extracted param registration
nicolaslara 6d79e71
active rate limiting
nicolaslara 225dfcf
calculating channel value
nicolaslara 863abef
cleaner tests
nicolaslara 76c0678
fix issue with epochs
nicolaslara c52c96e
fixed tests
nicolaslara de5e919
testing rate limit reset
nicolaslara 5aa644e
linting
nicolaslara 8309b95
added receive middleware
nicolaslara 6432034
added test for non-configured channel
nicolaslara 9ffdc37
make format
nicolaslara 80b8008
Revert "make format"
nicolaslara de08caf
only applying format to ibc-rate-limit
nicolaslara bebec8b
applying fmt to app.go
nicolaslara 2d1cacb
added gov_module and changed no-quota default to "allow all"
nicolaslara 0fd7e64
added asymetric quotas
nicolaslara 2733060
moved getters to modules.go
nicolaslara d040f84
Merge branch 'main' into ibc-rate-limit
nicolaslara ef47f16
initial work to support multiple quotas
nicolaslara fb072ed
added multiple quotas
nicolaslara 010628c
small fixes
nicolaslara c604c0d
reordered imports
nicolaslara b9ffbab
added management messages
nicolaslara 1ec6b8e
reorganized management messages and experimenting with e2e testing
nicolaslara 73607f7
commenting out test configuration test for now
nicolaslara 241aa9e
added query
nicolaslara 66a55b0
added flow unit test
nicolaslara 73535d4
cleanup
nicolaslara 8f8b7d2
added AddChannel tests
nicolaslara e007ca6
format
nicolaslara b16fa70
test values are properly stored
nicolaslara c171bb8
testing remove channel
nicolaslara 8ca29e7
some more rate limiting tests
nicolaslara 66c3346
moved tests about test setup to the right place
nicolaslara 3a37701
fixed params
nicolaslara 8c97907
Merge branch 'main' into ibc-rate-limit
nicolaslara 6a331dd
merged main
nicolaslara 5ef145e
running gofumpt
nicolaslara 0a2656c
added ibc-rate-limiting contract
nicolaslara 2fd6e04
added ibc-rate-limit middleware
nicolaslara 49ad2cd
Merge branch 'nicolas/ibc-rate-limit-middlware' into nicolas/ibc-rate…
nicolaslara 7105550
added chain integration and tests
nicolaslara 17c05af
reverted change to match merged branch in main (#2341 instead of #2274)
nicolaslara a6cf294
added cosmwasm workflow
nicolaslara 4855c0f
Merge branch 'nicolas/ibc-rate-limit-contract' into nicolas/ibc-rate-…
nicolaslara 3d8aa96
added a migrate message
nicolaslara 318cf57
added some doc comments to the state
nicolaslara 15cbcec
added doc comments
nicolaslara 3357e94
fixed dependency after merging https://github.com/osmosis-labs/cosmos…
nicolaslara 9f605fc
added migration msg
nicolaslara 70a11b4
added workflow
nicolaslara 2daf2ba
experimenting with better workflow
nicolaslara be0fa76
added missing $
nicolaslara 04a2a7a
using env
nicolaslara 26fc15b
Update x/ibc-rate-limit/contracts/rate-limiter/src/msg.rs
nicolaslara 2723f07
using stable for clippy
nicolaslara a9dd5bf
removed gitkeep
nicolaslara 94f079b
Merge branch 'nicolas/ibc-rate-limit-contract' into ibc-rate-limit
nicolaslara a7e7d75
using the minimal profile for clippy
nicolaslara 8917e77
experimenting with cache
nicolaslara 61bc4fe
removed target from lints
nicolaslara 67b1477
cleaner matrix?
nicolaslara 11c5765
COmments & questions
ValarDragon 1f237e8
Merge branch 'nicolas/ibc-rate-limit-contract' of github.com:osmosis-…
ValarDragon d9dd5b3
debugging
nicolaslara bf41b6f
more debugging
nicolaslara 8b6390b
debug faster
nicolaslara 1faa8c5
quick cache debug
nicolaslara a8a9b88
typo
nicolaslara 12accb3
quick workflow check
nicolaslara aee867f
working tests with optimization
nicolaslara 2758919
testing artifacts
nicolaslara f726d2c
split the wasm target into its own step
nicolaslara 506453a
artifacts without slash
nicolaslara 2fa15b8
full working tests
nicolaslara 4b66483
clippy fixes
nicolaslara 8128b0c
Merge branch 'nicolas/ibc-rate-limit-contract' into ibc-rate-limit
nicolaslara 73acb2f
workflow without test data checks and clippy fixes
nicolaslara 5b66bdc
renamed CHANNEL_FLOWS
nicolaslara 2e4a6ab
renaming and code clenaup
nicolaslara 4af7fe9
more renames
nicolaslara 48b19cb
renames and code fixes
nicolaslara 0dd7fc9
Merge branch 'nicolas/ibc-rate-limit-contract' into ibc-rate-limit
nicolaslara 6180eb8
reordered imports
nicolaslara 82c83b1
cargo fmt
nicolaslara 92b4bb3
Merge branch 'nicolas/ibc-rate-limit-contract' into ibc-rate-limit
nicolaslara d4ace7b
added danom tracking
nicolaslara 746daa9
cleanup
nicolaslara fe97ee8
refactoring
nicolaslara c6758f1
changes to the expiration logic so that balances are calculated based…
nicolaslara e1d52f4
slightly slower but considerably cleanner
nicolaslara 7434a44
cleanup attributes and removed redundancy when not testing
nicolaslara 727fef2
update to edition 2021
nicolaslara 7859a55
added comments explaining the tests
nicolaslara 628db47
removed .beaker
nicolaslara 9facb27
unified gitignore
nicolaslara 042f3f4
removed second gitignore
nicolaslara c37a968
better doc comments
nicolaslara e5d72d6
spelling
nicolaslara d658fdd
spelling
nicolaslara c2a72ad
added channel value cache
nicolaslara 0b738c9
Merge branch 'nicolas/ibc-rate-limit-contract' into ibc-rate-limit
nicolaslara 71d8aca
updated the middlware to use the new contract interface
nicolaslara 8135a90
update middleware to match new contract interface
nicolaslara 2151825
added missing updates
nicolaslara a800e9b
updated dependencies
nicolaslara ae15972
added missing helpers
nicolaslara f8b972a
go.mod changes shouldn't be in this branch
nicolaslara e15c77c
Revert "go.mod changes shouldn't be in this branch"
nicolaslara 63b23f0
moved send and receive to sudo
nicolaslara 7aa90e3
reorganizing
nicolaslara fcec5b9
calling the contract via sudo
nicolaslara 7acacb3
lint
nicolaslara 4268c79
removed gitkeep
nicolaslara 80617e8
using sudo instead of execute
nicolaslara 0529667
cleaned up and updated contract and integration
nicolaslara 294e19a
updated x86 test wasm file
nicolaslara 6c49460
fixed bad print
nicolaslara 3028b38
storing and instantiating the contract
nicolaslara f332e23
setting up E2E tests for ibc rate limits
nicolaslara 5bdccfc
fixed proposal. Now just have to get the math right and cleanup
nicolaslara b9408e6
Using the supply for the channel value
nicolaslara 6916ffa
experimenting with e2e tests
nicolaslara 216bcee
passing the contract keeper instead of instantiating it each time
nicolaslara f1cdb16
changes from code review
nicolaslara 314455e
added contract from main and changes to the middleware from code review
nicolaslara 0aed029
using the correct bank supply method
nicolaslara 54056fa
debugging issues with e2e tests. Everything works after one interacti…
nicolaslara cd74eaa
Merge branch 'main' into nicolas/merged-supply-offset-dependency
nicolaslara a69b58f
updated dependency to match latest sdk form (now that the changes to …
nicolaslara e8e9012
working E2E test for rate limiting
nicolaslara 381e5e2
added e2e tests and changes from code review
nicolaslara fa8cafe
removed debug logs
nicolaslara cc91a76
remove debug logs
nicolaslara bbcc8af
Merge branch 'main' into nicolas/ibc-rate-limit-middlware
nicolaslara d4e10bd
Merge branch 'ibc-rate-limit' into nicolas/ibc-rate-limit-integration…
nicolaslara 45ca648
Merge branch 'main' into nicolas/ibc-rate-limit-integration-and-tests
nicolaslara c425518
Merge branch 'nicolas/merged-supply-offset-dependency' into nicolas/i…
nicolaslara fde1440
Merge branch 'nicolas/merged-supply-offset-dependency' into nicolas/i…
nicolaslara 79843a1
Merge branch 'nicolas/merged-supply-offset-dependency' into ibc-rate-…
nicolaslara fd54ed3
updated test to also use GetSupplyWithOffset
nicolaslara 298636d
using correct GetSupplyWithOffset method
nicolaslara 5561530
using correct GetSupplyWithOffset method
nicolaslara 6e47abc
lint
nicolaslara deaacfd
Merge branch 'ibc-rate-limit' into nicolas/ibc-rate-limit-integration…
nicolaslara c676404
removed e2e from this branch as it's not doing anything without the i…
nicolaslara 7544235
lint
nicolaslara 98b720d
Merge branch 'ibc-rate-limit' into nicolas/ibc-rate-limit-integration…
nicolaslara a7f5bc4
tests fail on CI because of "inactive" proposal. Is the deposit the i…
nicolaslara 89cf19f
remove rate limiting after the test so it doesn't interfeer with the …
nicolaslara 10424b4
using standard proposals instead of expedited
nicolaslara 4b23e98
Merge branch 'ibc-rate-limit' into nicolas/ibc-rate-limit-integration…
nicolaslara 443fff3
added packet reverts on unsuccessful acks and timeouts
nicolaslara 76c9cc9
lint
nicolaslara d46b51c
ran gofumpt
nicolaslara af4d9a7
lint
nicolaslara 2751bee
added undo to the contract
nicolaslara b682542
integrating undo
nicolaslara fa12ff0
updated contract with x86 wasm file
nicolaslara 25a7767
added undo for sent packages when they are rejected bia timeout or a …
nicolaslara 219118c
added a readme
nicolaslara 803d26e
markdown lint
nicolaslara f474ee4
added readme
nicolaslara a3f82e9
abstracted params
nicolaslara ddfcac0
better params and param tests
nicolaslara 3018357
using a helper function instead of returning from the test
nicolaslara 42b354d
updated contract to allow for undo
nicolaslara 3350c57
added undo, readme, and cleanup based on reviews
nicolaslara a183a0e
Merge branch 'main' into ibc-rate-limit
nicolaslara 2825e21
updated wasm file with x86 version
nicolaslara ca5fecf
using string params in e2e tests
nicolaslara 20b40de
Merge branch 'main' into nicolas/ibc-rate-limit-middlware
nicolaslara 3f98ebe
Merge branch 'main' into ibc-rate-limit
nicolaslara 463f1cc
updated to v12
nicolaslara eb6471b
removed unnecessary keeper
nicolaslara f2ba12f
only exposing what's needed
nicolaslara 4b68e46
refactoring
nicolaslara 1506c3f
updated types
nicolaslara 33ad060
added shell history to gitignore
nicolaslara 30fb80b
adding only one wasm file to the codebase
nicolaslara acf1f50
remove test for same wasm files. No longer needed.
nicolaslara 4541b87
Merge branch 'main' into nicolas/ibc-rate-limit-middlware
nicolaslara f9ee22d
refactor based on code review
nicolaslara d9df73c
removed integration tests as they won't pass without integration
nicolaslara e681a7d
added params unit test
nicolaslara 9e14d15
Merge branch 'main' into nicolas/ibc-rate-limit-integration-and-tests
nicolaslara 11a4957
Merge branch 'nicolas/ibc-rate-limit-middlware' into nicolas/ibc-rate…
nicolaslara 4fc7abb
reorganized tests
nicolaslara d2daad6
reorganizing tests
nicolaslara 24a3e2e
refactoring
nicolaslara 2095003
Merge branch 'main' into ibc-rate-limit
nicolaslara 65f0485
Merge branch 'ibc-rate-limit' into nicolas/ibc-rate-limit-integration…
nicolaslara 9240011
added address length limit
nicolaslara 0ca235b
Merge branch 'nicolas/ibc-receiver-field-cap' into ibc-rate-limit
nicolaslara 71d60b8
Merge branch 'main' into nicolas/ibc-rate-limit-integration-and-tests
nicolaslara 69b4954
added tests and fixed lack of return
nicolaslara 21e7f51
Merge branch 'ibc-rate-limit' into nicolas/ibc-rate-limit-integration…
nicolaslara a78c757
remove tests from bad merge
nicolaslara 93413be
remove from bad merge again
nicolaslara 29f61fd
Merge branch 'main' into nicolas/ibc-rate-limit-integration-and-tests
nicolaslara 7b79685
comment
nicolaslara 08a1cd8
test helpers for cosmwasm contracts
nicolaslara 27ee3ee
added helpers for ibctesting
nicolaslara 8c36532
comments
nicolaslara d125dbd
Merge branch 'nicolas/test-helpers' into nicolas/ibc-rate-limit-integ…
nicolaslara cc42cab
removed unnecessary txConfig
nicolaslara 41b3cae
fixed typos
nicolaslara 0ad0a90
clearer comment
nicolaslara 7b50cb4
using second helper function for ExportGenesis
nicolaslara 40f8cc6
Merge branch 'nicolas/export_for_modules' into nicolas/ibc-rate-limit…
nicolaslara e7798a1
added new wasm file
nicolaslara 88b1c4a
Merge branch 'main' into nicolas/ibc-rate-limit-integration-and-tests
nicolaslara 032f33b
Fixed send with ibc assets. Better tests and error messages
nicolaslara f107877
updated contract with x86 version
nicolaslara 237f144
gofumpt
nicolaslara caad1f2
fixed clippy errors
nicolaslara 13f2621
using the escrowed value as the channel value for native tokens
nicolaslara 79109a2
gofumpt
nicolaslara 60811cf
update fail string
nicolaslara c50cf10
Merge branch 'main' into nicolas/ibc-rate-limit-integration-and-tests
nicolaslara 952a2e6
Merge branch 'main' into nicolas/ibc-rate-limit-integration-and-tests
ValarDragon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#![allow(clippy::result_large_err)] | ||
|
||
// Contract | ||
pub mod contract; | ||
mod error; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused about this wiring. We make our middleware the transfer module, but we pass the middleware into the transfer keeper as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this is confusing, but that's how you wire up the middlewares. What we pass into the keeper is not the middleware, but the ICS4Wrapper which would be the middleware's keeper if we had one (Notice that the transfer keeper has two params that originally pointed to the channel: ics4Wrapper and channelKeeper; we override the first one)
So the ibc module's methods (the OnSomething methods) all go to the part implementing the IBCModule interface, but the ICS4 methods (SendPacket and WriteAck) go to the ICS4Wrapper (which ends up in the channel). This is because things go in one direction on send and the other on receive. So we get:
SendPacket -> Transfer -> RateLimit -> channel
OnRecv -> RateLimit -> transfer -> channel
But I'll double check this to make sure I'm wrapping it correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrmm, I somewhat think I get it? So middleware from IBC is currently insufficient to do everything we need, since we want rate limit code before other code in the receive code path?
(Not sure why it couldn't be in transfer first though, since as long as we error anywhere, it should get atomically reverted)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is not a workaround to get our use case to work; this is unfortunately the way the middleware wiring us designed to be used. The transfer IBCModule doesn't implement SendPacket or WriteAcknowledgement, as it only implements porttypes.IBCModule and not porttypes.ICS4Wrapper (definitions). It instead relies on the transfer module's keeper to have an ICS4Wrapper that is initialized to either the channelKeeper (which implements ICS4Wrapper) or the ICS4Wrapper implementation of the middleware.
The middleware interface from IBC requires users to implement both porttypes.IBCModule and porttypes.ICS4Wrapper, but the later can't really wrap SendPacket or WriteAcknowledgement because they don't exist in the transfer ibc module.
I think the reason for designing it this way is so that a middleware would behave the same way as if it was a function wrapping another: what originates from the outside (other chain) must flow inwards and what originates in the last function called (our chain) must flow outwards.
It's probably easier if I go over the code in a call though, so let me know so we can screenshare