-
Notifications
You must be signed in to change notification settings - Fork 234
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
Directory Sevices v2.1 #4903
Merged
Merged
Directory Sevices v2.1 #4903
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jstuczyn
force-pushed
the
feature/directory-v3-purge-base
branch
from
September 19, 2024 15:27
c91f42b
to
2485d63
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
jstuczyn
force-pushed
the
feature/directory-v3-purge-base
branch
from
September 25, 2024 10:28
e2fb52c
to
25a8a27
Compare
octol
approved these changes
Oct 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a beast of a PR, great work! :)
I've been trying to look at the big picture to get a feel for what the changes are and I like it!
jstuczyn
force-pushed
the
feature/directory-v3-purge-base
branch
from
October 9, 2024 15:48
e9d990a
to
d53f841
Compare
WIP; rebasing Another branch squash Squashing the v3 branch changing min pledge amounts logic for adding new nymnode into the contract converting mixnode/gateway bonding into nym-node bonding logic for migrating gateways into nymnodes ibid for mixnodes further nym-node work + fixed most existing unit tests forbid nymnode migration with pending cost params changes preassign nodeid for gateways changing role assignment and epoch progression changing role assignment and epoch progression optional custom http port logic for unbonding a nym-node updating Delegation struct logic for increasing pledge of either mixnode or nymnode logic for decreasing pledge of either mixnode or a nym node logic for changing cost params of either mixnode or a nym node wip initialise nymnodes storage fixing transaction tests fixed naive family tests reward-compatibility related works resolving delegation events introduced rewarded set metadata another iteration of restoring old tests updated rewarding part of nym-api parking the branch unparking the branch wip purged families added 'ExitGateway' role passing explicit work factor for rewarding function remove legacy layers storage wip: node description queries added announced ports to self-described api step1 in gruelling journey of adding node_id to gateways ensure epoch work never goes above 1.0 changed active set to contain role distribution [theoretically] sending rewarding messages for the new rewarded set [theoretically] assigning new rewarded set reimplementing more nym-api features remove legacy types re-implement legacy network monitor restoring further routes + minor refactor of NodeStatusCache skimmed routes now return legacy nodes alongside nym-nodes seemingly restored all functionalities in nym-api removing more legacy things from the contract initial contract cleanup added nym-api endpoints to return generic annotations regardless of type updated simulator to use new rewarding parameters more contract cleanup made existing mixnet contract tests compile extra validation of nym-node bonding parameters fixed additional compilation issues fixed nym-api v3 database migration failure added additional nym-node contract queries updated the schema made additional delegation/rewards queries compatible with both legacy mixnodes and nym-nodes fixing existing unit tests in mixnet contract wip resolved first batch of 500 compiler errors re-deprecating routes making wallet's rust backend compile fixed non-determinism in contract + nym-api build fixes to the build populating cotracts-cache with nym-nodes data more missing nymnodes queries temp mixnet contract methods + restored result submission in nym-api allow deprecated routes submitting correct results for mixnode results removed deprecated re-export of AxumAppState and removed smurf naming moved axum modules into support::http cleaning up nym-api warnings determine entry gateways before exits exposed transaction to update nym-node config missing memo for updating node config new routes added routes to swagger and fixed relative paths fixed some macro derivations added nym-node commands to nym-cli
jstuczyn
force-pushed
the
feature/directory-v3-purge-base
branch
from
October 10, 2024 14:38
07c9501
to
45f4eee
Compare
amazing work @jstuczyn <3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CHANGES
Higher Level Relevant changes
Okay. This is yet another godzilla PR. It's the final (I hope) step in the project smoosh (™️) which introduces Nym Nodes into the mixnet contract and deprecates standalone gateways/mixnodes. Any new bonded node will provide only the bare minimum information: host, identity key and optionally custom port of its HTTP api. everything else will be discovered via the self-described API for maximum flexibility. this also includes the sphinx key, meaning if the API is not exposed, the node will be unable to route any traffic. Furthermore, this allows to arbitrary change your mixnode into a gateway (and vice versa) without losing any delegations.
The contract changes also mean the rewarding is getting (kinda) revamped. Rather than just mixnodes, or nodes with assigned mixing roles, getting rewards, gateways now also added into the pool. However, to be eligible for gateway rewarding, one must migrate into a Nym Node (or bond a new nodde). Currently the rewards are split equally, i.e. every node being assigned 1/240 work factor with the usual scaling by performance, stake. etc.
Below I've listed some detailed API changes for the nym-api and the mixnet contract so that the consumers of those could migrate accordingly.
For any additional context and details of some of the changes, please refer to the internal document I shared a while back. ping me for the link if you lost it.
nym-api
High Level Changes
Added:
Removed:
rocket
support has been completely removed. all routes are now always served viaaxum
Changed:
node_id
. for legacy gateway endpoints, we have a helper method that translates identity key to thenode_id
node_id
that indicate the id pre-assigned during contract migrationAPI Changes
Added:
a small QoL for myself: root route:
/
now redirects to/swagger
Nym Nodes
routes:/v1/nym-nodes/annotation/{node_id}
- get annotation about particular Nym Node, as gathered by this nym-api. currently this just includes last 24h performance metric and the current node role/v1/nym-nodes/bonded
- get bond information about Nym Nodes, as present in the mixnet contract/v1/nym-nodes/described
- get described information about Nym Nodes, as present on their self-described API/v1/nym-nodes/historical-performance/{node_id}
- return historical performance of this Nym Node on the provided date/v1/nym-nodes/performance-history/{node_id}
- return performance history of this Nym Node (as a 0 - 1 float)/v1/nym-nodes/uptime-history/{node_id}
- return current uptime of this Nym Node (as a 0 - 100 u8); added for compatibility with existing APIs using that data format/v1/nym-nodes/performance/{node_id}
- return current performance of this Nym NodeUnstable Nym Nodes Routes
:/v1/unstable/nym-nodes/noise
- returns information basic information needed for the noise protocol between nodes/v1/unstable/nym-nodes/skimmed/active
- returns all Nym Nodes AND legacy mixnodes AND legacy gateways that are currently in the active set, unlessno-legacy
parameter is used/v1/unstable/nym-nodes/skimmed/mixnodes/active
- returns all Nym Nodes AND legacy mixnodes that are currently in the active set, unlessno-legacy
parameter is used/v1/unstable/nym-nodes/skimmed/mixnodes/all
- returns all Nym Nodes AND legacy mixnodes that are currently bonded and support mixing role, unlessno-legacy
parameter is used/v1/unstable/nym-nodes/skimmed/entry-gateways/active
- returns all Nym Nodes AND legacy gateways that are currently in the active set and are assigned the entry role, unlessno-legacy
parameter is used/v1/unstable/nym-nodes/skimmed/exit-gateways/active
- returns all Nym Nodes AND legacy gateways that are currently in the active set and are assigned the exit role, unlessno-legacy
parameter is used/v1/unstable/nym-nodes/skimmed/entry-gateways/all
- returns all Nym Nodes AND legacy gateways that are currently bonded and support entry gateway role, unlessno-legacy
parameter is used/v1/unstable/nym-nodes/skimmed/exit-gateways/all
- returns all Nym Nodes AND legacy gateways that are currently bonded and support exit gateway role, unlessno-legacy
parameter is usedDeprecated (will be removed eventually, so please migrate away from their usage):
Some endpoints got purposely deprecated without any equivalent reimplemented since they do not belong on nym-api. This includes for example
/stake-saturation
(which can be obtained directly from the contract instead) or/inclusion-probability
(for this run your own Monte Carlo simulation)contract-cache
routes - all of the below got deprecated as they will only return legacy mixnode/gateway data:/v1/gateways
/v1/gateways/blacklisted
/v1/mixnodes
/v1/mixnodes/active
- just to restate the obvious, it will only return a small SUBSET of the active set that since it will ignore active Nym Nodes/v1/mixnodes/active/detailed
/v1/mixnodes/blacklisted
/v1/mixnodes/detailed
/v1/mixnodes/rewarded
/v1/mixnodes/rewarded/detailed
status
routes - all of the below got deprecated as they will only return legacy mixnode/gateway data:/v1/status/gateway/{identity}/report
/v1/status/gateway/{identity}/history
/v1/status/gateway/{identity}/core-status-count
/v1/status/gateway/{identity}/avg_uptime
/v1/status/gateways/detailed
/v1/status/gateways/detailed-unfiltered
/v1/status/mixnode/{mix_id}/report
/v1/status/mixnode/{mix_id}/history
/v1/status/mixnode/{mix_id}/core-status-count
/v1/status/mixnode/{mix_id}/avg_uptime
/v1/status/mixnodes/detailed
/v1/status/mixnodes/detailed-unfiltered
/v1/status/mixnode/{mix_id}/status
/v1/status/mixnode/{mix_id}/reward-estimation
/v1/status/mixnode/{mix_id}/compute-reward-estimation
/v1/status/mixnode/{mix_id}/stake-saturation
/v1/status/mixnode/{mix_id}/inclusion-probability
/v1/status/mixnodes/inclusion_probability
/v1/status/mixnodes/rewarded/detailed
/v1/status/mixnodes/active/detailed
Nym Nodes
routes - all of the below got deprecated as they will only return legacy mixnode/gateway data:/v1/gateways/described
/v1/mixnodes/described
Unstable Nym Nodes Routes
:/v1/unstable/nym-nodes/mixnodes/skimmed
- due to inconsistency in behaviour (i.e. active vs all) it is now redirected to/v1/unstable/nym-nodes/mixnodes/skimmed/active
and unwraps the pagination/v1/unstable/nym-nodes/gateways/skimmed
- due to inconsistency in behaviour (i.e. active vs all) it is now redirected to/v1/unstable/nym-nodes/entry-gateways/skimmed/all
and unwraps the paginationChanged:
Unstable Nym Nodes Routes
:/v1/unstable/nym-nodes/skimmed
- now works withexit
parameter/v1/unstable/nym-nodes/skimmed
- introducedno-legacy
flag to ignore legacy mixnodes/gateways (where applicable)/v1/unstable/nym-nodes/skimmed
- will now return ALL nodes if no query parameter is providedMixnet Contract
High Level Changes
Added:
BondMixnode
orBondGateway
messages (messages are getting translated)node_id
node_id
durring the contract migrationRemoved:
Changed:
Transaction Messages Changes
Added:
BondNymNode
- self-explanatoryUnbondNymNode
- self-explanatoryUpdateNodeConfig
- works asUpdateMixnodeConfig
; it lets you change your announced host or http api portMigrateMixnode
- migrate your existing legacy mixnode into a Nym NodeMigrateGateway
- migrate your exsting legacy gasteway into a Nym Node. enables staking and rewardingAssignRoles
- an additional step for epoch transition transactions. think of it as a replacement forAdvanceCurrentEpoch
. it assigns nodes to particular roles for the given epochRemoved:
CreateFamily
,JoinFamily
,LeaveFamily
,KickFamilyMember
,CreateFamilyOnBehalf
,JoinFamilyOnBehalf
,LeaveFamilyOnBehalf
,KickFamilyMemberOnBehalf
UpdateActiveSetSize
- the rewarded/active set are now based on the role distributionAssignNodeLayer
- we're no longer explicitly assigning roles to all mixnodes, instead they get assigned mixing rolesAdvanceCurrentEpoch
- the logic for advancing the epoch/assining active set has changed so this message was removedRenamed/Changed:
UpdateMixnodeCostParams
- is now calledUpdateCostParams
. Old variant, however, should still work through the magic ofserde
DelegateToMixnode
- is now calledDelegate
with themix_id
field being replaced bynode_id
. Old variant, however, should still work through the magic ofserde
UndelegateFromMixnode
- is now calledUndelegate
with themix_id
field being replaced bynode_id
. Old variant, however, should still work through the magic ofserde
RewardMixnode
- is now calledRewardNode
with themix_id
field being replaced bynode_id
. Old variant, however, should still work through the magic ofserde
WithdrawDelegatorReward
- themix_id
field is replaced bynode_id
. Old variant, however, should still work through the magic ofserde
Query Changes
Added:
GetPreassignedGatewayIds
- getnode_id
of an unmigrated legacy gateway that got assigned during contract migrationGetNymNodeBondsPaged
GetNymNodesDetailedPaged
GetUnbondedNymNode
GetUnbondedNymNodesPaged
GetUnbondedNymNodesByOwnerPaged
GetUnbondedNymNodesByIdentityKeyPaged
GetOwnedNymNode
GetNymNodeDetails
GetNymNodeDetailsByIdentityKey
GetNodeRewardingDetails
GetNodeStakeSaturation
GetRoleAssignment
- get list ofnode_id
of nodes that got assigned particular role for this epochGetRewardedSetMetadata
- get metadata associated with the current rewarded set, such as number of nodes for given role, highest id, etc. not really useful for "average" userGetNodeStakeSaturation
- works the same way as oldMixStakeSaturationResponse
, but the response is ever so slightly differentGetPendingOperatorReward
. it differs fromGetPendingNodeOperatorReward
Removed:
GetRewardedSet
GetLayerDistribution
Renamed/Changed:
GetMixnodeDelegations
- is now calledGetNodeDelegations
with themix_id
field being replaced bynode_id
. Old variant, however, should still work through the magic ofserde
GetPendingMixNodeOperatorReward
- is now calledGetPendingNodeOperatorReward
with themix_id
field being replaced bynode_id
. Old variant, however, should still work through the magic ofserde
This change is