Skip to content

Commit 8e644bb

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

25 files changed

+541
-302
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: 26 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,37 @@ 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: &utxorpc.BigInt{
97+
BigInt: &utxorpc.BigInt_Int{Int: 500},
98+
},
99+
MinFeeConstant: &utxorpc.BigInt{
100+
BigInt: &utxorpc.BigInt_Int{Int: 2},
101+
},
102+
MaxBlockBodySize: 65536,
103+
MaxTxSize: 16384,
104+
MaxBlockHeaderSize: 1024,
105+
StakeKeyDeposit: &utxorpc.BigInt{
106+
BigInt: &utxorpc.BigInt_Int{Int: 2000},
107+
},
108+
PoolDeposit: &utxorpc.BigInt{
109+
BigInt: &utxorpc.BigInt_Int{Int: 500000},
110+
},
103111
PoolRetirementEpochBound: 2160,
104112
DesiredNumberOfPools: 100,
105-
PoolInfluence: &cardano.RationalNumber{
113+
PoolInfluence: &utxorpc.RationalNumber{
106114
Numerator: int32(1),
107115
Denominator: uint32(2),
108116
},
109-
MonetaryExpansion: &cardano.RationalNumber{
117+
MonetaryExpansion: &utxorpc.RationalNumber{
110118
Numerator: int32(3),
111119
Denominator: uint32(4),
112120
},
113-
TreasuryExpansion: &cardano.RationalNumber{
121+
TreasuryExpansion: &utxorpc.RationalNumber{
114122
Numerator: int32(5),
115123
Denominator: uint32(6),
116124
},
117-
ProtocolVersion: &cardano.ProtocolVersion{
125+
ProtocolVersion: &utxorpc.ProtocolVersion{
118126
Major: 8,
119127
Minor: 0,
120128
},
@@ -171,10 +179,10 @@ func TestAllegraTransactionBody_Utxorpc(t *testing.T) {
171179
}
172180

173181
// Check that the fee matches
174-
if actual.Fee != txBody.Fee() {
182+
if actual.Fee.GetInt() != int64(txBody.Fee()) {
175183
t.Errorf(
176184
"AllegraTransactionBody.Utxorpc() fee mismatch\nGot: %d\nWant: %d",
177-
actual.Fee,
185+
actual.Fee.GetInt(),
178186
txBody.Fee(),
179187
)
180188
}
@@ -233,10 +241,10 @@ func TestAllegraTransaction_Utxorpc(t *testing.T) {
233241
t.Fatalf("Could not convert transaction to utxorpc format: %v", err)
234242
}
235243
// Assertion checks
236-
if actual.Fee != tx.Fee() {
244+
if actual.Fee.GetInt() != int64(tx.Fee()) {
237245
t.Errorf(
238246
"AllegraTransaction.Utxorpc() fee mismatch\nGot: %d\nWant: %d",
239-
actual.Fee,
247+
actual.Fee.GetInt(),
240248
tx.Fee(),
241249
)
242250
}

ledger/alonzo/alonzo.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,14 @@ 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: &utxorpc.BigInt{
460+
BigInt: &utxorpc.BigInt_BigUInt{
461+
BigUInt: new(big.Int).SetUint64(amount).Bytes(),
462+
},
463+
},
464+
},
459465
}
460466
ma.Assets = append(ma.Assets, asset)
461467
}
@@ -476,8 +482,12 @@ func (o AlonzoTransactionOutput) Utxorpc() (*utxorpc.TxOutput, error) {
476482

477483
return &utxorpc.TxOutput{
478484
Address: addressBytes,
479-
Coin: o.Amount(),
480-
Assets: assets,
485+
Coin: &utxorpc.BigInt{
486+
BigInt: &utxorpc.BigInt_BigUInt{
487+
BigUInt: new(big.Int).SetUint64(o.Amount()).Bytes(),
488+
},
489+
},
490+
Assets: assets,
481491
Datum: &utxorpc.Datum{
482492
Hash: datumHash,
483493
},

ledger/alonzo/pparams.go

Lines changed: 33 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,69 @@ 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
}
304314
// #nosec G115
305-
return &cardano.PParams{
306-
CoinsPerUtxoByte: p.AdaPerUtxoByte,
315+
return &utxorpc.PParams{
316+
CoinsPerUtxoByte: common.ToUtxorpcBigInt(p.AdaPerUtxoByte),
307317
MaxTxSize: uint64(p.MaxTxSize),
308-
MinFeeCoefficient: uint64(p.MinFeeA),
309-
MinFeeConstant: uint64(p.MinFeeB),
318+
MinFeeCoefficient: common.ToUtxorpcBigInt(uint64(p.MinFeeA)),
319+
MinFeeConstant: common.ToUtxorpcBigInt(uint64(p.MinFeeB)),
310320
MaxBlockBodySize: uint64(p.MaxBlockBodySize),
311321
MaxBlockHeaderSize: uint64(p.MaxBlockHeaderSize),
312-
StakeKeyDeposit: uint64(p.KeyDeposit),
313-
PoolDeposit: uint64(p.PoolDeposit),
322+
StakeKeyDeposit: common.ToUtxorpcBigInt(uint64(p.KeyDeposit)),
323+
PoolDeposit: common.ToUtxorpcBigInt(uint64(p.PoolDeposit)),
324+
MinPoolCost: common.ToUtxorpcBigInt(p.MinPoolCost),
314325
PoolRetirementEpochBound: uint64(p.MaxEpoch),
315326
DesiredNumberOfPools: uint64(p.NOpt),
316-
PoolInfluence: &cardano.RationalNumber{
327+
PoolInfluence: &utxorpc.RationalNumber{
317328
Numerator: int32(p.A0.Num().Int64()),
318329
Denominator: uint32(p.A0.Denom().Int64()),
319330
},
320-
MonetaryExpansion: &cardano.RationalNumber{
331+
MonetaryExpansion: &utxorpc.RationalNumber{
321332
Numerator: int32(p.Rho.Num().Int64()),
322333
Denominator: uint32(p.Rho.Denom().Int64()),
323334
},
324-
TreasuryExpansion: &cardano.RationalNumber{
335+
TreasuryExpansion: &utxorpc.RationalNumber{
325336
Numerator: int32(p.Tau.Num().Int64()),
326337
Denominator: uint32(p.Tau.Denom().Int64()),
327338
},
328-
MinPoolCost: p.MinPoolCost,
329-
ProtocolVersion: &cardano.ProtocolVersion{
339+
ProtocolVersion: &utxorpc.ProtocolVersion{
330340
Major: uint32(p.ProtocolMajor),
331341
Minor: uint32(p.ProtocolMinor),
332342
},
@@ -336,21 +346,21 @@ func (p *AlonzoProtocolParameters) Utxorpc() (*cardano.PParams, error) {
336346
CostModels: common.ConvertToUtxorpcCardanoCostModels(
337347
p.CostModels,
338348
),
339-
Prices: &cardano.ExPrices{
340-
Memory: &cardano.RationalNumber{
349+
Prices: &utxorpc.ExPrices{
350+
Memory: &utxorpc.RationalNumber{
341351
Numerator: int32(p.ExecutionCosts.MemPrice.Num().Int64()),
342352
Denominator: uint32(p.ExecutionCosts.MemPrice.Denom().Int64()),
343353
},
344-
Steps: &cardano.RationalNumber{
354+
Steps: &utxorpc.RationalNumber{
345355
Numerator: int32(p.ExecutionCosts.StepPrice.Num().Int64()),
346356
Denominator: uint32(p.ExecutionCosts.StepPrice.Denom().Int64()),
347357
},
348358
},
349-
MaxExecutionUnitsPerTransaction: &cardano.ExUnits{
359+
MaxExecutionUnitsPerTransaction: &utxorpc.ExUnits{
350360
Memory: uint64(p.MaxTxExUnits.Memory),
351361
Steps: uint64(p.MaxTxExUnits.Steps),
352362
},
353-
MaxExecutionUnitsPerBlock: &cardano.ExUnits{
363+
MaxExecutionUnitsPerBlock: &utxorpc.ExUnits{
354364
Memory: uint64(p.MaxBlockExUnits.Memory),
355365
Steps: uint64(p.MaxBlockExUnits.Steps),
356366
},

0 commit comments

Comments
 (0)