[bisq-network/bisq] Hash of ProtectedStoragePayload is non-deterministic (#3367)

Justin Carter notifications at github.com
Thu Oct 10 09:16:54 UTC 2019


I have applied the technique described in [this](
https://havoc.io/post/deterministic-protobuf/) article to switch out the maps into arrays like so:
```
message TempProposalPayload {
    Proposal proposal = 1;
    bytes owner_pub_key_encoded = 2;
    map<string, string> extra_data = 3;
```
becomes:
```
message TempProposalPayload {¬
    Proposal proposal = 1;
    bytes owner_pub_key_encoded = 2;
    repeated StringKV extra_data = 3;
}

message StringKV {
    string key = 1;
    string value = 2;
}
```

The result is both backwards compatible and currently deterministic for both java and rust.
There is no guarantee that this will not break in the future and relies on current implementation details of the individual libraries.
In other words this is a risky work-around that could blow up in the future but seems okay for the time beeing.

I will be using that as the bases for messages in my rust implementation going forward.

If there is interest I'm happy to invest the work to make the required changes in Java as well. Please comment if you think this makes sense!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/issues/3367#issuecomment-540478944
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191010/d0b44b57/attachment.html>


More information about the bisq-github mailing list