@blinklabs/dingo 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/.dingo/blob/000001.sst +0 -0
  2. package/.dingo/blob/000001.vlog +0 -0
  3. package/.dingo/blob/DISCARD +0 -0
  4. package/.dingo/blob/KEYREGISTRY +2 -0
  5. package/.dingo/blob/MANIFEST +0 -0
  6. package/.dingo/metadata.sqlite +0 -0
  7. package/.github/workflows/golangci-lint.yml +1 -1
  8. package/.github/workflows/publish.yml +1 -7
  9. package/README.md +2 -1
  10. package/{dist/dingo_darwin_amd64_v1/dingo → dingo} +0 -0
  11. package/dingo.yaml.example +53 -0
  12. package/package.json +5 -5
  13. package/Dockerfile +0 -25
  14. package/Makefile +0 -53
  15. package/blockfetch.go +0 -144
  16. package/chain/chain.go +0 -504
  17. package/chain/chain_test.go +0 -468
  18. package/chain/errors.go +0 -80
  19. package/chain/event.go +0 -33
  20. package/chain/iter.go +0 -64
  21. package/chainsync/chainsync.go +0 -97
  22. package/chainsync.go +0 -223
  23. package/cmd/dingo/load.go +0 -52
  24. package/cmd/dingo/main.go +0 -118
  25. package/cmd/dingo/serve.go +0 -49
  26. package/config/cardano/node.go +0 -192
  27. package/config/cardano/node_test.go +0 -85
  28. package/config/cardano/preview/README.md +0 -4
  29. package/config/cardano/preview/alonzo-genesis.json +0 -196
  30. package/config/cardano/preview/byron-genesis.json +0 -117
  31. package/config/cardano/preview/config.json +0 -114
  32. package/config/cardano/preview/conway-genesis.json +0 -297
  33. package/config/cardano/preview/shelley-genesis.json +0 -68
  34. package/config.go +0 -245
  35. package/connmanager/connection_manager.go +0 -105
  36. package/connmanager/connection_manager_test.go +0 -185
  37. package/connmanager/event.go +0 -37
  38. package/connmanager/listener.go +0 -140
  39. package/connmanager/outbound.go +0 -93
  40. package/connmanager/socket.go +0 -55
  41. package/connmanager/unix.go +0 -78
  42. package/custom-p2p-topology.json +0 -24
  43. package/custom-p2p-topology.json.backup +0 -24
  44. package/custom-p2p-topology.json.mainnet +0 -37
  45. package/database/account.go +0 -138
  46. package/database/block.go +0 -362
  47. package/database/certs.go +0 -53
  48. package/database/commit_timestamp.go +0 -77
  49. package/database/database.go +0 -118
  50. package/database/database_test.go +0 -62
  51. package/database/drep.go +0 -27
  52. package/database/epoch.go +0 -121
  53. package/database/immutable/chunk.go +0 -182
  54. package/database/immutable/immutable.go +0 -350
  55. package/database/immutable/immutable_test.go +0 -59
  56. package/database/immutable/primary.go +0 -106
  57. package/database/immutable/secondary.go +0 -103
  58. package/database/immutable/testdata/08893.chunk +0 -0
  59. package/database/immutable/testdata/08893.primary +0 -0
  60. package/database/immutable/testdata/08893.secondary +0 -0
  61. package/database/immutable/testdata/08894.chunk +0 -0
  62. package/database/immutable/testdata/08894.primary +0 -0
  63. package/database/immutable/testdata/08894.secondary +0 -0
  64. package/database/immutable/testdata/README.md +0 -4
  65. package/database/plugin/blob/badger/commit_timestamp.go +0 -50
  66. package/database/plugin/blob/badger/database.go +0 -152
  67. package/database/plugin/blob/badger/logger.go +0 -63
  68. package/database/plugin/blob/badger/metrics.go +0 -98
  69. package/database/plugin/blob/blob.go +0 -19
  70. package/database/plugin/blob/store.go +0 -40
  71. package/database/plugin/log.go +0 -27
  72. package/database/plugin/metadata/metadata.go +0 -19
  73. package/database/plugin/metadata/sqlite/account.go +0 -224
  74. package/database/plugin/metadata/sqlite/certs.go +0 -58
  75. package/database/plugin/metadata/sqlite/commit_timestamp.go +0 -68
  76. package/database/plugin/metadata/sqlite/database.go +0 -218
  77. package/database/plugin/metadata/sqlite/epoch.go +0 -120
  78. package/database/plugin/metadata/sqlite/models/account.go +0 -81
  79. package/database/plugin/metadata/sqlite/models/auth_committee_hot.go +0 -26
  80. package/database/plugin/metadata/sqlite/models/deregistration_drep.go +0 -26
  81. package/database/plugin/metadata/sqlite/models/drep.go +0 -27
  82. package/database/plugin/metadata/sqlite/models/epoch.go +0 -31
  83. package/database/plugin/metadata/sqlite/models/models.go +0 -45
  84. package/database/plugin/metadata/sqlite/models/pool.go +0 -97
  85. package/database/plugin/metadata/sqlite/models/pparam_update.go +0 -27
  86. package/database/plugin/metadata/sqlite/models/pparams.go +0 -27
  87. package/database/plugin/metadata/sqlite/models/registration_drep.go +0 -28
  88. package/database/plugin/metadata/sqlite/models/resign_committee_cold.go +0 -27
  89. package/database/plugin/metadata/sqlite/models/stake_registration_delegation.go +0 -27
  90. package/database/plugin/metadata/sqlite/models/stake_vote_delegation.go +0 -27
  91. package/database/plugin/metadata/sqlite/models/stake_vote_registration_delegation.go +0 -27
  92. package/database/plugin/metadata/sqlite/models/tip.go +0 -26
  93. package/database/plugin/metadata/sqlite/models/update_drep.go +0 -27
  94. package/database/plugin/metadata/sqlite/models/utxo.go +0 -30
  95. package/database/plugin/metadata/sqlite/models/vote_delegation.go +0 -26
  96. package/database/plugin/metadata/sqlite/models/vote_registration_delegation.go +0 -26
  97. package/database/plugin/metadata/sqlite/pool.go +0 -240
  98. package/database/plugin/metadata/sqlite/pparams.go +0 -110
  99. package/database/plugin/metadata/sqlite/tip.go +0 -83
  100. package/database/plugin/metadata/sqlite/utxo.go +0 -292
  101. package/database/plugin/metadata/store.go +0 -168
  102. package/database/plugin/option.go +0 -190
  103. package/database/plugin/plugin.go +0 -20
  104. package/database/plugin/register.go +0 -118
  105. package/database/pparams.go +0 -145
  106. package/database/tip.go +0 -45
  107. package/database/txn.go +0 -147
  108. package/database/types/types.go +0 -74
  109. package/database/types/types_test.go +0 -83
  110. package/database/utxo.go +0 -263
  111. package/dist/artifacts.json +0 -1
  112. package/dist/checksums.txt +0 -22
  113. package/dist/config.yaml +0 -253
  114. package/dist/dingo-0.5.0-SNAPSHOT-d9431e4.tar.gz +0 -0
  115. package/dist/dingo-0.5.0-SNAPSHOT-d9431e4.tar.gz.sbom.json +0 -1
  116. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_darwin_arm64.tar.gz +0 -0
  117. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_darwin_arm64.tar.gz.sbom.json +0 -1
  118. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_darwin_x86_64.tar.gz +0 -0
  119. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_darwin_x86_64.tar.gz.sbom.json +0 -1
  120. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.apk +0 -0
  121. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.apk.sbom.json +0 -1
  122. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.deb +0 -0
  123. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.deb.sbom.json +0 -1
  124. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.rpm +0 -0
  125. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.rpm.sbom.json +0 -1
  126. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.apk +0 -0
  127. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.apk.sbom.json +0 -1
  128. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.deb +0 -0
  129. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.deb.sbom.json +0 -1
  130. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.rpm +0 -0
  131. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.rpm.sbom.json +0 -1
  132. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.tar.gz +0 -0
  133. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.tar.gz.sbom.json +0 -1
  134. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_x86_64.tar.gz +0 -0
  135. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_x86_64.tar.gz.sbom.json +0 -1
  136. package/dist/dingo_darwin_arm64_v8.0/dingo +0 -0
  137. package/dist/dingo_linux_amd64_v1/dingo +0 -0
  138. package/dist/dingo_linux_arm64_v8.0/dingo +0 -0
  139. package/dist/homebrew/dingo.rb +0 -51
  140. package/dist/metadata.json +0 -1
  141. package/event/event.go +0 -141
  142. package/event/event_test.go +0 -115
  143. package/event/metrics.go +0 -44
  144. package/go.mod +0 -98
  145. package/go.sum +0 -358
  146. package/internal/config/config.go +0 -145
  147. package/internal/config/config_test.go +0 -118
  148. package/internal/node/load.go +0 -149
  149. package/internal/node/node.go +0 -176
  150. package/internal/version/version.go +0 -33
  151. package/ledger/certs.go +0 -113
  152. package/ledger/chainsync.go +0 -578
  153. package/ledger/eras/allegra.go +0 -154
  154. package/ledger/eras/alonzo.go +0 -156
  155. package/ledger/eras/babbage.go +0 -154
  156. package/ledger/eras/byron.go +0 -42
  157. package/ledger/eras/conway.go +0 -158
  158. package/ledger/eras/eras.go +0 -44
  159. package/ledger/eras/mary.go +0 -154
  160. package/ledger/eras/shelley.go +0 -164
  161. package/ledger/error.go +0 -19
  162. package/ledger/event.go +0 -50
  163. package/ledger/metrics.go +0 -53
  164. package/ledger/queries.go +0 -260
  165. package/ledger/slot.go +0 -127
  166. package/ledger/slot_test.go +0 -147
  167. package/ledger/state.go +0 -726
  168. package/ledger/view.go +0 -73
  169. package/localstatequery.go +0 -50
  170. package/localtxmonitor.go +0 -44
  171. package/localtxsubmission.go +0 -52
  172. package/mempool/consumer.go +0 -98
  173. package/mempool/mempool.go +0 -322
  174. package/node.go +0 -320
  175. package/peergov/event.go +0 -27
  176. package/peergov/peer.go +0 -67
  177. package/peergov/peergov.go +0 -290
  178. package/peersharing.go +0 -70
  179. package/preview-local-topology.json +0 -23
  180. package/topology/topology.go +0 -69
  181. package/topology/topology_test.go +0 -179
  182. package/tracing.go +0 -65
  183. package/txsubmission.go +0 -233
  184. package/utxorpc/query.go +0 -311
  185. package/utxorpc/submit.go +0 -395
  186. package/utxorpc/sync.go +0 -276
  187. package/utxorpc/utxorpc.go +0 -166
  188. package/utxorpc/watch.go +0 -310
