Replies: 2 comments 1 reply
-
That's a struct for memory purpose, tightly packing is much more relevant on storage actions. If we won't change the |
Beta Was this translation helpful? Give feedback.
1 reply
-
Locking based on @andreivladbrg's observation that the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We might be able to save some gas in the
Broker
struct by tightly packing theaddr
and thefee
fields.We would pack them by using the
UD2x18
type instead ofUD60x18
.address
has 160 bits andUD2x18
64 bits, so in total 224 bits, which is less than 256.There are two downsides, though:
protocolFee
to be anUD2x18
.UD2x18
type is a bit counter-intuitive - the maximum value is ~18.44, which is not what you expect from a type that purportedly "can have up to 2 digits" in the whole part.Howeveeere, the second downside is a weak contention, because we are already using the
UD2x18
type in the segment exponent, and so we would have to document and explain its internal logic anyway. In fact, it might be a good thing to stick with using a single PRBMath value type in the public smart contract API.Beta Was this translation helpful? Give feedback.
All reactions