Skip to content

Commit 88dcc5d

Browse files
authored
refactor: update block header signature field type (#834)
1 parent 7f2e305 commit 88dcc5d

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

ledger/babbage/babbage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ type BabbageBlockHeader struct {
173173
Minor uint64
174174
}
175175
}
176-
Signature interface{}
176+
Signature []byte
177177
}
178178

179179
func (h *BabbageBlockHeader) UnmarshalCBOR(cborData []byte) error {

ledger/shelley/shelley.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ type ShelleyBlockHeader struct {
151151
ProtoMajorVersion uint64
152152
ProtoMinorVersion uint64
153153
}
154-
Signature interface{}
154+
Signature []byte
155155
}
156156

157157
func (h *ShelleyBlockHeader) UnmarshalCBOR(cborData []byte) error {

ledger/verify_kes.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ func VerifyKes(
129129
slotsPerKesPeriod uint64,
130130
) (bool, error) {
131131
// Ref: https://github.com/IntersectMBO/ouroboros-consensus/blob/de74882102236fdc4dd25aaa2552e8b3e208448c/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/Praos.hs#L125
132-
sigBytes := header.Signature.([]byte)
133132
// Ref: https://github.com/IntersectMBO/cardano-ledger/blob/master/libs/cardano-protocol-tpraos/src/Cardano/Protocol/TPraos/BHeader.hs#L189
134133
msgBytes, err := cbor.Encode(header.Body)
135134
if err != nil {
@@ -144,7 +143,7 @@ func VerifyKes(
144143
if currentKesPeriod >= startOfKesPeriod {
145144
t = currentKesPeriod - startOfKesPeriod
146145
}
147-
return verifySignedKES(opCertVkHotBytes, t, msgBytes, sigBytes), nil
146+
return verifySignedKES(opCertVkHotBytes, t, msgBytes, header.Signature), nil
148147
}
149148

150149
func verifySignedKES(vkey []byte, period uint64, msg []byte, sig []byte) bool {

0 commit comments

Comments
 (0)