From 38f97246ee9c16ac43f45383b4ca47ca44d14abb Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Fri, 17 Mar 2023 10:15:34 +1000 Subject: [PATCH 1/6] Added capella fork epoch to mainnet configuration --- configs/mainnet.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/mainnet.yaml b/configs/mainnet.yaml index f7e53d7e18..8b467fce24 100644 --- a/configs/mainnet.yaml +++ b/configs/mainnet.yaml @@ -46,7 +46,7 @@ BELLATRIX_FORK_VERSION: 0x02000000 BELLATRIX_FORK_EPOCH: 144896 # Sept 6, 2022, 11:34:47am UTC # Capella CAPELLA_FORK_VERSION: 0x03000000 -CAPELLA_FORK_EPOCH: 18446744073709551615 +CAPELLA_FORK_EPOCH: 6209536 # April 12, 2023, 10:27:35pm UTC # Deneb DENEB_FORK_VERSION: 0x04000000 DENEB_FORK_EPOCH: 18446744073709551615 From 01ec71a3edd62ec2b77c68af322931690e69a590 Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Fri, 17 Mar 2023 10:20:58 +1000 Subject: [PATCH 2/6] computed epoch, rather than slot number --- configs/mainnet.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/mainnet.yaml b/configs/mainnet.yaml index 8b467fce24..f204d1746e 100644 --- a/configs/mainnet.yaml +++ b/configs/mainnet.yaml @@ -46,7 +46,7 @@ BELLATRIX_FORK_VERSION: 0x02000000 BELLATRIX_FORK_EPOCH: 144896 # Sept 6, 2022, 11:34:47am UTC # Capella CAPELLA_FORK_VERSION: 0x03000000 -CAPELLA_FORK_EPOCH: 6209536 # April 12, 2023, 10:27:35pm UTC +CAPELLA_FORK_EPOCH: 194048 # April 12, 2023, 10:27:35pm UTC # Deneb DENEB_FORK_VERSION: 0x04000000 DENEB_FORK_EPOCH: 18446744073709551615 From 0e0403d0e2edac7c4e992f7979d5296a9b8788c4 Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Thu, 16 Mar 2023 15:49:40 +0200 Subject: [PATCH 3/6] Reject zero inputs in bls_modular_inverse() --- specs/deneb/polynomial-commitments.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/specs/deneb/polynomial-commitments.md b/specs/deneb/polynomial-commitments.md index c48857d9e8..e23c31fab8 100644 --- a/specs/deneb/polynomial-commitments.md +++ b/specs/deneb/polynomial-commitments.md @@ -252,10 +252,11 @@ def compute_challenge(blob: Blob, ```python def bls_modular_inverse(x: BLSFieldElement) -> BLSFieldElement: """ - Compute the modular inverse of x - i.e. return y such that x * y % BLS_MODULUS == 1 and return 0 for x == 0 + Compute the modular inverse of x (for x != 0) + i.e. return y such that x * y % BLS_MODULUS == 1 """ - return BLSFieldElement(pow(x, -1, BLS_MODULUS)) if x != 0 else BLSFieldElement(0) + assert (int(x) % BLS_MODULUS) != 0 + return BLSFieldElement(pow(x, -1, BLS_MODULUS)) ``` #### `div` From 1219beae265f355e7f98d8b31a7afa7611b113ec Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Fri, 17 Mar 2023 11:50:19 +0200 Subject: [PATCH 4/6] Add some basic bls_modular_inverse() tests --- .../test_polynomial_commitments.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py b/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py index f42f88393d..7d89a9788e 100644 --- a/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py +++ b/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py @@ -215,6 +215,29 @@ def test_verify_blob_kzg_proof_incorrect_proof(spec): assert not spec.verify_blob_kzg_proof(blob, commitment, proof) +@with_deneb_and_later +@spec_test +@single_phase +def test_bls_modular_inverse(spec): + """ + Verify computation of multiplicative inverse + """ + rng = random.Random(5566) + + # Should fail for x == 0 + expect_assertion_error(lambda: spec.bls_modular_inverse(0)) + expect_assertion_error(lambda: spec.bls_modular_inverse(spec.BLS_MODULUS)) + expect_assertion_error(lambda: spec.bls_modular_inverse(2 * spec.BLS_MODULUS)) + + # Test a trivial inversion + assert 1 == int(spec.bls_modular_inverse(1)) + + # Test a random inversion + r = rng.randint(0, spec.BLS_MODULUS - 1) + r_inv = int(spec.bls_modular_inverse(r)) + assert r * r_inv % BLS_MODULUS == 1 + + @with_deneb_and_later @spec_test @single_phase From 18eb1fa33462d74719f621f17fca5a16d0598f8f Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Mon, 20 Mar 2023 13:48:49 +0800 Subject: [PATCH 5/6] Set `CAPELLA_FORK_EPOCH` to `194048` --- README.md | 2 +- specs/capella/fork.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 61600d3890..9f2528263e 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,11 @@ Features are researched and developed in parallel, and then consolidated into se | 0 | **Phase0** |`0` |
  • Core
    • [The beacon chain](specs/phase0/beacon-chain.md)
    • [Deposit contract](specs/phase0/deposit-contract.md)
    • [Beacon chain fork choice](specs/phase0/fork-choice.md)
  • Additions
    • [Honest validator guide](specs/phase0/validator.md)
    • [P2P networking](specs/phase0/p2p-interface.md)
    • [Weak subjectivity](specs/phase0/weak-subjectivity.md)
| | 1 | **Altair** | `74240` |
  • Core
    • [Beacon chain changes](specs/altair/beacon-chain.md)
    • [Altair fork](specs/altair/fork.md)
  • Additions
    • [Light client sync protocol](specs/altair/light-client/sync-protocol.md) ([full node](specs/altair/light-client/full-node.md), [light client](specs/altair/light-client/light-client.md), [networking](specs/altair/light-client/p2p-interface.md))
    • [Honest validator guide changes](specs/altair/validator.md)
    • [P2P networking](specs/altair/p2p-interface.md)
| | 2 | **Bellatrix**
(["The Merge"](https://ethereum.org/en/upgrades/merge/)) | `144896` |
  • Core
    • [Beacon Chain changes](specs/bellatrix/beacon-chain.md)
    • [Bellatrix fork](specs/bellatrix/fork.md)
    • [Fork choice changes](specs/bellatrix/fork-choice.md)
  • Additions
    • [Honest validator guide changes](specs/bellatrix/validator.md)
    • [P2P networking](specs/bellatrix/p2p-interface.md)
| +| 3 | **Capella** | `194048` |
  • Core
    • [Beacon chain changes](specs/capella/beacon-chain.md)
    • [Capella fork](specs/capella/fork.md)
  • Additions
    • [Light client sync protocol changes](specs/capella/light-client/sync-protocol.md) ([fork](specs/capella/light-client/fork.md), [full node](specs/capella/light-client/full-node.md), [networking](specs/capella/light-client/p2p-interface.md))
    • [Validator additions](specs/capella/validator.md)
    • [P2P networking](specs/capella/p2p-interface.md)
| ### In-development Specifications | Code Name or Topic | Specs | Notes | | - | - | - | -| Capella (tentative) |
  • Core
    • [Beacon chain changes](specs/capella/beacon-chain.md)
    • [Capella fork](specs/capella/fork.md)
  • Additions
    • [Light client sync protocol changes](specs/capella/light-client/sync-protocol.md) ([fork](specs/capella/light-client/fork.md), [full node](specs/capella/light-client/full-node.md), [networking](specs/capella/light-client/p2p-interface.md))
    • [Validator additions](specs/capella/validator.md)
    • [P2P networking](specs/capella/p2p-interface.md)
| | Deneb (tentative) |
  • Core
    • [Beacon Chain changes](specs/deneb/beacon-chain.md)
    • [Deneb fork](specs/deneb/fork.md)
    • [Polynomial commitments](specs/deneb/polynomial-commitments.md)
    • [Fork choice changes](specs/deneb/fork-choice.md)
  • Additions
    • [Light client sync protocol changes](specs/deneb/light-client/sync-protocol.md) ([fork](specs/deneb/light-client/fork.md), [full node](specs/deneb/light-client/full-node.md), [networking](specs/deneb/light-client/p2p-interface.md))
    • [Honest validator guide changes](specs/deneb/validator.md)
    • [P2P networking](specs/deneb/p2p-interface.md)
| | Sharding (outdated) |
  • Core
    • [Beacon Chain changes](specs/_features/sharding/beacon-chain.md)
  • Additions
    • [P2P networking](specs/_features/sharding/p2p-interface.md)
| | Custody Game (outdated) |
  • Core
    • [Beacon Chain changes](specs/_features/custody_game/beacon-chain.md)
  • Additions
    • [Honest validator guide changes](specs/_features/custody_game/validator.md)
| Dependent on sharding | diff --git a/specs/capella/fork.md b/specs/capella/fork.md index 49bf8744f3..95bdf79aee 100644 --- a/specs/capella/fork.md +++ b/specs/capella/fork.md @@ -27,7 +27,7 @@ Warning: this configuration is not definitive. | Name | Value | | - | - | | `CAPELLA_FORK_VERSION` | `Version('0x03000000')` | -| `CAPELLA_FORK_EPOCH` | `Epoch(18446744073709551615)` **TBD** | +| `CAPELLA_FORK_EPOCH` | `Epoch(194048)` (April 12, 2023, 10:27:35pm UTC) | ## Helper functions From 024cec5fc95f95f4dcad69f15430fdc0065789cb Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Mon, 20 Mar 2023 14:39:24 +0800 Subject: [PATCH 6/6] bump version.txt to 1.3.0-rc.5 --- tests/core/pyspec/eth2spec/VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/core/pyspec/eth2spec/VERSION.txt b/tests/core/pyspec/eth2spec/VERSION.txt index 9b388ed89d..d4f06976f0 100644 --- a/tests/core/pyspec/eth2spec/VERSION.txt +++ b/tests/core/pyspec/eth2spec/VERSION.txt @@ -1 +1 @@ -1.3.0-rc.4 +1.3.0-rc.5