package/utxorpc/watch.go DELETED
@@ -1,310 +0,0 @@
1
- // Copyright 2025 Blink Labs Software
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- package utxorpc
16
-
17
- import (
18
- "bytes"
19
- "context"
20
- "errors"
21
- "fmt"
22
-
23
- "connectrpc.com/connect"
24
- "github.com/blinklabs-io/gouroboros/ledger"
25
- ocommon "github.com/blinklabs-io/gouroboros/protocol/common"
26
- cardano "github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano"
27
- watch "github.com/utxorpc/go-codegen/utxorpc/v1alpha/watch"
28
- "github.com/utxorpc/go-codegen/utxorpc/v1alpha/watch/watchconnect"
29
- )
30
-
31
- // watchServiceServer implements the WatchService API
32
- type watchServiceServer struct {
33
- watchconnect.UnimplementedWatchServiceHandler
34
- utxorpc *Utxorpc
35
- }
36
-
37
- // WatchTx
38
- func (s *watchServiceServer) WatchTx(
39
- ctx context.Context,
40
- req *connect.Request[watch.WatchTxRequest],
41
- stream *connect.ServerStream[watch.WatchTxResponse],
42
- ) error {
43
- predicate := req.Msg.GetPredicate() // Predicate
44
- fieldMask := req.Msg.GetFieldMask()
45
- intersect := req.Msg.GetIntersect() // []*BlockRef
46
-
47
- s.utxorpc.config.Logger.Info(
48
- fmt.Sprintf(
49
- "Got a WatchTx request with predicate %v and fieldMask %v and intersect %v",
50
- predicate,
51
- fieldMask,
52
- intersect,
53
- ),
54
- )
55
-
56
- // Get our points
57
- var points []ocommon.Point
58
- if len(intersect) > 0 {
59
- for _, blockRef := range intersect {
60
- blockIdx := blockRef.GetIndex()
61
- blockHash := blockRef.GetHash()
62
- slot := blockIdx
63
- point := ocommon.NewPoint(slot, blockHash)
64
- points = append(points, point)
65
- }
66
- } else {
67
- point := s.utxorpc.config.LedgerState.Tip().Point
68
- points = append(points, point)
69
- }
70
-
71
- // Get our starting point matching our chain
72
- point, err := s.utxorpc.config.LedgerState.GetIntersectPoint(points)
73
- if err != nil {
74
- s.utxorpc.config.Logger.Error(
75
- "failed to get points",
76
- "error", err,
77
- )
78
- return err
79
- }
80
- if point == nil {
81
- s.utxorpc.config.Logger.Error(
82
- "nil point returned",
83
- )
84
- return errors.New("nil point returned")
85
- }
86
-
87
- // Create our chain iterator
88
- chainIter, err := s.utxorpc.config.LedgerState.GetChainFromPoint(
89
- *point,
90
- false,
91
- )
92
- if err != nil {
93
- s.utxorpc.config.Logger.Error(
94
- "failed to get chain iterator",
95
- "error", err,
96
- )
97
- return err
98
- }
99
-
100
- for {
101
- // Check for available block
102
- next, err := chainIter.Next(true)
103
- if err != nil {
104
- s.utxorpc.config.Logger.Error(
105
- "failed to iterate chain",
106
- "error", err,
107
- )
108
- return err
109
- }
110
- if next != nil {
111
- // Get ledger.Block from bytes
112
- blockBytes := next.Block.Cbor[:]
113
- blockType, err := ledger.DetermineBlockType(blockBytes)
114
- if err != nil {
115
- s.utxorpc.config.Logger.Error(
116
- "failed to get block type",
117
- "error", err,
118
- )
119
- return err
120
- }
121
- block, err := ledger.NewBlockFromCbor(blockType, blockBytes)
122
- if err != nil {
123
- s.utxorpc.config.Logger.Error(
124
- "failed to get block",
125
- "error", err,
126
- )
127
- return err
128
- }
129
-
130
- // Loop through transactions
131
- for _, tx := range block.Transactions() {
132
- var act watch.AnyChainTx
133
- actc := watch.AnyChainTx_Cardano{
134
- Cardano: tx.Utxorpc(),
135
- }
136
- act.Chain = &actc
137
- resp := &watch.WatchTxResponse{
138
- Action: &watch.WatchTxResponse_Apply{
139
- Apply: &act,
140
- },
141
- }
142
- if predicate == nil {
143
- err := stream.Send(resp)
144
- if err != nil {
145
- return err
146
- }
147
- } else {
148
- found := false
149
- assetFound := false
150
-
151
- // Check Predicate
152
- addressPattern := predicate.GetMatch().GetCardano().GetHasAddress()
153
- mintAssetPattern := predicate.GetMatch().GetCardano().GetMintsAsset()
154
- moveAssetPattern := predicate.GetMatch().GetCardano().GetMovesAsset()
155
-
156
- var addresses []ledger.Address
157
- if addressPattern != nil {
158
- // Handle Exact Address
159
- exactAddressBytes := addressPattern.GetExactAddress()
160
- if exactAddressBytes != nil {
161
- var addr ledger.Address
162
- err := addr.UnmarshalCBOR(exactAddressBytes)
163
- if err != nil {
164
- return fmt.Errorf(
165
- "failed to decode exact address: %w",
166
- err,
167
- )
168
- }
169
- addresses = append(addresses, addr)
170
- }
171
-
172
- // Handle Payment Part
173
- paymentPart := addressPattern.GetPaymentPart()
174
- if paymentPart != nil {
175
- s.utxorpc.config.Logger.Info("PaymentPart is present, decoding...")
176
- var paymentAddr ledger.Address
177
- err := paymentAddr.UnmarshalCBOR(paymentPart)
178
- if err != nil {
179
- return fmt.Errorf("failed to decode payment part: %w", err)
180
- }
181
- addresses = append(addresses, paymentAddr)
182
- }
183
-
184
- // Handle Delegation Part
185
- delegationPart := addressPattern.GetDelegationPart()
186
- if delegationPart != nil {
187
- s.utxorpc.config.Logger.Info(
188
- "DelegationPart is present, decoding...",
189
- )
190
- var delegationAddr ledger.Address
191
- err := delegationAddr.UnmarshalCBOR(delegationPart)
192
- if err != nil {
193
- return fmt.Errorf(
194
- "failed to decode delegation part: %w",
195
- err,
196
- )
197
- }
198
- addresses = append(addresses, delegationAddr)
199
- }
200
- }
201
-
202
- var assetPatterns []*cardano.AssetPattern
203
- if mintAssetPattern != nil {
204
- assetPatterns = append(assetPatterns, mintAssetPattern)
205
- }
206
- if moveAssetPattern != nil {
207
- assetPatterns = append(assetPatterns, moveAssetPattern)
208
- }
209
-
210
- // Convert everything to utxos (ledger.TransactionOutput) for matching
211
- var utxos []ledger.TransactionOutput
212
- utxos = append(tx.Outputs(), tx.CollateralReturn())
213
- var inputs []ledger.TransactionInput
214
- inputs = append(tx.Inputs(), tx.ReferenceInputs()...)
215
- inputs = append(inputs, tx.Collateral()...)
216
- for _, input := range inputs {
217
- utxo, err := s.utxorpc.config.LedgerState.UtxoByRef(
218
- input.Id().Bytes(),
219
- input.Index(),
220
- )
221
- if err != nil {
222
- return fmt.Errorf(
223
- "failed to look up input: %w",
224
- err,
225
- )
226
- }
227
- ret, err := utxo.Decode() // ledger.TransactionOutput
228
- if err != nil {
229
- return err
230
- }
231
- if ret == nil {
232
- return errors.New("decode returned empty utxo")
233
- }
234
- utxos = append(utxos, ret)
235
- }
236
-
237
- // Check UTxOs for addresses
238
- for _, address := range addresses {
239
- if found {
240
- break
241
- }
242
- if assetFound {
243
- found = true
244
- break
245
- }
246
- for _, utxo := range utxos {
247
- if found {
248
- break
249
- }
250
- if assetFound {
251
- found = true
252
- break
253
- }
254
- if utxo.Address().String() == address.String() {
255
- if found {
256
- break
257
- }
258
- if assetFound {
259
- found = true
260
- break
261
- }
262
- // We matched address, check assetPatterns
263
- for _, assetPattern := range assetPatterns {
264
- // Address found, no assetPattern
265
- if assetPattern == nil {
266
- found = true
267
- break
268
- }
269
- // Filter on assetPattern
270
- for _, policyId := range utxo.Assets().Policies() {
271
- if assetFound {
272
- found = true
273
- break
274
- }
275
- if bytes.Equal(
276
- policyId.Bytes(),
277
- assetPattern.GetPolicyId(),
278
- ) {
279
- for _, asset := range utxo.Assets().Assets(policyId) {
280
- if bytes.Equal(asset, assetPattern.GetAssetName()) {
281
- found = true
282
- assetFound = true
283
- break
284
- }
285
- }
286
- }
287
- }
288
- }
289
- if found {
290
- break
291
- }
292
- // Asset not found; skip this UTxO
293
- if !assetFound {
294
- continue
295
- }
296
- found = true
297
- }
298
- }
299
- }
300
- if found {
301
- err := stream.Send(resp)
302
- if err != nil {
303
- return err
304
- }
305
- }
306
- }
307
- }
308
- }
309
- }
310
- }