Add support for contract upgrades (#165)

* Add support for contract upgrades
* Add interface for the upgraded contract to implement, which provides functionality for upgrading legacy states.
* Add shared upgrade command and verification code for it.
* Add DummyContractV2 to illustrate what an upgraded contract looks like.
* Add new functions to vault service to support upgrading state objects.
* Add contract upgrade flow
This commit is contained in:
Patrick Kuo
2017-02-09 17:14:31 +00:00
committed by GitHub
parent a61c767505
commit c054ffe719
22 changed files with 496 additions and 42 deletions

View File

@ -14,7 +14,7 @@ class DummyIssueAndMove(private val notary: Party, private val counterpartyNode:
val random = Random()
val myKeyPair = serviceHub.legalIdentityKey
// Self issue an asset
val issueTx = DummyContract.generateInitial(serviceHub.myInfo.legalIdentity.ref(0), random.nextInt(), notary).apply {
val issueTx = DummyContract.generateInitial(random.nextInt(), notary, serviceHub.myInfo.legalIdentity.ref(0)).apply {
signWith(myKeyPair)
}
serviceHub.recordTransactions(issueTx.toSignedTransaction())

View File

@ -15,7 +15,7 @@ import net.corda.vega.contracts.RevisionedState
*/
object StateRevisionFlow {
class Requester<T>(curStateRef: StateAndRef<RevisionedState<T>>,
updatedData: T) : AbstractStateReplacementFlow.Instigator<RevisionedState<T>, T>(curStateRef, updatedData) {
updatedData: T) : AbstractStateReplacementFlow.Instigator<RevisionedState<T>, RevisionedState<T>, T>(curStateRef, updatedData) {
override fun assembleTx(): Pair<SignedTransaction, List<CompositeKey>> {
val state = originalState.state.data
val tx = state.generateRevision(originalState.state.notary, originalState, modification)