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
4 changes: 3 additions & 1 deletion ledger/eras/conway.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ func EvaluateTxConway(
// Lookup script from redeemer purpose
tmpScript := scripts[purpose.ScriptHash()]
if tmpScript == nil {
return 0, lcommon.ExUnits{}, nil, errors.New("could not find needed script")
return 0, lcommon.ExUnits{}, nil, errors.New(
"could not find needed script",
)
}
switch s := tmpScript.(type) {
case *lcommon.PlutusV3Script:
Expand Down
27 changes: 20 additions & 7 deletions ledger/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,17 @@ func (ls *LedgerState) ledgerProcessBlocks() {
// Get parameters from Shelley Genesis
shelleyGenesis := ls.config.CardanoNodeConfig.ShelleyGenesis()
if shelleyGenesis == nil {
return errors.New("failed to get Shelley Genesis config")
return errors.New(
"failed to get Shelley Genesis config",
)
}
// Get security parameter (k)
k := shelleyGenesis.SecurityParam
if k < 0 {
return fmt.Errorf("security param must be non-negative: %d", k)
return fmt.Errorf(
"security param must be non-negative: %d",
k,
)
}
securityParam := uint64(k)
currentTipSlot := ls.currentTip.Point.Slot
Expand All @@ -618,10 +623,14 @@ func (ls *LedgerState) ledgerProcessBlocks() {
shouldValidate = true
ls.config.Logger.Debug(
"enabling validation as block within k-slot window",
"security_param", securityParam,
"currentTipSlot", currentTipSlot,
"cutoffSlot", cutoffSlot,
"blockSlot", blockSlot,
"security_param",
securityParam,
"currentTipSlot",
currentTipSlot,
"cutoffSlot",
cutoffSlot,
"blockSlot",
blockSlot,
)
} else {
shouldValidate = false
Expand Down Expand Up @@ -1049,7 +1058,11 @@ func (ls *LedgerState) EvaluateTx(
return err
})
if err != nil {
return 0, lcommon.ExUnits{}, nil, fmt.Errorf("TX %s failed evaluation: %w", tx.Hash(), err)
return 0, lcommon.ExUnits{}, nil, fmt.Errorf(
"TX %s failed evaluation: %w",
tx.Hash(),
err,
)
}
}
return fee, totalExUnits, redeemerExUnits, nil
Expand Down
4 changes: 3 additions & 1 deletion utxorpc/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ func (s *submitServiceServer) EvalTx(
return nil, fmt.Errorf("failed to parse transaction CBOR: %w", err)
}
// Evaluate TX
fee, totalExUnits, redeemerExUnits, err := s.utxorpc.config.LedgerState.EvaluateTx(tx)
fee, totalExUnits, redeemerExUnits, err := s.utxorpc.config.LedgerState.EvaluateTx(
tx,
)
// Populate response
tmpRedeemers := make([]*cardano.Redeemer, 0, len(redeemerExUnits))
for key, val := range redeemerExUnits {
Expand Down
5 changes: 4 additions & 1 deletion utxorpc/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ func (s *syncServiceServer) FollowTip(
}
if next != nil {
// Send block response
block, err := ledger.NewBlockFromCbor(next.Block.Type, next.Block.Cbor)
block, err := ledger.NewBlockFromCbor(
next.Block.Type,
next.Block.Cbor,
)
if err != nil {
s.utxorpc.config.Logger.Error(
"failed to get block",
Expand Down
5 changes: 4 additions & 1 deletion utxorpc/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ func (s *watchServiceServer) WatchTx(
}
if next != nil {
// Get ledger.Block from bytes
block, err := ledger.NewBlockFromCbor(next.Block.Type, next.Block.Cbor)
block, err := ledger.NewBlockFromCbor(
next.Block.Type,
next.Block.Cbor,
)
if err != nil {
s.utxorpc.config.Logger.Error(
"failed to get block",
Expand Down
Loading