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

Prepare v3: IBC Wasm Hooks, PFM and Simapp rewrite #403

Closed
wants to merge 18 commits into from

Conversation

xlab
Copy link
Contributor

@xlab xlab commented Jun 13, 2023

WIP description.

To keep summary:

  • added and refactored ibc-hooks from osmosis (rationale TODO)
  • to wire with simapp, the simapp has to include IBC and WASM
  • it was impossible to add both to existing simapp, because layout was outdated and messy
  • this PR gets latest simapp from v0.47.2 and fully rewritten to match persistenceCore layout, at the same time keeping all new tests intact
  • with WASM and IBC enabled, IBC Wasm Hooks can be plugged in, TODO
  • PFM stands for packet forwarding middleware and also now can be plugged in
  • Tests for both should run on the simapp

Max added 6 commits May 26, 2023 15:36
Commit 1e56cc620a17e0b5debb8228896aa44b6421a723
This ignores app_v2 with deepinject which is not ready to be used with IBC
and other modules, for now we are sticking to app_v1 that is similar to what we had there.

In this commit the app is replaced, but no custom modules from persistence added.
@xlab xlab changed the base branch from master to ajeet/sdk-v47 June 13, 2023 00:59
@xlab xlab changed the title IBC Wasm Hooks, PFM and Simapp rewrite [WIP] IBC Wasm Hooks, PFM and Simapp rewrite Jun 13, 2023
Max added 9 commits June 16, 2023 03:22
The test spawns two nodes and IBC relayer, deploys WASM contract and runs few IBC transfers resulting in hooks triggering the counter updates in the contract. This is a desperate measure to test it out, ideally we want to write integration test in Go (see ibc middleware test), however, the infra used by original implementation expects ibc/v4 and it's time consuming to properly re-implement it for ibc/v4 and sdk v47. For now we're good with this E2E test.

Credit for the test goes to Terra, however it was refactored to accomodate sdk v47.
This actually needs to be LSM-enabled fork that imports our SDK and IBC repos.
Warn: the scope is not clear now, for now includes Auction mempool
and their custom Ante decorator.
@xlab xlab requested review from ajeet97 and puneet2019 and removed request for ajeet97 June 20, 2023 15:29
@xlab xlab changed the title [WIP] IBC Wasm Hooks, PFM and Simapp rewrite IBC Wasm Hooks, PFM and Simapp rewrite Jun 20, 2023
Base automatically changed from ajeet/sdk-v47 to master June 20, 2023 15:52
@puneet2019
Copy link
Member

chore: move wasmbindings from persistenceCore
this commit, I think it is okay if it is for simapp, but the bindings should exist in persistenceCore.
each app can write their set of allowlisted queries, and persistenceCore can import it, same for messages. some sort of router config there too.
if pstake ends up writing the wasmbindings here it will cause problems with circular imports.

@puneet2019
Copy link
Member

ibchooker has been removed from wiring

feat: add POB module from skip-mev to simapp
@github-actions
Copy link

Coverage after merging f/max/ibc-hooks into master

18.42%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
simapp
   test_helpers.go100%100%28.07%..., 51, 52, 53, 99
   genesis_account.go100%100%100%
   app.go100%100%80.06%..., 517, 520, 521, 522
   test_suite.go100%100%0%..., 58, 59, 60, 62
   export.go100%100%13.43%..., 96, 97, 98, 99
   ante_handler.go100%100%72.09%..., 53, 54, 58, 59
   modules.go100%100%100%
simapp/simd/cmd
   testnet.go100%100%69.54%..., 532, 533, 90, 91
   root.go100%100%80.44%..., 73, 74, 77, 78
x/epochs/client/cli
   query.go100%100%0%..., 95, 96, 97, 98
x/epochs/keeper
   hooks.go100%100%100%
   epoch.go100%100%85.71%..., 25, 61, 87, 92
   genesis.go100%100%90.91%14
   abci.go100%100%100%
   keeper.go100%100%92.86%30
   grpc_query.go100%100%38.46%..., 51, 53, 54, 55
x/epochs/types
   genesis.go100%100%59.18%..., 57, 58, 61, 62
   genesis.pb.go100%100%28.80%..., 96, 97, 98, 99
   hooks.go100%100%100%
   query.pb.gw.go100%100%0%..., 96, 97, 98, 99
   query.pb.go100%100%2.24%..., 96, 97, 98, 99
x/halving/simulation
   genesis.go100%100%70%17, 18, 19
