Skip to content

Commit

Permalink
rm Web3Signer Bellatrix block support
Browse files Browse the repository at this point in the history
  • Loading branch information
tersec committed Mar 11, 2024
1 parent f088e5f commit c8b8442
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 188 deletions.
8 changes: 3 additions & 5 deletions AllTests-mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,18 +649,16 @@ OK: 8/8 Fail: 0/8 Skip: 0/8
OK: 3/3 Fail: 0/3 Skip: 0/3
## Nimbus remote signer/signing test (verifying-web3signer)
```diff
+ Signing BeaconBlock (getBlockSignature(bellatrix)) OK
+ Signing BeaconBlock (getBlockSignature(capella)) OK
+ Signing BeaconBlock (getBlockSignature(deneb)) OK
+ Waiting for signing node (/upcheck) test OK
```
OK: 4/4 Fail: 0/4 Skip: 0/4
OK: 3/3 Fail: 0/3 Skip: 0/3
## Nimbus remote signer/signing test (web3signer)
```diff
+ Connection timeout test OK
+ Public keys enumeration (/api/v1/eth2/publicKeys) test OK
+ Public keys reload (/reload) test OK
+ Signing BeaconBlock (getBlockSignature(bellatrix)) OK
+ Signing BeaconBlock (getBlockSignature(capella)) OK
+ Signing BeaconBlock (getBlockSignature(deneb)) OK
+ Signing SC contribution and proof (getContributionAndProofSignature()) OK
Expand All @@ -675,7 +673,7 @@ OK: 4/4 Fail: 0/4 Skip: 0/4
+ Signing voluntary exit (getValidatorExitSignature()) OK
+ Waiting for signing node (/upcheck) test OK
```
OK: 17/17 Fail: 0/17 Skip: 0/17
OK: 16/16 Fail: 0/16 Skip: 0/16
## Old database versions [Preset: mainnet]
```diff
+ pre-1.1.0 OK
Expand Down Expand Up @@ -1008,4 +1006,4 @@ OK: 2/2 Fail: 0/2 Skip: 0/2
OK: 9/9 Fail: 0/9 Skip: 0/9

---TOTAL---
OK: 677/682 Fail: 0/682 Skip: 5/682
OK: 675/680 Fail: 0/680 Skip: 5/680
4 changes: 2 additions & 2 deletions beacon_chain/nimbus_signing_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@ proc installApiHandlers*(node: SigningNodeRef) =

let (feeRecipientIndex, blockHeader) =
case request.beaconBlockHeader.kind
of ConsensusFork.Phase0, ConsensusFork.Altair:
of ConsensusFork.Phase0 .. ConsensusFork.Bellatrix:
# `phase0` and `altair` blocks do not have `fee_recipient`, so
# we return an error.
return errorResponse(Http400, BlockIncorrectFork)
of ConsensusFork.Bellatrix, ConsensusFork.Capella:
of ConsensusFork.Capella:
(GeneralizedIndex(401), request.beaconBlockHeader.data)
of ConsensusFork.Deneb:
(GeneralizedIndex(801), request.beaconBlockHeader.data)
Expand Down
5 changes: 0 additions & 5 deletions beacon_chain/spec/keystore.nim
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ type
ProvenProperty* = object
path*: string
description*: Option[string]
bellatrixIndex*: Option[GeneralizedIndex]
capellaIndex*: Option[GeneralizedIndex]
denebIndex*: Option[GeneralizedIndex]

Expand Down Expand Up @@ -728,15 +727,13 @@ func parseProvenBlockProperty*(propertyPath: string): Result[ProvenProperty, str
if propertyPath == ".execution_payload.fee_recipient":
ok ProvenProperty(
path: propertyPath,
bellatrixIndex: some GeneralizedIndex(401),
capellaIndex: some GeneralizedIndex(401),
denebIndex: some GeneralizedIndex(801))
elif propertyPath == ".graffiti":
ok ProvenProperty(
path: propertyPath,
# TODO: graffiti is present since genesis, so the correct index in the early
# forks can be supplied here
bellatrixIndex: some GeneralizedIndex(18),
capellaIndex: some GeneralizedIndex(18),
denebIndex: some GeneralizedIndex(18))
else:
Expand Down Expand Up @@ -845,13 +842,11 @@ proc readValue*(reader: var JsonReader, value: var RemoteKeystore)
var provenProperties = reader.readValue(seq[ProvenProperty])
for prop in provenProperties.mitems:
if prop.path == ".execution_payload.fee_recipient":
prop.bellatrixIndex = some GeneralizedIndex(401)
prop.capellaIndex = some GeneralizedIndex(401)
prop.denebIndex = some GeneralizedIndex(801)
elif prop.path == ".graffiti":
# TODO: graffiti is present since genesis, so the correct index in the early
# forks can be supplied here
prop.bellatrixIndex = some GeneralizedIndex(18)
prop.capellaIndex = some GeneralizedIndex(18)
prop.denebIndex = some GeneralizedIndex(18)
else:
Expand Down
34 changes: 2 additions & 32 deletions beacon_chain/validators/validator_pool.nim
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,6 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
): Future[SignatureResult]
{.async: (raises: [CancelledError]).} =
type SomeBlockBody =
bellatrix.BeaconBlockBody |
capella.BeaconBlockBody |
deneb.BeaconBlockBody |
deneb_mev.BlindedBeaconBlockBody
Expand Down Expand Up @@ -567,24 +566,8 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
elif blck is ForkedMaybeBlindedBeaconBlock:
withForkyMaybeBlindedBlck(blck):
# TODO why isn't this a case statement
when consensusFork < ConsensusFork.Bellatrix:
when consensusFork < ConsensusFork.Capella:
return SignatureResult.err("Invalid beacon block fork")
elif consensusFork == ConsensusFork.Bellatrix:
when isBlinded:
return SignatureResult.err("Invalid blinded beacon block fork")
else:
case v.data.remoteType
of RemoteSignerType.Web3Signer:
Web3SignerRequest.init(fork, genesis_validators_root,
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Bellatrix,
data: forkyMaybeBlindedBlck.toBeaconBlockHeader))
of RemoteSignerType.VerifyingWeb3Signer:
let proofs = blockPropertiesProofs(
blck.bellatrixData.body, bellatrixIndex)
Web3SignerRequest.init(fork, genesis_validators_root,
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Bellatrix,
data: forkyMaybeBlindedBlck.toBeaconBlockHeader),
proofs)
elif consensusFork == ConsensusFork.Capella:
when isBlinded:
return SignatureResult.err("Invalid blinded beacon block fork")
Expand Down Expand Up @@ -632,21 +615,8 @@ proc getBlockSignature*(v: AttachedValidator, fork: Fork,
proofs)
else:
case blck.kind
of ConsensusFork.Phase0, ConsensusFork.Altair:
of ConsensusFork.Phase0 .. ConsensusFork.Bellatrix:
return SignatureResult.err("Invalid beacon block fork")
of ConsensusFork.Bellatrix:
case v.data.remoteType
of RemoteSignerType.Web3Signer:
Web3SignerRequest.init(fork, genesis_validators_root,
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Bellatrix,
data: blck.bellatrixData.toBeaconBlockHeader))
of RemoteSignerType.VerifyingWeb3Signer:
let proofs = blockPropertiesProofs(
blck.bellatrixData.body, bellatrixIndex)
Web3SignerRequest.init(fork, genesis_validators_root,
Web3SignerForkedBeaconBlock(kind: ConsensusFork.Bellatrix,
data: blck.bellatrixData.toBeaconBlockHeader),
proofs)
of ConsensusFork.Capella:
case v.data.remoteType
of RemoteSignerType.Web3Signer:
Expand Down
4 changes: 1 addition & 3 deletions tests/test_remote_keystore.nim
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ suite "Remove keystore testing suite":
check keystore.remotes[0].id == 0
check keystore.remotes[0].pubkey.toHex == "8b9c875fbe539c6429c4fc304675062579ce47fb6b2ac6b6a1ba1188ca123a80affbfe381dbbc8e7f2437709a4c3325c"
check keystore.provenBlockProperties.len == 1
check keystore.provenBlockProperties[0].bellatrixIndex == some GeneralizedIndex(401)
check keystore.provenBlockProperties[0].capellaIndex == some GeneralizedIndex(401)
check keystore.provenBlockProperties[0].denebIndex == some GeneralizedIndex(801)

Expand Down Expand Up @@ -184,6 +183,5 @@ suite "Remove keystore testing suite":
check keystore.remotes[2].pubkey.toHex == "8f5f9e305e7fcbde94182747f5ecec573d1786e8320a920347a74c0ff5e70f12ca22607c98fdc8dbe71161db59e0ac9d"
check keystore.threshold == 2
check keystore.provenBlockProperties.len == 1
check keystore.provenBlockProperties[0].bellatrixIndex == some GeneralizedIndex(401)
check keystore.provenBlockProperties[0].capellaIndex == some GeneralizedIndex(401)
check keystore.provenBlockProperties[0].denebIndex == some GeneralizedIndex(801)
check keystore.provenBlockProperties[0].denebIndex == some GeneralizedIndex(801)
Loading

0 comments on commit c8b8442

Please sign in to comment.