Skip to content

Commit

Permalink
refactor: update block header signature field type (#834)
Browse files Browse the repository at this point in the history
  • Loading branch information
agaffney authored Jan 17, 2025
1 parent 7f2e305 commit 88dcc5d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ledger/babbage/babbage.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ type BabbageBlockHeader struct {
Minor uint64
}
}
Signature interface{}
Signature []byte
}

func (h *BabbageBlockHeader) UnmarshalCBOR(cborData []byte) error {
Expand Down
2 changes: 1 addition & 1 deletion ledger/shelley/shelley.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ type ShelleyBlockHeader struct {
ProtoMajorVersion uint64
ProtoMinorVersion uint64
}
Signature interface{}
Signature []byte
}

func (h *ShelleyBlockHeader) UnmarshalCBOR(cborData []byte) error {
Expand Down
3 changes: 1 addition & 2 deletions ledger/verify_kes.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ func VerifyKes(
slotsPerKesPeriod uint64,
) (bool, error) {
// Ref: https://github.com/IntersectMBO/ouroboros-consensus/blob/de74882102236fdc4dd25aaa2552e8b3e208448c/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Protocol/Praos.hs#L125
sigBytes := header.Signature.([]byte)
// Ref: https://github.com/IntersectMBO/cardano-ledger/blob/master/libs/cardano-protocol-tpraos/src/Cardano/Protocol/TPraos/BHeader.hs#L189
msgBytes, err := cbor.Encode(header.Body)
if err != nil {
Expand All @@ -144,7 +143,7 @@ func VerifyKes(
if currentKesPeriod >= startOfKesPeriod {
t = currentKesPeriod - startOfKesPeriod
}
return verifySignedKES(opCertVkHotBytes, t, msgBytes, sigBytes), nil
return verifySignedKES(opCertVkHotBytes, t, msgBytes, header.Signature), nil
}

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

0 comments on commit 88dcc5d

Please sign in to comment.