Add BEEFY `latestFinalized` RPC and deduplicate code between BEEFY and GRANDPA (#10568)
* beefy: add dummy latest_finalized() RPC * beefy: rpc latest_best_beefy() using shared mem * beefy: rpc populate latest_best_beefy() * beefy: rpc handle readiness * beefy: best block over channel - wip Not working because channel can't be simply opened and receiver passed to `rpc_extensions_builder` because `rpc_extensions_builder` has to be `Fn` and not `FnOnce`... and and Receiver side of mpsc can't be cloned yay!.. * beefy: make notification channels payload-agnostic * beefy: use notification mechanism instead of custom channel * beefy: add tracing key to notif channels * sc-utils: add notification channel - wip * beefy: use sc-utils generic notification channel * grandpa: use sc-utils generic notification channel * fix grumbles * beefy-rpc: get best block header instead of number * beefy-rpc: rename to `beefy_getFinalizedHead` * fix nitpicks * client-rpc-notifications: move generic Error from struct to fn * beefy: use header from notification instead of getting from database * beefy-rpc: get best block hash instead of header * beefy-rpc: fix and improve latestHead test * beefy-rpc: bubble up errors from rpc-handler instantiation * update lockfile * Apply suggestions from code review Co-authored-by:André Silva <123550+andresilva@users.noreply.github.com> * fix errors and warnings * fix nit Co-authored-by:
André Silva <123550+andresilva@users.noreply.github.com>
Showing
- substrate/Cargo.lock 40 additions, 0 deletionssubstrate/Cargo.lock
- substrate/client/beefy/rpc/Cargo.toml 4 additions, 0 deletionssubstrate/client/beefy/rpc/Cargo.toml
- substrate/client/beefy/rpc/src/lib.rs 167 additions, 17 deletionssubstrate/client/beefy/rpc/src/lib.rs
- substrate/client/beefy/rpc/src/notification.rs 4 additions, 4 deletionssubstrate/client/beefy/rpc/src/notification.rs
- substrate/client/beefy/src/lib.rs 7 additions, 1 deletionsubstrate/client/beefy/src/lib.rs
- substrate/client/beefy/src/notification.rs 27 additions, 84 deletionssubstrate/client/beefy/src/notification.rs
- substrate/client/beefy/src/worker.rs 32 additions, 10 deletionssubstrate/client/beefy/src/worker.rs
- substrate/client/finality-grandpa/rpc/src/lib.rs 1 addition, 1 deletionsubstrate/client/finality-grandpa/rpc/src/lib.rs
- substrate/client/finality-grandpa/src/notification.rs 10 additions, 77 deletionssubstrate/client/finality-grandpa/src/notification.rs
- substrate/client/utils/Cargo.toml 4 additions, 0 deletionssubstrate/client/utils/Cargo.toml
- substrate/client/utils/src/lib.rs 1 addition, 0 deletionssubstrate/client/utils/src/lib.rs
- substrate/client/utils/src/notification.rs 151 additions, 0 deletionssubstrate/client/utils/src/notification.rs
Please register or sign in to comment