Skip to content

Commit 8f01d63

Browse files
authored
Merge branch 'main' into tx_metadata_encode
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
2 parents f511c6e + 8981d3f commit 8f01d63

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+5166
-1256
lines changed

.github/workflows/go-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout/releases/tag/v5.0.0
2525
with:
2626
submodules: true
27-
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 https://github.com/actions/setup-go/releases/tag/v5.5.0
27+
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 https://github.com/actions/setup-go/releases/tag/v6.0.0
2828
with:
2929
go-version: ${{ matrix.go-version }}
3030
- name: go-test

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout/releases/tag/v5.0.0
19-
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 https://github.com/actions/setup-go/releases/tag/v5.5.0
19+
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 https://github.com/actions/setup-go/releases/tag/v6.0.0
2020
with:
2121
go-version: 1.24.x
2222
- name: golangci-lint

.github/workflows/nilaway.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: nilaway
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- main
8+
pull_request:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
nilaway:
15+
name: nilaway
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout/releases/tag/v5.0.0
19+
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 https://github.com/actions/setup-go/releases/tag/v6.0.0
20+
with:
21+
go-version: 1.25.x
22+
- name: install nilaway
23+
run: go install go.uber.org/nilaway/cmd/nilaway@latest
24+
- name: run nilaway
25+
run: nilaway ./...

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
RELEASE_ID: ${{ steps.create-release.outputs.result }}
1717
steps:
1818
- run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
19-
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 https://github.com/actions/github-script/releases/tag/v7.0.1
19+
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 https://github.com/actions/github-script/releases/tag/v8.0.0
2020
id: create-release
2121
with:
2222
github-token: ${{ secrets.GITHUB_TOKEN }}

cbor/tags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ type Map map[any]any
181181

182182
// SetType is a generic type for wrapping other types in an optional CBOR set tag
183183
type SetType[T any] struct {
184-
useTag bool
185184
items []T
185+
useTag bool
186186
}
187187

