Skip to content

Commit 0b3d6ee

Browse files
authored
refactor: move VrfResult to common and use for Shelley block header (#835)
1 parent 88dcc5d commit 0b3d6ee

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

ledger/babbage/babbage.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ func (b *BabbageBlock) Utxorpc() *utxorpc.Block {
140140
return block
141141
}
142142

143-
type BabbageBlockHeaderVrfResult struct {
144-
cbor.StructAsArray
145-
Output []byte
146-
Proof []byte
147-
}
148-
149143
type BabbageBlockHeader struct {
150144
cbor.StructAsArray
151145
cbor.DecodeStoreCbor
@@ -157,7 +151,7 @@ type BabbageBlockHeader struct {
157151
PrevHash common.Blake2b256
158152
IssuerVkey common.IssuerVkey
159153
VrfKey []byte
160-
VrfResult BabbageBlockHeaderVrfResult
154+
VrfResult common.VrfResult
161155
BlockBodySize uint64
162156
BlockBodyHash common.Blake2b256
163157
OpCert struct {

ledger/common/vrf.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2024 Blink Labs Software
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package common
16+
17+
import (
18+
"github.com/blinklabs-io/gouroboros/cbor"
19+
)
20+
21+
type VrfResult struct {
22+
cbor.StructAsArray
23+
Output []byte
24+
Proof []byte
25+
}

ledger/shelley/shelley.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ type ShelleyBlockHeader struct {
140140
PrevHash common.Blake2b256
141141
IssuerVkey common.IssuerVkey
142142
VrfKey []byte
143-
NonceVrf interface{}
144-
LeaderVrf interface{}
143+
NonceVrf common.VrfResult
144+
LeaderVrf common.VrfResult
145145
BlockBodySize uint64
146146
BlockBodyHash common.Blake2b256
147147
OpCertHotVkey []byte

0 commit comments

Comments
 (0)