-
Notifications
You must be signed in to change notification settings - Fork 193
New Peer System. #1676
Comments
Looks good! It may be worth including the improvements to custom peers (e.g. persistence) which is mentioned in ArkEcosystemArchive/tier-0-program#9 just to keep it in one place |
I'm going to use this issue to document my progress. Since I do not understand the system deeply enough to assume the behavior of every component, this clears the path for further abstractions. A lot of work has been done to make this system more readable and maintainable, even if it breaks some of the patterns inside the code. For example, most of the validations are made inside the component methods directly. I'm implementing the validations separated from the components. New Classes
New store modeltype PeerStore {
discovery: PeerDiscoveryInstance,
current: CurrentPeer,
lists: [PeerList]
} {
...
peer: {
discovery: PeerDiscovery(),
current: CurrentPeer(),
lists: [
PeerList({
id: 'ark.devnet', // Added the `chainnet` ID reference to the PeerList
lastUpdate: Datetime()
peers: [Peer()]
})
]
}
...
} Format peer status (wip)
|
Peer shorthands
PeerList shorthandsAll those methods can be called natively by using array methods on
|
Chiming in with a little feature request that could be of interest to you: add the option to filter peers by their use of estimates or not. Unfortunately that information is available only in the meta object of an API request, e.g. {
"meta": {
"totalCountIsEstimate": false, <-- this
"count": 100,
"pageCount": 39244,
"totalCount": 3924387,
"next": "/transactions?transform=true&page=2&limit=100",
"previous": null,
"self": "/transactions?transform=true&page=1&limit=100",
"first": "/transactions?transform=true&page=1&limit=100",
"last": "/transactions?transform=true&page=39244&limit=100"
},
"data": []
} These nodes do not return all transactions and are affected by all kind of weird behaviour (pagination not working reliably, transaction API endpoints returning zero results in some cases, etc ...). Related issue #1335. |
ReportWhat has been done so far:
Need to do:
PostponedSome of the features that I've mentioned earlier required a previous refactor to be implemented (like |
Peer related logic for wallets will be moved to https://github.com/ArkEcosystem/platform-sdk. |
This is an attempt to ArkEcosystemArchive/tier-0-program#9
For models, I'm using the GraphQL SDL to show the model since it is less verbose than the
BaseModel
included on the app and it is almost self-explanatory (but you can use this article as a cheat sheet).New Peer and CurrentPeer classes
Current Model
Proposal
URL
class comes from the W3 living standard and implemented in JS using theURL()
class. This prevents a lot of mistakes from schemas, ports, IPs (including IPv6). Remember that the wallet should not validate hostnames and hosts directly.isCustom
. We can insert a tagdefault
, for example, for peers that come fromconfig/peers/mainnet.json
. We can set as many tags as we want to filter and group peers.New PeerList class
Current
Today it is simply a vector.
Proposal
PeerLists
is a class that holdsPeers
. When retrieving peers from seed servers, or accessing theconfigs
, or simply accessing the state/store forPeers
you are dealing withPeerLists
.This was one of the major problems with this old model since it is hard to distinguish methods from
Peers
andPeerLists
inside the store.filter
,order
andrandom
getters fromPeerList
. For example:PeerList
origins (config, network or store) and create proper handlers for those peers.Other features
InputPeer
to handle the input properly.ModalPeerTag
to make it easy to edit tags inside peers.The text was updated successfully, but these errors were encountered: