diff --git a/cmd/sszgen/gen.go b/cmd/sszgen/gen.go index 801d077..2e90303 100644 --- a/cmd/sszgen/gen.go +++ b/cmd/sszgen/gen.go @@ -372,7 +372,10 @@ func generateDefineSSZ(ctx *genContext, typ *sszContainer) ([]byte, error) { } } if !typ.static { - fmt.Fprint(&b, "\n // Define the dynamic data (fields)\n") + if typ.forks[len(typ.forks)-1] == "" { + fmt.Fprint(&b, "\n") + } + fmt.Fprint(&b, " // Define the dynamic data (fields)\n") var ( dynIndices []int dynFields []string diff --git a/tests/testtypes/consensus-spec-tests/gen_attestation_variation_3_ssz.go b/tests/testtypes/consensus-spec-tests/gen_attestation_variation_3_ssz.go index d7dcd07..0681689 100644 --- a/tests/testtypes/consensus-spec-tests/gen_attestation_variation_3_ssz.go +++ b/tests/testtypes/consensus-spec-tests/gen_attestation_variation_3_ssz.go @@ -37,7 +37,6 @@ func (obj *AttestationVariation3) DefineSSZ(codec *ssz.Codec) { if codec.Fork() >= ssz.ForkFuture { ssz.DefineUint64(codec, &obj.Future) // Field (3) - Future - 8 bytes } - // Define the dynamic data (fields) ssz.DefineSliceOfBitsContent(codec, &obj.AggregationBits, 2048) // Field (0) - AggregationBits - ? bytes } diff --git a/tests/testtypes/consensus-spec-tests/gen_beacon_block_body_monolith_ssz.go b/tests/testtypes/consensus-spec-tests/gen_beacon_block_body_monolith_ssz.go index 10ad204..c3f76cf 100644 --- a/tests/testtypes/consensus-spec-tests/gen_beacon_block_body_monolith_ssz.go +++ b/tests/testtypes/consensus-spec-tests/gen_beacon_block_body_monolith_ssz.go @@ -72,7 +72,6 @@ func (obj *BeaconBlockBodyMonolith) DefineSSZ(codec *ssz.Codec) { if codec.Fork() >= ssz.ForkDeneb { ssz.DefineSliceOfStaticBytesOffset(codec, &obj.BlobKzgCommitments, 4096) // Offset (11) - BlobKzgCommitments - 4 bytes } - // Define the dynamic data (fields) ssz.DefineSliceOfStaticObjectsContent(codec, &obj.ProposerSlashings, 16) // Field ( 3) - ProposerSlashings - ? bytes ssz.DefineSliceOfDynamicObjectsContent(codec, &obj.AttesterSlashings, 2) // Field ( 4) - AttesterSlashings - ? bytes diff --git a/tests/testtypes/consensus-spec-tests/gen_beacon_state_monolith_ssz.go b/tests/testtypes/consensus-spec-tests/gen_beacon_state_monolith_ssz.go index 2d46dff..4026f75 100644 --- a/tests/testtypes/consensus-spec-tests/gen_beacon_state_monolith_ssz.go +++ b/tests/testtypes/consensus-spec-tests/gen_beacon_state_monolith_ssz.go @@ -101,7 +101,6 @@ func (obj *BeaconStateMonolith) DefineSSZ(codec *ssz.Codec) { ssz.DefineUint64(codec, &obj.NextWithdrawalValidatorIndex) // Field (28) - NextWithdrawalValidatorIndex - 8 bytes ssz.DefineSliceOfStaticObjectsOffset(codec, &obj.HistoricalSummaries, 16777216) // Offset (29) - HistoricalSummaries - 4 bytes } - // Define the dynamic data (fields) ssz.DefineSliceOfStaticBytesContent(codec, &obj.HistoricalRoots, 16777216) // Field ( 7) - HistoricalRoots - ? bytes ssz.DefineSliceOfStaticObjectsContent(codec, &obj.Eth1DataVotes, 2048) // Field ( 9) - Eth1DataVotes - ? bytes diff --git a/tests/testtypes/consensus-spec-tests/gen_execution_payload_header_monolith_ssz.go b/tests/testtypes/consensus-spec-tests/gen_execution_payload_header_monolith_ssz.go index 632898d..a8626e8 100644 --- a/tests/testtypes/consensus-spec-tests/gen_execution_payload_header_monolith_ssz.go +++ b/tests/testtypes/consensus-spec-tests/gen_execution_payload_header_monolith_ssz.go @@ -46,7 +46,6 @@ func (obj *ExecutionPayloadHeaderMonolith) DefineSSZ(codec *ssz.Codec) { ssz.DefineUint64(codec, &obj.BlobGasUsed) // Field (15) - BlobGasUsed - 8 bytes ssz.DefineUint64(codec, &obj.ExcessBlobGas) // Field (16) - ExcessBlobGas - 8 bytes } - // Define the dynamic data (fields) ssz.DefineDynamicBytesContent(codec, &obj.ExtraData, 32) // Field (10) - ExtraData - ? bytes } diff --git a/tests/testtypes/consensus-spec-tests/gen_execution_payload_monolith_ssz.go b/tests/testtypes/consensus-spec-tests/gen_execution_payload_monolith_ssz.go index f62f00f..537e25f 100644 --- a/tests/testtypes/consensus-spec-tests/gen_execution_payload_monolith_ssz.go +++ b/tests/testtypes/consensus-spec-tests/gen_execution_payload_monolith_ssz.go @@ -49,7 +49,6 @@ func (obj *ExecutionPayloadMonolith) DefineSSZ(codec *ssz.Codec) { ssz.DefineUint64(codec, &obj.BlobGasUsed) // Field (15) - BlobGasUsed - 8 bytes ssz.DefineUint64(codec, &obj.ExcessBlobGas) // Field (16) - ExcessBlobGas - 8 bytes } - // Define the dynamic data (fields) ssz.DefineDynamicBytesContent(codec, &obj.ExtraData, 32) // Field (10) - ExtraData - ? bytes ssz.DefineSliceOfDynamicBytesContent(codec, &obj.Transactions, 1048576, 1073741824) // Field (13) - Transactions - ? bytes