I compare it with Grin Slate V4 :
pub struct SlateV4 {
pub ver: VersionCompatInfoV4,
pub id: Uuid,
pub sta: SlateStateV4,
pub off: BlindingFactor,
pub num_parts: u8,
pub amt: u64,
pub fee: FeeFields,
pub feat: u8,
pub ttl: u64,
pub sigs: Vec<ParticipantDataV4>,
pub coms: Option<Vec<CommitsV4>>,
pub proof: Option<PaymentInfoV4>,
pub feat_args: Option<KernelFeaturesArgsV4>,
}
And mapping to yours one:
Data |
Size |
Mapped |
content |
3 bit |
sta: SlateStateV4, |
Slate UUID |
16 bytes |
id: Uuid, |
Network |
1 bit |
|
amount |
Varibale |
amt: u64, |
fee |
Varibale |
fee: FeeFields, |
height |
Varibale |
|
lock_height |
Varibale |
feat_args: Option<KernelFeaturesArgsV4>, |
Option ttl_cutoff_height |
Varibale |
ttl: u64, |
Slate offset |
32 bytes |
off: BlindingFactor, |
|
|
|
Inputs types |
1 bit |
|
Input feature |
1 bit |
|
Input commit |
33 bytes |
coms: Option<Vec<CommitsV4>>, |
Input stop bit |
1 bit |
|
|
|
|
Output commit |
33 bytes |
coms: Option<Vec<CommitsV4>>, |
Output Range proof size |
10 bits |
|
Output Range proof |
length |
|
Output stop bit |
1 bit |
|
|
|
|
Kernel commit |
33 bytes |
|
Kernel signature |
64 bytes |
|
Kernel stop bit |
1 bit |
|
|
|
|
Participant blind Excess size |
7 bits |
sigs: Vec<ParticipantDataV4>, |
Participant blind Excess |
length |
|
Participant Nonce size |
7 bits |
|
Participant Nonce |
length |
|
Participant signature flag |
1 bit |
|
Participant signature |
64 bytes |
|
Participant message flag |
1 bit |
|
Participant Message size |
16 bits |
|
Participant message |
length |
|
|
|
|
Another participant data |
|
|
|
|
|
Proof flag |
1 bit |
proof: Option<PaymentInfoV4>, |
Proof Sender Address |
variable |
saddr: DalekPublicKey, (in proof) |
Proof Receiver address |
variable |
raddr: DalekPublicKey, (in proof) |
Proof Signature flag |
1 bit |
rsig: Option<DalekSignature>, (in proof) |
Proof Signature len delta |
4 bit |
|
Proof Signature |
64 bytes |
|
Future usage |
any |
|
My questions:
- Looks like you would need use dedicated serialization code with this definition, why not use Rust standard serialization? I guess you want to have a most compact data format?
- Backward compatibility is absolutely making users happy, but the code maintaining will be painful and more buggy, and hard to upgrade in the future. I suppose this is why Grin throw the old slate versions and facilitate the hard fork to get beautiful and easy-to-maintain source code, to make futureâs life easy.
- I donât find the kernel part in the new V4 slate. Do you understand why it has been removed? I suppose thatâs only useful in the final step and normally the wallet donât need to send to remote party, instead it just merge it locally and post to network.