todo-to-docs/sample/sample.md

32 KiB

  • 📁 account
    • 📃 keystore_geth.go
      • Todo:
        On line : 3
        Description : TODO: Make independent version for Nimbus
  • 📁 api
    • 📃 backend_test.go
      • Todo:
        On line : 115
        Description : TODO(adam): add concurrent tests for ResetChainData()
      • Todo:
        On line : 378
        Description : TODO(adam): add concurrent tests for: SendTransaction
    • 📃 geth_backend.go
      • Todo:
        On line : 255
        Description : TODO: we should use a proper struct with optional values instead of duplicating the regular functions
        with small variants for keycard, this created too many bugs
      • Todo:
        Related func or type : func (b *GethStatusBackend) AppStateChange(state string)
        On line : 912
        Description : TODO: put node in low-power mode if the app is in background (or inactive)
        and normal mode if the app is in foreground.
    • 📃 nimbus_backend.go
      • Todo:
        On line : 191
        Description : TODO: we should use a proper struct with optional values instead of duplicating the regular functions
        with small variants for keycard, this created too many bugs
      • Todo:
        Related func or type : func (b *nimbusStatusBackend) AppStateChange(state string)
        On line : 780
        Description : TODO: put node in low-power mode if the app is in background (or inactive)
        and normal mode if the app is in foreground.
  • 📁 bridge
    • 📃 bridge_test.go
      • Todo:
        Related func or type : func TestBridgeWhisperToWaku(t *testing.T)
        On line : 84
        Description : TODO: replace with a bridge event which should not be sent by Waku
      • Todo:
        Related func or type : func TestBridgeWakuToWhisper(t *testing.T)
        On line : 138
        Description : TODO: replace with a bridge event which should not be sent by Waku
  • 📁 db
    • 📃 history.go
      • Todo:
        Related func or type : func (req *HistoryRequest) Histories() []TopicHistory
        On line : 144
        Description : TODO Lazy load from database on first access
    • 📃 history_store.go
      • Todo:
        On line : 76
        Description : TODO explain
  • 📁 discovery
    • 📃 muxer_test.go
      • Todo:
        Related func or type : func TestMuxerDiscovery(t *testing.T)
        On line : 235
        Description : TODO test period channel
  • 📁 eth-node
    • 📁 bridge
      • 📁 nimbus
        • 📃 public_whisper_api.go
          • Todo:
            Related func or type : func (w *nimbusPublicWhisperAPIWrapper) NewMessageFilter(req types.Criteria) (string, error)
            On line : 119
            Description : TODO
          • Todo:
            Related func or type : func (w *nimbusPublicWhisperAPIWrapper) Post(ctx context.Context, req types.NewMessage) ([]byte, error)
            On line : 195
            Description : TODO: return envelope hash once nimbus_post is improved to return it
        • 📃 whisper.go
          • Todo:
            Related func or type : func (w *nimbusWhisperWrapper) SubscribeEnvelopeEvents(eventsProxy chan<- types.EnvelopeEvent) types.Subscription
            On line : 90
            Description : TODO: when mailserver support is implemented
          • Todo:
            Related func or type : func (w *nimbusWhisperWrapper) Subscribe(opts *types.SubscriptionOptions) (string, error)
            On line : 309
            Description : TODO: Check if this is done too late (race condition with onMessageHandler)
    • 📁 keystore
      • 📃 passphrase.go
        • Todo:
          Related func or type : func (m Message) CheckNonce() bool
          On line : 273
          Description : TODO: can we do without this when unmarshalling dynamic JSON?
          why do integers in KDF params end up as float64 and not int after
          unmarshal?
  • 📁 extkeys
    • 📃 hdkey.go
      • Todo:
        Related func or type : func (err decError) Error() string
        On line : 42
        Description : TODO make sure we're doing this ^^^^ !!!!!!
    • 📃 mnemonic.go
      • Todo:
        Related func or type : func (m *Mnemonic) MnemonicPhrase(strength EntropyStrength, language Language) (string, error)
        On line : 188
        Description : TODO simplify?
  • 📁 mailserver
    • 📃 mailserver.go
      • Todo:
        Related func or type : func newMailServer(cfg Config, adapter adapter, service service) (*mailServer, error)
        On line : 630
        Description : TODO: move out
      • Todo:
        Related func or type : func (s *mailServer) createIterator(req MessagesRequestPayload) (Iterator, error)
        On line : 1026
        Description : TODO(adam): this is invalid code. If the limit is 1000,
        it will only send 999 items and send a cursor.
  • 📁 multiaccounts
    • 📁 accounts
      • 📃 database.go
        • Todo:
          Related func or type : func TestPrepareJSONResponseErrorWithResult(t *testing.T)
          On line : 125
          Description : TODO remove photoPath from settings
  • 📁 node
    • 📃 get_status_node.go
      • Todo:
        Related func or type : func (n *StatusNode) startDiscovery() error
        On line : 345
        Description : TODO(dshulyak) consider adding a flag to define this behaviour
    • 📃 geth_node.go
      • Todo:
        Related func or type : func activateShhService(stack *node.Node, config *params.NodeConfig, db *leveldb.DB) (err error)
        On line : 357
        Description : TODO(dshulyak) add a config option to enable it by default, but disable if app is started from statusd
      • Todo:
        Related func or type : func activateWakuService(stack *node.Node, config *params.NodeConfig, db *leveldb.DB) (err error)
        On line : 397
        Description : TODO(dshulyak) add a config option to enable it by default, but disable if app is started from statusd
    • 📃 nimbus_node.go
      • Todo:
        Related func or type : func (n *NimbusStatusNode) activateShhService(config *params.NodeConfig, db *leveldb.DB) (err error)
        On line : 217
        Description : TODO(dshulyak) add a config option to enable it by default, but disable if app is started from statusd
      • Todo:
        Related func or type : func (n *NimbusStatusNode) activateWakuService(config *params.NodeConfig, db *leveldb.DB) (err error)
        On line : 242
        Description : TODO(dshulyak) add a config option to enable it by default, but disable if app is started from statusd
        return n.Register(func(ctx *nimbussvc.ServiceContext) (nimbussvc.Service, error) {
        var ethnode *nodebridge.NodeService
        if err := ctx.Service(&ethnode); err != nil {
        return nil, err
        }
        return shhext.New(ethnode.Node, ctx, "wakuext", shhext.EnvelopeSignalHandler{}, db, config.ShhextConfig), nil
        })
    • 📃 nimbus_status_node.go
      • Todo:
        Related func or type : func (n *NimbusStatusNode) startDiscovery() error
        On line : 332
        Description : TODO(dshulyak) consider adding a flag to define this behaviour
        options.AllowStop = len(n.config.RegisterTopics) == 0
        options.TrustedMailServers = parseNodesToNodeID(n.config.ClusterConfig.TrustedMailServers)
  • 📁 params
    • 📃 config.go
      • Todo:
        Related func or type : func (c *NodeConfig) updatePeerLimits()
        On line : 723
        Description : TODO(dshulyak) register mailserver limits when we will change how they are handled.
  • 📁 peers
    • 📃 peerpool.go
      • Todo:
        On line : 249
        Description : TODO(adam): split it into peers and discovery management loops. This should
        simplify the whole logic and allow to remove timeout field from PeerPool.
    • 📃 topicpool.go
      • Todo:
        Related func or type : func (t *TopicPool) AddPeerFromTable(server *p2p.Server) *discv5.Node
        On line : 401
        Description : TODO(adam): investigate if it's worth to keep the peer in the queue
        until the server confirms it is added and in the meanwhile only adjust its priority.
  • 📁 protocol
    • 📁 communities
      • 📃 community.go
        • Todo:
          On line : 300
          Description : TODO: this should accept a request from a user to join and perform any validation
        • Todo:
          On line : 306
          Description : TODO: this should decline a request from a user to join
      • 📃 community_test.go
        • Todo:
          Related func or type : func (s *CommunitySuite) TestHandleRequestJoin()
          On line : 306
          Description : TODO -> Org is invitation only, chat is read-write for members
          INVITATION_ONLY - INVITATION_ONLY -> Error -> Org is invitation only, chat is invitation only
        • Todo:
          Related func or type : func (s *CommunitySuite) TestHandleRequestJoin()
          On line : 308
          Description : TODO -> Error -> Org is invitation only, member of the org need to request access for chat
        • Todo:
          Related func or type : func (s *CommunitySuite) TestHandleRequestJoin()
          On line : 309
          Description : TODO -> Error -> Org is on request, chat is read write for members
          ON_REQUEST - INVITATION_ONLY -> Error -> Org is on request, chat is invitation only for members
          ON_REQUEST - ON_REQUEST -> Fine -> Org is on request, chat is on request
      • 📃 manager.go
        • Todo:
          On line : 225
          Description : TODO: Finish implementing this
    • 📁 encryption
      • 📃 persistence_test.go
        • Todo:
          On line : 342
          Description : TODO: Add test for MarkBundleExpired
      • 📃 protocol.go
        • Todo:
          Related func or type : func (p *Protocol) ProcessPublicBundle(myIdentityKey *ecdsa.PrivateKey, bundle *Bundle) ([]*multidevice.Installation, error)
          On line : 266
          Description : TODO(adam): why do we add installations using identity obtained from GetIdentity()
          instead of the output of crypto.CompressPubkey()? I tried the second option
          and the unit tests TestTopic and TestMaxDevices fail.
      • 📁 publisher
        • 📃 publisher_test.go
          • Todo:
            Related func or type : func (*ProtocolMessage) ProtoMessage()
            On line : 31
            Description : TODO(adam): provide more tests
      • 📁 sharedsecret
        • 📃 sharedsecret.go
          • Todo:
            Related func or type : func (*ProtocolMessage) ProtoMessage()
            On line : 25
            Description : TODO: make compression of public keys a responsibility of sqlitePersistence instead of SharedSecret.
    • 📃 message_handler.go
      • Todo:
        Related func or type : func (m *MessageHandler) matchChatEntity(chatEntity common.ChatEntity, chats map[string]*Chat, timesource common.TimeSource) (*Chat, error)
        On line : 742
        Description : TODO: this should be a three-word name used in the mobile client
    • 📃 message_validator_test.go
      • Todo:
        Related func or type : func (s *MessageValidatorSuite) TestValidatePlainTextMessage()
        On line : 287
        Description : TODO: FIX ME
    • 📃 messenger.go
      • Todo:
        Related func or type : func (m *Messenger) createChatIdentity(context chatContext) (*protobuf.ChatIdentity, error)
        On line : 631
        Description : TODO add ENS name handling to dedicate PR
      • Todo:
        Related func or type : func (m *Messenger) adaptIdentityImageToProtobuf(img *userimage.IdentityImage) *protobuf.IdentityImage
        On line : 678
        Description : TODO add ENS avatar handling to dedicated PR
      • Todo:
        Related func or type : func (m *Messenger) Init() error
        On line : 950
        Description : TODO: Get only active chats by the query.
      • Todo:
        Related func or type : func (m *Messenger) dispatchMessage(ctx context.Context, spec common.RawMessage) ([]byte, error)
        On line : 2314
        Description : TODO: add grant
      • Todo:
        Related func or type : func (m *Messenger) SendContactUpdates(ctx context.Context, ensName, profileImage string) error
        On line : 2545
        Description : TODO: This should not be sending paired messages, as we do it above
      • Todo:
        Related func or type : func (*ProtocolMessage) ProtoMessage()
        On line : 2635
        Description : TODO remove use of photoPath in contacts
      • Todo:
        Related func or type : func (m *Messenger) encodeChatEntity(chat *Chat, message common.ChatEntity) ([]byte, error)
        On line : 4614
        Description : TODO: add grant
    • 📁 pushnotificationclient
      • 📃 client.go
        • Todo:
          Related func or type : func (c *Client) RemovePushNotificationServer(publicKey *ecdsa.PublicKey) error
          On line : 556
          Description : TODO: this needs implementing. It requires unregistering from the server and
          likely invalidate the device token of the user
    • 📁 pushnotificationserver
      • 📃 persistence.go
        • Todo:
          Related func or type : func (p *SQLitePersistence) GetPushNotificationRegistrationByPublicKeys(publicKeys [][]byte) ([]*PushNotificationIDAndRegistration, error)
          On line : 84
          Description : TODO: check for a max number of keys
    • 📁 transport
      • 📃 filter.go
        • Todo:
          On line : 5
          Description : TODO: revise fields encoding/decoding. Some are encoded using hexutil and some using encoding/hex.
      • 📁 waku
        • 📃 waku_service.go
          • Todo:
            On line : 76
            Description : TODO: leaving a chat should verify that for a given public key
            there are no other chats. It may happen that we leave a private chat
            but still have a public chat for a given public key.
          • Todo:
            Related func or type : func (a *Transport) SendPrivateOnDiscovery(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error)
            On line : 295
            Description : TODO: change this anyway, it should be explicit
            and idempotent.
      • 📁 whisper
        • 📃 whisper_service.go
          • Todo:
            On line : 76
            Description : TODO: leaving a chat should verify that for a given public key
            there are no other chats. It may happen that we leave a private chat
            but still have a public chat for a given public key.
          • Todo:
            Related func or type : func (a *Transport) SendPrivateOnDiscovery(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error)
            On line : 346
            Description : TODO: change this anyway, it should be explicit
            and idempotent.
    • 📁 v1
      • 📃 membership_update_message.go
        • Todo:
          Related func or type : func (g Group) validateChatID(chatID string) bool
          On line : 372
          Description : TODO: It does not verify that the prefix is a valid UUID.
          Improve it so that the prefix follows UUIDv4 spec.
  • 📁 rpc
    • 📃 call_raw.go
      • Todo:
        On line : 62
        Description : TODO(divan): this function exists for compatibility and uses default
        go-ethereum's RPC client under the hood. It adds some unnecessary overhead
        by first marshalling JSON string into object to use with normal Call,
        which is then umarshalled back to the same JSON. The same goes with response.
        This is waste of CPU and memory and should be avoided if possible,
        either by changing exported API (provide only Call, not CallRaw) or
        refactoring go-ethereum's client to allow using raw JSON directly.
    • 📃 client.go
      • Todo:
        On line : 179
        Description : TODO(divan): use cancellation via context here?
      • Todo:
        Related func or type : func setResultFromRPCResponse(result, response interface{}) (err error)
        On line : 219
        Description : TODO(divan): add additional checks for result underlying value, if needed:
        some example: https://golang.org/src/encoding/json/decode.go#L596
  • 📁 services
    • 📁 ext
      • 📃 api.go
        • Todo:
          On line : 191
          Description : TODO: this is broken now as it requires dedup ID while a message hash should be used.
      • 📁 mailservers
        • 📃 connmanager.go
          • Todo:
            Related func or type : func (ps *ConnectionManager) Start()
            On line : 111
            Description : TODO treat failed requests the same way as expired
      • 📃 rpc.go
        • Todo:
          On line : 1
          Description : TODO: These types should be defined using protobuf, but protoc can only emit []byte instead of types.HexBytes,
          which causes issues when marshaling to JSON on the react side. Let's do that once the chat protocol is moved to the go repo.
        • Todo:
          Related func or type : type SendPublicMessageRPC struct
          On line : 15
          Description : TODO: remove
        • Todo:
          On line : 20
          Description : TODO: implement with accordance to https://github.com/status-im/status-go/protocol/issues/28.
        • Todo:
          Related func or type : type SendDirectMessageRPC struct
          On line : 29
          Description : TODO: remove
        • Todo:
          Related func or type : type SendDirectMessageRPC struct
          On line : 33
          Description : TODO: make sure to remove safely
        • Todo:
          Related func or type : func (m SendPublicMessageRPC) PublicKey() *ecdsa.PublicKey
          On line : 36
          Description : TODO: implement with accordance to https://github.com/status-im/status-go/protocol/issues/28.
      • 📃 signal.go
        • Todo:
          Related func or type : func (h PublisherSignalHandler) FilterAdded(filters []*signal.Filter)
          On line : 44
          Description : TODO(waku): change the name of the filter to generic one.
    • 📁 shhext
      • 📃 api_geth.go
        • Todo:
          Related func or type : func NewPublicAPI(s *Service) *PublicAPI
          On line : 57
          Description : TODO: replace with an types.Envelope creator passed to the API struct
        • Todo:
          Related func or type : func (api *PublicAPI) RequestMessagesSync(conf ext.RetryConfig, r ext.MessagesRequest) (ext.MessagesResponse, error)
          On line : 161
          Description : FIXME this weird conversion is required because MessagesRequest expects seconds but defines time.Duration
      • 📃 api_nimbus.go
        • Todo:
          Related func or type : func (api *NimbusPublicAPI) RequestMessagesSync(conf RetryConfig, r MessagesRequest) (MessagesResponse, error)
          On line : 69
          Description : FIXME this weird conversion is required because MessagesRequest expects seconds but defines time.Duration
          r.Timeout = time.Duration(int(r.Timeout.Seconds()))
          requestID, err = api.RequestMessages(context.Background(), r)
          if err != nil {
          sub.Unsubscribe()
          return resp, err
          }
          mailServerResp, err := waitForExpiredOrCompleted(types.BytesToHash(requestID), events, timeout)
          sub.Unsubscribe()
          if err == nil {
          resp.Cursor = hex.EncodeToString(mailServerResp.Cursor)
          resp.Error = mailServerResp.Error
          return resp, nil
          }
          retries++
          api.log.Error("[RequestMessagesSync] failed", "err", err, "retries", retries)
          }
          return resp, fmt.Errorf("failed to request messages after %d retries", retries)
          }
        • Todo:
          On line : 250
          Description : TODO: this is broken now as it requires dedup ID while a message hash should be used.
    • 📁 wakuext
      • 📃 api.go
        • Todo:
          Related func or type : func (api *PublicAPI) RequestMessagesSync(conf ext.RetryConfig, r ext.MessagesRequest) (ext.MessagesResponse, error)
          On line : 155
          Description : FIXME this weird conversion is required because MessagesRequest expects seconds but defines time.Duration
    • 📁 wallet
      • 📃 commands.go
        • Todo:
          Related func or type : func (c *controlCommand) verifyLastSynced(parent context.Context, last *DBHeader, head *types.Header) error
          On line : 623
          Description : TODO(dshulyak) make a standalone command that
          doesn't manage transfers and has an upper limit
      • 📃 database.go
        • Todo:
          On line : 49
          Description : FIXME(dshulyak) SQL big int is max 64 bits. Maybe store as bytes in big endian and hope
          that lexographical sorting will work.
      • 📃 downloader.go
        • Todo:
          Related func or type : func (d *ETHTransferDownloader) GetTransfers(ctx context.Context, header *DBHeader) (rst []Transfer, err error)
          On line : 65
          Description : TODO(dshulyak) consider caching balance and reset it on reorg
        • Todo:
          Related func or type : func (d *ETHTransferDownloader) getTransfersInBlock(ctx context.Context, blk *types.Block, accounts []common.Address) (rst []Transfer, err error)
          On line : 141
          Description : TODO(dshulyak) test that balance difference was covered by transactions
  • 📁 t
    • 📁 e2e
      • 📁 api
        • 📃 api_test.go
          • Todo:
            Related func or type : func (s *APITestSuite) TestCHTUpdate()
            On line : 42
            Description : TODO(tiabc): Test that CHT is really updated.
          • Todo:
            Related func or type : func (s *APITestSuite) TestRaceConditions()
            On line : 74
            Description : TODO(adam): quarantined until it uses a different datadir
            as otherwise it wipes out cached blockchain data.
            func(config *params.NodeConfig) {
            s.T().Logf("async call to ResetChainData() for network: %d", config.NetworkID)
            _, err := s.api.ResetChainData()
            progress <- struct{}{}
            },
        • 📃 backend_test.go
          • Todo:
            On line : 24
            Description : FIXME(tiabc): There's also a test with the same name in node/manager_test.go
            so this test should only check StatusBackend logic with a mocked version of the underlying StatusNode.
          • Todo:
            On line : 83
            Description : FIXME(tiabc): There's also a test with the same name in node/manager_test.go
            so this test should only check StatusBackend logic with a mocked version of the underlying StatusNode.
      • 📁 node
        • 📃 manager_test.go
          • Todo:
            On line : 242
            Description : TODO(adam): race conditions should be tested with -race flag and unit tests, if possible.
          • Todo:
            On line : 243
            Description : TODO(boris): going via https://github.com/status-im/status-go/pull/433#issuecomment-342232645 . Testing should be with -race flag
            Research if it's possible to do the same with unit tests.
            func (s *ManagerTestSuite) TestRaceConditions() {
            cnt := 25
            progress := make(chan struct{}, cnt)
            rnd := rand.New(rand.NewSource(time.Now().UnixNano()))
          • Todo:
            Related func or type : func (s *ManagerTestSuite) TestRaceConditions()
            On line : 281
            Description : TODO(adam): quarantined until it uses a different datadir
            // as otherwise it wipes out cached blockchain data.
            // func(config *params.NodeConfig) {
            // log.Info("ResetChainData()")
            // _, err := s.StatusNode.ResetChainData()
            // s.T().Logf("ResetChainData(), error: %v", err)
            // progress <- struct{}{}
            // },
            func(config *params.NodeConfig) {
            log.Info("RestartNode()")
            _, err := s.StatusNode.RestartNode()
            s.T().Logf("RestartNode(), error: %v", err)
            progress <- struct{}{}
            },
            func(config *params.NodeConfig) {
            log.Info("Config()")
            _, err := s.StatusNode.Config()
            s.T().Logf("Config(), error: %v", err)
            progress <- struct{}{}
            },
            func(config *params.NodeConfig) {
            log.Info("LightEthereumService()")
            _, err := s.StatusNode.LightEthereumService()
            s.T().Logf("LightEthereumService(), error: %v", err)
            progress <- struct{}{}
            },
            func(config *params.NodeConfig) {
            log.Info("WhisperService()")
            _, err := s.StatusNode.WhisperService()
            s.T().Logf("WhisperService(), error: %v", err)
            progress <- struct{}{}
            },
            func(config *params.NodeConfig) {
            log.Info("AccountManager()")
            _, err := s.StatusNode.AccountManager()
            s.T().Logf("AccountManager(), error: %v", err)
            progress <- struct{}{}
            },
            func(config *params.NodeConfig) {
            log.Info("AccountKeyStore()")
            _, err := s.StatusNode.AccountKeyStore()
            s.T().Logf("AccountKeyStore(), error: %v", err)
            progress <- struct{}{}
            },
            func(config *params.NodeConfig) {
            log.Info("RPCClient()")
            s.StatusNode.RPCClient()
            progress <- struct{}{}
            },
            }
  • 📁 waku
    • 📃 waku.go
      • Todo:
        Related func or type : func (m *mockRateLimiterHandler) ExceedIPLimit() error
        On line : 1022
        Description : TODO: This does not seem to update the bloom filter, nor topic-interest
        Note that the filter/topic-interest needs to take into account that there
        might be filters with duplicated topics, so it's not just a matter of removing
        from the map, in the topic-interest case, while the bloom filter might need to
        be rebuilt from scratch
  • 📁 whisper
    • 📃 whisper.go
      • Todo:
        Related func or type : func (whisper *Whisper) runMessageLoop(p *Peer, rw p2p.MsgReadWriter) error
        On line : 1166
        Description : TODO(adam): should we limit who can send this request?
      • Todo:
        Related func or type : func (whisper *Whisper) runMessageLoop(p *Peer, rw p2p.MsgReadWriter) error
        On line : 1192
        Description : TODO(adam): currently, there is no feedback when a sync response
        is received. An idea to fix this:
        1. Sending a request contains an ID,
        2. Each sync response contains this ID,
        3. There is a way to call whisper.SyncMessages() and wait for the response.Final to be received for that particular request ID.
        4. If Cursor is not empty, another p2pSyncRequestCode should be sent.