Skip to content

Commit 0f186c6

Browse files
committed
chore(deps): utxorpc/go-codegen 0.18.1
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent ce49039 commit 0f186c6

25 files changed

+499
-308
lines changed

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ require (
1212
github.com/fxamacker/cbor/v2 v2.9.0
1313
github.com/jinzhu/copier v0.4.0
1414
github.com/stretchr/testify v1.11.1
15-
github.com/utxorpc/go-codegen v0.17.0
15+
github.com/utxorpc/go-codegen v0.18.1
1616
go.uber.org/goleak v1.3.0
1717
golang.org/x/crypto v0.43.0
18+
google.golang.org/protobuf v1.36.10
1819
)
1920

2021
require (
@@ -25,12 +26,10 @@ require (
2526
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2627
github.com/decred/dcrd/crypto/blake256 v1.1.0 // indirect
2728
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
28-
github.com/google/go-cmp v0.6.0 // indirect
2929
github.com/kr/text v0.2.0 // indirect
3030
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
3131
github.com/rogpeppe/go-internal v1.14.1 // indirect
3232
github.com/x448/float16 v0.8.4 // indirect
3333
golang.org/x/sys v0.37.0 // indirect
34-
google.golang.org/protobuf v1.36.6 // indirect
3534
gopkg.in/yaml.v3 v3.0.1 // indirect
3635
)

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEW
6363
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
6464
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
6565
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
66-
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
67-
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
66+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
67+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
6868
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
6969
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
7070
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
@@ -103,8 +103,8 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
103103
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
104104
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
105105
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
106-
github.com/utxorpc/go-codegen v0.17.0 h1:cJ7Df9r8Az39lveIcmzcRciIDc3UJFdMSmXg8IAtBPM=
107-
github.com/utxorpc/go-codegen v0.17.0/go.mod h1:LBVGFns4YAHMhy+Pc8tF5ExkU+N8Wm3srst4omKZy4g=
106+
github.com/utxorpc/go-codegen v0.18.1 h1:2eenzXCkqvB2+g8MCq70MBR6koWs9CeTihZ0AqUvLDY=
107+
github.com/utxorpc/go-codegen v0.18.1/go.mod h1:DFij3zIGDM39BYCuzrz1rSuO3kTIIiHglWV0043wQxo=
108108
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
109109
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
110110
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
@@ -143,8 +143,8 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
143143
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
144144
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
145145
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
146-
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
147-
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
146+
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
147+
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
148148
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
149149
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
150150
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

ledger/allegra/block_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ func TestAllegraUtxorpcBlock(t *testing.T) {
152152
)
153153
assert.Greater(
154154
t,
155-
firstRpcTx.Fee,
156-
uint64(0),
155+
firstRpcTx.Fee.GetInt(),
156+
int64(0),
157157
"Transaction fee should be positive",
158158
)
159159
}

ledger/allegra/pparams_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Blink Labs Software
1+
// Copyright 2025 Blink Labs Software
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import (
2424
"github.com/blinklabs-io/gouroboros/ledger/allegra"
2525
"github.com/blinklabs-io/gouroboros/ledger/common"
2626
"github.com/blinklabs-io/gouroboros/ledger/shelley"
27-
"github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano"
27+
utxorpc "github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano"
2828
)
2929

3030
func TestAllegraProtocolParamsUpdate(t *testing.T) {
@@ -92,29 +92,29 @@ func TestAllegraUtxorpc(t *testing.T) {
9292
MinUtxoValue: 1000000,
9393
}
9494

95-
expectedUtxorpc := &cardano.PParams{
96-
MinFeeCoefficient: 500,
97-
MinFeeConstant: 2,
98-
MaxBlockBodySize: 65536,
99-
MaxTxSize: 16384,
100-
MaxBlockHeaderSize: 1024,
101-
StakeKeyDeposit: 2000,
102-
PoolDeposit: 500000,
95+
expectedUtxorpc := &utxorpc.PParams{
96+
MinFeeCoefficient: common.ToUtxorpcBigInt(500),
97+
MinFeeConstant: common.ToUtxorpcBigInt(2),
98+
MaxBlockBodySize: 65536,
99+
MaxTxSize: 16384,
100+
MaxBlockHeaderSize: 1024,
101+
StakeKeyDeposit: common.ToUtxorpcBigInt(2000),
102+
PoolDeposit: common.ToUtxorpcBigInt(500000),
103103
PoolRetirementEpochBound: 2160,
104104
DesiredNumberOfPools: 100,
105-
PoolInfluence: &cardano.RationalNumber{
105+
PoolInfluence: &utxorpc.RationalNumber{
106106
Numerator: int32(1),
107107
Denominator: uint32(2),
108108
},
109-
MonetaryExpansion: &cardano.RationalNumber{
109+
MonetaryExpansion: &utxorpc.RationalNumber{
110110
Numerator: int32(3),
111111
Denominator: uint32(4),
112112
},
113-
TreasuryExpansion: &cardano.RationalNumber{
113+
TreasuryExpansion: &utxorpc.RationalNumber{
114114
Numerator: int32(5),
115115
Denominator: uint32(6),
116116
},
117-
ProtocolVersion: &cardano.ProtocolVersion{
117+
ProtocolVersion: &utxorpc.ProtocolVersion{
118118
Major: 8,
119119
Minor: 0,
120120
},
@@ -171,10 +171,10 @@ func TestAllegraTransactionBody_Utxorpc(t *testing.T) {
171171
}
172172

173173
// Check that the fee matches
174-
if actual.Fee != txBody.Fee() {
174+
if actual.Fee.GetInt() != int64(txBody.Fee()) {
175175
t.Errorf(
176176
"AllegraTransactionBody.Utxorpc() fee mismatch\nGot: %d\nWant: %d",
177-
actual.Fee,
177+
actual.Fee.GetInt(),
178178
txBody.Fee(),
179179
)
180180
}
@@ -233,10 +233,10 @@ func TestAllegraTransaction_Utxorpc(t *testing.T) {
233233
t.Fatalf("Could not convert transaction to utxorpc format: %v", err)
234234
}
235235
// Assertion checks
236-
if actual.Fee != tx.Fee() {
236+
if actual.Fee.GetInt() != int64(tx.Fee()) {
237237
t.Errorf(
238238
"AllegraTransaction.Utxorpc() fee mismatch\nGot: %d\nWant: %d",
239-
actual.Fee,
239+
actual.Fee.GetInt(),
240240
tx.Fee(),
241241
)
242242
}

ledger/alonzo/alonzo.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,10 @@ func (o AlonzoTransactionOutput) Utxorpc() (*utxorpc.TxOutput, error) {
454454
for _, assetName := range tmpAssets.Assets(policyId) {
455455
amount := tmpAssets.Asset(policyId, assetName)
456456
asset := &utxorpc.Asset{
457-
Name: assetName,
458-
OutputCoin: amount,
457+
Name: assetName,
458+
Quantity: &utxorpc.Asset_OutputCoin{
459+
OutputCoin: common.ToUtxorpcBigInt(amount),
460+
},
459461
}
460462
ma.Assets = append(ma.Assets, asset)
461463
}
@@ -476,7 +478,7 @@ func (o AlonzoTransactionOutput) Utxorpc() (*utxorpc.TxOutput, error) {
476478

477479
return &utxorpc.TxOutput{
478480
Address: addressBytes,
479-
Coin: o.Amount(),
481+
Coin: common.ToUtxorpcBigInt(o.Amount()),
480482
Assets: assets,
481483
Datum: &utxorpc.Datum{
482484
Hash: datumHash,

ledger/alonzo/pparams.go

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/blinklabs-io/gouroboros/cbor"
2525
"github.com/blinklabs-io/gouroboros/ledger/common"
2626
"github.com/blinklabs-io/gouroboros/ledger/mary"
27-
cardano "github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano"
27+
utxorpc "github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano"
2828
)
2929

3030
// Constants for Plutus version mapping
@@ -274,59 +274,73 @@ func (u *AlonzoProtocolParameterUpdate) UnmarshalCBOR(cborData []byte) error {
274274
return nil
275275
}
276276

277-
func (p *AlonzoProtocolParameters) Utxorpc() (*cardano.PParams, error) {
277+
func (p *AlonzoProtocolParameters) Utxorpc() (*utxorpc.PParams, error) {
278278
// sanity check
279-
if p.A0.Num().Int64() > math.MaxInt32 ||
279+
if p.A0 == nil ||
280+
p.A0.Num().Int64() < math.MinInt32 ||
281+
p.A0.Num().Int64() > math.MaxInt32 ||
280282
p.A0.Denom().Int64() < 0 ||
281283
p.A0.Denom().Int64() > math.MaxUint32 {
282284
return nil, errors.New("invalid A0 rational number values")
283285
}
284-
if p.Rho.Num().Int64() > math.MaxInt32 ||
286+
if p.Rho == nil ||
287+
p.Rho.Num().Int64() < math.MinInt32 ||
288+
p.Rho.Num().Int64() > math.MaxInt32 ||
285289
p.Rho.Denom().Int64() < 0 ||
286290
p.Rho.Denom().Int64() > math.MaxUint32 {
287291
return nil, errors.New("invalid Rho rational number values")
288292
}
289-
if p.Tau.Num().Int64() > math.MaxInt32 ||
293+
if p.Tau == nil ||
294+
p.Tau.Num().Int64() < math.MinInt32 ||
295+
p.Tau.Num().Int64() > math.MaxInt32 ||
290296
p.Tau.Denom().Int64() < 0 ||
291297
p.Tau.Denom().Int64() > math.MaxUint32 {
292298
return nil, errors.New("invalid Tau rational number values")
293299
}
294-
if p.ExecutionCosts.MemPrice.Num().Int64() > math.MaxInt32 ||
300+
if p.ExecutionCosts.MemPrice == nil ||
301+
p.ExecutionCosts.MemPrice.Num().Int64() < math.MinInt32 ||
302+
p.ExecutionCosts.MemPrice.Num().Int64() > math.MaxInt32 ||
295303
p.ExecutionCosts.MemPrice.Denom().Int64() < 0 ||
296304
p.ExecutionCosts.MemPrice.Denom().Int64() > math.MaxUint32 {
297305
return nil, errors.New("invalid memory price rational number values")
298306
}
299-
if p.ExecutionCosts.StepPrice.Num().Int64() > math.MaxInt32 ||
307+
if p.ExecutionCosts.StepPrice == nil ||
308+
p.ExecutionCosts.StepPrice.Num().Int64() < math.MinInt32 ||
309+
p.ExecutionCosts.StepPrice.Num().Int64() > math.MaxInt32 ||
300310
p.ExecutionCosts.StepPrice.Denom().Int64() < 0 ||
301311
p.ExecutionCosts.StepPrice.Denom().Int64() > math.MaxUint32 {
302312
return nil, errors.New("invalid step price rational number values")
303313
}
314+
if p.MaxTxExUnits.Memory < 0 || p.MaxTxExUnits.Steps < 0 ||
315+
p.MaxBlockExUnits.Memory < 0 || p.MaxBlockExUnits.Steps < 0 {
316+
return nil, errors.New("invalid execution unit values")
317+
}
304318
// #nosec G115
305-
return &cardano.PParams{
306-
CoinsPerUtxoByte: p.AdaPerUtxoByte,
319+
return &utxorpc.PParams{
320+
CoinsPerUtxoByte: common.ToUtxorpcBigInt(p.AdaPerUtxoByte),
307321
MaxTxSize: uint64(p.MaxTxSize),
308-
MinFeeCoefficient: uint64(p.MinFeeA),
309-
MinFeeConstant: uint64(p.MinFeeB),
322+
MinFeeCoefficient: common.ToUtxorpcBigInt(uint64(p.MinFeeA)),
323+
MinFeeConstant: common.ToUtxorpcBigInt(uint64(p.MinFeeB)),
310324
MaxBlockBodySize: uint64(p.MaxBlockBodySize),
311325
MaxBlockHeaderSize: uint64(p.MaxBlockHeaderSize),
312-
StakeKeyDeposit: uint64(p.KeyDeposit),
313-
PoolDeposit: uint64(p.PoolDeposit),
326+
StakeKeyDeposit: common.ToUtxorpcBigInt(uint64(p.KeyDeposit)),
327+
PoolDeposit: common.ToUtxorpcBigInt(uint64(p.PoolDeposit)),
328+
MinPoolCost: common.ToUtxorpcBigInt(p.MinPoolCost),
314329
PoolRetirementEpochBound: uint64(p.MaxEpoch),
315330
DesiredNumberOfPools: uint64(p.NOpt),
316-
PoolInfluence: &cardano.RationalNumber{
331+
PoolInfluence: &utxorpc.RationalNumber{
317332
Numerator: int32(p.A0.Num().Int64()),
318333
Denominator: uint32(p.A0.Denom().Int64()),
319334
},
320-
MonetaryExpansion: &cardano.RationalNumber{
335+
MonetaryExpansion: &utxorpc.RationalNumber{
321336
Numerator: int32(p.Rho.Num().Int64()),
322337
Denominator: uint32(p.Rho.Denom().Int64()),
323338
},
324-
TreasuryExpansion: &cardano.RationalNumber{
339+
TreasuryExpansion: &utxorpc.RationalNumber{
325340
Numerator: int32(p.Tau.Num().Int64()),
326341
Denominator: uint32(p.Tau.Denom().Int64()),
327342
},
328-
MinPoolCost: p.MinPoolCost,
329-
ProtocolVersion: &cardano.ProtocolVersion{
343+
ProtocolVersion: &utxorpc.ProtocolVersion{
330344
Major: uint32(p.ProtocolMajor),
331345
Minor: uint32(p.ProtocolMinor),
332346
},
@@ -336,21 +350,21 @@ func (p *AlonzoProtocolParameters) Utxorpc() (*cardano.PParams, error) {
336350
CostModels: common.ConvertToUtxorpcCardanoCostModels(
337351
p.CostModels,
338352
),
339-
Prices: &cardano.ExPrices{
340-
Memory: &cardano.RationalNumber{
353+
Prices: &utxorpc.ExPrices{
354+
Memory: &utxorpc.RationalNumber{
341355
Numerator: int32(p.ExecutionCosts.MemPrice.Num().Int64()),
342356
Denominator: uint32(p.ExecutionCosts.MemPrice.Denom().Int64()),
343357
},
344-
Steps: &cardano.RationalNumber{
358+
Steps: &utxorpc.RationalNumber{
345359
Numerator: int32(p.ExecutionCosts.StepPrice.Num().Int64()),
346360
Denominator: uint32(p.ExecutionCosts.StepPrice.Denom().Int64()),
347361
},
348362
},
349-
MaxExecutionUnitsPerTransaction: &cardano.ExUnits{
363+
MaxExecutionUnitsPerTransaction: &utxorpc.ExUnits{
350364
Memory: uint64(p.MaxTxExUnits.Memory),
351365
Steps: uint64(p.MaxTxExUnits.Steps),
352366
},
353-
MaxExecutionUnitsPerBlock: &cardano.ExUnits{
367+
MaxExecutionUnitsPerBlock: &utxorpc.ExUnits{
354368
Memory: uint64(p.MaxBlockExUnits.Memory),
355369
Steps: uint64(p.MaxBlockExUnits.Steps),
356370
},

0 commit comments

Comments
 (0)