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

roles feature flag in data_model causes serialization disparity #2111

Closed
mversic opened this issue Apr 16, 2022 · 0 comments
Closed

roles feature flag in data_model causes serialization disparity #2111

mversic opened this issue Apr 16, 2022 · 0 comments
Assignees
Labels
Bug Something isn't working iroha2-dev The re-implementation of a BFT hyperledger in RUST question Further information is requested

Comments

@mversic
Copy link
Contributor

mversic commented Apr 16, 2022

roles feature flag affects the layout of enums/structures in data_model because it conditionally includes/excludes variants/fields. Due to this, a difference can arise in serialized format on client as compared to the server which basically makes them unable to exchange some messages. Example:

pub enum WorldEvent {
    Peer(peer::PeerEvent),
    Domain(domain::DomainEvent),
    #[cfg(feature = "roles")]
    Role(role::RoleEvent),
    Trigger(trigger::TriggerEvent),
}

This can be fixed in following ways:

  1. remove roles feature flag from all crates
    always include roles
  2. remove roles feature flag from data_model crate only
    don't include roles in your data structures but always include them in the serialized form. Queries can work without problems with server just empty lists objects for roles. Instructions on roles must fail with an error. I'm not sure this is possible without implying the 1st point to always include roles. This possibility requires more consideration
  3. Define initialization handshake
    Client will ask for the data layout information in the first message and adapt it's subsequent messages according to it. This effectively makes roles a compile flag on the server(as is currently) but a runtime flag on the client which adds strain on the sdk development
  4. Include information about roles support in the schema
    I mention this possibility just out of completeness. I maintain that the 3rd point should take precedence compared to this one.

Relates to #1969
Could relate to #2112

@mversic mversic added Bug Something isn't working question Further information is requested iroha2-dev The re-implementation of a BFT hyperledger in RUST labels Apr 16, 2022
@mversic mversic changed the title roles feature flag in data_model serialization disparity roles feature flag in data_model causes serialization disparity Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working iroha2-dev The re-implementation of a BFT hyperledger in RUST question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants