Closed Doy-lee closed 2 months ago
The staking_requirement was also not serialized to disk (so once the node restarts that value gets set to 0) and when the exit is processed, the stake amount to return gets clamped to 0.
I'm not seeing this happen on current dev
: staking_requirement seems to get preserved across a restart.
Edit: Oh, wait, I see: this is only for recently removed nodes (and I was looking at currently registered nodes).
Resyncing mainnet failed the payment validation check; pushed a fix.
Added the fixes and bumped the version to 11.0.5
Currently the network has the incorrect stake amounts to unlock to operators because the stake amount was not correctly multiplied by
BATCH_REWARD_FACTOR
when inserted into the SQL DB. Thestaking_requirement
was also not serialized to disk (so once the node restarts that value gets set to0
) and when the exit is processed, the stake amount to return gets clamped to0
. Right now only 2 exits have been done on the network which are from my nodes.This patch fixes that and increments the version of the SNL which will trigger everyone to recalculate the values in the DB and the metadata (and correctly store the
staking_requirement
).If the network tries to claim now there'll be inconsistencies in the amount of rewards claimable by the operator (me) and the aggregation will fail. The more operators that upgrade the better as the BLS aggregation will have less non-signers and more nodes with this patch will agree on the correct amounts to return.
Additionally noticed another adjacent bug where if you had multiple exits in the one block, only the first stake would get queued for unlocking and the rest was dropped due to an insert conflict.
More specifically:
(eth_address, payout_height)
which meant that if you had multiple stakes returning on the same height, it'd just completely ignore the payment, and hence incorrectly return only the first stake that you unlocked. Fixed this by adding a deconflict step to sum the amounts if they do.More broadly, at a higher level the primary key looks out of place since the table is not really relational but it did help catch this error and the end result of coalescing rows is more ideal than having individual rows for each payment.
BlockchainSQLite::reset_database()
was not dropping some tables causing left-over data to persist in the DB which caused the regeneration of data to fail. So we now drop thedelayed_payments
table and set theheight
to0
.Fix
service_node_list::public_key_lookup
not searching therecently_removed_nodes
list. The code path that relies on this fix is purely cosmetic and is used to log to the log files, so no repercussions here.In the
recently_removed_nodes
instead of just pulling out individual fields from theservice_node_info
on erase, store the whole struct which is useful for populating the BLS endpoints that end-user applications consume and helps them maintain a consistent view of a node as it transitions out of the network.The exit code was not storing the stake amounts into the DB in the correct units. I've introduced a
sql_db_money
which strongly types the units so that the conversion of monetary units is explicit at the DB interface.