Skip to content

Commit

Permalink
update VC to use SingleAttestation (#6884)
Browse files Browse the repository at this point in the history
  • Loading branch information
tersec authored Feb 1, 2025
1 parent 4183c93 commit dec1cd3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ type

EncodeArrays* =
seq[phase0.Attestation] |
seq[electra.Attestation] |
seq[electra.SingleAttestation] |
seq[PrepareBeaconProposer] |
seq[RemoteKeystoreInfo] |
seq[RestCommitteeSubscription] |
Expand Down
3 changes: 2 additions & 1 deletion beacon_chain/spec/forks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ type

ForkyAttestation* =
phase0.Attestation |
electra.Attestation
electra.SingleAttestation

ForkedAttestation* = object
case kind*: ConsensusFork
Expand Down Expand Up @@ -461,6 +461,7 @@ template kind*(
electra.MsgTrustedSignedBeaconBlock |
electra.TrustedSignedBeaconBlock |
electra.Attestation |
electra.SingleAttestation |
electra.AggregateAndProof |
electra.SignedAggregateAndProof |
electra_mev.SignedBlindedBeaconBlock]): ConsensusFork =
Expand Down
10 changes: 6 additions & 4 deletions beacon_chain/validator_client/attestation_service.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2021-2024 Status Research & Development GmbH
# Copyright (c) 2021-2025 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
Expand Down Expand Up @@ -72,10 +72,12 @@ proc serveAttestation(
logScope:
attestation = shortLog(atst)
try:
when atst is electra.Attestation:
when atst is electra.SingleAttestation:
await vc.submitPoolAttestationsV2(@[atst], ApiStrategyKind.First)
else:
elif atst is phase0.Attestation:
await vc.submitPoolAttestations(@[atst], ApiStrategyKind.First)
else:
static: doAssert false
except ValidatorApiError as exc:
warn "Unable to publish attestation", reason = exc.getFailureReason()
return false
Expand All @@ -85,7 +87,7 @@ proc serveAttestation(

let res =
if afterElectra:
let attestation = registered.toElectraAttestation(signature)
let attestation = registered.toSingleAttestation(signature)
submitAttestation(attestation)
else:
let attestation = registered.toAttestation(signature)
Expand Down

0 comments on commit dec1cd3

Please sign in to comment.