diff --git a/ledger/alonzo/pparams.go b/ledger/alonzo/pparams.go index 69a0038f..bcd7d005 100644 --- a/ledger/alonzo/pparams.go +++ b/ledger/alonzo/pparams.go @@ -150,7 +150,9 @@ func (p *AlonzoProtocolParameters) Update( } } -func (p *AlonzoProtocolParameters) UpdateFromGenesis(genesis *AlonzoGenesis) error { +func (p *AlonzoProtocolParameters) UpdateFromGenesis( + genesis *AlonzoGenesis, +) error { if genesis == nil { return nil } @@ -204,7 +206,11 @@ func (p *AlonzoProtocolParameters) UpdateFromGenesis(genesis *AlonzoGenesis) err // Verify we have all expected parameters for i, val := range values { if val == 0 { - return fmt.Errorf("missing parameter at index %d for %s", i, versionStr) + return fmt.Errorf( + "missing parameter at index %d for %s", + i, + versionStr, + ) } } diff --git a/ledger/alonzo/pparams_test.go b/ledger/alonzo/pparams_test.go index dfe69ccf..ade740fb 100644 --- a/ledger/alonzo/pparams_test.go +++ b/ledger/alonzo/pparams_test.go @@ -166,10 +166,16 @@ func TestAlonzoProtocolParametersUpdateFromGenesis(t *testing.T) { } if len(params.CostModels[alonzo.PlutusV1Key]) != 166 { - t.Errorf("expected 166 PlutusV1 parameters, got %d", len(params.CostModels[alonzo.PlutusV1Key])) + t.Errorf( + "expected 166 PlutusV1 parameters, got %d", + len(params.CostModels[alonzo.PlutusV1Key]), + ) } if len(params.CostModels[alonzo.PlutusV2Key]) != 175 { - t.Errorf("expected 175 PlutusV2 parameters, got %d", len(params.CostModels[alonzo.PlutusV2Key])) + t.Errorf( + "expected 175 PlutusV2 parameters, got %d", + len(params.CostModels[alonzo.PlutusV2Key]), + ) } } @@ -207,7 +213,10 @@ func TestCostModelArrayFormat(t *testing.T) { } if len(params.CostModels[alonzo.PlutusV1Key]) != 166 { - t.Errorf("expected 166 parameters, got %d", len(params.CostModels[alonzo.PlutusV1Key])) + t.Errorf( + "expected 166 parameters, got %d", + len(params.CostModels[alonzo.PlutusV1Key]), + ) } } @@ -307,7 +316,11 @@ func TestInvalidCostModelFormats(t *testing.T) { } } if !strings.Contains(err.Error(), tt.expectError) { - t.Errorf("expected error containing %q, got %v", tt.expectError, err) + t.Errorf( + "expected error containing %q, got %v", + tt.expectError, + err, + ) } }) } diff --git a/protocol/localstatequery/messages_test.go b/protocol/localstatequery/messages_test.go index a993ed9b..5f360e7a 100644 --- a/protocol/localstatequery/messages_test.go +++ b/protocol/localstatequery/messages_test.go @@ -97,23 +97,49 @@ var tests = []testDefinition{ MessageType: MessageTypeReacquireVolatileTip, }, { - CborHex: string(readFile("../../internal/test/cardano-blueprint/src/client/node-to-client/state-query/examples/getSystemStart/query.cbor")), - Message: NewMsgQuery(&SystemStartQuery{simpleQueryBase{Type: QueryTypeSystemStart}}), + CborHex: string( + readFile( + "../../internal/test/cardano-blueprint/src/client/node-to-client/state-query/examples/getSystemStart/query.cbor", + ), + ), + Message: NewMsgQuery( + &SystemStartQuery{simpleQueryBase{Type: QueryTypeSystemStart}}, + ), MessageType: MessageTypeQuery, }, { - CborHex: string(readFile("../../internal/test/cardano-blueprint/src/client/node-to-client/state-query/examples/getSystemStart/result.cbor")), + CborHex: string( + readFile( + "../../internal/test/cardano-blueprint/src/client/node-to-client/state-query/examples/getSystemStart/result.cbor", + ), + ), Message: NewMsgResult(unsafeCbor( SystemStartResult{ - Year: unsafeBigInt([]byte("703941703872597091335551638723343370661404331303175992839224705786473148")), - Day: -4205646576720553090, - Picoseconds: unsafeBigInt([]byte("-554918151390414980540174869115975093799476848534297657333456993160799627")), + Year: unsafeBigInt( + []byte( + "703941703872597091335551638723343370661404331303175992839224705786473148", + ), + ), + Day: -4205646576720553090, + Picoseconds: unsafeBigInt( + []byte( + "-554918151390414980540174869115975093799476848534297657333456993160799627", + ), + ), })), MessageType: MessageTypeResult, Result: SystemStartResult{ - Year: unsafeBigInt([]byte("703941703872597091335551638723343370661404331303175992839224705786473148")), - Day: -4205646576720553090, - Picoseconds: unsafeBigInt([]byte("-554918151390414980540174869115975093799476848534297657333456993160799627")), + Year: unsafeBigInt( + []byte( + "703941703872597091335551638723343370661404331303175992839224705786473148", + ), + ), + Day: -4205646576720553090, + Picoseconds: unsafeBigInt( + []byte( + "-554918151390414980540174869115975093799476848534297657333456993160799627", + ), + ), }, }, } diff --git a/protocol/localstatequery/queries.go b/protocol/localstatequery/queries.go index 9ef825c1..af7a2de4 100644 --- a/protocol/localstatequery/queries.go +++ b/protocol/localstatequery/queries.go @@ -424,7 +424,12 @@ type SystemStartResult struct { } func (s SystemStartResult) String() string { - return fmt.Sprintf("SystemStart %s %d %s", s.Year.String(), s.Day, s.Picoseconds.String()) + return fmt.Sprintf( + "SystemStart %s %d %s", + s.Year.String(), + s.Day, + s.Picoseconds.String(), + ) } func (s SystemStartResult) MarshalJSON() ([]byte, error) { diff --git a/protocol/protocol.go b/protocol/protocol.go index 73391444..4f1d524c 100644 --- a/protocol/protocol.go +++ b/protocol/protocol.go @@ -305,7 +305,10 @@ func (p *Protocol) sendLoop() { // Send messages in multiple segments (if needed) for { // Determine segment payload length - segmentPayloadLength := min(payloadBuf.Len(), muxer.SegmentMaxPayloadLength) + segmentPayloadLength := min( + payloadBuf.Len(), + muxer.SegmentMaxPayloadLength, + ) // Send current segment segmentPayload := payloadBuf.Bytes()[:segmentPayloadLength] isResponse := p.Role() == ProtocolRoleServer