Adrian
Adrian

Reputation: 444

Can contract run a custom function outside of its cordapp?

There's a Utility cordapp that contains all the helper constants/methods. The Contract cordapp has a dependency on Utilities and some of its contract code is running the constants or methods in Utility cordapp.

Is this a safe practice? If someone were to change the implementation of the helper method in Utility, it would fail on the responder side since they have the original Utility cordapp implmentation?

Upvotes: 0

Views: 34

Answers (1)

Joel
Joel

Reputation: 23140

In the Corda endstate:

  • Contract JARs will be fat JARs that contain not only Contract subclasses, but also any dependencies of these Contract subclasses (i.e. any classes referenced from these contracts)
  • The deterministic JVM will be sandboxed to only load classes from these contract JARs

Because contract JARs are pinned down by hash in transactions, you know that both parties are using the exact same version of any classes.

As of Corda 3, this functionality isn't implemented. Once it is, the design pattern you discuss above will be safe.

Upvotes: 0

Related Questions