Don't we need DeprecatedConstructorForDeserialization() In Corda State while deleting a state field for 4.9 Enterprise version?

huangapple go评论59阅读模式
英文:

Don't we need DeprecatedConstructorForDeserialization() In Corda State while deleting a state field for 4.9 Enterprise version?

问题

I was trying to test some deletion scenarios of fields in a Corda state. But I was wondered that it doesn't throw deserialization error while retrieving the older data, even without providing deserialization constructors for the deleted field.

And yes, I confirm that older version state has data in it for this particular field.

Is it handled somehow in 4.9 Enterprise version?

Edit: The datatype of my deleted field were String? & String (tested both). Will test customDataType soon, is it like String Corda will manage? (though, don't we need a matching class constructor for deserializing the old state data blob?)

This https://corda.net/blog/a-developers-primer-on-cordapp-upgrades/ blog also suggests providing a deserializationConstructor!

英文:

I was trying to test some deletion scenarios of fields in a Corda state. But I was wondered that it doesn't throw deserialisation error while retrieving the older data, even without providing deserialisation constructors for the deleted field.

And yes, I confirm that older version state has data in it for this particular field.

Is it handled somehow in 4.9 Enterprise version?

Edit: The datatype of my deleted field were String? & String (tested both). Will test customDataType soon, is it like String Corda will manage? (though, dont we need a matching class constructor for deserialising the old state data blob?)

This https://corda.net/blog/a-developers-primer-on-cordapp-upgrades/ blog also suggest to provide deserialisationConstructor!

答案1

得分: 1

这种情况可能发生在删除可空字段时,当Corda序列化框架检测到删除可空字段后的状态时,主构造函数中没有匹配参数的属性将被简单地从对象构建中省略。

要了解更多,请查看这里:https://docs.r3.com/en/platform/corda/4.7/enterprise/serialization-default-evolution.html

英文:

This can be a situation when you delete nullable fields, when a state after removing nullable fields is detected by the Corda serialization framework, properties that don’t have matching parameters in the main constructor are simply omitted from object construction.

To read more take a look here https://docs.r3.com/en/platform/corda/4.7/enterprise/serialization-default-evolution.html

huangapple
  • 本文由 发表于 2023年3月15日 20:52:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/75744981.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定