A given Leaf with MMR 0-based leaf index N-1 is constructed and added to MMR during construction of block N here.
The Leaf data/contents can be seen populated here and it consists of:
// contents for leaf index <N-1> added by block <N>
MmrLeaf {
version: <leaf-data-format-version>,
(
parent_num: <N-1>,
parent_hash: <hash_of_<N-1>>,
),
extra_data: <para_heads_of_<N-1>>,
next_auth_set: <next_auth_set_of<N>>,
}
While this is not a show-stopper - (light)clients can simply handle this in their code - it introduces cognitive complexity and code logic corner cases.
We could avoid this and make it easier for users by changing Leaf<N-1> contents to:
// contents for leaf index <N-1> added by block <N>
MmrLeaf {
version: <leaf-data-format-version>,
(
parent_num: <N-1>,
parent_hash: <hash_of_<N-1>>,
),
extra_data: <para_heads_of_<N-1>>,
- next_auth_set: <next_auth_set_of<N>>,
+ next_auth_set: <next_auth_set_of<N-1>>,
}