Skip to content

Commit fc0f4ab

Browse files
authored
chore: make format golines (#837)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 4683476 commit fc0f4ab

File tree

7 files changed

+81
-19
lines changed

7 files changed

+81
-19
lines changed

ledger/byron/genesis_test.go

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,25 @@ func TestGenesisNonAvvmUtxos(t *testing.T) {
282282
}
283283
tmpUtxo := tmpGenesisUtxos[0]
284284
if tmpUtxo.Id.Id().String() != expectedTxId {
285-
t.Fatalf("did not get expected TxID: got %s, wanted %s", tmpUtxo.Id.Id().String(), expectedTxId)
285+
t.Fatalf(
286+
"did not get expected TxID: got %s, wanted %s",
287+
tmpUtxo.Id.Id().String(),
288+
expectedTxId,
289+
)
286290
}
287291
if tmpUtxo.Output.Address().String() != testAddr {
288-
t.Fatalf("did not get expected address: got %s, wanted %s", tmpUtxo.Output.Address().String(), testAddr)
292+
t.Fatalf(
293+
"did not get expected address: got %s, wanted %s",
294+
tmpUtxo.Output.Address().String(),
295+
testAddr,
296+
)
289297
}
290298
if tmpUtxo.Output.Amount() != testAmount {
291-
t.Fatalf("did not get expected amount: got %d, wanted %d", tmpUtxo.Output.Amount(), testAmount)
299+
t.Fatalf(
300+
"did not get expected amount: got %d, wanted %d",
301+
tmpUtxo.Output.Amount(),
302+
testAmount,
303+
)
292304
}
293305
}
294306

@@ -323,12 +335,24 @@ func TestGenesisAvvmUtxos(t *testing.T) {
323335
}
324336
tmpUtxo := tmpGenesisUtxos[0]
325337
if tmpUtxo.Id.Id().String() != expectedTxId {
326-
t.Fatalf("did not get expected TxID: got %s, wanted %s", tmpUtxo.Id.Id().String(), expectedTxId)
338+
t.Fatalf(
339+
"did not get expected TxID: got %s, wanted %s",
340+
tmpUtxo.Id.Id().String(),
341+
expectedTxId,
342+
)
327343
}
328344
if tmpUtxo.Output.Address().String() != expectedAddr {
329-
t.Fatalf("did not get expected address: got %s, wanted %s", tmpUtxo.Output.Address().String(), expectedAddr)
345+
t.Fatalf(
346+
"did not get expected address: got %s, wanted %s",
347+
tmpUtxo.Output.Address().String(),
348+
expectedAddr,
349+
)
330350
}
331351
if tmpUtxo.Output.Amount() != testAmount {
332-
t.Fatalf("did not get expected amount: got %d, wanted %d", tmpUtxo.Output.Amount(), testAmount)
352+
t.Fatalf(
353+
"did not get expected amount: got %d, wanted %d",
354+
tmpUtxo.Output.Amount(),
355+
testAmount,
356+
)
333357
}
334358
}

ledger/common/address.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,24 @@ func (a *Address) populateFromBytes(data []byte) error {
181181
}
182182
payloadBytes, ok := rawAddr.Payload.Content.([]byte)
183183
if !ok || rawAddr.Payload.Number != 24 {
184-
return fmt.Errorf("invalid Byron address data: unexpected payload content")
184+
return fmt.Errorf(
185+
"invalid Byron address data: unexpected payload content",
186+
)
185187
}
186188
payloadChecksum := crc32.ChecksumIEEE(payloadBytes)
187189
if rawAddr.Checksum != payloadChecksum {
188-
return fmt.Errorf("invalid Byron address data: checksum does not match")
190+
return fmt.Errorf(
191+
"invalid Byron address data: checksum does not match",
192+
)
189193
}
190194
var byronAddr byronAddressPayload
191195
if _, err := cbor.Decode(payloadBytes, &byronAddr); err != nil {
192196
return err
193197
}
194198
if len(byronAddr.Hash) != AddressHashSize {
195-
return fmt.Errorf("invalid Byron address data: hash is not expected length")
199+
return fmt.Errorf(
200+
"invalid Byron address data: hash is not expected length",
201+
)
196202
}
197203
a.byronAddressType = byronAddr.AddrType
198204
a.byronAddressAttr = byronAddr.Attr

