180protocol / codaptor Goto Github PK
View Code? Open in Web Editor NEWInstantly add Corda to any tech stack and improve resiliency of your architecture
License: GNU Affero General Public License v3.0
Instantly add Corda to any tech stack and improve resiliency of your architecture
License: GNU Affero General Public License v3.0
Currently, serialising Files is only supported as part of the CordaNodeAttachmentSerialiser
. However, File streams can be inputs to flows. Hence a InputStreamSerialiser
needs to be written to handle File binary streams to be serialised as InputStream
Add support for flow initiation and progress tracking via WebSockets.
In some cases API clients may require tighter feedback about execution of a flow instance. Add an ability to use websockets for receiving real-time updates from flow progress tracker and flow outcomes.
As a developer creating CorDapp-specific extension for Cordaptor I want to use Corda vault query API, so that my code is more expressive.
Rationale: Corda offers nearly identical API for querying the node's vault both over Corda RPC and internally via VaultService. These APIs could be surfaced to extensions in a uniform way. This will simplify development of CorDapp-specific extensions that work across all deployment models.
Cordaptor 0.1.0 is built with platform version 7, expecting Corda 4.5+. We don’t have critical dependency on any APIs, and retrofitting support for older versions should be straightforward.
Please comment on what versions you’d like to see supported
Steps to reproduce:
{"cause":{"class":"tech.b180.cordaptor.rest.SerializationException","message":"Error finding serializer for property value of object Parameterised(CordaFlowResult<List (erased)>)","cause":"java.lang.AssertionError: Don't know how to make instances of interface java.util.List"},"errorType":"GENERIC_ERROR","message":"Unknown server error"}
Edit:
It seems the issue is because the Flow return type for flow AccountInfoByName
under Accounts SDK of Corda has nested parametrisation - e.x., FlowLogic<List<StateAndRef>>
The SerialiserKey in this case is not being created correctly
Describe the bug
Swagger UI request body don't show for Map data type
To Reproduce
Steps to reproduce the behavior:
Startup the application up using docker compose
Open the host node swagger UI at localhost:9500/swagger
The request configuration does not show up for map data type request
Expected behavior
The sample request configuration should show up
Hello,
I was trying to get the latest version of Codaptor, with the Feature 28: CORS Request support
However, it seems that the links to the Sonatype OSS Snapshots in the Readme Section Versions and Artifacts are broken. They redirect to the following url https://oss.sonatype.org/content/repositories/snapshots/
with the message Directory listing forbidden.
Would you be able to fix that please?
Also, do you have any plans as to when a new version will be released? Useful features such as CORS support were implemented since the last release.
Thank you very much for your work. Codaptor truly makes creating REST APIs for CorDapps very easy!
CorDapp developers tend to use AbstractParty when they want to support concrete parties, as well as anonymous identities. Currently Cordaptor only supports concrete parties. We need to change serialization logic to support both anonymous and concrete parties.
Cordaptor is coupled with the underlying node, so it will follow the principle that if the node knowns about anonymous party identity, it will provide its X.500 name, otherwise only a hash of the owning key.
Hashing mechanism for the keys will obtain SHA256 hash of the key bytes, and then represent it as a string encoded as Base58, in line with Corda and general crypto community practice
Steps to reproduce:
java.lang.AssertionError: Internal API is accessible via service hub instance expected:<1> but was:<0>
Steps to reproduce:
{"cause":{"class":"tech.b180.cordaptor.rest.SerializationException","message":"Cannot create a serializer for type Unparameterised(net.corda.samples.auction.states.AuctionState) introspected as non-composable for the following reason: Has properties [auctionItem] of types that are not serializable:\nauctionItem [net.corda.core.contracts.LinearPointer<net.corda.core.contracts.LinearState>]: Has properties [type] of types that are not serializable:\n type [java.lang.Class<net.corda.core.contracts.LinearState>]: No unique deserialization constructor can be identified","cause":"null"},"errorType":"GENERIC_ERROR","message":"Unknown server error"}
Steps to reproduce:
cordaptor_1 | Exception in thread "main" java.lang.AssertionError: Flow class class net.corda.finance.flows.CashExitFlow does not seem to extend FlowLogic
cordaptor_1 | at tech.b180.cordaptor.corda.ReflectionUtilsKt.determineFlowResultClass(ReflectionUtils.kt:16)
The fix will involve introspecting all supertypes rather than direct supertype when introspecting flow classes
Steps to reproduce:
{"cause":{"class":"tech.b180.cordaptor.rest.SerializationException","message":"Flow type identified as Parameterised(CordaFlowInstruction<CashExitFlow>) was not introspected as composable.\nIntrospection details: CashExitFlow)","cause":"null"},"errorType":"GENERIC_ERROR","message":"Unknown server error"}
Steps to reproduce:
{ "cause": { "class": "tech.b180.cordaptor.rest.SerializationException", "message": "Error finding serializer for property value of object Parameterised(CordaFlowResult<Unit>)", "cause": "tech.b180.cordaptor.rest.SerializationException: Don't know how to create a serializer for type Unparameterised(kotlin.Unit) (introspected as net.corda.serialization.internal.model.LocalTypeInformation.Singleton)" }, "errorType": "GENERIC_ERROR", "message": "Unknown server error" }
Introspection of the Amount class generates a weird-looking JSON, and we need to make it easier to work with.
Further, most commonly used token for Amount is a java.util.Currency, and it would be better if we represented it as a JSON string containing ISO code.
Steps to reproduce:
Serialisation of corda core type NonEmptySet is not supported and throws an error -
{
"cause": {
"class": "tech.b180.cordaptor.rest.SerializationException",
"message": "Error finding serializer for property acceptableContracts of object Parameterised(Terms<*>)",
"cause": "java.lang.AssertionError: Don't know how to make instances of class net.corda.core.utilities.NonEmptySet"
},
"errorType": "GENERIC_ERROR",
"message": "Unknown server error"
}
NonEmptySet is introspected as a Collection type and the solution would handle all such non supported collection types that do not need to be de-serialised.
The scripts don't start on linux because they use Windows file endings:
./cordaptor.sh
bash: ./cordaptor.sh: /bin/sh^M: bad interpreter: No such file or directory
file cordaptor.sh
cordaptor.sh: POSIX shell script, ASCII text executable, with CRLF line terminators
Summary:
Current Cordapp introspection logic queries and filters all classes on the cordapp for contract state classes. This includes dependencies such as those on apache and other libraries. Such libraries are sometimes sealed and thus introspection can fail -
Caused by: java.lang.SecurityException: sealing violation: package org.apache.commons.lang3.time is sealed
cordaptor_1 | at java.net.URLClassLoader.getAndVerifyPackage(URLClassLoader.java:400)
cordaptor_1 | at java.net.URLClassLoader.definePackageInternal(URLClassLoader.java:420)
cordaptor_1 | at java.net.URLClassLoader.defineClass(URLClassLoader.java:452)
cordaptor_1 | at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
cordaptor_1 | at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
cordaptor_1 | at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
cordaptor_1 | at java.security.AccessController.doPrivileged(Native Method)
cordaptor_1 | at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
cordaptor_1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
cordaptor_1 | at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
cordaptor_1 | at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
cordaptor_1 | at java.lang.Class.forName0(Native Method)
cordaptor_1 | at java.lang.Class.forName(Class.java:264)
cordaptor_1 | at tech.b180.cordaptor.corda.CordappInfoBuilder.build(Introspection.kt:96)
cordaptor_1 | at tech.b180.cordaptor.rpc.ClientNodeCatalogImpl.<init>(ClientNodeCatalog.kt:30)
Upgrade Codaptor to Corda 5 and test out serialisation framework
Steps to reproduce:
net.corda.core.transactions.MissingContractAttachments: Cannot find contract attachments for tech.b180.ref_cordapp.TrivialContractnull.
Steps to reproduce:
tech.b180.ref_cordapp.CordaInternalApiTest > can access cordapps list FAILED
org.junit.ComparisonFailure at CordaInternalApiTest.kt:74
Current CordApp introspection logic involves scanning Cordapp
object (from Corda Core library) for all underlying cordapps loaded at the given node.
States
For states this logic, involves looking at all cordapp classes and filtering out all package names that are of type ContractState
. However, this utilizes the Java Class forName
API that instantiates an instance of the said package, causing issues. To improve this, package names only containing 'state' in their qualified name are filtered and inspected.
Flows
Additionally, for flow inspection, the allFlows
parameter on the Cordapp
object was utilized. This caused issues inspecting flows that inherit a given parent flow. Therefore, serviceFlows
or rpcFlows
parameters are used respectively for embedded and standalone modes.
While testing flow triggering with multipart/form-data
Content Type with Swagger UI, an options
parameter is added by default. This caused the serialisation to break as options
parameter is a nested structured object, that requires to be treated as such.
User story:
As a CorDapp developer who wants to expose its API via Cordaptor, I want to be able to configure URL prefix to use for the API,
so that I can make it look reasonable without changing anything else in the CorDapp.
Rationale:
As of v0.1.0, Cordaptor takes shortName
from net.corda.core.cordapp.Cordapp.Info
, which is derived from attributes of MANIFEST.MF of the CorDapp JAR in Corda 4. This value is used as part of an URL prefix for API endpoints.
There is no common convention for this value, which means some CorDapps will have characters that are not compatible with URLs, have very long prefixes, or both, e.g. https://github.com/corda/bn-extension/blob/release/1.1/build.gradle
There has to be a way to override this value at the level of the CorDapp.
Other consideration is that it's likely in future there will be other settings to configure at the CorDapp level, so a solution with more broad potential is likely to be useful.
Certain web app will require cross origin request. Config to enable CORS by controlling the AllowedMethods and AllowedOrigins for requests coming to the Undertow server.
For detailed CORS config the following plugin can be used https://github.com/Download/undertow-cors-filter
Steps to reproduce:
While trying to serialize an object with java.time.Duration class as a property, there is a serialisation exception thrown.
{ "cause": { "class": "tech.b180.cordaptor.rest.SerializationException", "message": "Cannot create a serializer for type Erased(net.corda.finance.contracts.asset.Obligation$State) introspected as non-composable for the following reason: Has properties [template] of types that are not serializable:\ntemplate [net.corda.finance.contracts.asset.Obligation$Terms<*>]: Has properties [timeTolerance] of types that are not serializable:\n timeTolerance [class java.time.Duration]: Mandatory constructor parameters [arg0, arg1] are missing from the readable properties []", "cause": "null" }, "errorType": "GENERIC_ERROR", "message": "Unknown server error" }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.