Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use LazyValue for metadata to avoid decoding issues #638

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ledger/allegra.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type AllegraBlock struct {
Header *AllegraBlockHeader
TransactionBodies []AllegraTransactionBody
TransactionWitnessSets []ShelleyTransactionWitnessSet
TransactionMetadataSet map[uint]*cbor.Value
TransactionMetadataSet map[uint]*cbor.LazyValue
}

func (b *AllegraBlock) UnmarshalCBOR(cborData []byte) error {
Expand Down Expand Up @@ -135,7 +135,7 @@ type AllegraTransaction struct {
cbor.DecodeStoreCbor
Body AllegraTransactionBody
WitnessSet ShelleyTransactionWitnessSet
TxMetadata *cbor.Value
TxMetadata *cbor.LazyValue
}

func (t AllegraTransaction) Hash() string {
Expand Down Expand Up @@ -210,7 +210,7 @@ func (t AllegraTransaction) ProposalProcedures() []ProposalProcedure {
return t.Body.ProposalProcedures()
}

func (t AllegraTransaction) Metadata() *cbor.Value {
func (t AllegraTransaction) Metadata() *cbor.LazyValue {
return t.TxMetadata
}

Expand Down
6 changes: 3 additions & 3 deletions ledger/alonzo.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type AlonzoBlock struct {
Header *AlonzoBlockHeader
TransactionBodies []AlonzoTransactionBody
TransactionWitnessSets []AlonzoTransactionWitnessSet
TransactionMetadataSet map[uint]*cbor.Value
TransactionMetadataSet map[uint]*cbor.LazyValue
InvalidTransactions []uint
}

Expand Down Expand Up @@ -249,7 +249,7 @@ type AlonzoTransaction struct {
Body AlonzoTransactionBody
WitnessSet AlonzoTransactionWitnessSet
IsTxValid bool
TxMetadata *cbor.Value
TxMetadata *cbor.LazyValue
}

func (t AlonzoTransaction) Hash() string {
Expand Down Expand Up @@ -324,7 +324,7 @@ func (t AlonzoTransaction) ProposalProcedures() []ProposalProcedure {
return t.Body.ProposalProcedures()
}

func (t AlonzoTransaction) Metadata() *cbor.Value {
func (t AlonzoTransaction) Metadata() *cbor.LazyValue {
return t.TxMetadata
}

Expand Down
6 changes: 3 additions & 3 deletions ledger/babbage.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type BabbageBlock struct {
Header *BabbageBlockHeader
TransactionBodies []BabbageTransactionBody
TransactionWitnessSets []BabbageTransactionWitnessSet
TransactionMetadataSet map[uint]*cbor.Value
TransactionMetadataSet map[uint]*cbor.LazyValue
InvalidTransactions []uint
}

Expand Down Expand Up @@ -417,7 +417,7 @@ type BabbageTransaction struct {
Body BabbageTransactionBody
WitnessSet BabbageTransactionWitnessSet
IsTxValid bool
TxMetadata *cbor.Value
TxMetadata *cbor.LazyValue
}

func (t BabbageTransaction) Hash() string {
Expand Down Expand Up @@ -492,7 +492,7 @@ func (t BabbageTransaction) ProposalProcedures() []ProposalProcedure {
return t.Body.ProposalProcedures()
}

func (t BabbageTransaction) Metadata() *cbor.Value {
func (t BabbageTransaction) Metadata() *cbor.LazyValue {
return t.TxMetadata
}

Expand Down
4 changes: 2 additions & 2 deletions ledger/byron.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ type ByronTransaction struct {
hash string
TxInputs []ByronTransactionInput
TxOutputs []ByronTransactionOutput
Attributes *cbor.Value
Attributes *cbor.LazyValue
}

func (t *ByronTransaction) UnmarshalCBOR(data []byte) error {
Expand Down Expand Up @@ -235,7 +235,7 @@ func (t *ByronTransaction) ProposalProcedures() []ProposalProcedure {
return nil
}

func (t *ByronTransaction) Metadata() *cbor.Value {
func (t *ByronTransaction) Metadata() *cbor.LazyValue {
return t.Attributes
}

Expand Down
6 changes: 3 additions & 3 deletions ledger/conway.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type ConwayBlock struct {
Header *ConwayBlockHeader
TransactionBodies []ConwayTransactionBody
TransactionWitnessSets []BabbageTransactionWitnessSet
TransactionMetadataSet map[uint]*cbor.Value
TransactionMetadataSet map[uint]*cbor.LazyValue
InvalidTransactions []uint
}

Expand Down Expand Up @@ -322,7 +322,7 @@ type ConwayTransaction struct {
Body ConwayTransactionBody
WitnessSet BabbageTransactionWitnessSet
IsTxValid bool
TxMetadata *cbor.Value
TxMetadata *cbor.LazyValue
}

func (t ConwayTransaction) Hash() string {
Expand Down Expand Up @@ -397,7 +397,7 @@ func (t ConwayTransaction) ProposalProcedures() []ProposalProcedure {
return t.Body.ProposalProcedures()
}

func (t ConwayTransaction) Metadata() *cbor.Value {
func (t ConwayTransaction) Metadata() *cbor.LazyValue {
return t.TxMetadata
}

Expand Down
6 changes: 3 additions & 3 deletions ledger/mary.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type MaryBlock struct {
Header *MaryBlockHeader
TransactionBodies []MaryTransactionBody
TransactionWitnessSets []MaryTransactionWitnessSet
TransactionMetadataSet map[uint]*cbor.Value
TransactionMetadataSet map[uint]*cbor.LazyValue
}

func (b *MaryBlock) UnmarshalCBOR(cborData []byte) error {
Expand Down Expand Up @@ -146,7 +146,7 @@ type MaryTransaction struct {
cbor.DecodeStoreCbor
Body MaryTransactionBody
WitnessSet MaryTransactionWitnessSet
TxMetadata *cbor.Value
TxMetadata *cbor.LazyValue
}

type MaryTransactionWitnessSet struct {
Expand Down Expand Up @@ -227,7 +227,7 @@ func (t MaryTransaction) ProposalProcedures() []ProposalProcedure {
return t.Body.ProposalProcedures()
}

func (t MaryTransaction) Metadata() *cbor.Value {
func (t MaryTransaction) Metadata() *cbor.LazyValue {
return t.TxMetadata
}

Expand Down
6 changes: 3 additions & 3 deletions ledger/shelley.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type ShelleyBlock struct {
Header *ShelleyBlockHeader
TransactionBodies []ShelleyTransactionBody
TransactionWitnessSets []ShelleyTransactionWitnessSet
TransactionMetadataSet map[uint]*cbor.Value
TransactionMetadataSet map[uint]*cbor.LazyValue
}

func (b *ShelleyBlock) UnmarshalCBOR(cborData []byte) error {
Expand Down Expand Up @@ -389,7 +389,7 @@ type ShelleyTransaction struct {
cbor.DecodeStoreCbor
Body ShelleyTransactionBody
WitnessSet ShelleyTransactionWitnessSet
TxMetadata *cbor.Value
TxMetadata *cbor.LazyValue
}

func (t ShelleyTransaction) Hash() string {
Expand Down Expand Up @@ -464,7 +464,7 @@ func (t ShelleyTransaction) ProposalProcedures() []ProposalProcedure {
return t.Body.ProposalProcedures()
}

func (t ShelleyTransaction) Metadata() *cbor.Value {
func (t ShelleyTransaction) Metadata() *cbor.LazyValue {
return t.TxMetadata
}

Expand Down
2 changes: 1 addition & 1 deletion ledger/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

type Transaction interface {
TransactionBody
Metadata() *cbor.Value
Metadata() *cbor.LazyValue
IsValid() bool
Consumed() []TransactionInput
Produced() []TransactionOutput
Expand Down