Skip to content
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
11 changes: 1 addition & 10 deletions ledger/allegra/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,7 @@ func UtxoValidateValueNotConservedUtxo(
ls common.LedgerState,
pp common.ProtocolParameters,
) error {
tmpPparams, ok := pp.(*AllegraProtocolParameters)
if !ok {
return errors.New("pparams are not expected type")
}
return shelley.UtxoValidateValueNotConservedUtxo(
tx,
slot,
ls,
&tmpPparams.ShelleyProtocolParameters,
)
return shelley.UtxoValidateValueNotConservedUtxo(tx, slot, ls, pp)
}

func UtxoValidateOutputTooSmallUtxo(
Expand Down
7 changes: 2 additions & 5 deletions ledger/alonzo/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,13 @@ func UtxoValidateNoCollateralInputs(tx common.Transaction, slot uint64, ls commo
}
return NoCollateralInputsError{}
}

func UtxoValidateBadInputsUtxo(tx common.Transaction, slot uint64, ls common.LedgerState, pp common.ProtocolParameters) error {
return shelley.UtxoValidateBadInputsUtxo(tx, slot, ls, pp)
}

func UtxoValidateValueNotConservedUtxo(tx common.Transaction, slot uint64, ls common.LedgerState, pp common.ProtocolParameters) error {
tmpPparams, ok := pp.(*AlonzoProtocolParameters)
if !ok {
return errors.New("pparams are not expected type")
}
return shelley.UtxoValidateValueNotConservedUtxo(tx, slot, ls, &tmpPparams.ShelleyProtocolParameters)
return shelley.UtxoValidateValueNotConservedUtxo(tx, slot, ls, pp)
}

func UtxoValidateOutputTooSmallUtxo(tx common.Transaction, slot uint64, ls common.LedgerState, pp common.ProtocolParameters) error {
Expand Down
60 changes: 60 additions & 0 deletions ledger/babbage/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright 2025 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 babbage

import (
"fmt"
"strings"

"github.com/blinklabs-io/gouroboros/ledger/common"
)

type NonDisjointRefInputsError struct {
Inputs []common.TransactionInput
}

func (e NonDisjointRefInputsError) Error() string {
tmpInputs := make([]string, 0, len(e.Inputs))
for idx, tmpInput := range e.Inputs {
tmpInputs[idx] = tmpInput.String()
}
return "non-disjoint reference inputs: " + strings.Join(tmpInputs, ", ")
}

type TooManyCollateralInputsError struct {
Provided uint
Max uint
}

func (e TooManyCollateralInputsError) Error() string {
return fmt.Sprintf(
"too many collateral inputs: provided %d, maximum %d",
e.Provided,
e.Max,
)
}

type IncorrectTotalCollateralFieldError struct {
Provided uint64
TotalCollateral uint64
}

func (e IncorrectTotalCollateralFieldError) Error() string {
return fmt.Sprintf(
"incorrect total collateral field: provided %d, total collateral %d",
e.Provided,
e.TotalCollateral,
)
}
Loading