x/halving/types
   query.pb.go100%100%1.91%..., 96, 97, 98, 99
   query.pb.gw.go100%100%0%..., 95, 96, 97, 98
   params.go100%100%85.29%24, 25, 26, 44, 45
   genesis.pb.go100%100%2.55%..., 68, 69, 98, 99
   halving.pb.go100%100%2.76%..., 96, 97, 98, 99
   genesis.go100%100%86.67%25, 26
x/interchainquery
   genesis.go100%100%54.55%21, 22, 23, 24, 25
   handler.go100%100%0%15, 16, 17, 18, 19
   module.go100%100%63.38%..., 84, 87, 88, 89
x/interchainquery/keeper
   msg_server.go100%100%55.74%..., 76, 79, 87, 88
   abci.go100%100%92.68%58, 59, 60
   keeper.go100%100%67.59%..., 43, 66, 67, 89
   grpc_query.go100%100%74.07%..., 33, 40, 43, 44
   queries.go100%100%98%67
x/interchainquery/types
   msgs.go100%100%54.17%..., 39, 45, 46, 47
   keys.go100%100%0%22, 23, 24
   messages.pb.go100%100%3.58%..., 96, 97, 98, 99
   codec.go100%100%100%
   genesis.pb.go100%100%0.76%..., 996, 997, 998, 999
   query.pb.gw.go100%100%0%..., 96, 97, 98, 99
   messages.pb.gw.go100%100%0%..., 92, 93, 95, 99
   query.pb.go100%100%1.32%..., 996, 997, 998, 999
   genesis.go100%100%63.64%15, 16, 17, 18
x/oracle/keeper
   params.go100%100%68.89%..., 75, 79, 80, 81
   alias_functions.go100%100%100%
   grpc_query.go100%100%15.29%..., 96, 97, 98, 99
   slash.go100%100%97.44%41
   genesis.go100%100%93.33%..., 34, 43, 52, 63
   keeper.go100%100%93.45%..., 47, 68, 69, 70
   ballot.go100%100%100%
   msg_server.go100%100%75.83%..., 81, 82, 85, 86
   reward.go100%100%91.67%14, 15, 72, 88
   tally.go100%100%93.55%..., 113, 114, 60, 61
   utils.go100%100%77.78%10, 9
x/oracle/types
   keys.go100%100%0%..., 52, 53, 54, 55
   ballot.go100%100%96.61%110, 111, 195, 196
   msgs.go100%100%76.19%..., 37, 54, 55, 90
   vote.go100%100%100%
   oracle.pb.go100%100%0.76%..., 995, 996, 997, 998
   tx.pb.go100%100%0.90%..., 993, 994, 996, 999
   genesis.go100%100%66.67%..., 23, 24, 25, 26
   genesis.pb.go100%100%0.93%..., 993, 994, 998, 999
   query.pb.go100%100%0.83%..., 969, 97, 98, 99
   query.pb.gw.go100%100%0%..., 95, 97, 98, 99
   params.go100%100%88.59%..., 296, 297, 298, 300
   codec.go100%100%52.38%..., 45, 46, 47, 48
   denom.go100%100%100%
   hash.go100%100%68.42%..., 65, 66, 68, 69

@xlab xlab changed the title IBC Wasm Hooks, PFM and Simapp rewrite Prepare v3: IBC Wasm Hooks, PFM and Simapp rewrite Jun 26, 2023
@github-actions
Copy link

Coverage after merging f/max/ibc-hooks into master

18.43%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
simapp
   export.go100%100%13.43%..., 96, 97, 98, 99
   test_helpers.go100%100%28.07%..., 51, 52, 53, 99
   test_suite.go100%100%0%..., 58, 59, 60, 62
   modules.go100%100%100%
   ante_handler.go100%100%72.09%..., 54, 55, 59, 60
   genesis_account.go100%100%100%
   app.go100%100%81.79%..., 504, 507, 508, 509
simapp/simd/cmd
   testnet.go100%100%69.54%..., 535, 536, 93, 94
   root.go100%100%80.44%..., 73, 74, 77, 78
x/epochs/client/cli
   query.go100%100%0%..., 95, 96, 97, 98
x/epochs/keeper
   grpc_query.go100%100%38.46%..., 51, 53, 54, 55
   abci.go100%100%100%
   epoch.go100%100%85.71%..., 25, 61, 87, 92
   genesis.go100%100%90.91%14
   hooks.go100%100%100%
   keeper.go100%100%92.86%30
x/epochs/types
   genesis.go100%100%59.18%..., 57, 58, 61, 62
   query.pb.go100%100%2.24%..., 96, 97, 98, 99
   query.pb.gw.go100%100%0%..., 96, 97, 98, 99
   hooks.go100%100%100%
   genesis.pb.go100%100%28.80%..., 96, 97, 98, 99
x/halving/simulation
   genesis.go100%100%70%17, 18, 19
x/halving/types
   halving.pb.go100%100%2.76%..., 96, 97, 98, 99
   genesis.pb.go100%100%2.55%..., 68, 69, 98, 99
   genesis.go100%100%86.67%25, 26
   params.go100%100%85.29%24, 25, 26, 44, 45
   query.pb.gw.go100%100%0%..., 95, 96, 97, 98
   query.pb.go100%100%1.91%..., 96, 97, 98, 99
x/interchainquery
   module.go100%100%63.38%..., 84, 87, 88, 89
   genesis.go100%100%54.55%21, 22, 23, 24, 25
   handler.go100%100%0%15, 16, 17, 18, 19
x/interchainquery/keeper
   keeper.go100%100%67.59%..., 43, 66, 67, 89
   msg_server.go100%100%55.74%..., 76, 79, 87, 88
   grpc_query.go100%100%74.07%..., 33, 40, 43, 44
   abci.go100%100%92.68%58, 59, 60
   queries.go100%100%98%67
x/interchainquery/types
   genesis.go100%100%63.64%15, 16, 17, 18
   codec.go100%100%100%
   msgs.go100%100%54.17%..., 39, 45, 46, 47
   query.pb.gw.go100%100%0%..., 96, 97, 98, 99
   messages.pb.go100%100%3.58%..., 96, 97, 98, 99
   genesis.pb.go100%100%0.76%..., 996, 997, 998, 999
   keys.go100%100%0%22, 23, 24
   query.pb.go100%100%1.32%..., 996, 997, 998, 999
   messages.pb.gw.go100%100%0%..., 92, 93, 95, 99
x/oracle/keeper
   reward.go100%100%91.67%14, 15, 72, 88
   msg_server.go100%100%75.83%..., 81, 82, 85, 86
   keeper.go100%100%93.45%..., 47, 68, 69, 70
   genesis.go100%100%93.33%..., 34, 43, 52, 63
   params.go100%100%68.89%..., 75, 79, 80, 81
   grpc_query.go100%100%15.29%..., 96, 97, 98, 99
   ballot.go100%100%100%
   utils.go100%100%77.78%10, 9
   slash.go100%100%97.44%41
   alias_functions.go100%100%100%
   tally.go100%100%93.55%..., 113, 114, 60, 61
x/oracle/types
   vote.go100%100%100%
   tx.pb.go100%100%0.90%..., 993, 994, 996, 999
   genesis.pb.go100%100%0.93%..., 993, 994, 998, 999
   oracle.pb.go100%100%0.76%..., 995, 996, 997, 998
   msgs.go100%100%76.19%..., 37, 54, 55, 90
   params.go100%100%88.59%..., 296, 297, 298, 300
   keys.go100%100%0%..., 52, 53, 54, 55
   query.pb.gw.go100%100%0%..., 95, 97, 98, 99
   hash.go100%100%68.42%..., 65, 66, 68, 69
   denom.go100%100%100%
   codec.go100%100%52.38%..., 45, 46, 47, 48
   ballot.go100%100%96.61%110, 111, 195, 196
   genesis.go100%100%66.67%..., 23, 24, 25, 26
   query.pb.go100%100%0.83%..., 969, 97, 98, 99

@github-actions
Copy link

Coverage after merging f/max/ibc-hooks into master

18.46%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
simapp
   genesis_account.go100%100%100%
   modules.go100%100%100%
   test_helpers.go100%100%28.07%..., 51, 52, 53, 99
   app.go100%100%82.19%..., 511, 514, 515, 516
   export.go100%100%13.43%..., 96, 97, 98, 99
   ante_handler.go100%100%72.09%..., 54, 55, 59, 60
   test_suite.go100%100%0%..., 58, 59, 60, 62
simapp/simd/cmd
   testnet.go100%100%69.54%..., 535, 536, 93, 94
   root.go100%100%80.44%..., 73, 74, 77, 78
x/epochs/client/cli
   query.go100%100%0%..., 95, 96, 97, 98
x/epochs/keeper
   grpc_query.go100%100%38.46%..., 51, 53, 54, 55
   keeper.go100%100%92.86%30
   abci.go100%100%100%
   hooks.go100%100%100%
   epoch.go100%100%85.71%..., 25, 61, 87, 92
   genesis.go100%100%90.91%14
