Skip to content

Conversation

@CreeptoGengar
Copy link

Adds RPC support to DataStore for lazy loading of note scripts and foreign account inputs when not found locally.

  • Add optional RPC client to ClientDataStore
  • Implement lazy loading with RPC fallback in get_note_script() and get_foreign_account_inputs()
  • Update all instantiations to use RPC client

Resolves #1456

Copy link
Contributor

@mmagician mmagician left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also make sure to run lint jobs to clear the CI jobs?

Ok(note_script)
},
Err(rpc_err) => Err(DataStoreError::other(format!(
"Note script with root {script_root} not found locally or via RPC: {rpc_err}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this error message should not say "locally" since it's within the rpc-call match statement

Comment on lines 280 to 287
if let Err(err) = store
.upsert_note_scripts(core::slice::from_ref(&note_script))
.await
{
// Log but don't fail - we still have the script to return
// In a no_std environment, we can't easily log, so we just continue
let _ = err;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be good to understand the situation(s) when a script cannot be upserted and handle those error cases. It's a bit weird if we are able to fetch the script but not upsert it.
Also, at this point upsert shouldn't be necessary (we know it's not in the store, right?), is a pure insert available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider RPC-enabled DataStore

2 participants