Inlining `template` that uses `{.noSideEffect.}` without a `block` can
lead to invalid codegen that contains double-frees. Wrap problematic
instances with `block` to prevent issues in `libnimbus_lc` wasm (orc).
Somehow, creating the `FieldType` as a type messes with the macros used
in `NimYAML`. Inline `GetFieldType` to avoid the problem.
https://github.com/status-im/nimbus-eth2/pull/5043#issuecomment-1584219098
```
./nimbus-eth2/tests/consensus_spec/test_fixture_light_client_sync.nim(126, 8) template/generic instantiation of `test` from here
./nimbus-eth2/tests/consensus_spec/test_fixture_light_client_sync.nim(146, 20) template/generic instantiation of `load` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(1368, 14) template/generic instantiation of `construct` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(1343, 19) template/generic instantiation of `constructChild` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(1168, 20) template/generic instantiation of `constructObject` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(927, 25) template/generic instantiation of `constructObjectDefault` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(921, 31) template/generic instantiation of `ensureAllFieldsPresent` from here
./nimbus-eth2/vendor/NimYAML/yaml/serialization.nim(681, 29) Error: type mismatch: got <NimNode>
but expected one of:
proc none(T: typedesc): Option[T]
first type mismatch at position: 1
required type for T: typedesc
but expression 'nil' is of type: NimNode
proc none[T](): Option[T]
first type mismatch at position: 1
extra argument given
template none(O: type Opt; T: type): Opt[T]
first type mismatch at position: 1
required type for O: typedesc[Opt]
but expression 'nil' is of type: NimNode
expression: none(nil)
make: *** [consensus_spec_tests_minimal] Error 1
```
Transitioning the case of a case object without full reinitialization
leads to undefined behaviour. Don't do such transitions implicitly,
and require explicit `readValue` override for such types in those cases.
The README file was describing an outdated way of defining serialization
formats. It was updated accordingly to match the current API.
- New format declaration using `setReader` and `setWriter`
and mandatory `PreferredOutput` type declaration,
as introduced in f9a1121b87.
- Removal of `fileExt` declaration, which was never implemented.
- Removal of format-specific `dontSerialize` pragma
as well as the `serialize` pragma, which were never implemented.
- Rename `serializedFields` macro to `setSerializedFields`,
to keep up with 60613bac5d.
- Remove rename functionality in `setSerializedFields`,
which was never implemented.
- A couple updated argument lists and typo corrections.