Skip to content

Commit 0120828

Browse files
authored
chore: make format golines (#1132)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 1440f16 commit 0120828

22 files changed

+489
-95
lines changed

ledger/allegra/block_test.go

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,12 @@ func TestAllegraUtxorpcBlock(t *testing.T) {
110110
assert.NotNil(t, utxorpcBlock, "RPC block is nil")
111111

112112
t.Run("BlockHeader", func(t *testing.T) {
113-
assert.Equal(t, expectedHash, hex.EncodeToString(utxorpcBlock.Header.Hash),
114-
"Block hash mismatch")
113+
assert.Equal(
114+
t,
115+
expectedHash,
116+
hex.EncodeToString(utxorpcBlock.Header.Hash),
117+
"Block hash mismatch",
118+
)
115119

116120
assert.Equal(t, expectedHeight, utxorpcBlock.Header.Height,
117121
"Block height mismatch")
@@ -129,10 +133,29 @@ func TestAllegraUtxorpcBlock(t *testing.T) {
129133

130134
if len(rpcTxs) > 0 {
131135
firstRpcTx := rpcTxs[0]
132-
assert.NotEmpty(t, firstRpcTx.Hash, "Transaction hash should not be empty")
133-
assert.Greater(t, len(firstRpcTx.Inputs), 0, "Transaction should have inputs")
134-
assert.Greater(t, len(firstRpcTx.Outputs), 0, "Transaction should have outputs")
135-
assert.Greater(t, firstRpcTx.Fee, uint64(0), "Transaction fee should be positive")
136+
assert.NotEmpty(
137+
t,
138+
firstRpcTx.Hash,
139+
"Transaction hash should not be empty",
140+
)
141+
assert.Greater(
142+
t,
143+
len(firstRpcTx.Inputs),
144+
0,
145+
"Transaction should have inputs",
146+
)
147+
assert.Greater(
148+
t,
149+
len(firstRpcTx.Outputs),
150+
0,
151+
"Transaction should have outputs",
152+
)
153+
assert.Greater(
154+
t,
155+
firstRpcTx.Fee,
156+
uint64(0),
157+
"Transaction fee should be positive",
158+
)
136159
}
137160
})
138161
}

ledger/alonzo/alonzo.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,9 @@ func (o AlonzoTransactionOutput) ToPlutusData() data.PlutusData {
347347
[][2]data.PlutusData{
348348
{
349349
data.NewByteString(nil),
350-
data.NewInteger(new(big.Int).SetUint64(o.OutputAmount.Amount)),
350+
data.NewInteger(
351+
new(big.Int).SetUint64(o.OutputAmount.Amount),
352+
),
351353
},
352354
},
353355
),

ledger/alonzo/alonzo_test.go

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ func TestAlonzoTransactionOutputToPlutusDataCoinOnly(t *testing.T) {
7575
)
7676
tmpData := testTxOut.ToPlutusData()
7777
if !reflect.DeepEqual(tmpData, expectedData) {
78-
t.Fatalf("did not get expected PlutusData\n got: %#v\n wanted: %#v", tmpData, expectedData)
78+
t.Fatalf(
79+
"did not get expected PlutusData\n got: %#v\n wanted: %#v",
80+
tmpData,
81+
expectedData,
82+
)
7983
}
8084
}
8185

@@ -131,22 +135,38 @@ func TestAlonzoTransactionOutputToPlutusDataCoinAssets(t *testing.T) {
131135
),
132136
},
133137
{
134-
data.NewByteString(test.DecodeHexString("29a8fb8318718bd756124f0c144f56d4b4579dc5edf2dd42d669ac61")),
138+
data.NewByteString(
139+
test.DecodeHexString(
140+
"29a8fb8318718bd756124f0c144f56d4b4579dc5edf2dd42d669ac61",
141+
),
142+
),
135143
data.NewMap(
136144
[][2]data.PlutusData{
137145
{
138-
data.NewByteString(test.DecodeHexString("6675726e697368613239686e")),
146+
data.NewByteString(
147+
test.DecodeHexString(
148+
"6675726e697368613239686e",
149+
),
150+
),
139151
data.NewInteger(big.NewInt(123456)),
140152
},
141153
},
142154
),
143155
},
144156
{
145-
data.NewByteString(test.DecodeHexString("eaf8042c1d8203b1c585822f54ec32c4c1bb4d3914603e2cca20bbd5")),
157+
data.NewByteString(
158+
test.DecodeHexString(
159+
"eaf8042c1d8203b1c585822f54ec32c4c1bb4d3914603e2cca20bbd5",
160+
),
161+
),
146162
data.NewMap(
147163
[][2]data.PlutusData{
148164
{
149-
data.NewByteString(test.DecodeHexString("426f7764757261436f6e63657074733638")),
165+
data.NewByteString(
166+
test.DecodeHexString(
167+
"426f7764757261436f6e63657074733638",
168+
),
169+
),
150170
data.NewInteger(big.NewInt(234567)),
151171
},
152172
},
@@ -161,7 +181,11 @@ func TestAlonzoTransactionOutputToPlutusDataCoinAssets(t *testing.T) {
161181
)
162182
tmpData := testTxOut.ToPlutusData()
163183
if !reflect.DeepEqual(tmpData, expectedData) {
164-
t.Fatalf("did not get expected PlutusData\n got: %#v\n wanted: %#v", tmpData, expectedData)
184+
t.Fatalf(
185+
"did not get expected PlutusData\n got: %#v\n wanted: %#v",
186+
tmpData,
187+
expectedData,
188+
)
165189
}
166190
}
167191

@@ -237,10 +261,18 @@ func TestAlonzoRedeemersIter(t *testing.T) {
237261
for key, val := range testRedeemers.Iter() {
238262
expected := expectedOrder[iterIdx]
239263
if !reflect.DeepEqual(key, expected.Key) {
240-
t.Fatalf("did not get expected key: got %#v, wanted %#v", key, expected.Key)
264+
t.Fatalf(
265+
"did not get expected key: got %#v, wanted %#v",
266+
key,
267+
expected.Key,
268+
)
241269
}
242270
if !reflect.DeepEqual(val, expected.Value) {
243-
t.Fatalf("did not get expected value: got %#v, wanted %#v", val, expected.Value)
271+
t.Fatalf(
272+
"did not get expected value: got %#v, wanted %#v",
273+
val,
274+
expected.Value,
275+
)
244276
}
245277
iterIdx++
246278
}

ledger/alonzo/block_test.go

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,24 @@ func TestAlonzoBlockUtxorpc(t *testing.T) {
2525
assert.NotNil(t, block, "Parsed block is nil")
2626

2727
assert.NotEmpty(t, block.Hash(), "Block hash should not be empty")
28-
assert.Greater(t, block.BlockNumber(), uint64(0), "Block number should be positive")
29-
assert.Greater(t, block.SlotNumber(), uint64(0), "Slot number should be positive")
30-
assert.Greater(t, len(block.Transactions()), 0, "Block should contain transactions")
28+
assert.Greater(
29+
t,
30+
block.BlockNumber(),
31+
uint64(0),
32+
"Block number should be positive",
33+
)
34+
assert.Greater(
35+
t,
36+
block.SlotNumber(),
37+
uint64(0),
38+
"Slot number should be positive",
39+
)
40+
assert.Greater(
41+
t,
42+
len(block.Transactions()),
43+
0,
44+
"Block should contain transactions",
45+
)
3146

3247
t.Run("UtxorpcConversion", func(t *testing.T) {
3348
pbBlock, err := block.Utxorpc()
@@ -36,9 +51,29 @@ func TestAlonzoBlockUtxorpc(t *testing.T) {
3651
}
3752

3853
assert.NotNil(t, pbBlock, "Converted block should not be nil")
39-
assert.Equal(t, block.Hash().Bytes(), pbBlock.Header.Hash, "Block hash mismatch")
40-
assert.Equal(t, block.BlockNumber(), pbBlock.Header.Height, "Block height mismatch")
41-
assert.Equal(t, block.SlotNumber(), pbBlock.Header.Slot, "Block slot mismatch")
42-
assert.Equal(t, len(block.Transactions()), len(pbBlock.Body.Tx), "Transaction count mismatch")
54+
assert.Equal(
55+
t,
56+
block.Hash().Bytes(),
57+
pbBlock.Header.Hash,
58+
"Block hash mismatch",
59+
)
60+
assert.Equal(
61+
t,
62+
block.BlockNumber(),
63+
pbBlock.Header.Height,
64+
"Block height mismatch",
65+
)
66+
assert.Equal(
67+
t,
68+
block.SlotNumber(),
69+
pbBlock.Header.Slot,
70+
"Block slot mismatch",
71+
)
72+
assert.Equal(
73+
t,
74+
len(block.Transactions()),
75+
len(pbBlock.Body.Tx),
76+
"Transaction count mismatch",
77+
)
4378
})
4479
}

ledger/babbage/babbage.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,9 @@ func (o BabbageTransactionOutput) ToPlutusData() data.PlutusData {
500500
[][2]data.PlutusData{
501501
{
502502
data.NewByteString(nil),
503-
data.NewInteger(new(big.Int).SetUint64(o.OutputAmount.Amount)),
503+
data.NewInteger(
504+
new(big.Int).SetUint64(o.OutputAmount.Amount),
505+
),
504506
},
505507
},
506508
),

ledger/babbage/babbage_test.go

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,7 +2857,11 @@ func TestBabbageTransactionOutputToPlutusDataCoinOnly(t *testing.T) {
28572857
)
28582858
tmpData := testTxOut.ToPlutusData()
28592859
if !reflect.DeepEqual(tmpData, expectedData) {
2860-
t.Fatalf("did not get expected PlutusData\n got: %#v\n wanted: %#v", tmpData, expectedData)
2860+
t.Fatalf(
2861+
"did not get expected PlutusData\n got: %#v\n wanted: %#v",
2862+
tmpData,
2863+
expectedData,
2864+
)
28612865
}
28622866
}
28632867

@@ -2913,22 +2917,38 @@ func TestBabbageTransactionOutputToPlutusDataCoinAssets(t *testing.T) {
29132917
),
29142918
},
29152919
{
2916-
data.NewByteString(test.DecodeHexString("29a8fb8318718bd756124f0c144f56d4b4579dc5edf2dd42d669ac61")),
2920+
data.NewByteString(
2921+
test.DecodeHexString(
2922+
"29a8fb8318718bd756124f0c144f56d4b4579dc5edf2dd42d669ac61",
2923+
),
2924+
),
29172925
data.NewMap(
29182926
[][2]data.PlutusData{
29192927
{
2920-
data.NewByteString(test.DecodeHexString("6675726e697368613239686e")),
2928+
data.NewByteString(
2929+
test.DecodeHexString(
2930+
"6675726e697368613239686e",
2931+
),
2932+
),
29212933
data.NewInteger(big.NewInt(123456)),
29222934
},
29232935
},
29242936
),
29252937
},
29262938
{
2927-
data.NewByteString(test.DecodeHexString("eaf8042c1d8203b1c585822f54ec32c4c1bb4d3914603e2cca20bbd5")),
2939+
data.NewByteString(
2940+
test.DecodeHexString(
2941+
"eaf8042c1d8203b1c585822f54ec32c4c1bb4d3914603e2cca20bbd5",
2942+
),
2943+
),
29282944
data.NewMap(
29292945
[][2]data.PlutusData{
29302946
{
2931-
data.NewByteString(test.DecodeHexString("426f7764757261436f6e63657074733638")),
2947+
data.NewByteString(
2948+
test.DecodeHexString(
2949+
"426f7764757261436f6e63657074733638",
2950+
),
2951+
),
29322952
data.NewInteger(big.NewInt(234567)),
29332953
},
29342954
},
@@ -2943,6 +2963,10 @@ func TestBabbageTransactionOutputToPlutusDataCoinAssets(t *testing.T) {
29432963
)
29442964
tmpData := testTxOut.ToPlutusData()
29452965
if !reflect.DeepEqual(tmpData, expectedData) {
2946-
t.Fatalf("did not get expected PlutusData\n got: %#v\n wanted: %#v", tmpData, expectedData)
2966+
t.Fatalf(
2967+
"did not get expected PlutusData\n got: %#v\n wanted: %#v",
2968+
tmpData,
2969+
expectedData,
2970+
)
29472971
}
29482972
}

ledger/babbage/block_test.go

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,38 @@ func TestBabbageBlockUtxorpc(t *testing.T) {
4343
}
4444

4545
if !bytes.Equal(utxoBlock.Header.Hash, hashBytes) {
46-
t.Errorf("unexpected block hash: got %x, want %x", utxoBlock.Header.Hash, hashBytes)
46+
t.Errorf(
47+
"unexpected block hash: got %x, want %x",
48+
utxoBlock.Header.Hash,
49+
hashBytes,
50+
)
4751
}
4852

4953
// Verify block number matches what's in the header body
5054
if utxoBlock.Header.Height != block.BlockHeader.Body.BlockNumber {
51-
t.Errorf("unexpected block height: got %d, want %d", utxoBlock.Header.Height, block.BlockHeader.Body.BlockNumber)
55+
t.Errorf(
56+
"unexpected block height: got %d, want %d",
57+
utxoBlock.Header.Height,
58+
block.BlockHeader.Body.BlockNumber,
59+
)
5260
}
5361

5462
// Verify slot number matches what's in the header body
5563
if utxoBlock.Header.Slot != block.BlockHeader.Body.Slot {
56-
t.Errorf("unexpected block slot: got %d, want %d", utxoBlock.Header.Slot, block.BlockHeader.Body.Slot)
64+
t.Errorf(
65+
"unexpected block slot: got %d, want %d",
66+
utxoBlock.Header.Slot,
67+
block.BlockHeader.Body.Slot,
68+
)
5769
}
5870

5971
// Verify transactions
6072
if len(utxoBlock.Body.Tx) != len(block.TransactionBodies) {
61-
t.Errorf("unexpected transaction count: got %d, want %d", len(utxoBlock.Body.Tx), len(block.TransactionBodies))
73+
t.Errorf(
74+
"unexpected transaction count: got %d, want %d",
75+
len(utxoBlock.Body.Tx),
76+
len(block.TransactionBodies),
77+
)
6278
}
6379

6480
// Verify the first transaction as a sample
@@ -69,11 +85,19 @@ func TestBabbageBlockUtxorpc(t *testing.T) {
6985
}
7086

7187
if len(tx.Inputs) != len(block.TransactionBodies[0].TxInputs.Items()) {
72-
t.Errorf("unexpected input count in first tx: got %d, want %d", len(tx.Inputs), len(block.TransactionBodies[0].TxInputs.Items()))
88+
t.Errorf(
89+
"unexpected input count in first tx: got %d, want %d",
90+
len(tx.Inputs),
91+
len(block.TransactionBodies[0].TxInputs.Items()),
92+
)
7393
}
7494

7595
if len(tx.Outputs) != len(block.TransactionBodies[0].TxOutputs) {
76-
t.Errorf("unexpected output count in first tx: got %d, want %d", len(tx.Outputs), len(block.TransactionBodies[0].TxOutputs))
96+
t.Errorf(
97+
"unexpected output count in first tx: got %d, want %d",
98+
len(tx.Outputs),
99+
len(block.TransactionBodies[0].TxOutputs),
100+
)
77101
}
78102
}
79103
}

0 commit comments

Comments
 (0)