Skip to content

Commit

Permalink
refactor: move VrfResult to common and use for Shelley block header (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
agaffney authored Jan 19, 2025
1 parent 88dcc5d commit 0b3d6ee
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
8 changes: 1 addition & 7 deletions ledger/babbage/babbage.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,6 @@ func (b *BabbageBlock) Utxorpc() *utxorpc.Block {
return block
}

type BabbageBlockHeaderVrfResult struct {
cbor.StructAsArray
Output []byte
Proof []byte
}

type BabbageBlockHeader struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
Expand All @@ -157,7 +151,7 @@ type BabbageBlockHeader struct {
PrevHash common.Blake2b256
IssuerVkey common.IssuerVkey
VrfKey []byte
VrfResult BabbageBlockHeaderVrfResult
VrfResult common.VrfResult
BlockBodySize uint64
BlockBodyHash common.Blake2b256
OpCert struct {
Expand Down
25 changes: 25 additions & 0 deletions ledger/common/vrf.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2024 Blink Labs Software
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package common

import (
"github.com/blinklabs-io/gouroboros/cbor"
)

type VrfResult struct {
cbor.StructAsArray
Output []byte
Proof []byte
}
4 changes: 2 additions & 2 deletions ledger/shelley/shelley.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ type ShelleyBlockHeader struct {
PrevHash common.Blake2b256
IssuerVkey common.IssuerVkey
VrfKey []byte
NonceVrf interface{}
LeaderVrf interface{}
NonceVrf common.VrfResult
LeaderVrf common.VrfResult
BlockBodySize uint64
BlockBodyHash common.Blake2b256
OpCertHotVkey []byte
Expand Down

0 comments on commit 0b3d6ee

Please sign in to comment.