ContractState.hash() method throws exception when class has field with type of BigDecimal

Description

From External Contributor:
https://github.com/corda/corda/issues/5680

[ERROR] 2019-11-06T11:20:54,377Z [Node thread-1] internal.Verifier.verifyContracts - Error validating transaction B3F8D48A7FBCACF37DB40E60A6113F0AF06ED2F5B2C06B1D3EBA133351496ED7... java.lang.IllegalArgumentException: corporateAdvanceBalance(java.math.BigDecimal) -> object is not an instance of declaring class

The ContractState.hash() function throws an exception when you try to calculate the hash of state object inside the Contract.verify() method.

What I have observed that it throws an exception if the contract state having the field of type BigDecimal and especially with Zero value.

You can find the sample code for state, contract, flow, and stack trace logs at below gist:
https://gist.github.com/balajimore/91c2a41c767c17020041bd718952acb8

This code works fine if you test using MockNetwork. However, you can reproduce the error by deploying this code on actual Corda Node.

Tested with the Corda OS version 4 and 4.1

Assignee

Unassigned

Reporter

David Rapacchiale

Labels

Priority

Medium

Fix versions

None

Ported to...

None

Feature Team

Select team

CVSS Vector

None

Severity

Medium
Configure