-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend ContractInfo for custom data #492
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I would just ask for some docs on usage, as well as clarifying how ValidateBasic
works on the ContractExtension (it is handled slightly different in two places, this must be consistent and explicit - either implementation is fine with me, just make it clear)
if c.Extension == nil { | ||
return nil | ||
} | ||
e, ok := c.Extension.GetCachedValue().(validatable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should definitely be documented (maybe below?)
not just how to register an Any type for the extension, but all variants of this type must implement ValidateBasic()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh, that was not intended. I had the interface implementation mandatory but made it optional later. Good to have you covering me. 😅
Codecov Report
@@ Coverage Diff @@
## master #492 +/- ##
==========================================
+ Coverage 56.97% 58.32% +1.34%
==========================================
Files 41 41
Lines 4411 4441 +30
==========================================
+ Hits 2513 2590 +77
+ Misses 1689 1638 -51
- Partials 209 213 +4
|
Features:
google.protobuf.Any extension
field toContractinfo
as extension pointAny
types proper. This is a breaking change to the CLI json/ yaml outputThis PR touched more files as the new
Any
field required some helper methods and tests for storage and queries.To use the
Extension
you would need to register an implementation to the interfacetypes.ContractInfoExtension