abstract icon indicating copy to clipboard operation
abstract copied to clipboard

New feature --> No ID replies

Open Kayanski opened this issue 1 year ago • 6 comments

This PR aims at removing the reply ids all-together from the Abstract Framework. The rationale behind that is that they are hard to manage, easy to miss and difficult to maintain. Instead, the user will register the replies to a specific endpoint by returning the following new structure inside their endpoints:

// Old 
// SubMsg::reply_always(cosmos_msg, REPLY_ID)
// New
SubMsg::reply_always(cosmos_msg, reply_func)

In addition, they will need to register reply_func with the App object for the rust engine to be able to match it and call it accordingly.

This allows for code to be easier to read (register a callback function instead of a random ID) and less error-prone. We could also use this concept for IBC Callbacks

Checklist

  • [ ] CI is green.
  • [ ] Changelog updated.

Kayanski avatar Oct 08 '24 08:10 Kayanski

Deploying abstract-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: a7a1232
Status: ✅  Deploy successful!
Preview URL: https://da55cfca.abstract-docs.pages.dev
Branch Preview URL: https://feature-no-id-replies.abstract-docs.pages.dev

View logs

Since it removes reply ids entirely, how would developers build examples with dynamic replies like:

https://github.com/CyberHoward/interchain-gov/blob/main/contracts/interchain-gov/src/contract.rs#L37-L45

adairrr avatar Oct 09 '24 15:10 adairrr

Since it removes reply ids entirely, how would developers build examples with dynamic replies like:

https://github.com/CyberHoward/interchain-gov/blob/main/contracts/interchain-gov/src/contract.rs#L37-L45

And makes it more difficult to migrate existing cosmwasm contracts to abstract (if this is a concern).

adairrr avatar Oct 09 '24 15:10 adairrr

Since it removes reply ids entirely, how would developers build examples with dynamic replies like:

https://github.com/CyberHoward/interchain-gov/blob/main/contracts/interchain-gov/src/contract.rs#L37-L45

They wouldn't, but using ID as a value field shouldn't not be done and this is a basis for this change (checkout the cosmwasm docs)

Kayanski avatar Oct 09 '24 15:10 Kayanski

Since it removes reply ids entirely, how would developers build examples with dynamic replies like: https://github.com/CyberHoward/interchain-gov/blob/main/contracts/interchain-gov/src/contract.rs#L37-L45

And makes it more difficult to migrate existing cosmwasm contracts to abstract (if this is a concern).

It does !

Kayanski avatar Oct 09 '24 15:10 Kayanski

Don't think this is worth pursuing either. Seems to add complexity for not too much gain.

CyberHoward avatar Oct 09 '24 15:10 CyberHoward

This was a POC, closing as this introduces too much complexity for very little gain

Kayanski avatar Oct 11 '24 06:10 Kayanski