-
Notifications
You must be signed in to change notification settings - Fork 10
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
Update raw.hpp
so that we can serialize and deserialize const
types
#938
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.
Since we have the time. What about making a pass through the code and making what can be const, const
.
I started doing that, but it does require a lot of changes through the code. For example most of the Probably if we want to do this I should create another issue. |
For the large refactor like |
Note:start |
@@ -184,7 +189,13 @@ namespace eosio::chain { | |||
|
|||
// for testing purposes only, not thread safe | |||
const fsi_t& get_fsi(const bls_public_key& k) const { return finalizers.at(k).fsi; } | |||
void set_fsi(const bls_public_key& k, const fsi_t& fsi) { finalizers[k].fsi = fsi; } | |||
|
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 think remove this blank line or add another comment saying this is only for testing purposes and not thread safe.
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.
removed!
I tried to make thsome members of |
Resolves #796.
Some types are only set in the constructor and never modified. So they are logically const and could be accessed from multiple threads safely.
Using this would allow us to remove some friend declarations (we use private as a way to prevent unchecked access to non thread-safe members).
Ideally we would make the member type const.
The serialization is what trips us up. I feel that the unpack functions in raw.hpp should accept to unpack const members of structs (logically deserializing to recreate a value which is never modified after creation). Right now we cannot mark non-funadamental types that needs to be serialized const.
Also added a test.