I have some calculation code into corda APP. for example (stateA + StateB).
After some time after corda network was started I have to upgrade formula from
(stateA + StateB)
to
(stateA + StateB + 2)
Does corda have the best practice how to do it. For example upgradable contracts from Version 1 to Version 2 with a new formula. Any best practice how to achieve it?
Thanks.
The upgrade guide for CorDapps can be found here: https://docs.corda.net/upgrading-cordapps.html.
Related
Very new to Corda, I would be asking very basic or simple questions, please bear with me, I am looking for some examples for my POC. I have to save the txns details into DB for each node and notary. I am using the Corda community 4.9 version. Any leads on this?
Thanks in Advance.
regards
Ajit
As mentioned in the docs on performing flow upgrades, all you need to do is basically shut down the node, replace JAR, and start the node back up. When I do this, when my upgraded flow is run the next time, I get the following error:
net.corda.core.contracts.TransactionVerificationException$ContractConstraintRejection: Contract constraints failed for com.company.project.contract.MyContract, transaction: ABCDEFG
And the flow does not complete as a result. What am I doing wrong?
As my experience it seem like Corda flow upgrade not update network parameter (state still belong to old hash, old contract). Then when replace with new contract it will be contract constraint.
So I think you have 3 way to manage this
For local network bootstrap, update network parameter before doing flow upgrade (I use network-bootstrap.jar for copy new contract to cordapp folder, then it will append new contract hash immediately)
For Corda network, you must contact network operator for update new hash.
Use SignatureConstraint of Corda4 (they claim that it's upgrade easier but I didn't try yet)
Hope this help
We are using Nitrogen-SR3 release and using customized 2 node cluster. We have to support "Rolling Upgrade" (no downtime to cluster) of our entire application. Please let us know can we add/remove nodes dynamically from/to "Akka" cluster and form a new cluster (after upgrade of all nodes) programmatically. If yes, could you please give us the steps.
Thanks
Is there a way to build a troubleshooting component that reports the Cordapp and Corda version being used by a node in the network?
CordaRPCOps has two methods that retrieve version information but they are only for RPC and Flow version information:
https://docs.corda.net/clientrpc.html#versioning
https://docs.corda.net/api/kotlin/corda/net.corda.core.flows/-flow-logic/get-flow-info.html
CordaRPCOps.protocolVersion returns the Corda version being run by the node.
As of Corda V3, there is no way to determine the version of each CorDapp the node is running (except for information you can infer from the versions of the flows present on the node). The feature request to add this functionality can be found here: https://r3-cev.atlassian.net/browse/CORDA-1212.
I am currently working on a project where we need to test the database packages and functions.
We need to provide the input parameters to the database package and test the packages returns the expected value, also we want to test the response time of the request.
Please advice, if there is any tool available to perform this or we can write our test cases in Junit or some other framework.
Which one will be best approach?
I've used a more native approach when I had to do DWH testing. I've arranged the Test framework around the Dev data integration framework that was already in place. So i had a lot of reusable jobs, configurations and code. But using OOP like you suggest
write our test cases in Junit
is a way to go too. But keep in mind that very often the DWH design is very complex (with a lot of aspects to consider) and interacting with the Persistence layer is not always the best candidate for testing strategy. A more DB oriented solution (like tSQLt) offers a significant performance.
Those resources helped me a lot:
dwh_testing
data-warehouse-testing
what-is-a-data-warehouse-and-how-do-i-test-it
My framework Acolyte provides a JDBC driver & tools, designed for such purposes (mock up, testing, ...): http://tour.acolyte.eu.org
It's used already in some open source projects (Anorm, Youtube Vitess, ...), either in vanilla Java, or using its Scala DSL.
handler = handleStatement.withQueryDetection(...).
withQueryHandler(/* which result for which query */).
withUpdateHandler(/* which result for which update */).
// Register prepared handler with expected ID 'my-unique-id'
acolyte.Driver.register("my-unique-id", handler);
// then ...
Connection con = DriverManager.getConnection(jdbcUrl);
// ... Connection |con| is managed through |handler|