-
Notifications
You must be signed in to change notification settings - Fork 43
Conversation
Gas results 🚀📝Account actor
Miner actor
Datacap actor
Init actor
Market actor
Power actor
Precompiles actor
Send actor
Verifreg actor
|
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 LGTM besides the comments.
@@ -130,6 +130,10 @@ library MarketCBOR { | |||
buf.startFixedArray(uint64(params.deals.length)); | |||
|
|||
for (uint64 i = 0; i < params.deals.length; i++) { | |||
bool isLabelStr = bytes(params.deals[i].proposal.label.dataStr).length > 0; | |||
bool isLabelBts = params.deals[i].proposal.label.dataBts.length > 0; | |||
require((!isLabelStr && isLabelBts) || (!isLabelBts && isLabelStr), "deal label must be either string or bytes"); |
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 super deep into this code, but can't this be simplified?
require((!isLabelStr && isLabelBts) || (!isLabelBts && isLabelStr), "deal label must be either string or bytes"); | |
require(!(isLabelStr && isLabelBts), "deal label must be either string or bytes"); |
Also worth noting that this will default to serializing empty bytes if none is set, which I think is fine, but please document that behavior.
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.
Yes Raul, you are right! good catch
@@ -64,5 +64,11 @@ library CommonTypes { | |||
bytes data; | |||
} | |||
|
|||
/// @param dataBytes deal proposal label in bytes format (it can be utf8 string or arbitray bytes string) |
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.
Can we strengthen the documentation to indicate that this is actually an enum type and it's expect to be either or? Also check typos.
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.
I will add that in the inline docs
closes #318
🔗 zboto Link