Signing data structures the wrong way

https://blog.foks.pub/posts/domain-separation-in-idl/

Signing data structures the right way | The FOKS Blog

Since the example was given in proto, I'll suggest a solution in proto: add a message option.

extend google.protobuf.MessageOptions {
optional uint64 domain_separator = 1234;
}

message TreeRoot {
option (domain_separator) = 4567;
...
}