Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update TODO comments with issues #872

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func (c *Connection) setupConnection() error {
c.networkMagic,
handshakeDiffusionMode,
c.peerSharingEnabled,
// TODO: make this configurable
// TODO: make this configurable (#373)
protocol.QueryModeDisabled,
)
// Perform handshake
Expand Down
2 changes: 1 addition & 1 deletion ledger/alonzo/pparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (p *AlonzoProtocolParameters) UpdateFromGenesis(genesis *AlonzoGenesis) {
StepPrice: &cbor.Rat{Rat: genesis.ExecutionPrices.Steps.Rat},
}
}
// TODO: cost models
// TODO: cost models (#852)
// We have 150+ string values to map to array indexes
// CostModels map[string]map[string]int
}
Expand Down
3 changes: 1 addition & 2 deletions ledger/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ func NewBlockFromCbor(blockType uint, data []byte) (Block, error) {
return nil, fmt.Errorf("unknown node-to-client block type: %d", blockType)
}

// XXX: should this take the block header type instead?
func NewBlockHeaderFromCbor(blockType uint, data []byte) (BlockHeader, error) {
switch blockType {
case BlockTypeByronEbb:
return NewByronEpochBoundaryBlockHeaderFromCbor(data)
case BlockTypeByronMain:
return NewByronMainBlockHeaderFromCbor(data)
// TODO: break into separate cases and parse as specific block header types
// TODO: break into separate cases and parse as specific block header types (#844)
case BlockTypeShelley, BlockTypeAllegra, BlockTypeMary, BlockTypeAlonzo:
return NewShelleyBlockHeaderFromCbor(data)
case BlockTypeBabbage, BlockTypeConway:
Expand Down
4 changes: 2 additions & 2 deletions ledger/byron/byron.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,11 @@ type ByronUpdateProposalBlockVersionMod struct {
type ByronMainBlockBody struct {
cbor.StructAsArray
cbor.DecodeStoreCbor
// TODO: split this to its own type
// TODO: split this to its own type (#853)
TxPayload []struct {
cbor.StructAsArray
Transaction ByronTransaction
// TODO: figure out what this field actually is
// TODO: properly decode TX witnesses (#853)
Twit []cbor.Value
}
SscPayload cbor.Value
Expand Down
4 changes: 2 additions & 2 deletions ledger/common/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func (a Address) Bytes() []byte {
}
rawPayload, err := cbor.Encode(tmpPayload)
if err != nil {
// TODO: handle error
// TODO: handle error (#851)
return nil
}
tmpData := []any{
Expand All @@ -374,7 +374,7 @@ func (a Address) Bytes() []byte {
}
ret, err := cbor.Encode(tmpData)
if err != nil {
// TODO: handle error
// TODO: handle error (#851)
return nil
}
return ret
Expand Down
24 changes: 12 additions & 12 deletions ledger/common/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ func (c *RegistrationCertificate) UnmarshalCBOR(
}

func (c *RegistrationCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}

Expand All @@ -537,7 +537,7 @@ func (c *DeregistrationCertificate) UnmarshalCBOR(
}

func (c *DeregistrationCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}

Expand All @@ -558,7 +558,7 @@ func (c *VoteDelegationCertificate) UnmarshalCBOR(
}

func (c *VoteDelegationCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}

Expand All @@ -580,7 +580,7 @@ func (c *StakeVoteDelegationCertificate) UnmarshalCBOR(
}

func (c *StakeVoteDelegationCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}

Expand All @@ -602,7 +602,7 @@ func (c *StakeRegistrationDelegationCertificate) UnmarshalCBOR(
}

func (c *StakeRegistrationDelegationCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}

Expand All @@ -624,7 +624,7 @@ func (c *VoteRegistrationDelegationCertificate) UnmarshalCBOR(
}

func (c *VoteRegistrationDelegationCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}

Expand All @@ -647,7 +647,7 @@ func (c *StakeVoteRegistrationDelegationCertificate) UnmarshalCBOR(
}

func (c *StakeVoteRegistrationDelegationCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}

Expand All @@ -668,7 +668,7 @@ func (c *AuthCommitteeHotCertificate) UnmarshalCBOR(
}

func (c *AuthCommitteeHotCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}

Expand All @@ -689,7 +689,7 @@ func (c *ResignCommitteeColdCertificate) UnmarshalCBOR(
}

func (c *ResignCommitteeColdCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}

Expand All @@ -711,7 +711,7 @@ func (c *RegistrationDrepCertificate) UnmarshalCBOR(
}

func (c *RegistrationDrepCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}

Expand All @@ -732,7 +732,7 @@ func (c *DeregistrationDrepCertificate) UnmarshalCBOR(
}

func (c *DeregistrationDrepCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}

Expand All @@ -753,6 +753,6 @@ func (c *UpdateDrepCertificate) UnmarshalCBOR(
}

func (c *UpdateDrepCertificate) Utxorpc() *utxorpc.Certificate {
// TODO
// TODO (#850)
return nil
}
6 changes: 3 additions & 3 deletions ledger/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func (e *UtxoFailure) UnmarshalCBOR(data []byte) error {
}

func (e *UtxoFailure) Error() string {
// TODO: lookup era name programmatically
// TODO: lookup era name programmatically (#846)
return fmt.Sprintf("UtxoFailure (FromAlonzoUtxoFail (%s))", e.Err)
}

Expand Down Expand Up @@ -528,7 +528,7 @@ func (e *InsufficientCollateral) Error() string {

type ScriptsNotPaidUtxo struct {
UtxoFailureErrorBase
// TODO: determine content/structure of this value
// TODO: determine content/structure of this value (#847)
Value cbor.Value
}

Expand All @@ -552,7 +552,7 @@ func (e *ExUnitsTooBigUtxo) Error() string {

type CollateralContainsNonADA struct {
UtxoFailureErrorBase
// TODO: determine content/structure of this value
// TODO: determine content/structure of this value (#848)
Value cbor.Value
}

Expand Down
2 changes: 0 additions & 2 deletions ledger/shelley/pparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ func (p *ShelleyProtocolParameters) UpdateFromGenesis(genesis *ShelleyGenesis) {
p.ProtocolMajor = genesisParams.ProtocolVersion.Major
p.ProtocolMinor = genesisParams.ProtocolVersion.Minor
p.MinUtxoValue = genesisParams.MinUtxoValue
// TODO:
//p.Nonce *cbor.Rat
}

type ShelleyProtocolParameterUpdate struct {
Expand Down
4 changes: 2 additions & 2 deletions ledger/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func NewTransactionBodyFromCbor(
// NewTransactionOutputFromCbor attempts to parse the provided arbitrary CBOR data as a transaction output from
// each of the eras, returning the first one that we can successfully decode
func NewTransactionOutputFromCbor(data []byte) (TransactionOutput, error) {
// TODO: add Byron transaction output support
// TODO: add Byron transaction output support (#849)
if txOut, err := NewShelleyTransactionOutputFromCbor(data); err == nil {
return txOut, nil
}
Expand All @@ -90,7 +90,7 @@ func NewTransactionOutputFromCbor(data []byte) (TransactionOutput, error) {
}

func DetermineTransactionType(data []byte) (uint, error) {
// TODO: uncomment this once the following issue is resolved:
// TODO: uncomment this once the following issue is resolved: (#849)
// https://github.com/blinklabs-io/gouroboros/issues/206
/*
if _, err := NewByronTransactionFromCbor(data); err == nil {
Expand Down
2 changes: 1 addition & 1 deletion ledger/verify_kes.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (s Sum0KesSig) Verify(
return ed25519.Verify(pubKey, msg, s)
}

// TODO: make this work on anything from Shelley onward
// TODO: make this work on anything from Shelley onward (#845)
func VerifyKes(
header *BabbageBlockHeader,
slotsPerKesPeriod uint64,
Expand Down
7 changes: 4 additions & 3 deletions protocol/blockfetch/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ package blockfetch

import (
"encoding/hex"
"github.com/blinklabs-io/gouroboros/cbor"
"github.com/blinklabs-io/gouroboros/protocol"
"reflect"
"testing"

"github.com/blinklabs-io/gouroboros/cbor"
"github.com/blinklabs-io/gouroboros/protocol"
)

type testDefinition struct {
Expand All @@ -28,7 +29,7 @@ type testDefinition struct {
MessageType uint
}

// TODO: implement tests for more messages
// TODO: implement tests for more messages (#871)
var tests = []testDefinition{
{
CborHex: "8105",
Expand Down
3 changes: 2 additions & 1 deletion protocol/chainsync/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package chainsync

import (
"fmt"

"github.com/blinklabs-io/gouroboros/cbor"
"github.com/blinklabs-io/gouroboros/protocol"
"github.com/blinklabs-io/gouroboros/protocol/common"
Expand Down Expand Up @@ -134,7 +135,7 @@ func NewMsgRollForwardNtC(
copy(m.blockCbor, blockCbor)
wb := NewWrappedBlock(blockType, blockCbor)
content, err := cbor.Encode(wb)
// TODO: figure out better way to handle error
// TODO: figure out better way to handle error (#855)
if err != nil {
return nil
}
Expand Down
30 changes: 5 additions & 25 deletions protocol/chainsync/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ package chainsync
import (
"encoding/hex"
"fmt"
"github.com/blinklabs-io/gouroboros/cbor"
"github.com/blinklabs-io/gouroboros/ledger"
"github.com/blinklabs-io/gouroboros/protocol"
"github.com/blinklabs-io/gouroboros/protocol/common"
"os"
"reflect"
"strings"
"testing"

"github.com/blinklabs-io/gouroboros/cbor"
"github.com/blinklabs-io/gouroboros/ledger"
"github.com/blinklabs-io/gouroboros/protocol"
"github.com/blinklabs-io/gouroboros/protocol/common"
)

type testDefinition struct {
Expand Down Expand Up @@ -157,27 +158,6 @@ func TestMsgRollForwardNodeToNode(t *testing.T) {
MessageType: MessageTypeRollForward,
ProtocolMode: protocol.ProtocolModeNodeToNode,
},
// TODO: fetch full block content and enable test
/*
// Byron main block (NtN)
{
CborHex: string(readFile("testdata/rollforward_ntn_byron_main_block_testnet_388a82f053603f3552717d61644a353188f2d5500f4c6354cc1ad27a36a7ea91.hex")),
Message: NewMsgRollForwardNtN(
ledger.BlockHeaderTypeByron,
1,
hexDecode(string(readFile("testdata/byron_main_block_testnet_xxxx.hex"))),
Tip{
Point: common.Point{
Slot: 55740899,
Hash: hexDecode("C89E652408EC269379751C8B2BF0137297BF9F5D0FB2E76E19ACF63D783C3A66"),
},
BlockNumber: 3479284,
},
),
MessageType: MessageTypeRollForward,
ProtocolMode: protocol.ProtocolModeNodeToNode,
},
*/
// Shelley block (NtN)
{
CborHex: string(
Expand Down
2 changes: 1 addition & 1 deletion protocol/chainsync/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (s *Server) messageHandler(msg protocol.Message) error {

func (s *Server) handleRequestNext() error {
// TODO: figure out why this one log message causes a panic (and only this one)
// during tests
// during tests (#857)
//s.Protocol.Logger().
// Debug("request next",
// "component", "network",
Expand Down

This file was deleted.

5 changes: 3 additions & 2 deletions protocol/chainsync/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ func NewWrappedHeader(
}
// Record the original block size for Byron blocks
if era == ledger.BlockHeaderTypeByron {
// TODO: figure out why we have to add 2 to the length to match official message CBOR
// NOTE: we add 2 to the length to account for the extra CBOR bytes that need to be added
// when calculating the hash
w.byronSize = uint(len(blockCbor)) + 2
}
// Parse block and extract header
tmp := []cbor.RawMessage{}
// TODO: figure out a better way to handle an error
// TODO: figure out a better way to handle an error (#856)
if _, err := cbor.Decode(blockCbor, &tmp); err != nil {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion protocol/handshake/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var tests = []testDefinition{
},
),
},
// TODO: add more tests for other refusal types
// TODO: add more tests for other refusal types (#854)
}

func TestDecode(t *testing.T) {
Expand Down
Loading