make missing docs a warning
This commit is contained in:
parent
f0691efc5c
commit
0178d09b79
2
TODO.md
2
TODO.md
@ -58,8 +58,8 @@
|
|||||||
- we can improve this by only publishing the synced connections once a threshold of total available soft and hard limits is passed. how can we do this without hammering redis? at least its only once per block per server
|
- we can improve this by only publishing the synced connections once a threshold of total available soft and hard limits is passed. how can we do this without hammering redis? at least its only once per block per server
|
||||||
- [x] instead of tracking `pending_synced_connections`, have a mapping of where all connections are individually. then each change, re-check for consensus.
|
- [x] instead of tracking `pending_synced_connections`, have a mapping of where all connections are individually. then each change, re-check for consensus.
|
||||||
- [x] synced connections swap threshold set to 1 so that it always serves something
|
- [x] synced connections swap threshold set to 1 so that it always serves something
|
||||||
- [ ] basic request method stats
|
|
||||||
- [ ] nice output when cargo doc is run
|
- [ ] nice output when cargo doc is run
|
||||||
|
- [ ] basic request method stats
|
||||||
|
|
||||||
## V1
|
## V1
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
use bb8_redis::redis::cmd;
|
use bb8_redis::redis::cmd;
|
||||||
|
|
||||||
pub use bb8_redis::redis::RedisError;
|
pub use bb8_redis::redis::RedisError;
|
||||||
|
@ -44,9 +44,11 @@ struct SyncedConnections {
|
|||||||
impl fmt::Debug for SyncedConnections {
|
impl fmt::Debug for SyncedConnections {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
// TODO: the default formatter takes forever to write. this is too quiet though
|
// TODO: the default formatter takes forever to write. this is too quiet though
|
||||||
|
// TODO: print the actual conns?
|
||||||
f.debug_struct("SyncedConnections")
|
f.debug_struct("SyncedConnections")
|
||||||
.field("head_num", &self.head_block_num)
|
.field("head_num", &self.head_block_num)
|
||||||
.field("head_hash", &self.head_block_hash)
|
.field("head_hash", &self.head_block_hash)
|
||||||
|
.field("num_conns", &self.conns.len())
|
||||||
.finish_non_exhaustive()
|
.finish_non_exhaustive()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -702,6 +704,9 @@ impl Web3Connections {
|
|||||||
// TODO: default_min_soft_limit? without, we start serving traffic at the start too quickly
|
// TODO: default_min_soft_limit? without, we start serving traffic at the start too quickly
|
||||||
// let min_soft_limit = total_soft_limit / 2;
|
// let min_soft_limit = total_soft_limit / 2;
|
||||||
let min_soft_limit = 1;
|
let min_soft_limit = 1;
|
||||||
|
let num_possible_heads = rpcs_by_hash.len();
|
||||||
|
|
||||||
|
trace!(?rpcs_by_hash);
|
||||||
|
|
||||||
struct State<'a> {
|
struct State<'a> {
|
||||||
block: &'a Arc<Block<TxHash>>,
|
block: &'a Arc<Block<TxHash>>,
|
||||||
@ -724,8 +729,6 @@ impl Web3Connections {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trace!(?rpcs_by_hash);
|
|
||||||
|
|
||||||
// TODO: i'm always getting None
|
// TODO: i'm always getting None
|
||||||
if let Some(x) = rpcs_by_hash
|
if let Some(x) = rpcs_by_hash
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@ -773,9 +776,11 @@ impl Web3Connections {
|
|||||||
best_head_hash
|
best_head_hash
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
// TODO: this isn't necessarily a fork. this might just be an rpc being slow
|
||||||
|
// TODO: log all the heads?
|
||||||
warn!(
|
warn!(
|
||||||
"chain is forked! {} possible heads. {}/{}/{}/{} rpcs have {}",
|
"chain is forked! {} possible heads. {}/{}/{}/{} rpcs have {}",
|
||||||
"?", // TODO: how should we get this?
|
num_possible_heads,
|
||||||
best_rpcs.len(),
|
best_rpcs.len(),
|
||||||
synced_rpcs.len(),
|
synced_rpcs.len(),
|
||||||
connection_heads.len(),
|
connection_heads.len(),
|
||||||
@ -805,6 +810,7 @@ impl Web3Connections {
|
|||||||
if new_head_block {
|
if new_head_block {
|
||||||
self.chain.add_block(new_block.clone(), true);
|
self.chain.add_block(new_block.clone(), true);
|
||||||
|
|
||||||
|
// TODO: include the fastest rpc here?
|
||||||
info!(
|
info!(
|
||||||
"{}/{} rpcs at {} ({}). publishing new head!",
|
"{}/{} rpcs at {} ({}). publishing new head!",
|
||||||
pending_synced_connections.conns.len(),
|
pending_synced_connections.conns.len(),
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
#![forbid(unsafe_code)]
|
//! Run the web3 proxy
|
||||||
|
|
||||||
mod app;
|
#![forbid(unsafe_code)]
|
||||||
mod bb8_helpers;
|
#![warn(missing_docs)]
|
||||||
mod config;
|
|
||||||
mod connection;
|
|
||||||
mod connections;
|
|
||||||
mod firewall;
|
|
||||||
mod frontend;
|
|
||||||
mod jsonrpc;
|
|
||||||
|
|
||||||
use parking_lot::deadlock;
|
use parking_lot::deadlock;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
@ -18,8 +12,9 @@ use tokio::runtime;
|
|||||||
use tracing::{debug, info};
|
use tracing::{debug, info};
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
use crate::app::{flatten_handle, Web3ProxyApp};
|
use web3_proxy::app::{flatten_handle, Web3ProxyApp};
|
||||||
use crate::config::{AppConfig, CliConfig};
|
use web3_proxy::config::{AppConfig, CliConfig};
|
||||||
|
use web3_proxy::frontend;
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
shutdown_receiver: flume::Receiver<()>,
|
shutdown_receiver: flume::Receiver<()>,
|
||||||
@ -148,7 +143,7 @@ mod tests {
|
|||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use crate::config::{RpcSharedConfig, Web3ConnectionConfig};
|
use web3_proxy::config::{RpcSharedConfig, Web3ConnectionConfig};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user