[ABR] Refactor xamdata
Handling in transition-dapp
to Support Assets Transfers and Generic Custom Instructions (Beyond SEKAI)
#689
Labels
Description
sekai/x/layer2/client/cli/tx.go
Lines 521 to 531 in 1a5be2f
transition-dapp
currently expects a fourth parameter of type[]sdk.Msg{}
, which supposedly refers toxamdata
.xamdata
is meant to allow applications to bundle xam messages (containing arbitrary instructions for inter-app communication and assets transfers such as settling internal users balances). However, the expectation of asdk.Msg
type suggests thattransition-dapp
expects only transactions destined to SEKAI, which is incorrect.Expected Behaviour
The
xamdata
sent by applications should resemble the structure of the transaction created by thetransfer-dapp
, but should be capable of containing an array of such transactions, allowing multiple REQUEST operations to be packed together.xamdata
must carry asset transfers AND custom instructions.The
xamdata
must allow RESPONSE type to be appended. It should be the only way for applications to respond to XAM REQUEST, henceAckTransferDappTx
need to be refactored/deleted since the ABR should processxamdata
.sekai/x/layer2/keeper/msg_server.go
Line 553 in 1a5be2f
Example
xamdata
If
dest_app == 0
and themessages
(calledxam
in KIP) property of thexamdata
is notnull
, the ABR should recognize thatmessages
contains messages of type[]sdk.Msg{}
to be executed by SEKAI. Ifdest_app =/= 0
, the XAM is simply registered,messages
don't need to be processed by ABR since it is the responsibility of the destination app to monitor incoming XAMs and process custom instructions if any.All asset transfers are processed by ABR no matter the value of
dest_app
. Applications monitor the ABR for XAMs and respond during session submissions usingxamdata
(see above). ABR monitor incoming RESPONSE messages, process them and settle transfer according to following logic:Deposits need destination app confirmation within 2 blocks or twice the application's
update_time_max
whichever is bigger. If not confirmed, ABR doesn't settle and edit XAM withirc
code402
.Withdrawals do not need confirmation they are automatically settled after the same set time with ABR returning
irc
code200
. Can be confirmed by the source app to speed processing up.If
dest_app == 0
, transactions destined for SEKAI are unsigned; if the Session submission (and by extension itsxamdata
) are accepted by Verifiers, they are signed by the application's public key.Transactions destined for SEKAI may or may not be valid, however if one transaction is invalid the Session containing the
xamdata
should fail and all assets transfer within the samexamdata
should also fail even if Verifiers approved the Session submission. Conversely, if any asset transfer within thexamdata
fails, the Session must fail as well. All or nothing.Use
parameter of thetransition-dapp
CLI should be explicit about the necessity to providexamdata
The text was updated successfully, but these errors were encountered: