Composite Types are types that can hold multiple values at the same time, with usage similar to that of a struct in popular programming languages.
The SSZ specs describe 4 composite types:
"Fixed Length" sequence of elements of same TypeHomogeneous"Variable Length" sequence of elements of the same TypeHomogenousOrdered collection of elementsHetrogeneousA "Union Type" containing SSZ Typesfixed or variable)homogeneous or heterogeneousfixed size if:fixed sizetype has a fixed element count (e.g. Lists cannot be fixed size)homogeneous ifheterogeneous ifT, and of fixed length N.Vector[T, N][default(T)] * Ndefault valueN = 0) are illegal types, even if the element type T is dynamic length.fixed-length types of 0 length, which break various size assumptions in deserialization.values, all of type T.root = merkle_subtree(chunkify(values)), see merkle_subtree and chunkifyT, and can be any length from 0 to N (inclusive).List[T, N][], i.e. empty list.N and called the "list limit".values, all of type T.N elements are serialized or deserialized.root = mix_in_num(merkle_subtree(chunkify(values), limit=chunk_count(List[T, N])), length),merkle_subtree,chunkify, chunk_count and mix_in_num.Container[(<K_i>: <T_i>)]T_i independently from the other fields, and is identified by a unique (relative to the other fields) name K_i.Container[(<K_i>: <T_i>)](default(T_i)...), i.e. all fields set to their default value.fields, each of their own type T_i.root = merkle_subtree(chunkify(fields)),merkle_subtree, chunkify.Unions provide the ability to represent a set of predetermined types in the same tree and serialization position.Union[type_0, type_1, ...]union[null, uint64]type_0Null Types:null type may be used as first type parameter to emulate an Option, any other type parameter than the first MUST not be null.null as a standalone type is illegal.dynamic encoding-size, even if all the selectable options have the same type or happen to have the same serialized byte length.uint32 for the type indexnull is represented as an empty byte sequencemix_in_num(x, i)
x is the root of the selected option with index iuint256