Closed sappenin closed 6 years ago
I'm supportive of this but suggest we consider merging the code or splitting out the codecs from core or something.
What if we think of the current Condition
and Fulfillment
in ilp-core as an alternative encoding of a subset of crypto-conditions? i.e. Always PREIMAGE-SHA-256, always cost of 32 and encoded in OER as just the hash and preimage.
If we do that we could have a standard condition interface that could be compliant with crypto-conditions and then 3 encodings:
This aligns with earlier discussions we have had about decoupling the encoding from the objects.
My proposal is along the lines of option 1:
org.interledger.Condition
and org.interledger.Fulfillment
org.interledger.cryptoconditions.Condition
and org.interledger.cryptoconditions.Fulfillment
instead but encode/decode them as required for universal mode ILP.If we do that we could have a standard condition interface that could be compliant with crypto-conditions and then 3 encodings...this aligns with earlier discussions we have had about decoupling the encoding from the objects.
I added a comment in #102, and I think my counter-proposal satisfies the encoding requirement (encoded in OER as just the hash
and preimage
) as well as the other 2 requirements (Always PREIMAGE-SHA-256
, always cost of 32
).
What do you think?
Fixed by #102
I propose that we remove
org.interledger.Condition/Fulfilment
and reintroduce the java-crypto-conditions dependency.The
Condition
andFulfillment
in the java-ilp-core class works great for ILP Universal mode, but causes confusion and conversion issues in ILP Atomic-mode scenarios. In atomic-mode, the local-ledger transfers use threshold conditions (among other things) to wrap Preimage conditions used in the ILP packet. The problem is, the two types are different betweenorg.interledger.Fulfillment
andorg.interledger.cryptoconditions.Fulfillment
, so validation is tricky because conversion needs to occur between the ILPCondition/Fulfillment
and the crypto-condtions Condition/Fulfillment.This problem becomes worse when trying to create a java variant of the Ledger Plugin Interface, because in order to support both ILP modes, the java-crypto-conditions versions need to be used. This will create more headaches for Java Connectors that want to operate in either Universal or Atomic modes.
Some ideas to solve this issue:
Condition/Fulfillment
from java-ilp-core, and restore the dependency on java-crypto-condtions.java-ilp-core
andjava-crypto-conditions
could depend on this project, and implement their own flavor of PreimageSha256, but program interfaces to the mainCondition/Fulfillment
interfaces defined in the parent project.I kind of prefer Option1, because the original rationale for removing the crypto-conditions dependency has now gone away: There is now a published SNAPSHOT of the crypto-conditions library that can be trivially included in java-ilp-core.
That said, I'm open to other ideas.