Evolvable token should only be eidted by maitainer.

Description

Evolvable token should only be edited by maintainer but now its editable by other nodes also, which means observer can also edit the token.

Below testcase is failing because nodeC(observer) node is able to edit the token.

/*

  • This below flow test checks whether updation of EvolvableToken by observers is not possible

  • */
    @Test(expected = Exception::class)
    fun `should not update EvolvableToken by observers`() {
    val house = House("24 Leinster Gardens, Bayswater, London", 1_000_000.GBP, listOf(nodeI.legalIdentity()), linearId = UniqueIdentifier())
    //Create an EvolvableToken with two observers node B and node C
    val createEvolvableTokenTx = nodeI.startFlow(CreateEvolvableTokens(
    house withNotary network.defaultNotaryNode.legalIdentity(), listOf(nodeB.legalIdentity(), nodeC.legalIdentity()))
    )
    network.runNetwork()
    val getCreateEvolvableTx=createEvolvableTokenTx.getOrThrow()
    val housePtr = house.toPointer<House>()
    val issue = nodeI.startFlow(
    ConfidentialIssueTokens(
    listOf(housePtr issuedBy nodeI.legalIdentity() heldBy nodeA.legalIdentity()),
    emptyList<Party>() // TODO this should be handled by JvmOverloads on the constructor, but for some reason corda doesn't see the second constructor
    ))
    network.runNetwork()
    issue.getOrThrow()

//Get the EvolvableToken state
val evolvableToken = getCreateEvolvableTx.coreTransaction.outRefsOfType<House>().single()
//Updating the EvolvableToken
val newToken=evolvableToken.state.data.copy(valuation = 1_100_000.GBP)
//Update the token by observer node C
val newUpdationByObserverNodeCTx = nodeC.startFlow(UpdateEvolvableToken(evolvableToken, newToken))
network.runNetwork()
val getNewUpdationByObserverNodeCTx=newUpdationByObserverNodeCTx.getOrThrow()
}

Status

Assignee

Roger Willis

Reporter

gokulnath.v@tcs.com

Priority

Medium

Labels

None

Severity

Medium

Fix versions

None

Ported to...

None

Feature Team

Mid Stack