From d2edfee87809ec492a90c7d07654e3c890f8e0a7 Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Thu, 28 Aug 2025 17:20:29 -0400 Subject: [PATCH] chore: make format golines Signed-off-by: Chris Gianelloni --- ledger/eras/conway.go | 4 +++- ledger/state.go | 27 ++++++++++++++++++++------- utxorpc/submit.go | 4 +++- utxorpc/sync.go | 5 ++++- utxorpc/watch.go | 5 ++++- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/ledger/eras/conway.go b/ledger/eras/conway.go index 845debc7..b3878c92 100644 --- a/ledger/eras/conway.go +++ b/ledger/eras/conway.go @@ -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: diff --git a/ledger/state.go b/ledger/state.go index ce58a30a..bf5824d3 100644 --- a/ledger/state.go +++ b/ledger/state.go @@ -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 @@ -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 @@ -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 diff --git a/utxorpc/submit.go b/utxorpc/submit.go index 23f76cd9..1f06324f 100644 --- a/utxorpc/submit.go +++ b/utxorpc/submit.go @@ -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 { diff --git a/utxorpc/sync.go b/utxorpc/sync.go index 0bab1da4..d63ce8d7 100644 --- a/utxorpc/sync.go +++ b/utxorpc/sync.go @@ -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", diff --git a/utxorpc/watch.go b/utxorpc/watch.go index 047c3b71..18780b57 100644 --- a/utxorpc/watch.go +++ b/utxorpc/watch.go @@ -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",