-
Notifications
You must be signed in to change notification settings - Fork 197
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
Structs in the ABI #296
Structs in the ABI #296
Conversation
5f558cc
to
ac5736e
Compare
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.
Very cool!
|
||
/// Attribute contextual information to an event definition node. | ||
pub fn add_event(&mut self, spanned: &Spanned<fe::ContractStmt>, event: EventDef) { | ||
self.events.insert(spanned.span, event); |
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.
Not just related to this change but also to all the other APIs on the context that do self.events.insert(key, value);
. I think the fact that we are ignoring the returned Option<T>
is a problem. These APIs all assume that the key doesn't exist yet. If for some reason it does exist already we would just silently overwrite it without knowing that we have some underlying issue to fix. We should probably panic
here if a value already exists because it means we are dealing with an unrecoverable programming error. If you agree then this would make a good first issues for newcomer to refactor.
# num3=self.block_time_stamp | ||
# ) | ||
pass | ||
pub def get_reserves() -> ThreeNums: |
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.
❤️
What was wrong?
fixes #282
Structs were not being added to the ABI. For example, we could not build the JSON ABI for the following example:
How was it fixed?
components
to theAbiEncoding
trait.To-Do
OPTIONAL: Update Spec if applicable
Add entry to the release notes (may forgo for trivial changes)
Clean up commit history