188188
func NewSetType[T any](items []T, useTag bool) SetType[T] {

cmd/tx-submission/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func main() {
141141
// Wait until we're done
142142
<-doneChan
143143

144-
fmt.Printf("Successfully sent transaction %x\n", tx.Hash())
144+
fmt.Printf("Successfully sent transaction %x\n", tx.Id())
145145

146146
if err := o.Close(); err != nil {
147147
fmt.Printf("ERROR: failed to close connection: %s\n", err)

connection.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ import (
3939
"github.com/blinklabs-io/gouroboros/protocol/chainsync"
4040
"github.com/blinklabs-io/gouroboros/protocol/handshake"
4141
"github.com/blinklabs-io/gouroboros/protocol/keepalive"
42+
"github.com/blinklabs-io/gouroboros/protocol/leiosfetch"
43+
"github.com/blinklabs-io/gouroboros/protocol/leiosnotify"
4244
"github.com/blinklabs-io/gouroboros/protocol/localstatequery"
4345
"github.com/blinklabs-io/gouroboros/protocol/localtxmonitor"
4446
"github.com/blinklabs-io/gouroboros/protocol/localtxsubmission"
@@ -84,6 +86,10 @@ type Connection struct {
8486
handshake *handshake.Handshake
8587
keepAlive *keepalive.KeepAlive
8688
keepAliveConfig *keepalive.Config
89+
leiosFetch *leiosfetch.LeiosFetch
90+
leiosFetchConfig *leiosfetch.Config
91+
leiosNotify *leiosnotify.LeiosNotify
92+
leiosNotifyConfig *leiosnotify.Config
8793
localStateQuery *localstatequery.LocalStateQuery
8894
localStateQueryConfig *localstatequery.Config
8995
localTxMonitor *localtxmonitor.LocalTxMonitor
@@ -206,6 +212,16 @@ func (c *Connection) KeepAlive() *keepalive.KeepAlive {
206212
return c.keepAlive
207213
}
208214

215+
// LeiosFetch returns the leios-fetch protocol handler
216+
func (c *Connection) LeiosFetch() *leiosfetch.LeiosFetch {
217+
return c.leiosFetch
218+
}
219+
220+
// LeiosNotify returns the leios-notify protocol handler
221+
func (c *Connection) LeiosNotify() *leiosnotify.LeiosNotify {
222+
return c.leiosNotify
223+
}
224+
209225
// LocalStateQuery returns the local-state-query protocol handler
210226
func (c *Connection) LocalStateQuery() *localstatequery.LocalStateQuery {
211227
return c.localStateQuery
@@ -396,6 +412,8 @@ func (c *Connection) setupConnection() error {
396412
if versionNtN.EnablePeerSharingProtocol {
397413
c.peerSharing = peersharing.New(protoOptions, c.peerSharingConfig)
398414
}
415+
c.leiosNotify = leiosnotify.New(protoOptions, c.leiosNotifyConfig)
416+
c.leiosFetch = leiosfetch.New(protoOptions, c.leiosFetchConfig)
399417
// Start protocols
400418
if !c.delayProtocolStart {
401419
if (c.fullDuplex && handshakeFullDuplex) || !c.server {
@@ -408,6 +426,8 @@ func (c *Connection) setupConnection() error {
408426
if c.peerSharing != nil {
409427
c.peerSharing.Client.Start()
410428
}
429+
c.leiosNotify.Client.Start()
430+
c.leiosFetch.Client.Start()
411431
}
412432
if (c.fullDuplex && handshakeFullDuplex) || c.server {
413433
c.blockFetch.Server.Start()
@@ -419,6 +439,8 @@ func (c *Connection) setupConnection() error {
419439
if c.peerSharing != nil {
420440
c.peerSharing.Server.Start()
421441
}
442+
c.leiosNotify.Server.Start()
443+
c.leiosFetch.Server.Start()
422444
}
423445
}
424446
} else {

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ toolchain go1.24.1
77
require (
88
filippo.io/edwards25519 v1.1.0
99
github.com/blinklabs-io/ouroboros-mock v0.3.8
10-
github.com/blinklabs-io/plutigo v0.0.7
10+
github.com/blinklabs-io/plutigo v0.0.13
1111
github.com/btcsuite/btcd/btcutil v1.1.6
1212
github.com/fxamacker/cbor/v2 v2.9.0
1313
github.com/jinzhu/copier v0.4.0
14-
github.com/stretchr/testify v1.10.0
14+
github.com/stretchr/testify v1.11.1
1515
github.com/utxorpc/go-codegen v0.17.0
1616
go.uber.org/goleak v1.3.0
17-
golang.org/x/crypto v0.41.0
17+
golang.org/x/crypto v0.43.0
1818
)
1919

2020
require (
2121
github.com/bits-and-blooms/bitset v1.20.0 // indirect
2222
github.com/btcsuite/btcd/btcec/v2 v2.3.5 // indirect
2323
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
24-
github.com/consensys/gnark-crypto v0.18.0 // indirect
24+
github.com/consensys/gnark-crypto v0.19.0 // indirect
2525
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2626
github.com/decred/dcrd/crypto/blake256 v1.1.0 // indirect
2727
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
@@ -30,7 +30,7 @@ require (
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
33-
golang.org/x/sys v0.35.0 // indirect
33+
golang.org/x/sys v0.37.0 // indirect
3434
google.golang.org/protobuf v1.36.6 // indirect
3535
gopkg.in/yaml.v3 v3.0.1 // indirect
3636
)

go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ github.com/bits-and-blooms/bitset v1.20.0 h1:2F+rfL86jE2d/bmw7OhqUg2Sj/1rURkBn3M
55
github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
66
github.com/blinklabs-io/ouroboros-mock v0.3.8 h1:+DAt2rx0ouZUxee5DBMgZq3I1+ZdxFSHG9g3tYl/FKU=
77
github.com/blinklabs-io/ouroboros-mock v0.3.8/go.mod h1:UwQIf4KqZwO13P9d90fbi3UL/X7JaJfeEbqk+bEeFQA=
8-
github.com/blinklabs-io/plutigo v0.0.7 h1:wgb7v47FggrZEfikolV12WhPsWEXzFyzLtak5IrAOEk=
9-
github.com/blinklabs-io/plutigo v0.0.7/go.mod h1:gxTWAu9n7+4SgQ+zAoO91LYU+5WanUNdRkl9mLdm8f8=
8+
github.com/blinklabs-io/plutigo v0.0.13 h1:JztPigFmknQmQ3Ti1+mdTY96ihOUDh6wJ3pPnN2YYBU=
9+
github.com/blinklabs-io/plutigo v0.0.13/go.mod h1:CoNpHHFifPV21KfnHlP3hEFOVj3yF6zgV5OPr058+Do=
1010
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
1111
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
1212
github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A=
@@ -33,8 +33,8 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku
3333
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
3434
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
3535
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
36-
github.com/consensys/gnark-crypto v0.18.0 h1:vIye/FqI50VeAr0B3dx+YjeIvmc3LWz4yEfbWBpTUf0=
37-
github.com/consensys/gnark-crypto v0.18.0/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx8ubaYfDROyp2Z8c=
36+
github.com/consensys/gnark-crypto v0.19.0 h1:zXCqeY2txSaMl6G5wFpZzMWJU9HPNh8qxPnYJ1BL9vA=
37+
github.com/consensys/gnark-crypto v0.19.0/go.mod h1:rT23F0XSZqE0mUA0+pRtnL56IbPxs6gp4CeRsBk4XS0=
3838
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
3939
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4040
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -100,8 +100,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
100100
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
101101
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
102102
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
103-
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
104-
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
103+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
104+
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=
106106
github.com/utxorpc/go-codegen v0.17.0 h1:cJ7Df9r8Az39lveIcmzcRciIDc3UJFdMSmXg8IAtBPM=
107107
github.com/utxorpc/go-codegen v0.17.0/go.mod h1:LBVGFns4YAHMhy+Pc8tF5ExkU+N8Wm3srst4omKZy4g=
@@ -112,8 +112,8 @@ go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
112112
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
113113
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
114114
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
115-
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
116-
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
115+
golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04=
116+
golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0=
117117
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
118118
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
119119
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -129,8 +129,8 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w
129129
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
130130
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
131131
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
132-
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
133-
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
132+
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
133+
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
134134
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
135135
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
136136
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=

internal/test/ledger/ledger.go

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package test_ledger
1616

1717
import (
1818
"errors"
19+
"time"
1920

2021
"github.com/blinklabs-io/gouroboros/ledger/common"
2122
)
@@ -52,7 +53,7 @@ func (ls MockLedgerState) StakeRegistration(
5253
ret := []common.StakeRegistrationCertificate{}
5354
for _, cert := range ls.MockStakeRegistration {
5455
if string(
55-
common.Blake2b224(cert.StakeRegistration.Credential).Bytes(),
56+
common.Blake2b224(cert.StakeCredential.Credential).Bytes(),
5657
) == string(
5758
stakingKey,
5859
) {
@@ -62,18 +63,29 @@ func (ls MockLedgerState) StakeRegistration(
6263
return ret, nil
6364
}
6465

65-
func (ls MockLedgerState) PoolRegistration(
66+
func (ls MockLedgerState) PoolCurrentState(
6667
poolKeyHash []byte,
67-
) ([]common.PoolRegistrationCertificate, error) {
68-
ret := []common.PoolRegistrationCertificate{}
68+
) (*common.PoolRegistrationCertificate, *uint64, error) {
6969
for _, cert := range ls.MockPoolRegistration {
7070
if string(
7171
common.Blake2b224(cert.Operator).Bytes(),
7272
) == string(
7373
poolKeyHash,
7474
) {
75-
ret = append(ret, cert)
75+
// pretend latest registration is current; no retirement support in mock
76+
c := cert
77+
return &c, nil, nil
7678
}
7779
}
78-
return ret, nil
80+
return nil, nil, nil
81+
}
82+
83+
func (ls MockLedgerState) SlotToTime(slot uint64) (time.Time, error) {
84+
// TODO
85+
return time.Now(), nil
86+
}
87+
88+
func (ls MockLedgerState) TimeToSlot(t time.Time) (uint64, error) {
89+
// TODO
90+
return 0, nil
7991
}

0 commit comments

Comments
 (0)