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

Proposal: Interledger RPC (instead of LLL) #260

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion asn1/GenericPacket.asn
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ IMPORTS
QuoteByDestinationAmountRequest,
QuoteByDestinationAmountResponse
FROM InterledgerQuotingProtocol

Transfer,
ConditionalTransfer,
ConditionFulfillment,
TransferStateRequest,
TransferStateResponse,
FROM TransferProtocol

Ack,
CustomMessage
FROM InterledgerTypes
;

PACKET ::= CLASS {
Expand All @@ -34,7 +45,14 @@ PacketSet PACKET ::= {
{5 QuoteBySourceAmountResponse} |
{6 QuoteByDestinationAmountRequest} |
{7 QuoteByDestinationAmountResponse} |
{8 InterledgerProtocolError}
{8 InterledgerProtocolError} |
{9 Transfer } |
{10 ConditionalTransfer } |
{11 ConditionFulfillment } |
{12 TransferStateRequest } |
{13 TransferStateResponse } |
{14 Ack } |
{15 CustomMessage }
}

InterledgerPacket ::= SEQUENCE {
Expand Down
33 changes: 33 additions & 0 deletions asn1/InterledgerRPC.asn
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
LedgerLedgerLotocol
DEFINITIONS
AUTOMATIC TAGS ::=
BEGIN

IMPORTS
UInt32
FROM GenericTypes

Address,
CustomMessage
FROM InterledgerTypes

InterledgerPacket
FROM GenericPacket
;

InterledgerRpc ::= SEQUENCE {
-- to and from can be empty strings if they can be
-- inferred from the context
to Address,
from Address,
-- Used to associate requests and corresponding responses
-- If requestId = 0, the server MUST not send a response
requestId UInt32,
packet InterledgerPacket,
-- Additional data for protocol extensibility
sideProtocolData SEQUENCE OF CustomMessage
}
-- Note: any RPC call can be turned into a paid (or conditionally paid) request
-- by setting the packet to either a Transfer or a ConditionalTransfer

END
13 changes: 12 additions & 1 deletion asn1/InterledgerTypes.asn
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Address ::= IA5String
| "a".."z"
| tilde )
)
(SIZE (1..1023))
(SIZE (0..1023))

-- --------------------------------------------------------------------------

Expand Down Expand Up @@ -70,4 +70,15 @@ LiquidityCurve ::= SEQUENCE OF SEQUENCE {
y UInt64
}

Ack ::= NULL

CustomMessage ::= {
type IA5String,
-- mimeType SHOULD be defined but it MAY be an empty string if
-- the encoding is implied by the type
mimeType IA5String,
data OCTET STRING (SIZE (0..32767))
}


END
58 changes: 58 additions & 0 deletions asn1/TransferProtocol.asn
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
TransferProtocol
DEFINITIONS
AUTOMATIC TAGS ::=
BEGIN

IMPORTS
UInt64,
UInt128,
UInt256
FROM GenericTypes

Timestamp
FROM InterledgerTypes

InterledgerPacket
FROM GenericPacket

InterledgerProtocolError
FROM InterledgerProtocol
;

-- TODO: is it too strange for a Transfer to be an InterledgerPacket itself?
-- (that means you technically could include a Transfer in a Transfer)
Transfer ::= SEQUENCE {
transferId UInt128,
amount UInt64,
packet InterledgerPacket
-- TODO: is it worth putting extensions?
}

ConditionalTransfer ::= SEQUENCE {
transferId UInt128,
amount UInt64,
packet InterledgerPacket,
expiresAt Timestamp,
executionCondition UInt256
}

ConditionFulfillment ::= SEQUENCE {
transferId UInt128,
fulfillment UInt256
}

TransferStateRequest ::= SEQUENCE {
transferId UInt128
}

TransferStateResponse ::= SEQUENCE {
-- TODO: is it worth having this in a sequence?
state CHOICE {
fulfillment UInt256,
rejectionReason InterledgerProtocolError,
prepared NULL,
nonExistent NULL
}
}

END