Giter Club home page Giter Club logo

ibc-apps's Introduction

ibc-apps

IBC-APPS Header

IBC applications and middleware for Cosmos SDK blockchains

🌌 Why have an ibc-apps repo?

Early IBC work started in the ibc-go repo. As the repo grew, the need arose to parallelize the work among many teams.

The ibc-apps repo is meant to be an easily discoverable, navigable, central place for modules and middleware.

🌌🌌 Who's it for?

IBC-Apps is for:

  • Core ibc-go contributors; it frees them from having to maintain IBC Apps,

  • Publishers of ibc apps, so their apps can be easily found, and

  • Everyone who uses IBC and wants to benefit from the full range of its capabilities.

🌌🌌🌌 What is it?

What is IBC?

The Inter-Blockchain Communication Protocol (IBC) is a protocol to handle the authentication and transport of data between two blockchains. IBC requires a minimal set of functions, specified in the Interchain Standards (ICS). These specifications do not limit the network topology or consensus algorithm, so IBC can be used with a wide range of blockchains or state machines. The IBC protocol provides a permissionless way for relaying data packets between blockchains, unlike most trusted bridging technologies. The security of IBC reduces to the security of the participating chains.

IBC solves a widespread problem: cross-chain communication. This problem exists on public blockchains when exchanges wish to perform swaps. The problem arises early in the case of application-specific blockchains, where every asset is likely to emerge from its own purpose-built chain. Cross-chain communication is also a challenge in the world of private blockchains, in cases where communication with a public chain or other private chains is desirable.

Cross-chain communication between application-specific blockchains in Cosmos creates the potential for high horizontal scalability with transaction finality. These design features provide convincing solutions to well-known problems that plague other platforms, such as transaction costs, network capacity, and transaction confirmation finality.

What is an IBC App?

IBC apps can be split into two categories - modules and middleware.

IBC Modules are self-contained applications that enable packets to be sent to and received from other IBC-enabled chains. IBC application developers do not need to concern themselves with the low-level details of clients, connections, and proof verification.

IBC Middleware are self-contained modules that sit between core IBC and an underlying IBC application. This allows developers to customize lower-level packet handling. Multiple middleware modules can be chained together.

🌌🌌🌌🌌 How to Use this repo

If you'd like to include software in this repo, please see contributing.

🌌🌌🌌🌌🌌 Bonus Content

Maintained Branches

Branch Name IBC-Go
main v8
release/v7 v7
release/v6 v6
release/v5 v5
release/v4 v4

List of Apps

Name Type Example Stakeholders Description
Async Interchain Query Module Link Strangelove Interchain Queries enable blockchains to query the state of an account on another chain without the need for ICA auth.
IBC Hooks Module Link Osmosis The IBC hooks module is an IBC middleware that enables ICS-20 token transfers to initiate contract calls.
Packet Forward Middleware Middleware Link Strangelove Middleware for forwarding IBC packets.

Ecosystem Apps

Modules and middleware developed by other awesome teams in the ecosystem:

Name Type Stakeholders Description
Interchain KV Queries Module Ingenuity An application that enables on chain querying of another IBC enabled chains state without the need for the chain being queried to implement the application.
query Module Defund Labs An application that enables on chain querying of another IBC enabled chains state without the need for the chain being queried to implement the application. Similar to the interchain-queries application in the row above but without callbacks.
NFT Transfer (ICS 721) Module Bianjieai An application that enables cross chain NFT transfer.
CosmWasm NFT Transfer (ICS 721) WASM Contract Public Awesome (Stargaze), Ark Protocol An application that enables cross chain NFT transfer. CosmWasm implementation of the above, written in Rust.
recovery Middleware Evmos Middleware enabling the recovery of tokens sent to unsupported addresses.
ibc-rate-limit Middleware Osmosis Labs Middleware that limits the in or out flow of an asset in a certain time period to minimise the risks of cross chain token transfers. This is implemented as a middleware wrapping ICS20 with the rate limiting logic implemented by cosmwasm contracts.
Interchain Atomic Swap WASM Contract Side Labs An application that facilitates inter-blockchain peer-to-peer asset swaps.
Interchain Liquidity WASM Contract Side Labs An application that splits the state of a weighted liquidity pool between two chains, enabling inter-blockchain automated asset swaps.

ibc-apps's People

Contributors

agouin avatar alexanderbez avatar assafmo avatar bd21 avatar beer-1 avatar boojamya avatar crodriguezvega avatar dzmitry-lahoda avatar emidev98 avatar faddat avatar hoank101 avatar jhernandezb avatar johnletey avatar jonathanpberger avatar jtieri avatar liangping avatar luqipan avatar mdulin2 avatar nicolaslara avatar pr0n00gler avatar reecepbcups avatar rootulp avatar shanev avatar taztingo avatar vitalyv1337 avatar xlab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ibc-apps's Issues

adding & importing ibc-rate-limit cleanup

TODO

  • Get a guide up for adding a new directory (codeowners, coordination, requirements, labels, etc)
  • Add Stride write -> @sampocs @asalzmann @riley-stride @shellvish and @ethan-stride
  • Diff check feat/v50 branch upstream -> noble-assets fork (this pr)
  • Add ibc-rate-limit label, give credit to original authors
  • Write in basic e2e interchaintest if not already (take from spawn). Add to GH CI
  • Remove v50 from upstream / add to readme to use ibc-apps Archive upstream
  • Tag a v8.0.0 release for ibc-rate-limit
  • Anywhere that Stride-Labs/ibc-rate-limiting is needs to be renamed (i.e. docs)

Consider updating PFM references

Context

- <https://github.com/cosmos/ibc-go/pull/373>
- <https://github.com/strangelove-ventures/governance/blob/master/proposals/2021-09-hub-ibc-router/README.md>

Problem

The first link is a closed PR and the second link is broken.

Proposal

The first link may still relevant be if that was the original PR that was the basis for this line of work but it seems confusing without context. The second link seems like it should be updated or removed.

Related: this repo may consider adopting markdown link check to get CI signal when a link is dead.

If a query panics an error acknowledgement is not sent.

Example:

Let's say I want to query GetCmdEstimateSwapExactAmountIn from Osmosis, if you're querying a stableswap pool and enter more tokens than there are in a pool it will panic Here this will not cause the query to panic and not return an error thus async-icq will not return an ack-err.

async-icq demo controller chain implementation should live in this repo

async-icq has the concept of a host chain (the chain where queries are received and processed) and a controller chain (the chain sending the query req and processing the ack). there is a demo that currently lives here but i think it would be more beneficial for app developers to have access to this demo in the ibc-apps repo. it would also make testing via an e2e test with ictest in this repo straightforward so that functionality for both the host and controller can be exercised in CI

ibc-hooks doesn't always return ack,err when it should

This code should error because we can't instantiate code_id 2000, because it doesn't exist

{
  "contract": "migaloo1v7cuk85rgfrsegsegsslre0lhgrvq28gqtlyms6",
  "msg": {
    "execute_msgs": {
      "msgs": [
        {
          "msg": {
            "wasm": {
              "instantiate": {
                "code_id": 2000,
                "msg": "eyJhbGxvd19jcm9zc19jaGFpbl9tc2dzIjogdHJ1ZX0=",
                "funds": [],
                "label": "Global proxy"
              }
            }
          }
        }
      ]
    }
  }
}

I'm not sure if this issue "lives" here or possibly in CosmWasm. As we work on it, we'll put updates here.

Remove gogoproto replace statements for v8

I'm currently assisting the Provenance Blockchain in migrating to sdk 50. One step in this migration process is the ability to remove github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 from go.mod since cosmos/gogoproto is being used. The Provenance Blockchain cannot remove this dependency because it was not removed from async-icq/v8. This ibc-app should be able to remove it since it is no longer needed.

Branches cosmos-sdk and ibc-go version compatibility

The current repository only contains the async-icq module and has a branching structure as shown in the image.
image

If we add more modules, it could become messy without a better branching naming convention. For example, if we add a new module called ibc-hooks and want to support multiple versions of cosmos-sdk and ibc-go, we can only branch out from main, which currently has a version of async-icq that supports ibc-go v7. This means that all three versions of ibc-hooks will live together with async-icq v7, which feels awkward.

We are open to suggestions on how to better manage this, such as having a base branch with all the latest patches for a certain cosmos-sdk/ibc-go release.

We propose having two release branches, release/v6 and release/v7, with each branch containing specific versions of the modules. Pull requests for ibc-hooks module updates targeting ibc-go/v6 will be merged into release/v6, and a tag ibc-hooks/v6.0.1 can be released from release/v6.

- release/v6
    |_ async-icq/v6.0.1
    |_ ibc-hooks/v6.0.0
- release/v7
    |_ async-icq/v7.0.1
    |_ ibc-hooks/v7.0.1

The name router is ambiguous given its usage in other contexts

From Justin in the previous repo: strangelove-ventures/packet-forward-middleware#10

router is used in a few different contexts across modules/in the SDK so perhaps renaming to ibcrouter would be less confusing

"I think pfm or forward are valid choices! typically when I import the middleware into other repos I end up creating an alias called forward"

"I think a lot of apps already rename the import to packetforward so this might be a good candidate as well"

doc: IBC Hooks counter smart contract README contains misleading explanation

Here https://github.com/cosmos/ibc-apps/blob/main/modules/ibc-hooks/tests/unit/testdata/counter/README.md you mention that

This way we can verify that, independently of the sender, the funds will end up under the WasmHooksModuleAccount address when the contract is executed via an IBC send that goes through the wasmhooks module.

But in reality I can see that module account never receives funds. Instead intermediary account is created from channel+original sender and it temporary holds funds.

Proofs:

// Calculate the receiver / contract caller based on the packet's channel and sender
channel := packet.GetDestChannel()
sender := data.GetSender()
senderBech32, err := keeper.DeriveIntermediateSender(channel, sender, h.bech32PrefixAccAddr)
if err != nil {
return NewEmitErrorAcknowledgement(ctx, types.ErrBadSender, fmt.Sprintf("cannot convert sender address %s/%s to bech32: %s", channel, sender, err.Error()))
}

// The funds sent on this packet need to be transferred to the intermediary account for the sender.
// For this, we override the ICS20 packet's Receiver (essentially hijacking the funds to this new address)
// and execute the underlying OnRecvPacket() call (which should eventually land on the transfer app's
// relay.go and send the sunds to the intermediary account.
//
// If that succeeds, we make the contract call

https://github.com/cosmos/ibc-apps/blob/main/modules/ibc-hooks/wasm_hook.go#L71

IMO the README should be rephrased.

question(ibc-hooks): incentives to relay wasm hooks

There are 2 undone issues to handle relayer incentives it on CW level:

CosmWasm/cosmwasm#1491

CosmWasm/cosmwasm#893

Incentive - why would relayer burn gas on wasm hook packet?

One solution could be packet fee takes from ics20, but that is per chain module and does not work in all cases.

So how I can within existing wasm hook do incentives?

Can my contract reflect (query current TX context) on signer (get signer infos) in Cosmos chain so that my contract can bank transfer some?

Gas prices spiked recently on bull market.

ICS27 has solution has something about fees, but its callback sucks (it is 2x more blocks slowness on top of existing wasm hook).

Make router.getReceiver public

Hello,
I think it would be highly beneficial to make the packet-forward-middleware function getReceiver public

func getReceiver(channel string, originalSender string) (string, error) {

There are a number of use cases where other middleware may need to also have access to this address. In particular, for Duality/Neutron, our swap-and-forward middleware needs to use this same address to receive funds from a swap in order to be forwarded correctly by the PFM. As a temporary fix, we have copied over the code for getReceiver into our own middleware, but this is a very brittle solution.

Thanks for your consideration.

(Bug?) ResponseQuery Data changed from Value to Key

We noticed from testing that the data encoded in the ResponseQuery on the host side was changed to be stored into Key instead of Value when changing versions from v7.0.0 to v7.1.1. The tests were ran using both osmosis and juno, unfortunately cannot provide the e2e test since it is in a private repo currently. We can spin up a test on this repo for further proof if required.

There was no mention of this change in the CHANGELOG and we were wondering whether this change was intentional. Thanks!

Update integration docs

We are adding PFM to Stride next week.

In v7.1.2, the integrations docs say

// Register packet forward middleware AppModule
app.moduleManager = module.NewManager(
    ...
    packetforward.NewAppModule(app.PacketForwardKeeper),
)

But a second argument is required by NewAppModule

// NewAppModule creates a new packetforward module
func NewAppModule(k *keeper.Keeper, ss exported.Subspace) AppModule {
	return AppModule{
		keeper:         k,
		legacySubspace: ss,
	}
}

What should legacySubspace be? Why is it required? @Reecepbcups

Related PR: #128

add mergify to CI

We should add mergify to the repo to assist in back porting issues across supported branches/releases. It has been a huge help in other repos and I can see it being especially useful here as well

Update async-icq to ibc-go/v8

We are in the process of updating Provenance Blockchain to cosmos sdk v0.50.0, and one step involves updating ibc-go to v8. One of our dependencies is async-icq, and unfortunately it doesn't have support for ibc-go/v8 yet. A new tagged version of async-icq/v8 would be very helpful.

Integrate CI tests for apps and middleware

There should be CI testing for each application and module.

We should document and standardize this process and make is smooth for future incoming apps.

Some R and D may be necessary for mono repos like this.

middleware: staking

Reference

#41

Goal

The ability to use an ICS20 packet to directly stake w/o additional transactions from the end user. Designed to be chained with other middlewares, such as packet forward middleware and/or swap and forward

Flow

$ATOM on Osmosis -> IBC out to Cosmoshub-4 -> stake to validator with X amount

Why?

Better UX, good base middleware which can be easily copied for other teams to build application specific middlewares (lending, borrowing, swaps, etc.)

PFM hook possible fixes when used along with IBC-hook? #

Hello, what is planned fix for https://github.com/SCV-Security/responsible-disclosures/blob/main/SCV%20-%20Responsible%20Disclosure%20-%20PFM%20and%20IBC-hooks.pdf ?
I though of all fixes I can do in contract with all data available, the only fix CW developer can do is signed token inside packet, but without ZK this is dead end for IBCing high gas cost chains with different signature schemes.
Planned fix would help to write code the way anticipating that fix to happen.
Thank you

ibc-hooks: failing unit tests when using with ibc-go >= 7.1.0

Hello! Recent changes in ibc-go 7.1.0 (see apps/transfer in release notes and specifically ADR-011 for the background) are breaking unit tests for ibc-hooks package. While it can still work fine with ibc-go 7.2.0, this mock of escrow in the test is not sufficient anymore:

// send funds to the escrow address to simulate a transfer from the ibc module
escrowAddress := transfertypes.GetEscrowAddress(recvPacket.GetDestPort(), recvPacket.GetDestChannel())
err := suite.App.BankKeeper.SendCoins(suite.Ctx, suite.TestAddress.GetAddress(), escrowAddress, sdk.NewCoins(sdk.NewInt64Coin("stake", 2)))

Will result in a panic like this:

receiver cosmos1axvk83fmkhz98wqzse6ds0aq53q99xs7cc0478yungfeflscex0qlg7stl unescrows 1stake
    suite.go:87: test panicked: negative coin amount: -1stake
        goroutine 12 [running]:
        runtime/debug.Stack()
        	/usr/local/go/src/runtime/debug/stack.go:24 +0x64

This is because escrow amounts now tracked in TransferKeeper as well, not only as balances in the bank module.

To properly simulate escrowing tokens without actually sending them, the caller must also set the total escrow amount in the TransferKeeper directly:

// SetTotalEscrowForDenom stores the total amount of source chain tokens that are in escrow.
// Amount is stored in state if and only if it is not equal to zero. The function will panic
// if the amount is negative.
func (k Keeper) SetTotalEscrowForDenom(ctx sdk.Context, coin sdk.Coin) 

I have made necessary changes in PR #56 please note that it supports versions prior to 7.1.0 as well, that don't have SetTotalEscrowForDenom available in TransferKeeper.

Tasks

Look into creating a GitHub Badge for each app

I envision the badge being a part of the List of Apps table on the home readme.

Docs on create custom github badges:

Chains can then add the badge to their repository.

Maybe not the most elegant, but this seems like an easy win to allow chains to advertise their use of specific apps.

chore: remove `IBCMiddleware.refundTimeout` as it is no longer used

I was trying to understand meaning of refundTimeout inside IBCMiddleware but didn't find any usage of this attribute except initialization (3 times) and unit test (2 times) - see screenshot.

I'm still wondering what is the reason behind and if it should be present at all.

Screenshot 2024-05-01 at 17 47 15

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.