-
Notifications
You must be signed in to change notification settings - Fork 17
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
Revert AuthorityStore
deprecated functions to fix AuthorityStore::multi_get_transaction_checkpoint
#4164
Revert AuthorityStore
deprecated functions to fix AuthorityStore::multi_get_transaction_checkpoint
#4164
Conversation
AuthorityStore
deprecated functions to fix AuthorityStore ::multi_get_transaction_checkpoint
AuthorityStore
deprecated functions to fix AuthorityStore::multi_get_transaction_checkpoint
As discussed in the call, if those things are actually needed and not deprecated, please remove all "deprecated" comments and function names, and add a proper description why the database table is needed. Then please sync the state from genesis with an old commit of the codebase, then apply this fix and restart the node to check if the node crashes, or if the newly added table works fine. @alexsporn We should discuss if a "migration step or tool" is needed to fill that info in the perpetual table, or if the lack of the info for the old transactions is not that big of a problem. In my opinion it would get pruned at some point anyway, or nodes that want to keep all history could simply resync from genesis after applying that fix, to have the fixed state. |
Thanks @muXxer for the test plan, I addressed them and did 3 different testings in 7347932 locally. All of them passed, and I put the details here. @semenov-vladyslav will add comments and do renaming, then I will test the new commit again. Also need to check if we can query the tx digest which belongs to the previous epoch. |
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.
The test patch documented in #4154 is not actually merged on develop
. I will push a more polished version promptly here if you don't mind.
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.
Added the test with 60c8182. Ran it locally, so once the CI passes this is good to go
After an in person discussion with @miker83z we decided to investigate first how this information is fetched via graphql RPC, before we reintroduce these mappings in the database just for the json-rpc. Maybe there is a way without using the table. |
Graphql uses iota-indexer to process queries, it is the job of iota-indexer to maintain the DB, iota-indexer runs iota-node with rest_api enabled which in turn enables |
GraphQL uses the indexer database, as does the Indexer RPC that return the expected information. The node tables do not enter the equation. |
…cated after previous revert
60c8182
to
f26162b
Compare
Description of change
Together with @semenov-vladyslav to investigate the
AuthorityStore
deprecated codes again, and in order to enable get theCheckpointSequenceNumber
by the transaction digest, the old deprecated codes need to be reverted, because there is no other tables storing the relationship between thedigest
andepochId
, ordigest
andCheckpointSequenceNumber
in old epochs. Also thedeprecated_multi_get_transaction_checkpoint
/deprecated_get_transaction_checkpoint
/deprecated_insert_finalized_transactions
/executed_transactions_to_checkpoint
/checkpoint_cache
are coupled together. The easiest/safest way might be just to revert them back.Investigation
The error is triggered in JSON RPC
ReadApi
impl ofget_transaction_block
: the API response contains checkpoint sequence number and timestamp (of the checkpoint) which are fetched fromAuthorityPerpetualTables::executed_transactions_to_checkpoint
DB table via a number of traits and wrappers. The table is not used for any other purposes and was marked as deprecated (together with a number of related functions and trait methods that support this table) in favor ofAuthorityEpochTables::executed_transactions_to_checkpoint
which gets cleared after each epoch. The reason for deprecation is unclear. Maybe, the JSON RPC ReadApi was expected to change (eg. get rid of checkpoint sequence number), or the implementation was expected to change and not use the mentioned table.AuthorityState::rest_index
that might have the required info (it seems to be duplicated), but it is only optionally enabled, so we can't rely on it unconditionally.So the only reasonable option is to revert the RP that removed the table and deprecated API. And rename functions to make it clearer that the checkpoint info is fetched from perpetual table and add a few comments explaining these few implementation details.
As for the testnet the simplest solutions is to resync nodes from genesis.
Links to any relevant issues
Fixed #4154
Type of change
How the change has been tested
Local Testing
Passed the testing
cargo nextest run -p iota-json-rpc-tests -E "test(#get_transaction_block)"
locally.Nextest run ID a45927f8-cf75-464b-a4ea-a5110d5a6d8e with nextest profile: default Starting 1 test across 10 binaries (148 tests skipped) PASS [ 14.656s] iota-json-rpc-tests::read_api get_transaction_block
Sync from Genesis Testing
db/live
foldercargo run --release --bin iota-node -- --config-path fullnode.yaml
Sync in the middle of the epoch testing
iotaledger/iota-node:v0.7.2-rc
image to sync to the last checkpoint.live
foldercargo run --release --bin iota-node -- --config-path fullnode.yaml
Change checklist
Tick the boxes that are relevant to your changes, and delete any items that are not.