ledger/common/nonce.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,15 @@ func (n *Nonce) MarshalCBOR() ([]byte, error) {
8585

8686
// CalculateRollingNonce calculates a rolling nonce (eta_v) value from the previous block's eta_v value and the current
8787
// block's VRF result
88-
func CalculateRollingNonce(prevBlockNonce []byte, blockVrf []byte) (Blake2b256, error) {
88+
func CalculateRollingNonce(
89+
prevBlockNonce []byte,
90+
blockVrf []byte,
91+
) (Blake2b256, error) {
8992
if len(blockVrf) != 32 && len(blockVrf) != 64 {
90-
return Blake2b256{}, fmt.Errorf("invalid block VRF length: %d, expected 32 or 64", len(blockVrf))
93+
return Blake2b256{}, fmt.Errorf(
94+
"invalid block VRF length: %d, expected 32 or 64",
95+
len(blockVrf),
96+
)
9197
}
9298
blockVrfHash := Blake2b256Hash(blockVrf)
9399
tmpData := slices.Concat(prevBlockNonce, blockVrfHash.Bytes())
@@ -96,7 +102,11 @@ func CalculateRollingNonce(prevBlockNonce []byte, blockVrf []byte) (Blake2b256,
96102

97103
// CalculateEpochNonce calculates an epoch nonce from the rolling nonce (eta_v) value of the block immediately before the stability
98104
// window and the block hash of the first block from the previous epoch.
99-
func CalculateEpochNonce(stableBlockNonce []byte, prevEpochFirstBlockHash []byte, extraEntropy []byte) (Blake2b256, error) {
105+
func CalculateEpochNonce(
106+
stableBlockNonce []byte,
107+
prevEpochFirstBlockHash []byte,
108+
extraEntropy []byte,
109+
) (Blake2b256, error) {
100110
tmpData := slices.Concat(
101111
stableBlockNonce,
102112
prevEpochFirstBlockHash,

ledger/common/nonce_test.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ func TestCalculateRollingNonce(t *testing.T) {
146146
}
147147
nonceHex := hex.EncodeToString(nonce.Bytes())
148148
if nonceHex != testDef.expectedNonce {
149-
t.Fatalf("did not get expected nonce value: got %s, wanted %s", nonceHex, testDef.expectedNonce)
149+
t.Fatalf(
150+
"did not get expected nonce value: got %s, wanted %s",
151+
nonceHex,
152+
testDef.expectedNonce,
153+
)
150154
}
151155
rollingNonce = nonce.Bytes()
152156
}
@@ -176,7 +180,9 @@ func TestCalculateEpochNonce(t *testing.T) {
176180
if err != nil {
177181
t.Fatalf("unexpected error: %s", err)
178182
}
179-
prevEpochFirstBlockHash, err := hex.DecodeString(testDef.prevEpochFirstBlockHash)
183+
prevEpochFirstBlockHash, err := hex.DecodeString(
184+
testDef.prevEpochFirstBlockHash,
185+
)
180186
if err != nil {
181187
t.Fatalf("unexpected error: %s", err)
182188
}
@@ -188,13 +194,21 @@ func TestCalculateEpochNonce(t *testing.T) {
188194
}
189195
extraEntropy = tmpEntropy
190196
}
191-
tmpNonce, err := common.CalculateEpochNonce(stableBlockNonce, prevEpochFirstBlockHash, extraEntropy)
197+
tmpNonce, err := common.CalculateEpochNonce(
198+
stableBlockNonce,
199+
prevEpochFirstBlockHash,
200+
extraEntropy,
201+
)
192202
if err != nil {
193203
t.Fatalf("unexpected error: %s", err)
194204
}
195205
tmpNonceHex := hex.EncodeToString(tmpNonce.Bytes())
196206
if tmpNonceHex != testDef.expectedNonce {
197-
t.Fatalf("did not get expected epoch nonce: got %s, wanted %s", tmpNonceHex, testDef.expectedNonce)
207+
t.Fatalf(
208+
"did not get expected epoch nonce: got %s, wanted %s",
209+
tmpNonceHex,
210+
testDef.expectedNonce,
211+
)
198212
}
199213
}
200214
}

protocol/chainsync/chainsync.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ func WithRollForwardFunc(rollForwardFunc RollForwardFunc) ChainSyncOptionFunc {
272272
}
273273

274274
// WithRollForwardRawFunc specifies the RollForwardRaw callback function. This will provide the raw header or block
275-
func WithRollForwardRawFunc(rollForwardRawFunc RollForwardRawFunc) ChainSyncOptionFunc {
275+
func WithRollForwardRawFunc(
276+
rollForwardRawFunc RollForwardRawFunc,
277+
) ChainSyncOptionFunc {
276278
return func(c *Config) {
277279
c.RollForwardRawFunc = rollForwardRawFunc
278280
}

protocol/localstatequery/error.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ import "errors"
2020
var ErrAcquireFailurePointTooOld = errors.New("acquire failure: point too old")
2121

2222
// ErrAcquireFailurePointNotOnChain indicates a failure to acquire a point due to it not being present on the chain
23-
var ErrAcquireFailurePointNotOnChain = errors.New("acquire failure: point not on chain")
23+
var ErrAcquireFailurePointNotOnChain = errors.New(
24+
"acquire failure: point not on chain",
25+
)

protocol/localstatequery/queries.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,11 @@ type ShelleyPoolDistrQuery struct {
335335
simpleQueryBase
336336
}
337337

338-
func decodeQuery(data []byte, typeDesc string, queryTypes map[int]any) (any, error) {
338+
func decodeQuery(
339+
data []byte,
340+
typeDesc string,
341+
queryTypes map[int]any,
342+
) (any, error) {
339343
// Determine query type
340344
queryType, err := cbor.DecodeIdFromList(data)
341345
if err != nil {

0 commit comments

Comments
 (0)