Skip to content

Commit e469cf3

Browse files
committed
indentations to spaces
1 parent 945c7c6 commit e469cf3

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed

sips/verifiable_consensus_data.md

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,32 @@ func (cd VerifiableConsensusData) GetAttestationData (att phase0.AttestationData
5353
}
5454

5555
func (cd VerifiableConsensusData) GetSyncCommitteeBlockRoot (phase0.Root, phase0.SignedBeaconBlockHeader, error) {
56-
ret := SSZ32Bytes{}
57-
if err := ret.UnmarshalSSZ(cd.DataSSZ); err != nil {
58-
return nil, errors.Wrap(err, "could not unmarshal ssz")
59-
}
56+
ret := SSZ32Bytes{}
57+
if err := ret.UnmarshalSSZ(cd.DataSSZ); err != nil {
58+
return nil, errors.Wrap(err, "could not unmarshal ssz")
59+
}
6060
proof := phase0.SignedBeaconBlockHeader
6161
if err := proof.UnmarshalSSZ(cd.Proof); err != nil {
6262
return nil, nil, errors.Wrap(err, "could not unmarshal proof ssz")
6363
}
64-
return phase0.Root(ret), proof, nil
64+
return phase0.Root(ret), proof, nil
6565
}
6666

6767
func (cd VerifiableConsensusData) Validate error {
6868
switch cid.Duty.Type {
69-
case BNRoleAttester:
69+
case BNRoleAttester:
7070
if _, _, _, _, err := cid.GetAttestationData(); err != nil {
7171
return err
7272
}
7373
return nil
74-
case BNRoleSyncCommittee:
74+
case BNRoleSyncCommittee:
7575
if _, _, err := cid.GetSyncCommitteeBlockRoot(); err != nil {
7676
return err
7777
}
7878
return nil
7979
default:
80-
return errors.New("unknown duty role")
81-
}
80+
return errors.New("unknown duty role")
81+
}
8282
}
8383
```
8484

@@ -124,19 +124,19 @@ func verifyAssignedBlockHeader(blockHeader *phase0.BeaconBlockHeader, proposerDu
124124

125125
//beaconChecks ensures that the beacon chain will accept the attestation
126126
func beaconChecks(cd *VerifiableConsensusData) error {
127-
attestationData, headProof, targetProof, sourceProof, err := cd.GetAttestationData() // error checked in cd.validate()
127+
attestationData, headProof, targetProof, sourceProof, err := cd.GetAttestationData() // error checked in cd.validate()
128128

129-
if cd.Duty.Slot != attestationData.Slot {
130-
return errors.New("attestation data slot != duty slot")
131-
}
129+
if cd.Duty.Slot != attestationData.Slot {
130+
return errors.New("attestation data slot != duty slot")
131+
}
132132

133-
if cd.Duty.CommitteeIndex != attestationData.Index {
134-
return errors.New("attestation data CommitteeIndex != duty CommitteeIndex")
135-
}
133+
if cd.Duty.CommitteeIndex != attestationData.Index {
134+
return errors.New("attestation data CommitteeIndex != duty CommitteeIndex")
135+
}
136136

137-
if attestationData.Target.Epoch < network.EstimatedCurrentEpoch()-1 {
138-
return errors.New("attestation data target epoch is into far past")
139-
}
137+
if attestationData.Target.Epoch < network.EstimatedCurrentEpoch()-1 {
138+
return errors.New("attestation data target epoch is into far past")
139+
}
140140

141141
// Addition
142142
if attestationData.Target.Epoch != getBeaconNode().EpochFromSlot(headProof.Message.Slot) {
@@ -149,9 +149,9 @@ func beaconChecks(cd *VerifiableConsensusData) error {
149149
}
150150

151151

152-
if attestationData.Source.Epoch >= attestationData.Target.Epoch {
153-
return errors.New("attestation data source > target")
154-
}
152+
if attestationData.Source.Epoch >= attestationData.Target.Epoch {
153+
return errors.New("attestation data source > target")
154+
}
155155

156156
// Addition
157157
if attestationData.Source.Epoch != getBeaconNode().EpochFromSlot(sourceProof.Message.Slot) {
@@ -179,33 +179,33 @@ func isSourceJustified(attestationData)) error {
179179
}
180180

181181
func AttesterValueCheckF(
182-
signer types.BeaconSigner,
183-
network types.BeaconNetwork,
184-
validatorPK types.ValidatorPK,
185-
validatorIndex phase0.ValidatorIndex,
186-
sharePublicKey []byte,
182+
signer types.BeaconSigner,
183+
network types.BeaconNetwork,
184+
validatorPK types.ValidatorPK,
185+
validatorIndex phase0.ValidatorIndex,
186+
sharePublicKey []byte,
187187
// obtained from the operator's beacon node, consists of duties for the last 2 epochs
188188
proposerDuties []ethApi.ProposerDuty
189189
// obtained from the operator's beacon node
190190
attestationDataByts []byte,
191191
) qbft.ProposedValueCheckF {
192-
return func(data []byte) error {
192+
return func(data []byte) error {
193193
// addition
194194
if bytes.Equal(attestationDataByts, data) {
195195
return nil
196196
}
197197

198-
cd := types.VerifyableConsensusData{}
199-
if err := cd.Decode(data); err != nil {
200-
return errors.Wrap(err, "failed decoding consensus data")
201-
}
202-
if err := cd.Validate(); err != nil {
203-
return errors.Wrap(err, "invalid value")
204-
}
198+
cd := types.VerifyableConsensusData{}
199+
if err := cd.Decode(data); err != nil {
200+
return errors.Wrap(err, "failed decoding consensus data")
201+
}
202+
if err := cd.Validate(); err != nil {
203+
return errors.Wrap(err, "invalid value")
204+
}
205205

206-
if err := dutyValueCheck(&cd.Duty, network, types.BNRoleAttester, validatorPK, validatorIndex); err != nil {
207-
return errors.Wrap(err, "duty invalid")
208-
}
206+
if err := dutyValueCheck(&cd.Duty, network, types.BNRoleAttester, validatorPK, validatorIndex); err != nil {
207+
return errors.Wrap(err, "duty invalid")
208+
}
209209

210210
if err := beaconChecks(&cd); err != nil {
211211
return errors.Wrap(err, "beacon checks failed")
@@ -231,35 +231,35 @@ func AttesterValueCheckF(
231231
}
232232

233233
return nil
234-
}
234+
}
235235

236236
func SyncCommitteeValueCheckF(
237-
signer types.BeaconSigner,
238-
network types.BeaconNetwork,
239-
validatorPK types.ValidatorPK,
240-
validatorIndex phase0.ValidatorIndex,
237+
signer types.BeaconSigner,
238+
network types.BeaconNetwork,
239+
validatorPK types.ValidatorPK,
240+
validatorIndex phase0.ValidatorIndex,
241241
// obtained from the operator's beacon node, consists of duties for the last 2 epochs
242242
proposerDuties []ethApi.ProposerDuty
243243
// obtained from the operator's beacon node
244244
syncCommitteeBlockRoot []byte,
245245
) qbft.ProposedValueCheckF {
246-
return func(data []byte) error {
246+
return func(data []byte) error {
247247
// addition
248248
if bytes.Equal(syncCommitteeBlockRoot, data) {
249249
return nil
250250
}
251251

252-
cd := types.VerifiableConsensusData{}
253-
if err := cd.Decode(data); err != nil {
254-
return errors.Wrap(err, "failed decoding consensus data")
255-
}
256-
if err := cd.Validate(); err != nil {
257-
return errors.Wrap(err, "invalid value")
258-
}
259-
260-
if err := dutyValueCheck(&cd.Duty, network, types.BNRoleSyncCommittee, validatorPK, validatorIndex); err != nil {
261-
return errors.Wrap(err, "duty invalid")
262-
}
252+
cd := types.VerifiableConsensusData{}
253+
if err := cd.Decode(data); err != nil {
254+
return errors.Wrap(err, "failed decoding consensus data")
255+
}
256+
if err := cd.Validate(); err != nil {
257+
return errors.Wrap(err, "invalid value")
258+
}
259+
260+
if err := dutyValueCheck(&cd.Duty, network, types.BNRoleSyncCommittee, validatorPK, validatorIndex); err != nil {
261+
return errors.Wrap(err, "duty invalid")
262+
}
263263

264264
root, proof, _, cd.GetSyncCommitteeBlockRoot \\ checked on validate
265265

0 commit comments

Comments
 (0)