Skip to content

Commit

Permalink
chore: update TODO comments with issue numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
agaffney committed Feb 2, 2025
1 parent 1d53d3b commit 94d5dd9
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 44 deletions.
4 changes: 2 additions & 2 deletions blockfetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (n *Node) blockfetchServerRequestRange(
start ocommon.Point,
end ocommon.Point,
) error {
// TODO: check if we have requested block range available and send NoBlocks if not
// TODO: check if we have requested block range available and send NoBlocks if not (#397)
chainIter, err := n.ledgerState.GetChainFromPoint(start, true)
if err != nil {
return err
Expand All @@ -73,7 +73,7 @@ func (n *Node) blockfetchServerRequestRange(
blockBytes,
)
if err != nil {
// TODO: push this error somewhere
// TODO: push this error somewhere (#398)
return
}
// Make sure we don't hang waiting for the next block if we've already hit the end
Expand Down
8 changes: 4 additions & 4 deletions chainsync/chainsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type State struct {
eventBus *event.EventBus
ledgerState *state.LedgerState
clients map[ouroboros.ConnectionId]*ChainsyncClientState
clientConnId *ouroboros.ConnectionId // TODO: replace with handling of multiple chainsync clients
clientConnId *ouroboros.ConnectionId // TODO: replace with handling of multiple chainsync clients (#385)
}

func NewState(
Expand Down Expand Up @@ -79,17 +79,17 @@ func (s *State) RemoveClient(connId connection.ConnectionId) {
delete(s.clients, connId)
}

// TODO: replace with handling of multiple chainsync clients
// TODO: replace with handling of multiple chainsync clients (#385)
func (s *State) GetClientConnId() *ouroboros.ConnectionId {
return s.clientConnId
}

// TODO: replace with handling of multiple chainsync clients
// TODO: replace with handling of multiple chainsync clients (#385)
func (s *State) SetClientConnId(connId ouroboros.ConnectionId) {
s.clientConnId = &connId
}

// TODO: replace with handling of multiple chainsync clients
// TODO: replace with handling of multiple chainsync clients (#385)
func (s *State) RemoveClientConnId(connId ouroboros.ConnectionId) {
if s.clientConnId != nil && *s.clientConnId == connId {
s.clientConnId = nil
Expand Down
1 change: 0 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func NewConfig(opts ...ConfigOptionFunc) Config {
// Default logger will throw away logs
// We do this so we don't have to add guards around every log operation
logger: slog.New(slog.NewJSONHandler(io.Discard, nil)),
// TODO: add defaults
}
// Apply options
for _, opt := range opts {
Expand Down
9 changes: 4 additions & 5 deletions config/cardano/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type CardanoNodeConfig struct {
shelleyGenesis *shelley.ShelleyGenesis
ShelleyGenesisFile string `yaml:"ShelleyGenesisFile"`
ShelleyGenesisHash string `yaml:"ShelleyGenesisHash"`
// TODO: add more fields from cardano-node config as we need them
}

func NewCardanoNodeConfigFromReader(r io.Reader) (*CardanoNodeConfig, error) {
Expand Down Expand Up @@ -73,7 +72,7 @@ func (c *CardanoNodeConfig) loadGenesisConfigs() error {
// Load Byron genesis
if c.ByronGenesisFile != "" {
byronGenesisPath := path.Join(c.path, c.ByronGenesisFile)
// TODO: check genesis file hash
// TODO: check genesis file hash (#399)
byronGenesis, err := byron.NewByronGenesisFromFile(byronGenesisPath)
if err != nil {
return err
Expand All @@ -83,7 +82,7 @@ func (c *CardanoNodeConfig) loadGenesisConfigs() error {
// Load Shelley genesis
if c.ShelleyGenesisFile != "" {
shelleyGenesisPath := path.Join(c.path, c.ShelleyGenesisFile)
// TODO: check genesis file hash
// TODO: check genesis file hash (#399)
shelleyGenesis, err := shelley.NewShelleyGenesisFromFile(
shelleyGenesisPath,
)
Expand All @@ -95,7 +94,7 @@ func (c *CardanoNodeConfig) loadGenesisConfigs() error {
// Load Alonzo genesis
if c.AlonzoGenesisFile != "" {
alonzoGenesisPath := path.Join(c.path, c.AlonzoGenesisFile)
// TODO: check genesis file hash
// TODO: check genesis file hash (#399)
alonzoGenesis, err := alonzo.NewAlonzoGenesisFromFile(alonzoGenesisPath)
if err != nil {
return err
Expand All @@ -105,7 +104,7 @@ func (c *CardanoNodeConfig) loadGenesisConfigs() error {
// Load Conway genesis
if c.ConwayGenesisFile != "" {
conwayGenesisPath := path.Join(c.path, c.ConwayGenesisFile)
// TODO: check genesis file hash
// TODO: check genesis file hash (#399)
conwayGenesis, err := conway.NewConwayGenesisFromFile(conwayGenesisPath)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion database/immutable/immutable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ func TestGetTip(t *testing.T) {
}
}

// TODO: add tests for getting a specific block and getting a range of blocks that traverses multiple chunks
// TODO: add tests for getting a specific block and getting a range of blocks that traverses multiple chunks (#386)
4 changes: 2 additions & 2 deletions internal/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func Run(logger *slog.Logger) error {
fmt.Sprintf("topology: %+v", config.GetTopologyConfig()),
"component", "node",
)
// TODO: make this safer, check PID, create parent, etc.
// TODO: make this safer, check PID, create parent, etc. (#276)
if _, err := os.Stat(cfg.SocketPath); err == nil {
os.Remove(cfg.SocketPath)
}
Expand Down Expand Up @@ -87,7 +87,7 @@ func Run(logger *slog.Logger) error {
dingo.WithUtxorpcTlsKeyFilePath(cfg.TlsKeyFilePath),
// Enable metrics with default prometheus registry
dingo.WithPrometheusRegistry(prometheus.DefaultRegisterer),
// TODO: make this configurable
// TODO: make this configurable (#387)
//dingo.WithTracing(true),
dingo.WithTopologyConfig(config.GetTopologyConfig()),
),
Expand Down
4 changes: 2 additions & 2 deletions localstatequery.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (n *Node) localstatequeryServerAcquire(
acquireTarget olocalstatequery.AcquireTarget,
reAcquire bool,
) error {
// TODO: create "view" from ledger state
// TODO: create "view" from ledger state (#382)
return nil
}

Expand All @@ -45,6 +45,6 @@ func (n *Node) localstatequeryServerQuery(
func (n *Node) localstatequeryServerRelease(
ctx olocalstatequery.CallbackContext,
) error {
// TODO: release "view" from ledger state
// TODO: release "view" from ledger state (#382)
return nil
}
2 changes: 1 addition & 1 deletion localtxmonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

const (
localtxmonitorMempoolCapacity = 10 * 1024 * 1024 // TODO: replace with configurable value
localtxmonitorMempoolCapacity = 10 * 1024 * 1024 // TODO: replace with configurable value (#400)
)

func (n *Node) localtxmonitorServerConnOpts() []olocaltxmonitor.LocalTxMonitorOptionFunc {
Expand Down
4 changes: 2 additions & 2 deletions mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func NewMempool(
} else {
m.logger = logger
}
// TODO: replace this with purging based on on-chain TXs
// TODO: replace this with purging based on on-chain TXs (#388)
// Schedule initial mempool expired cleanup
m.scheduleRemoveExpired()
// Init metrics
Expand Down Expand Up @@ -165,7 +165,7 @@ func (m *Mempool) Consumer(connId ouroboros.ConnectionId) *MempoolConsumer {
return m.consumers[connId]
}

// TODO: replace this with purging based on on-chain TXs
// TODO: replace this with purging based on on-chain TXs (#388)
func (m *Mempool) removeExpired() {
m.Lock()
defer m.Unlock()
Expand Down
4 changes: 2 additions & 2 deletions node.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (n *Node) Run() error {
}

func (n *Node) Stop() error {
// TODO: use a cancelable context and wait for it above to call shutdown
// TODO: use a cancelable context and wait for it above to call shutdown (#72)
return n.shutdown()
}

Expand Down Expand Up @@ -288,7 +288,7 @@ func (n *Node) handleConnClosedEvent(evt event.Event) {
func (n *Node) handleOutboundConnEvent(evt event.Event) {
e := evt.Data.(peergov.OutboundConnectionEvent)
connId := e.ConnectionId
// TODO: replace this with handling for multiple chainsync clients
// TODO: replace this with handling for multiple chainsync clients (#385)
// Start chainsync client if we don't have another
n.chainsyncState.Lock()
defer n.chainsyncState.Unlock()
Expand Down
5 changes: 2 additions & 3 deletions peersharing.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ func (n *Node) peersharingServerConnOpts() []opeersharing.PeerSharingOptionFunc
}

func (n *Node) peersharingClientConnOpts() []opeersharing.PeerSharingOptionFunc {
return []opeersharing.PeerSharingOptionFunc{
// TODO
}
// We don't provide any client options, but we have this here for consistency
return []opeersharing.PeerSharingOptionFunc{}
}

func (n *Node) peersharingShareRequest(
Expand Down
4 changes: 2 additions & 2 deletions state/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (ci *ChainIterator) Next(blocking bool) (*ChainIteratorResult, error) {
select {
case blockEvt, ok := <-blockChan:
if !ok {
// TODO
// TODO: return an actual error (#389)
return nil, nil
}
blockData := blockEvt.Data.(ChainBlockEvent)
Expand All @@ -114,7 +114,7 @@ func (ci *ChainIterator) Next(blocking bool) (*ChainIteratorResult, error) {
ci.blockNumber++
case rollbackEvt, ok := <-rollbackChan:
if !ok {
// TODO
// TODO: return an actual error (#389)
return nil, nil
}
rollbackData := rollbackEvt.Data.(ChainRollbackEvent)
Expand Down
2 changes: 1 addition & 1 deletion state/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (m *stateMetrics) init(promRegistry prometheus.Registerer) {
Name: "cardano_node_metrics_blockNum_int",
Help: "current block number",
})
// TODO: figure out how to calculate this
// TODO: figure out how to calculate this (#390)
m.density = promautoFactory.NewGauge(prometheus.GaugeOpts{
Name: "cardano_node_metrics_density_real",
Help: "chain density",
Expand Down
16 changes: 5 additions & 11 deletions state/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (ls *LedgerState) querySystemStart() (any, error) {

func (ls *LedgerState) queryChainBlockNo() (any, error) {
ret := []any{
1, // TODO: figure out what this value is
1, // TODO: figure out what this value is (#393)
ls.currentTip.BlockNumber,
}
return ret, nil
Expand All @@ -79,7 +79,7 @@ func (ls *LedgerState) queryHardFork(
switch q := query.Query.(type) {
case *olocalstatequery.HardForkCurrentEraQuery:
return ls.currentEra.Id, nil
// TODO
// TODO (#321)
//case *olocalstatequery.HardForkEraHistoryQuery:
default:
return nil, fmt.Errorf("unsupported query type: %T", q)
Expand All @@ -89,7 +89,6 @@ func (ls *LedgerState) queryHardFork(
func (ls *LedgerState) queryShelley(
query *olocalstatequery.ShelleyQuery,
) (any, error) {
// TODO: make these era-specific
switch q := query.Query.(type) {
case *olocalstatequery.ShelleyEpochNoQuery:
return []any{ls.currentEpoch.EpochId}, nil
Expand All @@ -101,24 +100,19 @@ func (ls *LedgerState) queryShelley(
return ls.queryShelleyUtxoByAddress(q.Addrs)
case *olocalstatequery.ShelleyUtxoByTxinQuery:
return ls.queryShelleyUtxoByTxIn(q.TxIns)
// TODO
// TODO (#394)
/*
case *olocalstatequery.ShelleyLedgerTipQuery:
case *olocalstatequery.ShelleyEpochNoQuery:
case *olocalstatequery.ShelleyNonMyopicMemberRewardsQuery:
case *olocalstatequery.ShelleyCurrentProtocolParamsQuery:
case *olocalstatequery.ShelleyProposedProtocolParamsUpdatesQuery:
case *olocalstatequery.ShelleyStakeDistributionQuery:
case *olocalstatequery.ShelleyUtxoByAddressQuery:
case *olocalstatequery.ShelleyUtxoWholeQuery:
case *olocalstatequery.ShelleyDebugEpochStateQuery:
case *olocalstatequery.ShelleyCborQuery:
case *olocalstatequery.ShelleyFilteredDelegationAndRewardAccountsQuery:
case *olocalstatequery.ShelleyGenesisConfigQuery:
case *olocalstatequery.ShelleyDebugNewEpochStateQuery:
case *olocalstatequery.ShelleyDebugChainDepStateQuery:
case *olocalstatequery.ShelleyRewardProvenanceQuery:
case *olocalstatequery.ShelleyUtxoByTxinQuery:
case *olocalstatequery.ShelleyStakePoolsQuery:
case *olocalstatequery.ShelleyStakePoolParamsQuery:
case *olocalstatequery.ShelleyRewardInfoPoolsQuery:
Expand All @@ -140,7 +134,7 @@ func (ls *LedgerState) queryShelleyUtxoByAddress(
addrs []ledger.Address,
) (any, error) {
ret := make(map[olocalstatequery.UtxoId]ledger.TransactionOutput)
// TODO: support multiple addresses
// TODO: support multiple addresses (#391)
utxos, err := models.UtxosByAddress(ls.db, addrs[0])
if err != nil {
return nil, err
Expand All @@ -163,7 +157,7 @@ func (ls *LedgerState) queryShelleyUtxoByTxIn(
txIns []ledger.ShelleyTransactionInput,
) (any, error) {
ret := make(map[olocalstatequery.UtxoId]ledger.TransactionOutput)
// TODO: support multiple TxIns
// TODO: support multiple TxIns (#392)
utxo, err := models.UtxoByRef(
ls.db,
txIns[0].Id().Bytes(),
Expand Down
5 changes: 2 additions & 3 deletions state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (

const (
cleanupConsumedUtxosInterval = 15 * time.Minute
cleanupConsumedUtxosSlotWindow = 50000 // TODO: calculate this from params
cleanupConsumedUtxosSlotWindow = 50000 // TODO: calculate this from params (#395)
)

type LedgerStateConfig struct {
Expand Down Expand Up @@ -163,7 +163,6 @@ func NewLedgerState(cfg LedgerStateConfig) (*LedgerState, error) {
)
// Schedule periodic process to purge consumed UTxOs outside of the rollback window
ls.scheduleCleanupConsumedUtxos()
// TODO: schedule process to scan/clean blob DB for keys that don't have a corresponding metadata DB entry
// Load current epoch from DB
if err := ls.loadEpoch(); err != nil {
return nil, err
Expand Down Expand Up @@ -492,7 +491,7 @@ func (ls *LedgerState) consumeUtxo(
// Find UTxO
utxo, err := models.UtxoByRefTxn(txn, utxoId.Id().Bytes(), utxoId.Index())
if err != nil {
// TODO: make this configurable?
// TODO: make this configurable? (#396)
if err == gorm.ErrRecordNotFound {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (n *Node) setupTracing() error {
stdouttrace.WithPrettyPrint(),
)
} else {
// TODO: make options configurable
// TODO: make options configurable (#387)
traceExporter, err = otlptracehttp.New(context.TODO())
}
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion utxorpc/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (s *syncServiceServer) DumpHistory(
point := s.utxorpc.config.LedgerState.Tip().Point
points = append(points, point)
}
// TODO: make this work
// TODO: make this work (#401)
// if startToken != nil {
// blockIdx := startToken.GetIndex()
// blockHash := startToken.GetHash()
Expand Down

0 comments on commit 94d5dd9

Please sign in to comment.