rpc: make z_importkey generic over Chain#505
Closed
oxarbitrage wants to merge 1 commit into
Closed
Conversation
nuttycom
reviewed
Jun 23, 2026
Comment on lines
+156
to
+163
| LegacyCode::Database.with_message(format!( | ||
| "Failed to get treestate at height {treestate_height}: {e}" | ||
| )) | ||
| })? | ||
| .ok_or_else(|| { | ||
| LegacyCode::Database.with_message(format!( | ||
| "Failed to get treestate at height {treestate_height}: above chain tip" | ||
| )) |
Contributor
Contributor
Author
|
Closing in favor of #506 |
This file contains hidden or 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
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.
Fixes the
mainbuild, which broke after #400 (z_importkey/z_exportkey) merged.#400's CI last ran 2026-06-08, before the "make the JSON-RPC layer generic over Chain" refactor landed on
main(2026-06-19 … 06-22, #492). That refactor turnedself.chain()into a genericC: Chain, but #400'simport_key::calland itsfetch_account_birthdayhelper still took a concreteFetchServiceSubscriber. The two were textually mergeable but type-incompatible, so once both were onmainthe build failed with:This migrates
import_key::callandfetch_account_birthdayto the genericChain/ChainViewAPI, mirroring the pattern the refactor applied to the other RPC methods (e.g.get_new_account):fetch_account_birthdaynow snapshots the chain and reads the treestate viaChainView::tree_state_as_of, building the birthday from the resultingChainState.Verified locally on current
main:cargo build -p zallet,cargo clippy -p zallet --all-targets,cargo fmt --check, andcargo test -p zallet import_keyall pass.🤖 Generated with Claude Code