x/epochs/types
   genesis.go100%100%59.18%..., 57, 58, 61, 62
   hooks.go100%100%100%
   genesis.pb.go100%100%28.80%..., 96, 97, 98, 99
   query.pb.gw.go100%100%0%..., 96, 97, 98, 99
   query.pb.go100%100%2.24%..., 96, 97, 98, 99
x/halving/simulation
   genesis.go100%100%70%17, 18, 19
x/halving/types
   query.pb.gw.go100%100%0%..., 95, 96, 97, 98
   genesis.go100%100%86.67%25, 26
   params.go100%100%85.29%24, 25, 26, 44, 45
   halving.pb.go100%100%2.76%..., 96, 97, 98, 99
   genesis.pb.go100%100%2.55%..., 68, 69, 98, 99
   query.pb.go100%100%1.91%..., 96, 97, 98, 99
x/interchainquery
   module.go100%100%63.38%..., 84, 87, 88, 89
   handler.go100%100%0%15, 16, 17, 18, 19
   genesis.go100%100%54.55%21, 22, 23, 24, 25
x/interchainquery/keeper
   grpc_query.go100%100%74.07%..., 33, 40, 43, 44
   msg_server.go100%100%55.74%..., 76, 79, 87, 88
   keeper.go100%100%67.59%..., 43, 66, 67, 89
   abci.go100%100%92.68%58, 59, 60
   queries.go100%100%98%67
x/interchainquery/types
   query.pb.go100%100%1.32%..., 996, 997, 998, 999
   messages.pb.go100%100%3.58%..., 96, 97, 98, 99
   msgs.go100%100%54.17%..., 39, 45, 46, 47
   messages.pb.gw.go100%100%0%..., 92, 93, 95, 99
   codec.go100%100%100%
   genesis.go100%100%63.64%15, 16, 17, 18
   query.pb.gw.go100%100%0%..., 96, 97, 98, 99
   keys.go100%100%0%22, 23, 24
   genesis.pb.go100%100%0.76%..., 996, 997, 998, 999
x/oracle/keeper
   msg_server.go100%100%75.83%..., 81, 82, 85, 86
   tally.go100%100%93.55%..., 113, 114, 60, 61
   utils.go100%100%77.78%10, 9
   grpc_query.go100%100%15.29%..., 96, 97, 98, 99
   reward.go100%100%91.67%14, 15, 72, 88
   alias_functions.go100%100%100%
   genesis.go100%100%93.33%..., 34, 43, 52, 63
   params.go100%100%68.89%..., 75, 79, 80, 81
   ballot.go100%100%100%
   slash.go100%100%97.44%41
   keeper.go100%100%93.45%..., 47, 68, 69, 70
x/oracle/types
   keys.go100%100%0%..., 52, 53, 54, 55
   oracle.pb.go100%100%0.76%..., 995, 996, 997, 998
   query.pb.gw.go100%100%0%..., 95, 97, 98, 99
   msgs.go100%100%76.19%..., 37, 54, 55, 90
   vote.go100%100%100%
   genesis.go100%100%66.67%..., 23, 24, 25, 26
   query.pb.go100%100%0.83%..., 969, 97, 98, 99
   ballot.go100%100%96.61%110, 111, 195, 196
   genesis.pb.go100%100%0.93%..., 993, 994, 998, 999
   params.go100%100%88.59%..., 296, 297, 298, 300
   codec.go100%100%52.38%..., 45, 46, 47, 48
   hash.go100%100%68.42%..., 65, 66, 68, 69
   tx.pb.go100%100%0.90%..., 993, 994, 996, 999
   denom.go100%100%100%

@xlab
Copy link
Contributor Author

xlab commented Jul 13, 2023

This PR lost its reason:

  • ibc-hooks from osmosis now lives in ibc-apps and included directly to persistenceCore
  • ibc-apps/pfm and skip/pob are too, don't need to be there because they are tested in corresponding repos and used in persistenceCore directly

Only useful part there is:

The new simapp code from cosmos-sdk 0.47.x and uses the same layout as our persistenceCore, also has WASM and IBC wired, in case we will have to simulate and debug certain modules (i.e. x/oracle) in the future.

See #405

@xlab xlab closed this Jul 13, 2023
@xlab xlab deleted the f/max/ibc-hooks branch July 13, 2023 21:44
xlab pushed a commit that referenced this pull request Jul 13, 2023
This ignores app_v2 with deepinject which is not ready to be used with IBC
and other modules, for now we are sticking to app_v1 that is similar to what we had there.

The commit is a merged version from superceded PR #403
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants