Skip to content
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

Some opinions on the new models #1117

Open
wants to merge 2 commits into
base: frrist/etl-pkg
Choose a base branch
from
Open

Conversation

kasteph
Copy link
Contributor

@kasteph kasteph commented Jan 27, 2023

  • add EventsRoot to Receipt
  • add Signature to Message
  • embed Message type inside VMMessage since it's basically that type here

@kasteph kasteph requested a review from frrist January 27, 2023 07:59
Params []byte
Receipt Receipt `gorm:"embedded"`
Message Message `gorm:"embedded"`
Receipt Receipt `gorm:"embedded"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it is true that VM messages are basically messages, many of the fields such as GasLimit, GasFee, and GasPremium are all 0. Similarly, VMMessages do not contain a Signature, nor do their receipts contain an EventRoot (less sure on this, but a hunch). I think it may be more efficient to avoid embedding the Message and Receipt structures in VmMessgae and instead take a subset of the fields that are populated. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at gorm Embedded Structs has me thinking that it's better to have common non-null types between Message and VmMessage wrapped like:

type BaseMessage struct {
  To
  From
  Value
  Method
  Params
}

which can then be respectively added as an embedded struct for both Message and VmMessage. This way it'll be easier to see what they do have in common and what they don't. But this is also not a ⛰️ I'm gonna die on lol.

ExitCode int64
GasUsed int64
Return []byte
EventsRoot types.DbCid
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo:

types.DbCID and not types.DbCid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants