crypto-org-chain / cronos

Cronos is the first Ethereum-compatible blockchain network built on Cosmos SDK technology. Cronos aims to massively scale the DeFi, GameFi, and overall Web3 user community by providing builders with the ability to instantly port apps and crypto assets from other chains while benefiting from low transaction fees, high throughput, and fast finality.
Other
295 stars 237 forks source link

Problem: no acknowledgement detail in ica callback #1636

Open mmsqe opened 1 month ago

mmsqe commented 1 month ago

smart contract could get more detail when receives callback onPacketResult instead of a simple boolean indicating success or failure.

yihuang commented 1 month ago

but we need to keep it backward compatible, right? to avoid breaking existing contracts?

mmsqe commented 1 month ago

but we need to keep it backward compatible, right? to avoid breaking existing contracts?

yes, but if we add it as a new, we need call both functions?

function onPacketResultCallback(string calldata packetSrcChannel, uint64 seq, bool ack) external payable returns (bool);
function onPacketResultCallbackWithDetail(string calldata packetSrcChannel, uint64 seq, bool ack, bytes calldata rsp) external payable returns (bool);
yihuang commented 1 month ago

better not, how about making the query api a special case, adding new apis only for query msg, without changing existing apis at all.

mmsqe commented 1 month ago

not sure if we just pass req.Data to contract, not sure how contract handle dynamically since safeRsp.Responses could come from query balance or param

var safeRes hosttypes.MsgModuleQuerySafe
err := proto.Unmarshal(res.GetResult(), &safeRes)
if err != nil {
    return err
}
for _, req := range safeRes.Requests {
    var safeRsp hosttypes.MsgModuleQuerySafeResponse
    if err := k.cdc.Unmarshal(req.Data, &safeRsp); err != nil {
        return err
    }
}