From 3ba3915396d93be3e6d683b6f0c28959d044b1f7 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Mon, 1 Nov 2021 12:11:15 +0800 Subject: [PATCH] Set execution params to presets and add builder checks. --- setup.py | 5 +++++ specs/merge/beacon-chain.md | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 4bb26bccd..61950021e 100644 --- a/setup.py +++ b/setup.py @@ -634,6 +634,10 @@ def objects_to_spec(preset_name: str, ssz_dep_constants = '\n'.join(map(lambda x: '%s = %s' % (x, builder.hardcoded_ssz_dep_constants()[x]), builder.hardcoded_ssz_dep_constants())) ssz_dep_constants_verification = '\n'.join(map(lambda x: 'assert %s == %s' % (x, spec_object.ssz_dep_constants[x]), builder.hardcoded_ssz_dep_constants())) custom_type_dep_constants = '\n'.join(map(lambda x: '%s = %s' % (x, builder.hardcoded_custom_type_dep_constants()[x]), builder.hardcoded_custom_type_dep_constants())) + custom_type_dep_constants_verification = '\n'.join(map( + lambda x: 'assert %s == %s' % (x, f'{spec_object.preset_vars[x].type_name}({spec_object.preset_vars[x].value})'), + builder.hardcoded_custom_type_dep_constants(), + )) spec = ( builder.imports(preset_name) + builder.preparations() @@ -654,6 +658,7 @@ def objects_to_spec(preset_name: str, # Since some constants are hardcoded in setup.py, the following assertions verify that the hardcoded constants are # as same as the spec definition. + ('\n\n\n' + ssz_dep_constants_verification if ssz_dep_constants_verification != '' else '') + + ('\n\n\n' + custom_type_dep_constants_verification if custom_type_dep_constants_verification != '' else '') + '\n' ) return spec diff --git a/specs/merge/beacon-chain.md b/specs/merge/beacon-chain.md index d164b5564..992526591 100644 --- a/specs/merge/beacon-chain.md +++ b/specs/merge/beacon-chain.md @@ -10,9 +10,8 @@ - [Introduction](#introduction) - [Custom types](#custom-types) -- [Constants](#constants) - - [Execution](#execution) - [Preset](#preset) + - [Execution](#execution) - [Updated penalty values](#updated-penalty-values) - [Configuration](#configuration) - [Transition settings](#transition-settings) @@ -64,7 +63,7 @@ Additionally, this upgrade introduces the following minor changes: | `Transaction` | `ByteList[MAX_BYTES_PER_TRANSACTION]` | either a [typed transaction envelope](https://eips.ethereum.org/EIPS/eip-2718#opaque-byte-array-rather-than-an-rlp-array) or a legacy transaction| | `ExecutionAddress` | `Bytes20` | Address of account on the execution layer | -## Constants +## Preset ### Execution @@ -77,8 +76,6 @@ Additionally, this upgrade introduces the following minor changes: | `MIN_GAS_LIMIT` | `uint64(5000)` (= 5,000) | | `MAX_EXTRA_DATA_BYTES` | `2**5` (= 32) | -## Preset - ### Updated penalty values The Merge updates a few configuration values to move penalty parameters to their final, maximum security values.