From 937277eff03a182ae21dec926fd64ef6af5ea763 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Mon, 14 Jan 2019 15:41:45 +0100 Subject: [PATCH 1/8] Rename all remaining TODO's as FIXME's --- core/basic-authorship/src/basic_authorship.rs | 2 +- core/client/db/src/lib.rs | 10 ++++----- core/client/db/src/light.rs | 4 ++-- core/client/db/src/storage_cache.rs | 2 +- core/client/src/call_executor.rs | 2 +- core/client/src/client.rs | 22 +++++++++---------- core/client/src/error.rs | 2 +- core/client/src/light/blockchain.rs | 2 +- core/consensus/common/src/import_queue.rs | 4 ++-- core/consensus/rhd/src/lib.rs | 10 ++++----- core/executor/src/native_executor.rs | 2 +- core/executor/src/wasm_executor.rs | 2 +- core/finality-grandpa/src/lib.rs | 2 +- core/keystore/src/lib.rs | 2 +- core/network-libp2p/src/node_handler.rs | 18 +++++++-------- core/network-libp2p/src/service_task.rs | 14 ++++++------ core/network-libp2p/src/swarm.rs | 8 +++---- core/network-libp2p/src/topology.rs | 20 ++++++++--------- core/network-libp2p/src/traits.rs | 2 +- core/network/src/consensus_gossip.rs | 2 +- core/network/src/on_demand.rs | 2 +- core/network/src/protocol.rs | 4 ++-- core/primitives/src/changes_trie.rs | 2 +- core/primitives/src/ed25519.rs | 2 +- core/rpc/src/chain/number.rs | 2 +- core/service/src/components.rs | 6 ++--- core/service/src/lib.rs | 2 +- core/sr-io/with_std.rs | 2 +- core/sr-io/without_std.rs | 4 ++-- .../src/generic/unchecked_extrinsic.rs | 2 +- .../unchecked_mortal_compact_extrinsic.rs | 2 +- .../src/generic/unchecked_mortal_extrinsic.rs | 2 +- core/sr-primitives/src/lib.rs | 14 ++++++------ core/state-db/src/noncanonical.rs | 2 +- core/state-machine/src/backend.rs | 4 ++-- .../src/changes_trie/changes_iterator.rs | 2 +- core/state-machine/src/changes_trie/prune.rs | 2 +- core/state-machine/src/ext.rs | 2 +- core/state-machine/src/proving_backend.rs | 2 +- core/state-machine/src/trie_backend.rs | 8 +++---- .../state-machine/src/trie_backend_essence.rs | 2 +- core/test-client/src/lib.rs | 2 +- core/transaction-pool/graph/src/lib.rs | 2 +- core/transaction-pool/graph/src/pool.rs | 2 +- core/transaction-pool/src/api.rs | 2 +- core/trie/src/lib.rs | 6 ++--- core/trie/src/node_codec.rs | 4 ++-- core/trie/src/trie_stream.rs | 2 +- node/cli/src/chain_spec.rs | 2 +- node/cli/src/lib.rs | 2 +- srml/aura/src/lib.rs | 2 +- srml/balances/src/lib.rs | 2 +- srml/consensus/src/lib.rs | 2 +- srml/contract/src/exec.rs | 4 ++-- srml/contract/src/lib.rs | 8 +++---- srml/contract/src/vm/mod.rs | 2 +- srml/contract/src/vm/runtime.rs | 2 +- srml/grandpa/src/lib.rs | 4 ++-- srml/session/src/lib.rs | 4 ++-- srml/staking/src/lib.rs | 8 +++---- srml/staking/src/tests.rs | 2 +- srml/support/procedural/src/storage/mod.rs | 4 ++-- srml/support/procedural/tools/src/lib.rs | 2 +- srml/support/src/dispatch.rs | 2 +- srml/support/src/storage/generator.rs | 6 ++--- srml/support/src/storage/mod.rs | 2 +- srml/system/src/lib.rs | 4 ++-- 67 files changed, 143 insertions(+), 143 deletions(-) diff --git a/core/basic-authorship/src/basic_authorship.rs b/core/basic-authorship/src/basic_authorship.rs index e524b6aa9e15d..a0efd6c08f93e 100644 --- a/core/basic-authorship/src/basic_authorship.rs +++ b/core/basic-authorship/src/basic_authorship.rs @@ -214,7 +214,7 @@ impl Proposer where let pending_iterator = self.transaction_pool.ready(); for pending in pending_iterator { - // TODO [ToDr] Probably get rid of it, and validate in runtime. + // FIXME [ToDr] Probably get rid of it, and validate in runtime. let encoded_size = pending.data.encode().len(); if pending_size + encoded_size >= MAX_TRANSACTIONS_SIZE { break } diff --git a/core/client/db/src/lib.rs b/core/client/db/src/lib.rs index f663cc0834d33..7754f33fbc31e 100644 --- a/core/client/db/src/lib.rs +++ b/core/client/db/src/lib.rs @@ -330,7 +330,7 @@ where Block: BlockT, } fn reset_storage(&mut self, mut top: StorageMap, children: ChildrenStorageMap) -> Result { - // TODO: wipe out existing trie. + // FIXME: wipe out existing trie. if top.iter().any(|(k, _)| well_known_keys::is_child_storage_key(k)) { return Err(client::error::ErrorKind::GenesisInvalid.into()); @@ -402,7 +402,7 @@ struct DbGenesisStorage(pub H256); impl DbGenesisStorage { pub fn new() -> Self { let mut root = H256::default(); - let mut mdb = MemoryDB::::default(); // TODO: use new() to make it more correct + let mut mdb = MemoryDB::::default(); // FIXME: use new() to make it more correct state_machine::TrieDBMut::::new(&mut mdb, &mut root); DbGenesisStorage(root) } @@ -803,7 +803,7 @@ impl client::backend::Backend for Backend whe }; if finalized { - // TODO: ensure best chain contains this block. + // FIXME: ensure best chain contains this block. self.note_finalized(&mut transaction, &pending_block.header, hash)?; } else { // canonicalize blocks which are old enough, regardless of finality. @@ -856,7 +856,7 @@ impl client::backend::Backend for Backend whe if let Some(header) = ::client::blockchain::HeaderBackend::header(&self.blockchain, block)? { let mut transaction = DBTransaction::new(); - // TODO: ensure best chain contains this block. + // FIXME: ensure best chain contains this block. let hash = header.hash(); self.note_finalized(&mut transaction, &header, hash.clone())?; if let Some(justification) = justification { @@ -970,7 +970,7 @@ mod tests { fn prepare_changes(changes: Vec<(Vec, Vec)>) -> (H256, MemoryDB) { let mut changes_root = H256::default(); - let mut changes_trie_update = MemoryDB::::default(); // TODO: change to new() to make more correct + let mut changes_trie_update = MemoryDB::::default(); // FIXME: change to new() to make more correct { let mut trie = TrieDBMut::::new( &mut changes_trie_update, diff --git a/core/client/db/src/light.rs b/core/client/db/src/light.rs index cbed1348a93a2..6a179518c4d37 100644 --- a/core/client/db/src/light.rs +++ b/core/client/db/src/light.rs @@ -340,7 +340,7 @@ impl LightBlockchainStorage for LightStorage // update block number to hash lookup entries. for retracted in tree_route.retracted() { if retracted.hash == meta.finalized_hash { - // TODO: can we recover here? + // FIXME: can we recover here? warn!("Safety failure: reverting finalized block {:?}", (&retracted.number, &retracted.hash)); } @@ -437,7 +437,7 @@ impl LightBlockchainStorage for LightStorage fn finalize_header(&self, id: BlockId) -> ClientResult<()> { if let Some(header) = self.header(id)? { let mut transaction = DBTransaction::new(); - // TODO: ensure best chain contains this block. + // FIXME: ensure best chain contains this block. let hash = header.hash(); let number = *header.number(); self.note_finalized(&mut transaction, &header, hash.clone())?; diff --git a/core/client/db/src/storage_cache.rs b/core/client/db/src/storage_cache.rs index 3411987d48cdc..2022aadfc683a 100644 --- a/core/client/db/src/storage_cache.rs +++ b/core/client/db/src/storage_cache.rs @@ -44,7 +44,7 @@ pub type SharedCache = Arc>>; /// Create new shared cache instance with given max memory usage. pub fn new_shared_cache(shared_cache_size: usize) -> SharedCache { - let cache_items = shared_cache_size / 100; // Estimated average item size. TODO: more accurate tracking + let cache_items = shared_cache_size / 100; // Estimated average item size. FIXME: more accurate tracking Arc::new(Mutex::new(Cache { storage: LruCache::new(cache_items), hashes: LruCache::new(cache_items), diff --git a/core/client/src/call_executor.rs b/core/client/src/call_executor.rs index 62104d4aa0e5a..21b8e560b35e1 100644 --- a/core/client/src/call_executor.rs +++ b/core/client/src/call_executor.rs @@ -184,7 +184,7 @@ where manager: ExecutionManager, ) -> Result, error::Error> where ExecutionManager: Clone { let state = self.backend.state_at(*at)?; - //TODO: Find a better way to prevent double block initialization + //FIXME: Find a better way to prevent double block initialization if method != "Core_initialise_block" && initialised_block.map(|id| id != *at).unwrap_or(true) { let header = prepare_environment_block()?; state_machine::execute_using_consensus_failure_handler( diff --git a/core/client/src/client.rs b/core/client/src/client.rs index 8cd0d95f67ea6..e3a6e84f78c73 100644 --- a/core/client/src/client.rs +++ b/core/client/src/client.rs @@ -64,7 +64,7 @@ pub struct Client where Block: BlockT { import_notification_sinks: Mutex>>>, finality_notification_sinks: Mutex>>>, import_lock: Mutex<()>, - importing_block: RwLock>, // holds the block hash currently being imported. TODO: replace this with block queue + importing_block: RwLock>, // holds the block hash currently being imported. FIXME: replace this with block queue block_execution_strategy: ExecutionStrategy, api_execution_strategy: ExecutionStrategy, _phantom: PhantomData, @@ -102,7 +102,7 @@ pub trait BlockBody { } /// Client info -// TODO: split queue info from chain info and amalgamate into single struct. +// FIXME: split queue info from chain info and amalgamate into single struct. #[derive(Debug)] pub struct ClientInfo { /// Best block hash. @@ -296,7 +296,7 @@ impl Client where /// Get the RuntimeVersion at a given block. pub fn runtime_version_at(&self, id: &BlockId) -> error::Result { - // TODO: Post Poc-2 return an error if version is missing + // FIXME: Post Poc-2 return an error if version is missing self.executor.runtime_version(id) } @@ -612,7 +612,7 @@ impl Client where None => (None, None, None) }; - // TODO: non longest-chain rule. + // FIXME: non longest-chain rule. let is_new_best = finalized || match fork_choice { ForkChoiceStrategy::LongestChain => import_headers.post().number() > &last_best_number, ForkChoiceStrategy::Custom(v) => v, @@ -652,7 +652,7 @@ impl Client where if make_notifications { if let Some(storage_changes) = storage_changes { - // TODO [ToDr] How to handle re-orgs? Should we re-emit all storage changes? + // FIXME [ToDr] How to handle re-orgs? Should we re-emit all storage changes? self.storage_notifications.lock() .trigger(&hash, storage_changes.into_iter()); } @@ -717,7 +717,7 @@ impl Client where // if the block is not a direct ancestor of the current best chain, // then some other block is the common ancestor. if route_from_best.common_block().hash != block { - // TODO: reorganize best block to be the best chain containing + // FIXME: reorganize best block to be the best chain containing // `block`. } @@ -782,7 +782,7 @@ impl Client where /// Get block status. pub fn block_status(&self, id: &BlockId) -> error::Result { - // TODO: more efficient implementation + // FIXME: more efficient implementation if let BlockId::Hash(ref h) = id { if self.importing_block.read().as_ref().map_or(false, |importing| h == importing) { return Ok(BlockStatus::Queued); @@ -831,9 +831,9 @@ impl Client where /// If `maybe_max_block_number` is `Some(max_block_number)` /// the search is limited to block `numbers <= max_block_number`. /// in other words as if there were no blocks greater `max_block_number`. - /// TODO [snd] possibly implement this on blockchain::Backend and just redirect here + /// FIXME [snd] possibly implement this on blockchain::Backend and just redirect here /// Returns `Ok(None)` if `target_hash` is not found in search space. - /// TODO [snd] write down time complexity + /// FIXME [snd] write down time complexity pub fn best_containing(&self, target_hash: Block::Hash, maybe_max_number: Option>) -> error::Result> { @@ -893,7 +893,7 @@ impl Client where // waiting until we are <= max_number if let Some(max_number) = maybe_max_number { loop { - // TODO [snd] this should be a panic + // FIXME [snd] this should be a panic let current_header = self.backend.blockchain().header(BlockId::Hash(current_hash.clone()))? .ok_or_else(|| error::Error::from(format!("failed to get header for hash {}", current_hash)))?; @@ -913,7 +913,7 @@ impl Client where return Ok(Some(best_hash)); } - // TODO [snd] this should be a panic + // FIXME [snd] this should be a panic let current_header = self.backend.blockchain().header(BlockId::Hash(current_hash.clone()))? .ok_or_else(|| error::Error::from(format!("failed to get header for hash {}", current_hash)))?; diff --git a/core/client/src/error.rs b/core/client/src/error.rs index 2a793e804945f..6a270f5088dca 100644 --- a/core/client/src/error.rs +++ b/core/client/src/error.rs @@ -144,7 +144,7 @@ error_chain! { } } -// TODO [ToDr] Temporary, state_machine::Error should be a regular error not Box. +// FIXME [ToDr] Temporary, state_machine::Error should be a regular error not Box. impl From> for Error { fn from(e: Box) -> Self { ErrorKind::Execution(e).into() diff --git a/core/client/src/light/blockchain.rs b/core/client/src/light/blockchain.rs index 62e40c579e213..14d528927fc6f 100644 --- a/core/client/src/light/blockchain.rs +++ b/core/client/src/light/blockchain.rs @@ -141,7 +141,7 @@ impl BlockchainHeaderBackend for Blockchain where Bloc impl BlockchainBackend for Blockchain where Block: BlockT, S: Storage, F: Fetcher { fn body(&self, _id: BlockId) -> ClientResult>> { - // TODO [light]: fetch from remote node + // FIXME [light]: fetch from remote node Ok(None) } diff --git a/core/consensus/common/src/import_queue.rs b/core/consensus/common/src/import_queue.rs index 5264b29cef792..9e5ac26121783 100644 --- a/core/consensus/common/src/import_queue.rs +++ b/core/consensus/common/src/import_queue.rs @@ -379,7 +379,7 @@ pub fn import_single_block>( } else { debug!(target: "sync", "Header {} was not provided ", block.hash); } - return Err(BlockImportError::IncompleteHeader(peer)) //TODO: use persistent ID + return Err(BlockImportError::IncompleteHeader(peer)) //FIXME: use persistent ID }, }; @@ -415,7 +415,7 @@ pub fn import_single_block>( }, Ok(ImportResult::KnownBad) => { debug!(target: "sync", "Peer gave us a bad block {}: {:?}", number, hash); - Err(BlockImportError::BadBlock(peer)) //TODO: use persistent ID + Err(BlockImportError::BadBlock(peer)) //FIXME: use persistent ID } Err(e) => { debug!(target: "sync", "Error importing block {}: {:?}: {:?}", number, hash, e); diff --git a/core/consensus/rhd/src/lib.rs b/core/consensus/rhd/src/lib.rs index 6441fb4e34a2f..74bf0acc68a1b 100644 --- a/core/consensus/rhd/src/lib.rs +++ b/core/consensus/rhd/src/lib.rs @@ -460,7 +460,7 @@ impl Drop for BftFuture OutSink: Sink, SinkError=Error>, { fn drop(&mut self) { - // TODO: have a trait member to pass misbehavior reports into. + // FIXME: have a trait member to pass misbehavior reports into. let misbehavior = self.inner.drain_misbehavior().collect::>(); self.inner.context().proposer.import_misbehavior(misbehavior); } @@ -494,7 +494,7 @@ pub struct BftService { live_agreement: Mutex>, round_cache: Arc>>, round_timeout_multiplier: u64, - key: Arc, // TODO: key changing over time. + key: Arc, // FIXME: key changing over time. factory: P, } @@ -516,14 +516,14 @@ impl BftService start_round: 0, })), round_timeout_multiplier: 10, - key: key, // TODO: key changing over time. + key: key, // FIXME: key changing over time. factory, } } /// Get the local Authority ID. pub fn local_id(&self) -> AuthorityId { - // TODO: based on a header and some keystore. + // FIXME: based on a header and some keystore. self.key.public().into() } @@ -1112,7 +1112,7 @@ impl BaseProposer<::Block> for Proposer where self.transaction_pool.ready(|pending_iterator| { let mut pending_size = 0; for pending in pending_iterator { - // TODO [ToDr] Probably get rid of it, and validate in runtime. + // FIXME [ToDr] Probably get rid of it, and validate in runtime. let encoded_size = pending.data.encode().len(); if pending_size + encoded_size >= MAX_TRANSACTIONS_SIZE { break } diff --git a/core/executor/src/native_executor.rs b/core/executor/src/native_executor.rs index 09606bc904f7b..52b7193a7048f 100644 --- a/core/executor/src/native_executor.rs +++ b/core/executor/src/native_executor.rs @@ -219,7 +219,7 @@ macro_rules! native_executor_instance { native_executor_instance!(IMPL $name, $dispatcher, $version, $code); }; (IMPL $name:ident, $dispatcher:path, $version:path, $code:expr) => { - // TODO: this is not so great – I think I should go back to have dispatch take a type param and modify this macro to accept a type param and then pass it in from the test-client instead + // FIXME: this is not so great – I think I should go back to have dispatch take a type param and modify this macro to accept a type param and then pass it in from the test-client instead use primitives::Blake2Hasher as _Blake2Hasher; impl $crate::NativeExecutionDispatch for $name { fn native_equivalent() -> &'static [u8] { diff --git a/core/executor/src/wasm_executor.rs b/core/executor/src/wasm_executor.rs index 60e2c84b1eb5a..5819c07b8ec53 100644 --- a/core/executor/src/wasm_executor.rs +++ b/core/executor/src/wasm_executor.rs @@ -138,7 +138,7 @@ impl ReadPrimitive for MemoryInstance { } } -// TODO: this macro does not support `where` clauses and that seems somewhat tricky to add +// FIXME: this macro does not support `where` clauses and that seems somewhat tricky to add impl_function_executor!(this: FunctionExecutor<'e, E>, ext_print_utf8(utf8_data: *const u8, utf8_len: u32) => { if let Ok(utf8) = this.memory.get(utf8_data, utf8_len as usize) { diff --git a/core/finality-grandpa/src/lib.rs b/core/finality-grandpa/src/lib.rs index aacee8fe7d78a..b2bc701d7bd8e 100644 --- a/core/finality-grandpa/src/lib.rs +++ b/core/finality-grandpa/src/lib.rs @@ -517,7 +517,7 @@ impl, N, RA> voter::Environment( round, self.set_id, diff --git a/core/keystore/src/lib.rs b/core/keystore/src/lib.rs index baeeab27556d7..61050e7b48a32 100644 --- a/core/keystore/src/lib.rs +++ b/core/keystore/src/lib.rs @@ -66,7 +66,7 @@ pub struct InvalidPassword; struct EncryptedKey { mac: [u8; 32], salt: [u8; 32], - ciphertext: Vec, // TODO: switch to fixed-size when serde supports + ciphertext: Vec, // FIXME: switch to fixed-size when serde supports iv: [u8; 16], iterations: u32, } diff --git a/core/network-libp2p/src/node_handler.rs b/core/network-libp2p/src/node_handler.rs index ad1f4b7504a62..ff95f459f7517 100644 --- a/core/network-libp2p/src/node_handler.rs +++ b/core/network-libp2p/src/node_handler.rs @@ -159,7 +159,7 @@ pub enum SubstrateOutEvent { /// The remote wants us to answer a Kademlia `FIND_NODE` request. /// /// The `responder` should be used to answer that query. - // TODO: this API with the "responder" is bad, but changing it requires modifications in libp2p + // FIXME: this API with the "responder" is bad, but changing it requires modifications in libp2p KadFindNode { /// The value being searched. searched: PeerId, @@ -203,7 +203,7 @@ impl IdentificationRequest { listen_addrs: Vec, remote_addr: &Multiaddr ) where TSubstream: AsyncRead + AsyncWrite + Send + 'static { - // TODO: what to return for `protocol_version` and `agent_version`? + // FIXME: what to return for `protocol_version` and `agent_version`? let sender = self.sender.send( identify::IdentifyInfo { public_key: local_key, @@ -233,7 +233,7 @@ pub enum SubstrateInEvent { }, /// Requests to open a Kademlia substream. - // TODO: document better + // FIXME: document better OpenKademlia, } @@ -247,7 +247,7 @@ macro_rules! listener_upgrade { upgrade::map(KadConnecConfig::new(), move |(c, s)| FinalUpgrade::Kad(c, s))), upgrade::map(ping::protocol::Ping::default(), move |p| FinalUpgrade::from(p))), upgrade::map(identify::IdentifyProtocolConfig, move |i| FinalUpgrade::from(i))) - // TODO: meh for cloning a Vec here + // FIXME: meh for cloning a Vec here ) } @@ -321,7 +321,7 @@ where TSubstream: AsyncRead + AsyncWrite + Send + 'static, match purpose { UpgradePurpose::Custom(id) => { let wanted = if let Some(proto) = self.registered_custom.find_protocol(id) { - // TODO: meh for cloning + // FIXME: meh for cloning upgrade::map(proto.clone(), move |c| FinalUpgrade::Custom(c)) } else { error!(target: "sub-libp2p", "Logic error: wrong custom protocol id for \ @@ -370,13 +370,13 @@ where TSubstream: AsyncRead + AsyncWrite + Send + 'static, }, SubstrateInEvent::OpenKademlia => self.open_kademlia(), SubstrateInEvent::Accept => { - // TODO: implement + // FIXME: implement }, } } fn shutdown(&mut self) { - // TODO: close gracefully + // FIXME: close gracefully self.is_shutting_down = true; for custom_proto in &mut self.custom_protocols_substreams { @@ -390,7 +390,7 @@ where TSubstream: AsyncRead + AsyncWrite + Send + 'static, fn poll(&mut self) -> Poll>, IoError> { if self.is_shutting_down { - // TODO: finish only when everything is closed + // FIXME: finish only when everything is closed return Ok(Async::Ready(None)); } @@ -645,7 +645,7 @@ where TSubstream: AsyncRead + AsyncWrite + Send + 'static, Ok(Async::NotReady) => self.upgrades_in_progress_dial.push((purpose, in_progress)), Err(err) => { - // TODO: dispatch depending on actual error ; right now we assume that + // FIXME: dispatch depending on actual error ; right now we assume that // error == not supported, which is not necessarily true in theory if let UpgradePurpose::Custom(_) = purpose { return Ok(Async::Ready(Some(SubstrateOutEvent::Useless))); diff --git a/core/network-libp2p/src/service_task.rs b/core/network-libp2p/src/service_task.rs index 5fd03caa4b200..1bfd5088ddef2 100644 --- a/core/network-libp2p/src/service_task.rs +++ b/core/network-libp2p/src/service_task.rs @@ -144,7 +144,7 @@ where TProtos: IntoIterator { } }, Err(_) => - // TODO: also handle the `IP:PORT` format ; however we need to somehow add the + // FIXME: also handle the `IP:PORT` format ; however we need to somehow add the // reserved ID to `reserved_peers` at some point warn!(target: "sub-libp2p", "Not a valid reserved node address: {}", reserved), } @@ -257,13 +257,13 @@ pub struct Service { topology: NetTopology, /// Handles the Kademlia queries. - // TODO: put the kbuckets in the topology instead + // FIXME: put the kbuckets in the topology instead kad_system: KadSystem, /// List of Kademlia controller we want to open. /// /// A clone of tihs `Arc` is stored in each Kademlia query stream. - // TODO: use a better container? + // FIXME: use a better container? kad_pending_ctrls: Arc>>>>, /// Sender whenever we inserted an entry in `kad_pending_ctrls`, so that we can process it. @@ -374,7 +374,7 @@ impl Service { } /// Sends a message to a peer using the custom protocol. - // TODO: report invalid node index or protocol? + // FIXME: report invalid node index or protocol? pub fn send_custom_message( &mut self, node_index: NodeIndex, @@ -418,7 +418,7 @@ impl Service { ) { let peer_id = match self.swarm.peer_id_of_node(node_index) { Some(pid) => pid.clone(), - None => return, // TODO: report? + None => return, // FIXME: report? }; // Kill the node from the swarm, and inject an event about it. @@ -563,7 +563,7 @@ impl Service { } } }) - // TODO: we really want to remove nodes with no multiaddress from + // FIXME: we really want to remove nodes with no multiaddress from // the results, but a flaw in the Kad protocol of libp2p makes it // impossible to return empty results ; therefore we must at least // return ourselves @@ -846,7 +846,7 @@ impl Service { } Ok(Async::NotReady) => return Ok(Async::NotReady), Ok(Async::Ready(None)) => unreachable!("The Swarm stream never ends"), - // TODO: this `Err` contains a `Void` ; remove variant when Rust allows that + // FIXME: this `Err` contains a `Void` ; remove variant when Rust allows that Err(_) => unreachable!("The Swarm stream never errors"), } } diff --git a/core/network-libp2p/src/swarm.rs b/core/network-libp2p/src/swarm.rs index 0a6bfaa994938..772a3119664d2 100644 --- a/core/network-libp2p/src/swarm.rs +++ b/core/network-libp2p/src/swarm.rs @@ -155,7 +155,7 @@ pub enum SwarmEvent { }, /// Opened a Kademlia substream with the node. - // TODO: the controller API is bad, but we need to make changes in libp2p to improve that + // FIXME: the controller API is bad, but we need to make changes in libp2p to improve that KadOpen { /// Index of the node. node_index: NodeIndex, @@ -166,7 +166,7 @@ pub enum SwarmEvent { /// The remote wants us to answer a Kademlia `FIND_NODE` request. /// /// The `responder` should be used to answer that query. - // TODO: this API with the "responder" is bad, but changing it requires modifications in libp2p + // FIXME: this API with the "responder" is bad, but changing it requires modifications in libp2p KadFindNode { /// Index of the node that wants an answer. node_index: NodeIndex, @@ -285,7 +285,7 @@ impl Swarm { } /// Sends a message to a peer using the custom protocol. - // TODO: report invalid node index or protocol? + // FIXME: report invalid node index or protocol? pub fn send_custom_message( &mut self, node_index: NodeIndex, @@ -346,7 +346,7 @@ impl Swarm { /// /// Returns an error if the node index is invalid, or if it was already accepted. pub fn accept_node(&mut self, node_index: NodeIndex) -> Result<(), ()> { - // TODO: detect if already accepted? + // FIXME: detect if already accepted? let peer_id = match self.nodes_info.get(&node_index) { Some(info) => &info.peer_id, None => return Err(()) diff --git a/core/network-libp2p/src/topology.rs b/core/network-libp2p/src/topology.rs index 061a3d1795687..85c90c8962b2a 100644 --- a/core/network-libp2p/src/topology.rs +++ b/core/network-libp2p/src/topology.rs @@ -58,7 +58,7 @@ const FAIL_BACKOFF_MULTIPLIER: u32 = 2; /// We need a maximum value for the backoff, overwise we risk an overflow. const MAX_BACKOFF: Duration = Duration::from_secs(30 * 60); -// TODO: should be merged with the Kademlia k-buckets +// FIXME: should be merged with the Kademlia k-buckets /// Stores information about the topology of the network. #[derive(Debug)] @@ -111,7 +111,7 @@ impl NetTopology { }; let file = fs::File::create(path)?; - // TODO: the capacity of the BufWriter is kind of arbitrary ; decide better + // FIXME: the capacity of the BufWriter is kind of arbitrary ; decide better serialize(BufWriter::with_capacity(1024 * 1024, file), &self.store) } @@ -142,7 +142,7 @@ impl NetTopology { let peer = if let Some(peer) = self.store.get(peer) { peer } else { - // TODO: use an EitherIterator or something + // FIXME: use an EitherIterator or something return Vec::new().into_iter(); }; @@ -158,7 +158,7 @@ impl NetTopology { } }).collect::>(); list.sort_by(|a, b| a.0.cmp(&b.0)); - // TODO: meh, optimize + // FIXME: meh, optimize let l = list.into_iter().map(|(_, connec, addr)| (addr, connec)).collect::>(); l.into_iter() } @@ -171,7 +171,7 @@ impl NetTopology { /// the earlier known time when a new entry will be added automatically to /// the list. pub fn addrs_to_attempt(&self) -> (impl Iterator, Instant) { - // TODO: optimize + // FIXME: optimize let now = Instant::now(); let now_systime = SystemTime::now(); let mut instant = now + Duration::from_secs(3600); @@ -367,7 +367,7 @@ impl NetTopology { continue; } - // TODO: a else block would be better, but we get borrowck errors + // FIXME: a else block would be better, but we get borrowck errors info_in_store.addrs.push(Addr { addr: addr.clone(), expires: SystemTime::now() + EXPIRATION_PUSH_BACK_CONNEC, @@ -469,7 +469,7 @@ pub enum DisconnectReason { } fn peer_access<'a>(store: &'a mut FnvHashMap, peer: &PeerId) -> &'a mut PeerInfo { - // TODO: should be optimizable if HashMap gets a better API + // FIXME: should be optimizable if HashMap gets a better API store.entry(peer.clone()).or_insert_with(Default::default) } @@ -586,7 +586,7 @@ impl Addr { } /// Divides a `Duration` with a `Duration`. This exists in the stdlib but isn't stable yet. -// TODO: remove this function once stable +// FIXME: remove this function once stable fn div_dur_with_dur(a: Duration, b: Duration) -> u32 { let a_ms = a.as_secs() * 1_000_000 + (a.subsec_nanos() / 1_000) as u64; let b_ms = b.as_secs() * 1_000_000 + (b.subsec_nanos() / 1_000) as u64; @@ -628,7 +628,7 @@ fn try_load(path: impl AsRef) -> FnvHashMap { } let mut file = match fs::File::open(path) { - // TODO: the capacity of the BufReader is kind of arbitrary ; decide better + // FIXME: the capacity of the BufReader is kind of arbitrary ; decide better Ok(f) => BufReader::with_capacity(1024 * 1024, f), Err(err) => { warn!(target: "sub-libp2p", "Failed to open peer storage file: {:?}", err); @@ -647,7 +647,7 @@ fn try_load(path: impl AsRef) -> FnvHashMap { let num_read = match file.read(&mut first_byte) { Ok(f) => f, Err(err) => { - // TODO: DRY + // FIXME: DRY warn!(target: "sub-libp2p", "Failed to read peer storage file: {:?}", err); info!(target: "sub-libp2p", "Deleting peer storage file {:?}", path); let _ = fs::remove_file(path); diff --git a/core/network-libp2p/src/traits.rs b/core/network-libp2p/src/traits.rs index 7e87ec130138c..9d405b1d4c263 100644 --- a/core/network-libp2p/src/traits.rs +++ b/core/network-libp2p/src/traits.rs @@ -80,7 +80,7 @@ impl NetworkConfiguration { out_peers: 75, reserved_nodes: Vec::new(), non_reserved_mode: NonReservedPeerMode::Accept, - client_version: "Parity-network".into(), // TODO: meh + client_version: "Parity-network".into(), // FIXME: meh } } diff --git a/core/network/src/consensus_gossip.rs b/core/network/src/consensus_gossip.rs index b9eec32b30cd1..f865e4a8fe96c 100644 --- a/core/network/src/consensus_gossip.rs +++ b/core/network/src/consensus_gossip.rs @@ -75,7 +75,7 @@ impl ConsensusGossip { if roles.intersects(Roles::AUTHORITY) { trace!(target:"gossip", "Registering {:?} {}", roles, who); // Send out all known messages to authorities. - // TODO: limit by size + // FIXME: limit by size let mut known_messages = HashSet::new(); for entry in self.messages.iter() { known_messages.insert((entry.topic, entry.message_hash)); diff --git a/core/network/src/on_demand.rs b/core/network/src/on_demand.rs index d71352e86ea48..c9e8236eb370f 100644 --- a/core/network/src/on_demand.rs +++ b/core/network/src/on_demand.rs @@ -213,7 +213,7 @@ impl OnDemandService for OnDemand where B::Header: HeaderT, { fn on_connect(&self, peer: NodeIndex, role: Roles, best_number: NumberFor) { - if !role.intersects(Roles::FULL | Roles::AUTHORITY) { // TODO: correct? + if !role.intersects(Roles::FULL | Roles::AUTHORITY) { // FIXME: correct? return; } diff --git a/core/network/src/protocol.rs b/core/network/src/protocol.rs index 41612c788d7c4..0525c2e8b2cab 100644 --- a/core/network/src/protocol.rs +++ b/core/network/src/protocol.rs @@ -357,7 +357,7 @@ impl, H: ExHashT> Protocol { message::FromBlock::Number(n) => BlockId::Number(n), }; let max = cmp::min(request.max.unwrap_or(u32::max_value()), MAX_BLOCK_DATA_RESPONSE) as usize; - // TODO: receipts, etc. + // FIXME: receipts, etc. let get_header = request.fields.contains(message::BlockAttributes::HEADER); let get_body = request.fields.contains(message::BlockAttributes::BODY); let get_justification = request.fields.contains(message::BlockAttributes::JUSTIFICATION); @@ -396,7 +396,7 @@ impl, H: ExHashT> Protocol { } fn on_block_response(&self, io: &mut SyncIo, peer: NodeIndex, request: message::BlockRequest, response: message::BlockResponse) { - // TODO: validate response + // FIXME: validate response let blocks_range = match ( response.blocks.first().and_then(|b| b.header.as_ref().map(|h| h.number())), response.blocks.last().and_then(|b| b.header.as_ref().map(|h| h.number())), diff --git a/core/primitives/src/changes_trie.rs b/core/primitives/src/changes_trie.rs index 0211b57236a32..29e4295b52473 100644 --- a/core/primitives/src/changes_trie.rs +++ b/core/primitives/src/changes_trie.rs @@ -49,7 +49,7 @@ impl ChangesTrieConfiguration { return 1; } - // TODO: use saturating_pow when available + // FIXME: use saturating_pow when available let mut max_digest_interval = self.digest_interval; for _ in 1..self.digest_levels { max_digest_interval = match max_digest_interval.checked_mul(self.digest_interval) { diff --git a/core/primitives/src/ed25519.rs b/core/primitives/src/ed25519.rs index 05077fbd37e80..42a0cf96459f1 100644 --- a/core/primitives/src/ed25519.rs +++ b/core/primitives/src/ed25519.rs @@ -240,7 +240,7 @@ impl Pair { } /// Derive a child key. Probably unsafe and broken. - // TODO: proper HD derivation https://cardanolaunch.com/assets/Ed25519_BIP.pdf + // FIXME: proper HD derivation https://cardanolaunch.com/assets/Ed25519_BIP.pdf pub fn derive_child_probably_bad(&self, chain_data: &[u8]) -> Pair { let sig = self.sign(chain_data); let mut seed = [0u8; 32]; diff --git a/core/rpc/src/chain/number.rs b/core/rpc/src/chain/number.rs index 7a300313e31d9..513cd66ac94ec 100644 --- a/core/rpc/src/chain/number.rs +++ b/core/rpc/src/chain/number.rs @@ -41,7 +41,7 @@ impl> NumberOrHex { match self { NumberOrHex::Number(n) => Ok(n), NumberOrHex::Hex(h) => { - // TODO [ToDr] this only supports `u64` since `BlockNumber` is `As` we could possibly go with `u128`. (#1377) + // FIXME [ToDr] this only supports `u64` since `BlockNumber` is `As` we could possibly go with `u128`. (#1377) let l = h.low_u64(); if U256::from(l) != h { Err(format!("`{}` does not fit into the block number type.", h)) diff --git a/core/service/src/components.rs b/core/service/src/components.rs index dc116873b6e39..a66bee44f2970 100644 --- a/core/service/src/components.rs +++ b/core/service/src/components.rs @@ -233,7 +233,7 @@ impl MaintainTransactionPool for C where ComponentClient: ProvideRuntimeApi, C::RuntimeApi: TaggedTransactionQueue>, { - // TODO [ToDr] Optimize and re-use tags from the pool. + // FIXME [ToDr] Optimize and re-use tags from the pool. fn on_block_imported( id: &BlockId>, client: &ComponentClient, @@ -283,7 +283,7 @@ pub trait ServiceFactory: 'static + Sized { /// ImportQueue for light clients type LightImportQueue: consensus_common::import_queue::ImportQueue + 'static; - //TODO: replace these with a constructor trait. that TransactionPool implements. (#1242) + //FIXME: replace these with a constructor trait. that TransactionPool implements. (#1242) /// Extrinsic pool constructor for the full client. fn build_full_transaction_pool(config: TransactionPoolOptions, client: Arc>) -> Result, error::Error>; @@ -345,7 +345,7 @@ pub trait Components: Sized + 'static { type RuntimeApi: Send + Sync; /// A type that can start the RPC. type RPC: StartRPC; - // TODO [ToDr] Traitify transaction pool and allow people to implement their own. (#1242) + // FIXME [ToDr] Traitify transaction pool and allow people to implement their own. (#1242) /// A type that can maintain transaction pool. type TransactionPool: MaintainTransactionPool; /// Extrinsic pool type. diff --git a/core/service/src/lib.rs b/core/service/src/lib.rs index a261ce5666d5f..60fb7cacb0cce 100644 --- a/core/service/src/lib.rs +++ b/core/service/src/lib.rs @@ -226,7 +226,7 @@ impl Service { // extrinsic notifications let network = Arc::downgrade(&network); let events = transaction_pool.import_notification_stream() - // TODO [ToDr] Consider throttling? + // FIXME [ToDr] Consider throttling? .for_each(move |_| { if let Some(network) = network.upgrade() { network.trigger_repropagate(); diff --git a/core/sr-io/with_std.rs b/core/sr-io/with_std.rs index a608a632fe136..7ce2eb239a1c2 100644 --- a/core/sr-io/with_std.rs +++ b/core/sr-io/with_std.rs @@ -37,7 +37,7 @@ use primitives::hexdisplay::HexDisplay; use primitives::H256; use hash_db::Hasher; -// TODO: use the real error, not NoError. +// FIXME: use the real error, not NoError. environmental!(ext: trait Externalities); diff --git a/core/sr-io/without_std.rs b/core/sr-io/without_std.rs index 6cc5a15d7f280..048834423efe4 100644 --- a/core/sr-io/without_std.rs +++ b/core/sr-io/without_std.rs @@ -315,7 +315,7 @@ pub fn trie_root< B: AsRef<[u8]>, >(_input: I) -> [u8; 32] { unimplemented!() - // TODO Maybe implement (though probably easier/cleaner to have blake2 be the only thing + // FIXME Maybe implement (though probably easier/cleaner to have blake2 be the only thing // implemneted natively and compile the trie logic as wasm). } @@ -326,7 +326,7 @@ pub fn ordered_trie_root< A: AsRef<[u8]> >(_input: I) -> [u8; 32] { unimplemented!() - // TODO Maybe implement (though probably easier/cleaner to have blake2 be the only thing + // FIXME Maybe implement (though probably easier/cleaner to have blake2 be the only thing // implemneted natively and compile the trie logic as wasm). } diff --git a/core/sr-primitives/src/generic/unchecked_extrinsic.rs b/core/sr-primitives/src/generic/unchecked_extrinsic.rs index d6442cbc0b387..bf84498c59c1f 100644 --- a/core/sr-primitives/src/generic/unchecked_extrinsic.rs +++ b/core/sr-primitives/src/generic/unchecked_extrinsic.rs @@ -156,7 +156,7 @@ impl } } -/// TODO: use derive when possible. +/// FIXME: use derive when possible. #[cfg(feature = "std")] impl fmt::Debug for UncheckedExtrinsic diff --git a/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs b/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs index 9ffac3d3f9a6c..560bd1d95eeaa 100644 --- a/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs +++ b/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs @@ -168,7 +168,7 @@ impl serde::Serialize } } -/// TODO: use derive when possible. +/// FIXME: use derive when possible. #[cfg(feature = "std")] impl fmt::Debug for UncheckedMortalCompactExtrinsic where Address: fmt::Debug, diff --git a/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs b/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs index e15a37c3bf01d..229cb7d9f320c 100644 --- a/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs +++ b/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs @@ -166,7 +166,7 @@ impl serde::Ser } } -/// TODO: use derive when possible. +/// FIXME: use derive when possible. #[cfg(feature = "std")] impl fmt::Debug for UncheckedMortalExtrinsic where Address: fmt::Debug, diff --git a/core/sr-primitives/src/lib.rs b/core/sr-primitives/src/lib.rs index 5c87782b04802..5900013609ae4 100644 --- a/core/sr-primitives/src/lib.rs +++ b/core/sr-primitives/src/lib.rs @@ -116,10 +116,10 @@ impl BuildStorage for StorageMap { #[derive(Encode, Decode, Default, Copy, Clone, PartialEq, Eq)] pub struct Permill(u32); -// TODO: impl Mul for N where N: As +// FIXME: impl Mul for N where N: As impl Permill { pub fn times + ::rstd::ops::Mul + ::rstd::ops::Div>(self, b: N) -> N { - // TODO: handle overflows + // FIXME: handle overflows b * >::sa(self.0 as u64) / >::sa(1000000) } @@ -151,11 +151,11 @@ impl From for Permill { #[derive(Encode, Decode, Default, Copy, Clone, PartialEq, Eq)] pub struct Perbill(u32); -// TODO: impl Mul for N where N: As +// FIXME: impl Mul for N where N: As impl Perbill { /// Attenuate `b` by self. pub fn times + ::rstd::ops::Mul + ::rstd::ops::Div>(self, b: N) -> N { - // TODO: handle overflows + // FIXME: handle overflows b * >::sa(self.0 as u64) / >::sa(1_000_000_000) } @@ -474,7 +474,7 @@ macro_rules! impl_outer_log { }; } -//TODO: https://github.com/paritytech/substrate/issues/1022 +//FIXME: https://github.com/paritytech/substrate/issues/1022 /// Basic Inherent data to include in a block; used by simple runtimes. #[derive(Encode, Decode)] pub struct BasicInherentData { @@ -497,7 +497,7 @@ impl BasicInherentData { } } -//TODO: https://github.com/paritytech/substrate/issues/1022 +//FIXME: https://github.com/paritytech/substrate/issues/1022 /// Error type used while checking inherents. #[derive(Encode)] #[cfg_attr(feature = "std", derive(Decode))] @@ -576,7 +576,7 @@ mod tests { pub enum RawLog { B1(AuthorityId), B2(AuthorityId) } } - // TODO try to avoid redundant brackets: a(AuthoritiesChange), b + // FIXME try to avoid redundant brackets: a(AuthoritiesChange), b impl_outer_log! { pub enum Log(InternalLog: DigestItem) for Runtime { a(AuthoritiesChange), b() diff --git a/core/state-db/src/noncanonical.rs b/core/state-db/src/noncanonical.rs index b1d34c09ad3ab..0e38bfa9ca920 100644 --- a/core/state-db/src/noncanonical.rs +++ b/core/state-db/src/noncanonical.rs @@ -220,7 +220,7 @@ impl NonCanonicalOverlay { commit.data.inserted = self.last_canonicalized_overlay.iter().map(|(k, v)| (k.clone(), v.clone())).collect(); commit.data.deleted = overlay.deleted; } else { - // TODO: borrow checker won't allow us to split out mutable references + // FIXME: borrow checker won't allow us to split out mutable references // required for recursive processing. A more efficient implementation // that does not require converting to vector is possible let mut vec: Vec<_> = self.levels.drain(..).collect(); diff --git a/core/state-machine/src/backend.rs b/core/state-machine/src/backend.rs index a032ab11957aa..80f6db7628368 100644 --- a/core/state-machine/src/backend.rs +++ b/core/state-machine/src/backend.rs @@ -118,7 +118,7 @@ impl Consolidate for MemoryDB { } /// Error impossible. -// TODO: use `!` type when stabilized. +// FIXME: use `!` type when stabilized. #[derive(Debug)] pub enum Void {} @@ -291,7 +291,7 @@ impl Backend for InMemory where H::Out: HeapSizeOf { } fn try_into_trie_backend(self) -> Option> { - let mut mdb = MemoryDB::default(); // TODO: should be more correct and use ::new() + let mut mdb = MemoryDB::default(); // FIXME: should be more correct and use ::new() let mut root = None; for (storage_key, map) in self.inner { if storage_key != None { diff --git a/core/state-machine/src/changes_trie/changes_iterator.rs b/core/state-machine/src/changes_trie/changes_iterator.rs index e8bd1e7db6b1a..d08e635d03172 100644 --- a/core/state-machine/src/changes_trie/changes_iterator.rs +++ b/core/state-machine/src/changes_trie/changes_iterator.rs @@ -102,7 +102,7 @@ pub fn key_changes_proof_check, H: Hasher>( max: u64, key: &[u8] ) -> Result, String> where H::Out: HeapSizeOf { - let mut proof_db = MemoryDB::::default(); // TODO: use new for correctness + let mut proof_db = MemoryDB::::default(); // FIXME: use new for correctness for item in proof { proof_db.insert(&item); } diff --git a/core/state-machine/src/changes_trie/prune.rs b/core/state-machine/src/changes_trie/prune.rs index 9886105115059..bd866d9a087d2 100644 --- a/core/state-machine/src/changes_trie/prune.rs +++ b/core/state-machine/src/changes_trie/prune.rs @@ -46,7 +46,7 @@ pub fn prune, H: Hasher, F: FnMut(H::Out)>( }; // delete changes trie for every block in range - // TODO: limit `max_digest_interval` so that this cycle won't involve huge ranges + // FIXME: limit `max_digest_interval` so that this cycle won't involve huge ranges for block in first..last+1 { let root = match storage.root(current_block, block) { Ok(Some(root)) => root, diff --git a/core/state-machine/src/ext.rs b/core/state-machine/src/ext.rs index 6274eef720593..34854efe66f0d 100644 --- a/core/state-machine/src/ext.rs +++ b/core/state-machine/src/ext.rs @@ -302,7 +302,7 @@ where ); let root_and_tx = root_and_tx.map(|(root, changes)| { let mut calculated_root = Default::default(); - let mut mdb = MemoryDB::default(); // TODO: use new for correctness + let mut mdb = MemoryDB::default(); // FIXME: use new for correctness { let mut trie = TrieDBMut::::new(&mut mdb, &mut calculated_root); for (key, value) in changes { diff --git a/core/state-machine/src/proving_backend.rs b/core/state-machine/src/proving_backend.rs index 2e9d2e5ff22d4..bce0425a0263b 100644 --- a/core/state-machine/src/proving_backend.rs +++ b/core/state-machine/src/proving_backend.rs @@ -195,7 +195,7 @@ where H: Hasher, H::Out: HeapSizeOf, { - let mut db = MemoryDB::default(); // TODO: use new for correctness + let mut db = MemoryDB::default(); // FIXME: use new for correctness for item in proof { db.insert(&item); } diff --git a/core/state-machine/src/trie_backend.rs b/core/state-machine/src/trie_backend.rs index 543f8a2e04fcd..516dedc2e4446 100644 --- a/core/state-machine/src/trie_backend.rs +++ b/core/state-machine/src/trie_backend.rs @@ -82,7 +82,7 @@ impl, H: Hasher> Backend for TrieBackend where } fn pairs(&self) -> Vec<(Vec, Vec)> { - let mut read_overlay = MemoryDB::default(); // TODO: use new for correctness + let mut read_overlay = MemoryDB::default(); // FIXME: use new for correctness let eph = Ephemeral::new(self.essence.backend_storage(), &mut read_overlay); let collect_all = || -> Result<_, Box>> { @@ -106,7 +106,7 @@ impl, H: Hasher> Backend for TrieBackend where } fn keys(&self, prefix: &Vec) -> Vec> { - let mut read_overlay = MemoryDB::default(); // TODO: use new for correctness + let mut read_overlay = MemoryDB::default(); // FIXME: use new for correctness let eph = Ephemeral::new(self.essence.backend_storage(), &mut read_overlay); let collect_all = || -> Result<_, Box>> { @@ -193,7 +193,7 @@ pub mod tests { fn test_db() -> (MemoryDB, H256) { let mut root = H256::default(); - let mut mdb = MemoryDB::::default(); // TODO: use new() to be more correct + let mut mdb = MemoryDB::::default(); // FIXME: use new() to be more correct { let mut trie = TrieDBMut::new(&mut mdb, &mut root); trie.insert(b"key", b"value").expect("insert failed"); @@ -230,7 +230,7 @@ pub mod tests { #[test] fn pairs_are_empty_on_empty_storage() { assert!(TrieBackend::, Blake2Hasher>::new( - MemoryDB::default(), // TODO: use new() to be more correct + MemoryDB::default(), // FIXME: use new() to be more correct Default::default(), ).pairs().is_empty()); } diff --git a/core/state-machine/src/trie_backend_essence.rs b/core/state-machine/src/trie_backend_essence.rs index cd5c0469414e6..b286f73903b6d 100644 --- a/core/state-machine/src/trie_backend_essence.rs +++ b/core/state-machine/src/trie_backend_essence.rs @@ -176,7 +176,7 @@ impl<'a, where H::Out: HeapSizeOf { fn keys(&self) -> HashMap { - self.overlay.keys() // TODO: iterate backing + self.overlay.keys() // FIXME: iterate backing } fn get(&self, key: &H::Out) -> Option { diff --git a/core/test-client/src/lib.rs b/core/test-client/src/lib.rs index 66b057350a217..f9456579d9f99 100644 --- a/core/test-client/src/lib.rs +++ b/core/test-client/src/lib.rs @@ -49,7 +49,7 @@ use keyring::Keyring; mod local_executor { #![allow(missing_docs)] use super::runtime; - // TODO: change the macro and pass in the `BlakeHasher` that dispatch needs from here instead + // FIXME: change the macro and pass in the `BlakeHasher` that dispatch needs from here instead native_executor_instance!(pub LocalExecutor, runtime::api::dispatch, runtime::native_version, include_bytes!("../../test-runtime/wasm/target/wasm32-unknown-unknown/release/substrate_test_runtime.compact.wasm")); } diff --git a/core/transaction-pool/graph/src/lib.rs b/core/transaction-pool/graph/src/lib.rs index a4879f3cb0e78..54b00c9be751f 100644 --- a/core/transaction-pool/graph/src/lib.rs +++ b/core/transaction-pool/graph/src/lib.rs @@ -21,7 +21,7 @@ //! The pool is able to return an iterator that traverses transaction //! graph in the correct order taking into account priorities and dependencies. //! -//! TODO [ToDr] +//! FIXME [ToDr] //! - [ ] Multi-threading (getting ready transactions should not block the pool) #![warn(missing_docs)] diff --git a/core/transaction-pool/graph/src/pool.rs b/core/transaction-pool/graph/src/pool.rs index e96d320046d37..8187132be44fa 100644 --- a/core/transaction-pool/graph/src/pool.rs +++ b/core/transaction-pool/graph/src/pool.rs @@ -226,7 +226,7 @@ impl Pool { impl Pool { /// Create a new transaction pool. - /// TODO [ToDr] Options + /// FIXME [ToDr] Options pub fn new(_options: Options, api: B) -> Self { Pool { api, diff --git a/core/transaction-pool/src/api.rs b/core/transaction-pool/src/api.rs index a29010b50c8c1..380bb501ac5bf 100644 --- a/core/transaction-pool/src/api.rs +++ b/core/transaction-pool/src/api.rs @@ -67,7 +67,7 @@ impl txpool::ChainApi for ChainApi where Ok(self.client.runtime_api().validate_transaction(at, uxt)?) } - // TODO [toDr] Use proper lbock number type + // FIXME [toDr] Use proper lbock number type fn block_id_to_number(&self, at: &BlockId) -> error::Result>> { Ok(self.client.block_number_from_id(at)?) } diff --git a/core/trie/src/lib.rs b/core/trie/src/lib.rs index 3b9791e99a13b..8d1071fc0ad48 100644 --- a/core/trie/src/lib.rs +++ b/core/trie/src/lib.rs @@ -16,7 +16,7 @@ //! Utility functions to interact with Substrate's Base-16 Modified Merkle Patricia tree ("trie"). -// TODO: no_std +// FIXME: no_std extern crate trie_root; extern crate parity_codec as codec; @@ -85,7 +85,7 @@ pub fn delta_trie_root(db: &mut HashDB, mut root: H::Out, for (key, change) in delta { match change { Some(val) => trie.insert(key.as_ref(), val.as_ref())?, - None => trie.remove(key.as_ref())?, // TODO: archive mode + None => trie.remove(key.as_ref())?, // FIXME: archive mode }; } } @@ -164,7 +164,7 @@ pub fn child_delta_trie_root(_storage_key: &[u8], db: &mut H for (key, change) in delta { match change { Some(val) => trie.insert(key.as_ref(), val.as_ref())?, - None => trie.remove(key.as_ref())?, // TODO: archive mode + None => trie.remove(key.as_ref())?, // FIXME: archive mode }; } } diff --git a/core/trie/src/node_codec.rs b/core/trie/src/node_codec.rs index 7cc888be7c9c7..f4f7d2d21e8eb 100644 --- a/core/trie/src/node_codec.rs +++ b/core/trie/src/node_codec.rs @@ -95,14 +95,14 @@ impl trie_db::NodeCodec for NodeCodec { vec![EMPTY_TRIE] } - // TODO: refactor this so that `partial` isn't already encoded with HPE. Should just be an `impl Iterator`. + // FIXME: refactor this so that `partial` isn't already encoded with HPE. Should just be an `impl Iterator`. fn leaf_node(partial: &[u8], value: &[u8]) -> Vec { let mut output = partial_to_key(partial, LEAF_NODE_OFFSET, LEAF_NODE_BIG); value.encode_to(&mut output); output } - // TODO: refactor this so that `partial` isn't already encoded with HPE. Should just be an `impl Iterator`. + // FIXME: refactor this so that `partial` isn't already encoded with HPE. Should just be an `impl Iterator`. fn ext_node(partial: &[u8], child: ChildReference) -> Vec { let mut output = partial_to_key(partial, EXTENSION_NODE_OFFSET, EXTENSION_NODE_BIG); match child { diff --git a/core/trie/src/trie_stream.rs b/core/trie/src/trie_stream.rs index 3c8291389cca3..f7c7880fd2db2 100644 --- a/core/trie/src/trie_stream.rs +++ b/core/trie/src/trie_stream.rs @@ -94,7 +94,7 @@ impl trie_root::TrieStream for TrieStream { _ => { // println!("[append_substream] would have hashed, because data.len() = {}", data.len()); // data.encode_to(&mut self.buffer) - // TODO: re-enable hashing before merging + // FIXME: re-enable hashing before merging H::hash(&data).as_ref().encode_to(&mut self.buffer) } } diff --git a/node/cli/src/chain_spec.rs b/node/cli/src/chain_spec.rs index ebf35a7491db5..c1ab38aa360ac 100644 --- a/node/cli/src/chain_spec.rs +++ b/node/cli/src/chain_spec.rs @@ -57,7 +57,7 @@ fn staging_testnet_config_genesis() -> GenesisConfig { GenesisConfig { consensus: Some(ConsensusConfig { - code: include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm").to_vec(), // TODO change + code: include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm").to_vec(), // FIXME change authorities: initial_authorities.clone(), }), system: None, diff --git a/node/cli/src/lib.rs b/node/cli/src/lib.rs index 88059728f8e5b..5e1bec4e50ac4 100644 --- a/node/cli/src/lib.rs +++ b/node/cli/src/lib.rs @@ -168,7 +168,7 @@ fn run_until_exit( let _telemetry = service.telemetry(); drop(service); - // TODO [andre]: timeout this future #1318 + // FIXME [andre]: timeout this future #1318 let _ = runtime.shutdown_on_idle().wait(); Ok(()) diff --git a/srml/aura/src/lib.rs b/srml/aura/src/lib.rs index b0bc50d69bc54..4285fd6ff1928 100644 --- a/srml/aura/src/lib.rs +++ b/srml/aura/src/lib.rs @@ -135,7 +135,7 @@ impl Module { /// Verify an inherent slot that is used in a block seal against a timestamp /// extracted from the block. - // TODO: ensure `ProvideInherent` can deal with dependencies like this. + // FIXME: ensure `ProvideInherent` can deal with dependencies like this. // https://github.com/paritytech/substrate/issues/1228 pub fn verify_inherent(timestamp: T::Moment, seal_slot: u64) -> Result { let timestamp_based_slot = timestamp.as_() / Self::slot_duration(); diff --git a/srml/balances/src/lib.rs b/srml/balances/src/lib.rs index c6e5d7729a722..6ea0a269aa689 100644 --- a/srml/balances/src/lib.rs +++ b/srml/balances/src/lib.rs @@ -399,7 +399,7 @@ impl Module { // account is reaped). // NOTE: This is orthogonal to the `Bondage` value that an account has, a high // value of which makes even the `free_balance` unspendable. - // TODO: enforce this for the other balance-altering functions. + // FIXME: enforce this for the other balance-altering functions. if balance < ed { Self::set_free_balance(who, balance); UpdateBalanceOutcome::AccountKilled diff --git a/srml/consensus/src/lib.rs b/srml/consensus/src/lib.rs index e8ef08e4b9ccb..181d4e8798130 100644 --- a/srml/consensus/src/lib.rs +++ b/srml/consensus/src/lib.rs @@ -199,7 +199,7 @@ decl_module! { /// Report some misbehaviour. fn report_misbehavior(origin, _report: Vec) { ensure_signed(origin)?; - // TODO: requires extension trait. + // FIXME: requires extension trait. } /// Note the previous block's validator missed their opportunity to propose a block. diff --git a/srml/contract/src/exec.rs b/srml/contract/src/exec.rs index 25dfe2e8fe0c4..881ad667102cb 100644 --- a/srml/contract/src/exec.rs +++ b/srml/contract/src/exec.rs @@ -23,12 +23,12 @@ use rstd::prelude::*; use runtime_primitives::traits::{Zero, CheckedAdd, CheckedSub}; use balances::{self, EnsureAccountLiquid}; -// TODO: Add logs +// FIXME: Add logs pub struct CreateReceipt { pub address: T::AccountId, } -// TODO: Add logs. +// FIXME: Add logs. pub struct CallReceipt; pub struct ExecutionContext<'a, T: Trait + 'a> { diff --git a/srml/contract/src/lib.rs b/srml/contract/src/lib.rs index 199f0058816c4..14e51adb2dbe4 100644 --- a/srml/contract/src/lib.rs +++ b/srml/contract/src/lib.rs @@ -147,7 +147,7 @@ decl_module! { /// Contracts module. pub struct Module for enum Call where origin: T::Origin { fn deposit_event() = default; - // TODO: Change AccountId to staking::Address + // FIXME: Change AccountId to staking::Address /// Make a call to a specified account, optionally transferring some balance. /// Make a call to a specified account, optionally transferring some balance. fn call( @@ -290,16 +290,16 @@ decl_storage! { /// Current cost schedule for contracts. CurrentSchedule get(current_schedule) config(): Schedule = Schedule::default(); /// The code associated with an account. - pub CodeOf: map T::AccountId => Vec; // TODO Vec values should be optimised to not do a length prefix. + pub CodeOf: map T::AccountId => Vec; // FIXME Vec values should be optimised to not do a length prefix. } } -// TODO: consider storing upper-bound for contract's gas limit in fixed-length runtime +// FIXME: consider storing upper-bound for contract's gas limit in fixed-length runtime // code in contract itself and use that. /// The storage items associated with an account/key. /// -/// TODO: keys should also be able to take AsRef to ensure Vecs can be passed as &[u8] +/// FIXME: keys should also be able to take AsRef to ensure Vecs can be passed as &[u8] pub(crate) struct StorageOf(::rstd::marker::PhantomData); impl StorageDoubleMap for StorageOf { const PREFIX: &'static [u8] = b"con:sto:"; diff --git a/srml/contract/src/vm/mod.rs b/srml/contract/src/vm/mod.rs index b46264bbd6fc2..702fa1af16f72 100644 --- a/srml/contract/src/vm/mod.rs +++ b/srml/contract/src/vm/mod.rs @@ -225,7 +225,7 @@ mod tests { gas_left: gas_meter.gas_left(), }); // Assume for now that it was just a plain transfer. - // TODO: Add tests for different call outcomes. + // FIXME: Add tests for different call outcomes. Ok(()) } fn caller(&self) -> &u64 { diff --git a/srml/contract/src/vm/runtime.rs b/srml/contract/src/vm/runtime.rs index d32808635957b..74fefea6d680f 100644 --- a/srml/contract/src/vm/runtime.rs +++ b/srml/contract/src/vm/runtime.rs @@ -159,7 +159,7 @@ fn write_sandbox_memory( // * AFTER MAKING A CHANGE MAKE SURE TO UPDATE COMPLEXITY.MD * // *********************************************************** -// TODO: ext_balance, ext_address, ext_callvalue, etc. +// FIXME: ext_balance, ext_address, ext_callvalue, etc. // Define a function `fn init_env() -> HostFunctionSet` that returns // a function set which can be imported by an executed contract. diff --git a/srml/grandpa/src/lib.rs b/srml/grandpa/src/lib.rs index 1a0d0f7c31dea..54e78e9474637 100644 --- a/srml/grandpa/src/lib.rs +++ b/srml/grandpa/src/lib.rs @@ -181,7 +181,7 @@ decl_module! { /// Report some misbehaviour. fn report_misbehavior(origin, _report: Vec) { ensure_signed(origin)?; - // TODO: https://github.com/paritytech/substrate/issues/1112 + // FIXME: https://github.com/paritytech/substrate/issues/1112 } fn on_finalise(block_number: T::BlockNumber) { @@ -259,7 +259,7 @@ impl Module where Ed25519AuthorityId: core::convert::From<(::rstd::marker::PhantomData); -// TODO: remove when https://github.com/rust-lang/rust/issues/26925 is fixed +// FIXME: remove when https://github.com/rust-lang/rust/issues/26925 is fixed impl Default for SyncedAuthorities { fn default() -> Self { SyncedAuthorities(::rstd::marker::PhantomData) diff --git a/srml/session/src/lib.rs b/srml/session/src/lib.rs index ea33395021346..5fa23df91c3cb 100644 --- a/srml/session/src/lib.rs +++ b/srml/session/src/lib.rs @@ -140,7 +140,7 @@ decl_storage! { impl Module { /// The number of validators currently. pub fn validator_count() -> u32 { - >::get().len() as u32 // TODO: can probably optimised + >::get().len() as u32 // FIXME: can probably optimised } /// The last length change, if there was one, zero if not. @@ -160,7 +160,7 @@ impl Module { /// Called by `staking::new_era()` only. `next_session` should be called after this in order to /// update the session keys to the next validator set. pub fn set_validators(new: &[T::AccountId]) { - >::put(&new.to_vec()); // TODO: optimise. + >::put(&new.to_vec()); // FIXME: optimise. >::set_authorities( &new.iter().cloned().map(T::ConvertAccountIdToSessionKey::convert).collect::>() ); diff --git a/srml/staking/src/lib.rs b/srml/staking/src/lib.rs index 70f71de152780..e424e141a52ae 100644 --- a/srml/staking/src/lib.rs +++ b/srml/staking/src/lib.rs @@ -72,7 +72,7 @@ pub enum LockStatus { /// Preference of what happens on a slash event. #[derive(PartialEq, Eq, Clone, Encode, Decode)] #[cfg_attr(feature = "std", derive(Debug))] -pub struct ValidatorPrefs { // TODO: @bkchr shouldn't need this Copy but derive(Encode) breaks otherwise +pub struct ValidatorPrefs { // FIXME: @bkchr shouldn't need this Copy but derive(Encode) breaks otherwise /// Validator should ensure this many more slashes than is necessary before being unstaked. #[codec(compact)] pub unstake_threshold: u32, @@ -362,7 +362,7 @@ impl Module { let noms = Self::current_nominators_for(v); let total = noms.iter().map(>::total_balance).fold(T::Balance::zero(), |acc, x| acc + x); if !total.is_zero() { - let safe_mul_rational = |b| b * rem / total;// TODO: avoid overflow + let safe_mul_rational = |b| b * rem / total;// FIXME: avoid overflow for n in noms.iter() { let _ = >::slash(n, safe_mul_rational(>::total_balance(n))); // best effort - not much that can be done on fail. } @@ -383,7 +383,7 @@ impl Module { .map(>::total_balance) .fold(>::total_balance(who), |acc, x| acc + x) .max(One::one()); - let safe_mul_rational = |b| b * reward / total;// TODO: avoid overflow + let safe_mul_rational = |b| b * reward / total;// FIXME: avoid overflow for n in noms.iter() { let _ = >::reward(n, safe_mul_rational(>::total_balance(n))); } @@ -461,7 +461,7 @@ impl Module { // combination of validators, then use session::internal::set_validators(). // for now, this just orders would-be stakers by their balances and chooses the top-most // >::get() of them. - // TODO: this is not sound. this should be moved to an off-chain solution mechanism. + // FIXME: this is not sound. this should be moved to an off-chain solution mechanism. let mut intentions = Self::intentions() .into_iter() .map(|v| (Self::slashable_balance(&v), v)) diff --git a/srml/staking/src/tests.rs b/srml/staking/src/tests.rs index fc3209bae3480..c9fd7cc105fd6 100644 --- a/srml/staking/src/tests.rs +++ b/srml/staking/src/tests.rs @@ -416,7 +416,7 @@ fn nominating_slashes_should_work() { assert_eq!(Balances::total_balance(&2), 20); //not slashed assert_eq!(Balances::total_balance(&3), 10); //slashed assert_eq!(Balances::total_balance(&4), 30); //slashed - // TODO: change slash % to something sensible. + // FIXME: change slash % to something sensible. }); } diff --git a/srml/support/procedural/src/storage/mod.rs b/srml/support/procedural/src/storage/mod.rs index 4e2599259316a..9a8023c180036 100644 --- a/srml/support/procedural/src/storage/mod.rs +++ b/srml/support/procedural/src/storage/mod.rs @@ -74,7 +74,7 @@ struct AddExtraGenesisLine { pub extra_field: ext::Parens, pub coldot_token: Token![:], pub extra_type: syn::Type, - // TODO use a custom ext::Option instead (syn option on '=' fails) + // FIXME use a custom ext::Option instead (syn option on '=' fails) pub default_value: ext::Seq, } @@ -91,7 +91,7 @@ struct DeclStorageLine { pub build: Option, pub coldot_token: Token![:], pub storage_type: DeclStorageType, - // TODO use a custom ext::Option instead (syn option on '=' fails) + // FIXME use a custom ext::Option instead (syn option on '=' fails) pub default_value: ext::Seq, } diff --git a/srml/support/procedural/tools/src/lib.rs b/srml/support/procedural/tools/src/lib.rs index 1dae39fce4345..49d012017b5c4 100644 --- a/srml/support/procedural/tools/src/lib.rs +++ b/srml/support/procedural/tools/src/lib.rs @@ -57,7 +57,7 @@ macro_rules! custom_keyword { } -// TODO following functions are copied from sr-api-macros : do a merge to get a unique procedural +// FIXME following functions are copied from sr-api-macros : do a merge to get a unique procedural // macro tooling crate (this crate path does not look good for it) use proc_macro2::{TokenStream, Span}; diff --git a/srml/support/src/dispatch.rs b/srml/support/src/dispatch.rs index f751a5293eedf..ec7af824f00a3 100644 --- a/srml/support/src/dispatch.rs +++ b/srml/support/src/dispatch.rs @@ -449,7 +449,7 @@ macro_rules! decl_module { // Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted. #[derive(Clone, Copy, PartialEq, Eq)] #[cfg_attr(feature = "std", derive(Debug))] - // TODO: switching based on std feature is because of an issue in + // FIXME: switching based on std feature is because of an issue in // serde-derive for when we attempt to derive `Deserialize` on these types, // in a situation where we've imported `srml_support` as another name. #[cfg(feature = "std")] diff --git a/srml/support/src/storage/generator.rs b/srml/support/src/storage/generator.rs index 7cf5e28dedf9a..cba8e5f849edc 100644 --- a/srml/support/src/storage/generator.rs +++ b/srml/support/src/storage/generator.rs @@ -194,7 +194,7 @@ pub trait StorageMap { fn mutate R, S: Storage>(key: &K, f: F, storage: &S) -> R; } -// TODO: Remove this in favour of `decl_storage` macro. +// FIXME: Remove this in favour of `decl_storage` macro. /// Declares strongly-typed wrappers around codec-compatible types in storage. #[macro_export] macro_rules! storage_items { @@ -445,7 +445,7 @@ macro_rules! __storage_items_internal { } /// Get the key used to put the length field. - // TODO: concat macro should accept byte literals. + // FIXME: concat macro should accept byte literals. fn len_key() -> $crate::rstd::vec::Vec { let mut key = $prefix.to_vec(); key.extend(b"len"); @@ -513,7 +513,7 @@ macro_rules! __handle_wrap_internal { }; } -// TODO: revisit this idiom once we get `type`s in `impl`s. +// FIXME: revisit this idiom once we get `type`s in `impl`s. /*impl Module { type Now = super::Now; }*/ diff --git a/srml/support/src/storage/mod.rs b/srml/support/src/storage/mod.rs index 6e1302718abd1..ffb4a25189423 100644 --- a/srml/support/src/storage/mod.rs +++ b/srml/support/src/storage/mod.rs @@ -24,7 +24,7 @@ use codec::{Codec, Decode, KeyedVec, Input}; #[macro_use] pub mod generator; -// TODO: consider using blake256 to avoid possible preimage attack. +// FIXME: consider using blake256 to avoid possible preimage attack. struct IncrementalInput<'a> { key: &'a [u8], diff --git a/srml/system/src/lib.rs b/srml/system/src/lib.rs index 67b10e2639d20..2756474b0f633 100644 --- a/srml/system/src/lib.rs +++ b/srml/system/src/lib.rs @@ -321,9 +321,9 @@ impl Module { #[cfg(any(feature = "std", test))] pub fn externalities() -> TestExternalities { TestExternalities::new(map![ - twox_128(&>::key_for(T::BlockNumber::zero())).to_vec() => [69u8; 32].encode(), // TODO: replace with Hash::default().encode + twox_128(&>::key_for(T::BlockNumber::zero())).to_vec() => [69u8; 32].encode(), // FIXME: replace with Hash::default().encode twox_128(>::key()).to_vec() => T::BlockNumber::one().encode(), - twox_128(>::key()).to_vec() => [69u8; 32].encode(), // TODO: replace with Hash::default().encode + twox_128(>::key()).to_vec() => [69u8; 32].encode(), // FIXME: replace with Hash::default().encode twox_128(>::key()).to_vec() => T::Hash::default().encode() ]) } From a2dfec4d3c467a481da70efb34f105e141a289fa Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Mon, 14 Jan 2019 15:56:03 +0100 Subject: [PATCH 2/8] Link to NLL ticket --- .../client/src/block_builder/block_builder.rs | 2 +- core/network-libp2p/src/node_handler.rs | 18 ++++++++--------- core/network-libp2p/src/service_task.rs | 14 ++++++------- core/network-libp2p/src/swarm.rs | 8 ++++---- core/network-libp2p/src/topology.rs | 20 +++++++++---------- core/network-libp2p/src/traits.rs | 2 +- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/core/client/src/block_builder/block_builder.rs b/core/client/src/block_builder/block_builder.rs index 8656bfed53512..49a92519418e2 100644 --- a/core/client/src/block_builder/block_builder.rs +++ b/core/client/src/block_builder/block_builder.rs @@ -101,7 +101,7 @@ where }) } - //FIXME: Please NLL, help me! + //FIXME: Replace with NLL as soon as we've switched to 2018: https://github.com/paritytech/substrate/issues/1413 impl_push(&mut self.api, &self.block_id, xt, &mut self.extrinsics) } diff --git a/core/network-libp2p/src/node_handler.rs b/core/network-libp2p/src/node_handler.rs index ff95f459f7517..ad1f4b7504a62 100644 --- a/core/network-libp2p/src/node_handler.rs +++ b/core/network-libp2p/src/node_handler.rs @@ -159,7 +159,7 @@ pub enum SubstrateOutEvent { /// The remote wants us to answer a Kademlia `FIND_NODE` request. /// /// The `responder` should be used to answer that query. - // FIXME: this API with the "responder" is bad, but changing it requires modifications in libp2p + // TODO: this API with the "responder" is bad, but changing it requires modifications in libp2p KadFindNode { /// The value being searched. searched: PeerId, @@ -203,7 +203,7 @@ impl IdentificationRequest { listen_addrs: Vec, remote_addr: &Multiaddr ) where TSubstream: AsyncRead + AsyncWrite + Send + 'static { - // FIXME: what to return for `protocol_version` and `agent_version`? + // TODO: what to return for `protocol_version` and `agent_version`? let sender = self.sender.send( identify::IdentifyInfo { public_key: local_key, @@ -233,7 +233,7 @@ pub enum SubstrateInEvent { }, /// Requests to open a Kademlia substream. - // FIXME: document better + // TODO: document better OpenKademlia, } @@ -247,7 +247,7 @@ macro_rules! listener_upgrade { upgrade::map(KadConnecConfig::new(), move |(c, s)| FinalUpgrade::Kad(c, s))), upgrade::map(ping::protocol::Ping::default(), move |p| FinalUpgrade::from(p))), upgrade::map(identify::IdentifyProtocolConfig, move |i| FinalUpgrade::from(i))) - // FIXME: meh for cloning a Vec here + // TODO: meh for cloning a Vec here ) } @@ -321,7 +321,7 @@ where TSubstream: AsyncRead + AsyncWrite + Send + 'static, match purpose { UpgradePurpose::Custom(id) => { let wanted = if let Some(proto) = self.registered_custom.find_protocol(id) { - // FIXME: meh for cloning + // TODO: meh for cloning upgrade::map(proto.clone(), move |c| FinalUpgrade::Custom(c)) } else { error!(target: "sub-libp2p", "Logic error: wrong custom protocol id for \ @@ -370,13 +370,13 @@ where TSubstream: AsyncRead + AsyncWrite + Send + 'static, }, SubstrateInEvent::OpenKademlia => self.open_kademlia(), SubstrateInEvent::Accept => { - // FIXME: implement + // TODO: implement }, } } fn shutdown(&mut self) { - // FIXME: close gracefully + // TODO: close gracefully self.is_shutting_down = true; for custom_proto in &mut self.custom_protocols_substreams { @@ -390,7 +390,7 @@ where TSubstream: AsyncRead + AsyncWrite + Send + 'static, fn poll(&mut self) -> Poll>, IoError> { if self.is_shutting_down { - // FIXME: finish only when everything is closed + // TODO: finish only when everything is closed return Ok(Async::Ready(None)); } @@ -645,7 +645,7 @@ where TSubstream: AsyncRead + AsyncWrite + Send + 'static, Ok(Async::NotReady) => self.upgrades_in_progress_dial.push((purpose, in_progress)), Err(err) => { - // FIXME: dispatch depending on actual error ; right now we assume that + // TODO: dispatch depending on actual error ; right now we assume that // error == not supported, which is not necessarily true in theory if let UpgradePurpose::Custom(_) = purpose { return Ok(Async::Ready(Some(SubstrateOutEvent::Useless))); diff --git a/core/network-libp2p/src/service_task.rs b/core/network-libp2p/src/service_task.rs index 1bfd5088ddef2..5fd03caa4b200 100644 --- a/core/network-libp2p/src/service_task.rs +++ b/core/network-libp2p/src/service_task.rs @@ -144,7 +144,7 @@ where TProtos: IntoIterator { } }, Err(_) => - // FIXME: also handle the `IP:PORT` format ; however we need to somehow add the + // TODO: also handle the `IP:PORT` format ; however we need to somehow add the // reserved ID to `reserved_peers` at some point warn!(target: "sub-libp2p", "Not a valid reserved node address: {}", reserved), } @@ -257,13 +257,13 @@ pub struct Service { topology: NetTopology, /// Handles the Kademlia queries. - // FIXME: put the kbuckets in the topology instead + // TODO: put the kbuckets in the topology instead kad_system: KadSystem, /// List of Kademlia controller we want to open. /// /// A clone of tihs `Arc` is stored in each Kademlia query stream. - // FIXME: use a better container? + // TODO: use a better container? kad_pending_ctrls: Arc>>>>, /// Sender whenever we inserted an entry in `kad_pending_ctrls`, so that we can process it. @@ -374,7 +374,7 @@ impl Service { } /// Sends a message to a peer using the custom protocol. - // FIXME: report invalid node index or protocol? + // TODO: report invalid node index or protocol? pub fn send_custom_message( &mut self, node_index: NodeIndex, @@ -418,7 +418,7 @@ impl Service { ) { let peer_id = match self.swarm.peer_id_of_node(node_index) { Some(pid) => pid.clone(), - None => return, // FIXME: report? + None => return, // TODO: report? }; // Kill the node from the swarm, and inject an event about it. @@ -563,7 +563,7 @@ impl Service { } } }) - // FIXME: we really want to remove nodes with no multiaddress from + // TODO: we really want to remove nodes with no multiaddress from // the results, but a flaw in the Kad protocol of libp2p makes it // impossible to return empty results ; therefore we must at least // return ourselves @@ -846,7 +846,7 @@ impl Service { } Ok(Async::NotReady) => return Ok(Async::NotReady), Ok(Async::Ready(None)) => unreachable!("The Swarm stream never ends"), - // FIXME: this `Err` contains a `Void` ; remove variant when Rust allows that + // TODO: this `Err` contains a `Void` ; remove variant when Rust allows that Err(_) => unreachable!("The Swarm stream never errors"), } } diff --git a/core/network-libp2p/src/swarm.rs b/core/network-libp2p/src/swarm.rs index 772a3119664d2..0a6bfaa994938 100644 --- a/core/network-libp2p/src/swarm.rs +++ b/core/network-libp2p/src/swarm.rs @@ -155,7 +155,7 @@ pub enum SwarmEvent { }, /// Opened a Kademlia substream with the node. - // FIXME: the controller API is bad, but we need to make changes in libp2p to improve that + // TODO: the controller API is bad, but we need to make changes in libp2p to improve that KadOpen { /// Index of the node. node_index: NodeIndex, @@ -166,7 +166,7 @@ pub enum SwarmEvent { /// The remote wants us to answer a Kademlia `FIND_NODE` request. /// /// The `responder` should be used to answer that query. - // FIXME: this API with the "responder" is bad, but changing it requires modifications in libp2p + // TODO: this API with the "responder" is bad, but changing it requires modifications in libp2p KadFindNode { /// Index of the node that wants an answer. node_index: NodeIndex, @@ -285,7 +285,7 @@ impl Swarm { } /// Sends a message to a peer using the custom protocol. - // FIXME: report invalid node index or protocol? + // TODO: report invalid node index or protocol? pub fn send_custom_message( &mut self, node_index: NodeIndex, @@ -346,7 +346,7 @@ impl Swarm { /// /// Returns an error if the node index is invalid, or if it was already accepted. pub fn accept_node(&mut self, node_index: NodeIndex) -> Result<(), ()> { - // FIXME: detect if already accepted? + // TODO: detect if already accepted? let peer_id = match self.nodes_info.get(&node_index) { Some(info) => &info.peer_id, None => return Err(()) diff --git a/core/network-libp2p/src/topology.rs b/core/network-libp2p/src/topology.rs index 85c90c8962b2a..061a3d1795687 100644 --- a/core/network-libp2p/src/topology.rs +++ b/core/network-libp2p/src/topology.rs @@ -58,7 +58,7 @@ const FAIL_BACKOFF_MULTIPLIER: u32 = 2; /// We need a maximum value for the backoff, overwise we risk an overflow. const MAX_BACKOFF: Duration = Duration::from_secs(30 * 60); -// FIXME: should be merged with the Kademlia k-buckets +// TODO: should be merged with the Kademlia k-buckets /// Stores information about the topology of the network. #[derive(Debug)] @@ -111,7 +111,7 @@ impl NetTopology { }; let file = fs::File::create(path)?; - // FIXME: the capacity of the BufWriter is kind of arbitrary ; decide better + // TODO: the capacity of the BufWriter is kind of arbitrary ; decide better serialize(BufWriter::with_capacity(1024 * 1024, file), &self.store) } @@ -142,7 +142,7 @@ impl NetTopology { let peer = if let Some(peer) = self.store.get(peer) { peer } else { - // FIXME: use an EitherIterator or something + // TODO: use an EitherIterator or something return Vec::new().into_iter(); }; @@ -158,7 +158,7 @@ impl NetTopology { } }).collect::>(); list.sort_by(|a, b| a.0.cmp(&b.0)); - // FIXME: meh, optimize + // TODO: meh, optimize let l = list.into_iter().map(|(_, connec, addr)| (addr, connec)).collect::>(); l.into_iter() } @@ -171,7 +171,7 @@ impl NetTopology { /// the earlier known time when a new entry will be added automatically to /// the list. pub fn addrs_to_attempt(&self) -> (impl Iterator, Instant) { - // FIXME: optimize + // TODO: optimize let now = Instant::now(); let now_systime = SystemTime::now(); let mut instant = now + Duration::from_secs(3600); @@ -367,7 +367,7 @@ impl NetTopology { continue; } - // FIXME: a else block would be better, but we get borrowck errors + // TODO: a else block would be better, but we get borrowck errors info_in_store.addrs.push(Addr { addr: addr.clone(), expires: SystemTime::now() + EXPIRATION_PUSH_BACK_CONNEC, @@ -469,7 +469,7 @@ pub enum DisconnectReason { } fn peer_access<'a>(store: &'a mut FnvHashMap, peer: &PeerId) -> &'a mut PeerInfo { - // FIXME: should be optimizable if HashMap gets a better API + // TODO: should be optimizable if HashMap gets a better API store.entry(peer.clone()).or_insert_with(Default::default) } @@ -586,7 +586,7 @@ impl Addr { } /// Divides a `Duration` with a `Duration`. This exists in the stdlib but isn't stable yet. -// FIXME: remove this function once stable +// TODO: remove this function once stable fn div_dur_with_dur(a: Duration, b: Duration) -> u32 { let a_ms = a.as_secs() * 1_000_000 + (a.subsec_nanos() / 1_000) as u64; let b_ms = b.as_secs() * 1_000_000 + (b.subsec_nanos() / 1_000) as u64; @@ -628,7 +628,7 @@ fn try_load(path: impl AsRef) -> FnvHashMap { } let mut file = match fs::File::open(path) { - // FIXME: the capacity of the BufReader is kind of arbitrary ; decide better + // TODO: the capacity of the BufReader is kind of arbitrary ; decide better Ok(f) => BufReader::with_capacity(1024 * 1024, f), Err(err) => { warn!(target: "sub-libp2p", "Failed to open peer storage file: {:?}", err); @@ -647,7 +647,7 @@ fn try_load(path: impl AsRef) -> FnvHashMap { let num_read = match file.read(&mut first_byte) { Ok(f) => f, Err(err) => { - // FIXME: DRY + // TODO: DRY warn!(target: "sub-libp2p", "Failed to read peer storage file: {:?}", err); info!(target: "sub-libp2p", "Deleting peer storage file {:?}", path); let _ = fs::remove_file(path); diff --git a/core/network-libp2p/src/traits.rs b/core/network-libp2p/src/traits.rs index 9d405b1d4c263..7e87ec130138c 100644 --- a/core/network-libp2p/src/traits.rs +++ b/core/network-libp2p/src/traits.rs @@ -80,7 +80,7 @@ impl NetworkConfiguration { out_peers: 75, reserved_nodes: Vec::new(), non_reserved_mode: NonReservedPeerMode::Accept, - client_version: "Parity-network".into(), // FIXME: meh + client_version: "Parity-network".into(), // TODO: meh } } From 5c95dc07ddd410e5c6d1c940a83b1b9befbb8699 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 15 Jan 2019 12:48:12 +0100 Subject: [PATCH 3/8] remove old comments --- core/transaction-pool/graph/src/lib.rs | 3 --- core/trie/src/trie_stream.rs | 9 --------- 2 files changed, 12 deletions(-) diff --git a/core/transaction-pool/graph/src/lib.rs b/core/transaction-pool/graph/src/lib.rs index 54b00c9be751f..963cb8cb28de5 100644 --- a/core/transaction-pool/graph/src/lib.rs +++ b/core/transaction-pool/graph/src/lib.rs @@ -20,9 +20,6 @@ //! and their priority. //! The pool is able to return an iterator that traverses transaction //! graph in the correct order taking into account priorities and dependencies. -//! -//! FIXME [ToDr] -//! - [ ] Multi-threading (getting ready transactions should not block the pool) #![warn(missing_docs)] #![warn(unused_extern_crates)] diff --git a/core/trie/src/trie_stream.rs b/core/trie/src/trie_stream.rs index f7c7880fd2db2..5f1bf1c9d9f8b 100644 --- a/core/trie/src/trie_stream.rs +++ b/core/trie/src/trie_stream.rs @@ -67,34 +67,25 @@ impl trie_root::TrieStream for TrieStream { fn append_leaf(&mut self, key: &[u8], value: &[u8]) { self.buffer.extend(fuse_nibbles_node(key, true)); - // OPTIMISATION: I'd like to do `hpe.encode_to(&mut self.buffer);` here; need an `impl<'a> Encode for impl Iterator + 'a`? value.encode_to(&mut self.buffer); } fn begin_branch(&mut self, maybe_value: Option<&[u8]>, has_children: impl Iterator) { -// println!("[begin_branch] pushing BRANCH_NODE"); self.buffer.extend(&branch_node(maybe_value.is_some(), has_children)); // Push the value if one exists. if let Some(value) = maybe_value { value.encode_to(&mut self.buffer); } -// println!("[begin_branch] buffer so far: {:#x?}", self.buffer); } fn append_extension(&mut self, key: &[u8]) { self.buffer.extend(fuse_nibbles_node(key, false)); } fn append_substream(&mut self, other: Self) { let data = other.out(); -// println!("[append_substream] START own buffer: {:x?}", self.buffer); -// println!("[append_substream] START other buffer: {:x?}", data); match data.len() { 0...31 => { -// println!("[append_substream] appending data, because data.len() = {}", data.len()); data.encode_to(&mut self.buffer) }, _ => { -// println!("[append_substream] would have hashed, because data.len() = {}", data.len()); -// data.encode_to(&mut self.buffer) - // FIXME: re-enable hashing before merging H::hash(&data).as_ref().encode_to(&mut self.buffer) } } From 889790b85d6f6b1b92e7784252ed0a69a48bbfcb Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 15 Jan 2019 13:00:39 +0100 Subject: [PATCH 4/8] Apply suggestions from code review --- core/basic-authorship/src/basic_authorship.rs | 1 - core/rpc/src/chain/number.rs | 2 +- core/service/src/components.rs | 4 ++-- core/sr-io/with_std.rs | 1 - core/state-db/src/noncanonical.rs | 2 +- core/state-machine/src/backend.rs | 4 ++-- core/state-machine/src/changes_trie/changes_iterator.rs | 2 +- core/state-machine/src/ext.rs | 2 +- core/state-machine/src/proving_backend.rs | 2 +- core/state-machine/src/trie_backend.rs | 8 ++++---- core/transaction-pool/graph/src/pool.rs | 1 - core/transaction-pool/src/api.rs | 1 - node/cli/src/lib.rs | 2 +- 13 files changed, 14 insertions(+), 18 deletions(-) diff --git a/core/basic-authorship/src/basic_authorship.rs b/core/basic-authorship/src/basic_authorship.rs index a0efd6c08f93e..449f6e67d8aac 100644 --- a/core/basic-authorship/src/basic_authorship.rs +++ b/core/basic-authorship/src/basic_authorship.rs @@ -214,7 +214,6 @@ impl Proposer where let pending_iterator = self.transaction_pool.ready(); for pending in pending_iterator { - // FIXME [ToDr] Probably get rid of it, and validate in runtime. let encoded_size = pending.data.encode().len(); if pending_size + encoded_size >= MAX_TRANSACTIONS_SIZE { break } diff --git a/core/rpc/src/chain/number.rs b/core/rpc/src/chain/number.rs index 513cd66ac94ec..32df8ee88612e 100644 --- a/core/rpc/src/chain/number.rs +++ b/core/rpc/src/chain/number.rs @@ -41,7 +41,7 @@ impl> NumberOrHex { match self { NumberOrHex::Number(n) => Ok(n), NumberOrHex::Hex(h) => { - // FIXME [ToDr] this only supports `u64` since `BlockNumber` is `As` we could possibly go with `u128`. (#1377) + // FIXME this only supports `u64` since `BlockNumber` is `As` we could possibly go with `u128`. (#1377) let l = h.low_u64(); if U256::from(l) != h { Err(format!("`{}` does not fit into the block number type.", h)) diff --git a/core/service/src/components.rs b/core/service/src/components.rs index a66bee44f2970..449baa798ea2c 100644 --- a/core/service/src/components.rs +++ b/core/service/src/components.rs @@ -283,7 +283,7 @@ pub trait ServiceFactory: 'static + Sized { /// ImportQueue for light clients type LightImportQueue: consensus_common::import_queue::ImportQueue + 'static; - //FIXME: replace these with a constructor trait. that TransactionPool implements. (#1242) + //TODO: replace these with a constructor trait. that TransactionPool implements. (#1242) /// Extrinsic pool constructor for the full client. fn build_full_transaction_pool(config: TransactionPoolOptions, client: Arc>) -> Result, error::Error>; @@ -345,7 +345,7 @@ pub trait Components: Sized + 'static { type RuntimeApi: Send + Sync; /// A type that can start the RPC. type RPC: StartRPC; - // FIXME [ToDr] Traitify transaction pool and allow people to implement their own. (#1242) + // TODO: Traitify transaction pool and allow people to implement their own. (#1242) /// A type that can maintain transaction pool. type TransactionPool: MaintainTransactionPool; /// Extrinsic pool type. diff --git a/core/sr-io/with_std.rs b/core/sr-io/with_std.rs index 7ce2eb239a1c2..6f55a87f0d248 100644 --- a/core/sr-io/with_std.rs +++ b/core/sr-io/with_std.rs @@ -37,7 +37,6 @@ use primitives::hexdisplay::HexDisplay; use primitives::H256; use hash_db::Hasher; -// FIXME: use the real error, not NoError. environmental!(ext: trait Externalities); diff --git a/core/state-db/src/noncanonical.rs b/core/state-db/src/noncanonical.rs index 0e38bfa9ca920..e689152da0160 100644 --- a/core/state-db/src/noncanonical.rs +++ b/core/state-db/src/noncanonical.rs @@ -220,7 +220,7 @@ impl NonCanonicalOverlay { commit.data.inserted = self.last_canonicalized_overlay.iter().map(|(k, v)| (k.clone(), v.clone())).collect(); commit.data.deleted = overlay.deleted; } else { - // FIXME: borrow checker won't allow us to split out mutable references + // borrow checker won't allow us to split out mutable references // required for recursive processing. A more efficient implementation // that does not require converting to vector is possible let mut vec: Vec<_> = self.levels.drain(..).collect(); diff --git a/core/state-machine/src/backend.rs b/core/state-machine/src/backend.rs index 80f6db7628368..9467f340d1a82 100644 --- a/core/state-machine/src/backend.rs +++ b/core/state-machine/src/backend.rs @@ -118,7 +118,7 @@ impl Consolidate for MemoryDB { } /// Error impossible. -// FIXME: use `!` type when stabilized. +// FIXME: use `!` type when stabilized. https://github.com/rust-lang/rust/issues/35121 #[derive(Debug)] pub enum Void {} @@ -291,7 +291,7 @@ impl Backend for InMemory where H::Out: HeapSizeOf { } fn try_into_trie_backend(self) -> Option> { - let mut mdb = MemoryDB::default(); // FIXME: should be more correct and use ::new() + let mut mdb = MemoryDB::default(); let mut root = None; for (storage_key, map) in self.inner { if storage_key != None { diff --git a/core/state-machine/src/changes_trie/changes_iterator.rs b/core/state-machine/src/changes_trie/changes_iterator.rs index d08e635d03172..68a8e40c92aba 100644 --- a/core/state-machine/src/changes_trie/changes_iterator.rs +++ b/core/state-machine/src/changes_trie/changes_iterator.rs @@ -102,7 +102,7 @@ pub fn key_changes_proof_check, H: Hasher>( max: u64, key: &[u8] ) -> Result, String> where H::Out: HeapSizeOf { - let mut proof_db = MemoryDB::::default(); // FIXME: use new for correctness + let mut proof_db = MemoryDB::::default(); for item in proof { proof_db.insert(&item); } diff --git a/core/state-machine/src/ext.rs b/core/state-machine/src/ext.rs index 34854efe66f0d..54d3511f42ed3 100644 --- a/core/state-machine/src/ext.rs +++ b/core/state-machine/src/ext.rs @@ -302,7 +302,7 @@ where ); let root_and_tx = root_and_tx.map(|(root, changes)| { let mut calculated_root = Default::default(); - let mut mdb = MemoryDB::default(); // FIXME: use new for correctness + let mut mdb = MemoryDB::default(); { let mut trie = TrieDBMut::::new(&mut mdb, &mut calculated_root); for (key, value) in changes { diff --git a/core/state-machine/src/proving_backend.rs b/core/state-machine/src/proving_backend.rs index bce0425a0263b..bb15ea74cd5a2 100644 --- a/core/state-machine/src/proving_backend.rs +++ b/core/state-machine/src/proving_backend.rs @@ -195,7 +195,7 @@ where H: Hasher, H::Out: HeapSizeOf, { - let mut db = MemoryDB::default(); // FIXME: use new for correctness + let mut db = MemoryDB::default(); for item in proof { db.insert(&item); } diff --git a/core/state-machine/src/trie_backend.rs b/core/state-machine/src/trie_backend.rs index 516dedc2e4446..a3947ab3db42f 100644 --- a/core/state-machine/src/trie_backend.rs +++ b/core/state-machine/src/trie_backend.rs @@ -82,7 +82,7 @@ impl, H: Hasher> Backend for TrieBackend where } fn pairs(&self) -> Vec<(Vec, Vec)> { - let mut read_overlay = MemoryDB::default(); // FIXME: use new for correctness + let mut read_overlay = MemoryDB::default(); let eph = Ephemeral::new(self.essence.backend_storage(), &mut read_overlay); let collect_all = || -> Result<_, Box>> { @@ -106,7 +106,7 @@ impl, H: Hasher> Backend for TrieBackend where } fn keys(&self, prefix: &Vec) -> Vec> { - let mut read_overlay = MemoryDB::default(); // FIXME: use new for correctness + let mut read_overlay = MemoryDB::default(); let eph = Ephemeral::new(self.essence.backend_storage(), &mut read_overlay); let collect_all = || -> Result<_, Box>> { @@ -193,7 +193,7 @@ pub mod tests { fn test_db() -> (MemoryDB, H256) { let mut root = H256::default(); - let mut mdb = MemoryDB::::default(); // FIXME: use new() to be more correct + let mut mdb = MemoryDB::::default(); { let mut trie = TrieDBMut::new(&mut mdb, &mut root); trie.insert(b"key", b"value").expect("insert failed"); @@ -230,7 +230,7 @@ pub mod tests { #[test] fn pairs_are_empty_on_empty_storage() { assert!(TrieBackend::, Blake2Hasher>::new( - MemoryDB::default(), // FIXME: use new() to be more correct + MemoryDB::default(), Default::default(), ).pairs().is_empty()); } diff --git a/core/transaction-pool/graph/src/pool.rs b/core/transaction-pool/graph/src/pool.rs index 8187132be44fa..e9e3ad1a996f0 100644 --- a/core/transaction-pool/graph/src/pool.rs +++ b/core/transaction-pool/graph/src/pool.rs @@ -226,7 +226,6 @@ impl Pool { impl Pool { /// Create a new transaction pool. - /// FIXME [ToDr] Options pub fn new(_options: Options, api: B) -> Self { Pool { api, diff --git a/core/transaction-pool/src/api.rs b/core/transaction-pool/src/api.rs index 380bb501ac5bf..62abc636194ce 100644 --- a/core/transaction-pool/src/api.rs +++ b/core/transaction-pool/src/api.rs @@ -67,7 +67,6 @@ impl txpool::ChainApi for ChainApi where Ok(self.client.runtime_api().validate_transaction(at, uxt)?) } - // FIXME [toDr] Use proper lbock number type fn block_id_to_number(&self, at: &BlockId) -> error::Result>> { Ok(self.client.block_number_from_id(at)?) } diff --git a/node/cli/src/lib.rs b/node/cli/src/lib.rs index 5e1bec4e50ac4..88059728f8e5b 100644 --- a/node/cli/src/lib.rs +++ b/node/cli/src/lib.rs @@ -168,7 +168,7 @@ fn run_until_exit( let _telemetry = service.telemetry(); drop(service); - // FIXME [andre]: timeout this future #1318 + // TODO [andre]: timeout this future #1318 let _ = runtime.shutdown_on_idle().wait(); Ok(()) From 2272df6c6109524f085e6cbc5396d4859d4a8221 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 15 Jan 2019 13:02:37 +0100 Subject: [PATCH 5/8] Apply suggestions from code review --- core/client/db/src/lib.rs | 7 ++----- core/client/db/src/light.rs | 2 -- core/client/src/call_executor.rs | 1 - core/client/src/client.rs | 13 +++++-------- core/client/src/error.rs | 1 - core/client/src/light/blockchain.rs | 2 +- core/consensus/common/src/import_queue.rs | 4 ++-- core/consensus/rhd/src/lib.rs | 7 ++----- core/executor/src/native_executor.rs | 1 - core/executor/src/wasm_executor.rs | 1 - core/finality-grandpa/src/lib.rs | 1 - core/network/src/consensus_gossip.rs | 1 - core/network/src/on_demand.rs | 2 +- core/network/src/protocol.rs | 2 -- core/primitives/src/changes_trie.rs | 2 +- 15 files changed, 14 insertions(+), 33 deletions(-) diff --git a/core/client/db/src/lib.rs b/core/client/db/src/lib.rs index 7754f33fbc31e..e2f431334321d 100644 --- a/core/client/db/src/lib.rs +++ b/core/client/db/src/lib.rs @@ -330,7 +330,6 @@ where Block: BlockT, } fn reset_storage(&mut self, mut top: StorageMap, children: ChildrenStorageMap) -> Result { - // FIXME: wipe out existing trie. if top.iter().any(|(k, _)| well_known_keys::is_child_storage_key(k)) { return Err(client::error::ErrorKind::GenesisInvalid.into()); @@ -402,7 +401,7 @@ struct DbGenesisStorage(pub H256); impl DbGenesisStorage { pub fn new() -> Self { let mut root = H256::default(); - let mut mdb = MemoryDB::::default(); // FIXME: use new() to make it more correct + let mut mdb = MemoryDB::::default(); state_machine::TrieDBMut::::new(&mut mdb, &mut root); DbGenesisStorage(root) } @@ -803,7 +802,6 @@ impl client::backend::Backend for Backend whe }; if finalized { - // FIXME: ensure best chain contains this block. self.note_finalized(&mut transaction, &pending_block.header, hash)?; } else { // canonicalize blocks which are old enough, regardless of finality. @@ -856,7 +854,6 @@ impl client::backend::Backend for Backend whe if let Some(header) = ::client::blockchain::HeaderBackend::header(&self.blockchain, block)? { let mut transaction = DBTransaction::new(); - // FIXME: ensure best chain contains this block. let hash = header.hash(); self.note_finalized(&mut transaction, &header, hash.clone())?; if let Some(justification) = justification { @@ -970,7 +967,7 @@ mod tests { fn prepare_changes(changes: Vec<(Vec, Vec)>) -> (H256, MemoryDB) { let mut changes_root = H256::default(); - let mut changes_trie_update = MemoryDB::::default(); // FIXME: change to new() to make more correct + let mut changes_trie_update = MemoryDB::::default(); { let mut trie = TrieDBMut::::new( &mut changes_trie_update, diff --git a/core/client/db/src/light.rs b/core/client/db/src/light.rs index 6a179518c4d37..162bebcc74797 100644 --- a/core/client/db/src/light.rs +++ b/core/client/db/src/light.rs @@ -340,7 +340,6 @@ impl LightBlockchainStorage for LightStorage // update block number to hash lookup entries. for retracted in tree_route.retracted() { if retracted.hash == meta.finalized_hash { - // FIXME: can we recover here? warn!("Safety failure: reverting finalized block {:?}", (&retracted.number, &retracted.hash)); } @@ -437,7 +436,6 @@ impl LightBlockchainStorage for LightStorage fn finalize_header(&self, id: BlockId) -> ClientResult<()> { if let Some(header) = self.header(id)? { let mut transaction = DBTransaction::new(); - // FIXME: ensure best chain contains this block. let hash = header.hash(); let number = *header.number(); self.note_finalized(&mut transaction, &header, hash.clone())?; diff --git a/core/client/src/call_executor.rs b/core/client/src/call_executor.rs index 21b8e560b35e1..215daf809633d 100644 --- a/core/client/src/call_executor.rs +++ b/core/client/src/call_executor.rs @@ -184,7 +184,6 @@ where manager: ExecutionManager, ) -> Result, error::Error> where ExecutionManager: Clone { let state = self.backend.state_at(*at)?; - //FIXME: Find a better way to prevent double block initialization if method != "Core_initialise_block" && initialised_block.map(|id| id != *at).unwrap_or(true) { let header = prepare_environment_block()?; state_machine::execute_using_consensus_failure_handler( diff --git a/core/client/src/client.rs b/core/client/src/client.rs index e3a6e84f78c73..4e40edb2dcb6c 100644 --- a/core/client/src/client.rs +++ b/core/client/src/client.rs @@ -64,7 +64,7 @@ pub struct Client where Block: BlockT { import_notification_sinks: Mutex>>>, finality_notification_sinks: Mutex>>>, import_lock: Mutex<()>, - importing_block: RwLock>, // holds the block hash currently being imported. FIXME: replace this with block queue + importing_block: RwLock>, // holds the block hash currently being imported. FIXME #1439 : should be replaced with a queue block_execution_strategy: ExecutionStrategy, api_execution_strategy: ExecutionStrategy, _phantom: PhantomData, @@ -102,7 +102,6 @@ pub trait BlockBody { } /// Client info -// FIXME: split queue info from chain info and amalgamate into single struct. #[derive(Debug)] pub struct ClientInfo { /// Best block hash. @@ -717,7 +716,7 @@ impl Client where // if the block is not a direct ancestor of the current best chain, // then some other block is the common ancestor. if route_from_best.common_block().hash != block { - // FIXME: reorganize best block to be the best chain containing + // FIXME: #1442 reorganize best block to be the best chain containing // `block`. } @@ -782,7 +781,7 @@ impl Client where /// Get block status. pub fn block_status(&self, id: &BlockId) -> error::Result { - // FIXME: more efficient implementation + // this can probably be implemented more efficiently if let BlockId::Hash(ref h) = id { if self.importing_block.read().as_ref().map_or(false, |importing| h == importing) { return Ok(BlockStatus::Queued); @@ -831,9 +830,9 @@ impl Client where /// If `maybe_max_block_number` is `Some(max_block_number)` /// the search is limited to block `numbers <= max_block_number`. /// in other words as if there were no blocks greater `max_block_number`. - /// FIXME [snd] possibly implement this on blockchain::Backend and just redirect here + /// TODO : we want to move this implement to `blockchain::Backend`, see [#1443](https://github.com/paritytech/substrate/issues/1443) /// Returns `Ok(None)` if `target_hash` is not found in search space. - /// FIXME [snd] write down time complexity + /// TODO: document time complexity of this, see [#1444](https://github.com/paritytech/substrate/issues/1444) pub fn best_containing(&self, target_hash: Block::Hash, maybe_max_number: Option>) -> error::Result> { @@ -893,7 +892,6 @@ impl Client where // waiting until we are <= max_number if let Some(max_number) = maybe_max_number { loop { - // FIXME [snd] this should be a panic let current_header = self.backend.blockchain().header(BlockId::Hash(current_hash.clone()))? .ok_or_else(|| error::Error::from(format!("failed to get header for hash {}", current_hash)))?; @@ -913,7 +911,6 @@ impl Client where return Ok(Some(best_hash)); } - // FIXME [snd] this should be a panic let current_header = self.backend.blockchain().header(BlockId::Hash(current_hash.clone()))? .ok_or_else(|| error::Error::from(format!("failed to get header for hash {}", current_hash)))?; diff --git a/core/client/src/error.rs b/core/client/src/error.rs index 6a270f5088dca..08f3dac345efc 100644 --- a/core/client/src/error.rs +++ b/core/client/src/error.rs @@ -144,7 +144,6 @@ error_chain! { } } -// FIXME [ToDr] Temporary, state_machine::Error should be a regular error not Box. impl From> for Error { fn from(e: Box) -> Self { ErrorKind::Execution(e).into() diff --git a/core/client/src/light/blockchain.rs b/core/client/src/light/blockchain.rs index 14d528927fc6f..8cb6dbac71505 100644 --- a/core/client/src/light/blockchain.rs +++ b/core/client/src/light/blockchain.rs @@ -141,7 +141,7 @@ impl BlockchainHeaderBackend for Blockchain where Bloc impl BlockchainBackend for Blockchain where Block: BlockT, S: Storage, F: Fetcher { fn body(&self, _id: BlockId) -> ClientResult>> { - // FIXME [light]: fetch from remote node + // TODO: #1445 fetch from remote node Ok(None) } diff --git a/core/consensus/common/src/import_queue.rs b/core/consensus/common/src/import_queue.rs index 9e5ac26121783..dabcebdf25257 100644 --- a/core/consensus/common/src/import_queue.rs +++ b/core/consensus/common/src/import_queue.rs @@ -379,7 +379,7 @@ pub fn import_single_block>( } else { debug!(target: "sync", "Header {} was not provided ", block.hash); } - return Err(BlockImportError::IncompleteHeader(peer)) //FIXME: use persistent ID + return Err(BlockImportError::IncompleteHeader(peer)) }, }; @@ -415,7 +415,7 @@ pub fn import_single_block>( }, Ok(ImportResult::KnownBad) => { debug!(target: "sync", "Peer gave us a bad block {}: {:?}", number, hash); - Err(BlockImportError::BadBlock(peer)) //FIXME: use persistent ID + Err(BlockImportError::BadBlock(peer)) } Err(e) => { debug!(target: "sync", "Error importing block {}: {:?}: {:?}", number, hash, e); diff --git a/core/consensus/rhd/src/lib.rs b/core/consensus/rhd/src/lib.rs index 74bf0acc68a1b..ae4f40a3fd5fa 100644 --- a/core/consensus/rhd/src/lib.rs +++ b/core/consensus/rhd/src/lib.rs @@ -460,7 +460,6 @@ impl Drop for BftFuture OutSink: Sink, SinkError=Error>, { fn drop(&mut self) { - // FIXME: have a trait member to pass misbehavior reports into. let misbehavior = self.inner.drain_misbehavior().collect::>(); self.inner.context().proposer.import_misbehavior(misbehavior); } @@ -494,7 +493,7 @@ pub struct BftService { live_agreement: Mutex>, round_cache: Arc>>, round_timeout_multiplier: u64, - key: Arc, // FIXME: key changing over time. + key: Arc, factory: P, } @@ -516,14 +515,13 @@ impl BftService start_round: 0, })), round_timeout_multiplier: 10, - key: key, // FIXME: key changing over time. + key: key, factory, } } /// Get the local Authority ID. pub fn local_id(&self) -> AuthorityId { - // FIXME: based on a header and some keystore. self.key.public().into() } @@ -1112,7 +1110,6 @@ impl BaseProposer<::Block> for Proposer where self.transaction_pool.ready(|pending_iterator| { let mut pending_size = 0; for pending in pending_iterator { - // FIXME [ToDr] Probably get rid of it, and validate in runtime. let encoded_size = pending.data.encode().len(); if pending_size + encoded_size >= MAX_TRANSACTIONS_SIZE { break } diff --git a/core/executor/src/native_executor.rs b/core/executor/src/native_executor.rs index 52b7193a7048f..3b34f85caab10 100644 --- a/core/executor/src/native_executor.rs +++ b/core/executor/src/native_executor.rs @@ -219,7 +219,6 @@ macro_rules! native_executor_instance { native_executor_instance!(IMPL $name, $dispatcher, $version, $code); }; (IMPL $name:ident, $dispatcher:path, $version:path, $code:expr) => { - // FIXME: this is not so great – I think I should go back to have dispatch take a type param and modify this macro to accept a type param and then pass it in from the test-client instead use primitives::Blake2Hasher as _Blake2Hasher; impl $crate::NativeExecutionDispatch for $name { fn native_equivalent() -> &'static [u8] { diff --git a/core/executor/src/wasm_executor.rs b/core/executor/src/wasm_executor.rs index 5819c07b8ec53..c75c4e3b5e03f 100644 --- a/core/executor/src/wasm_executor.rs +++ b/core/executor/src/wasm_executor.rs @@ -138,7 +138,6 @@ impl ReadPrimitive for MemoryInstance { } } -// FIXME: this macro does not support `where` clauses and that seems somewhat tricky to add impl_function_executor!(this: FunctionExecutor<'e, E>, ext_print_utf8(utf8_data: *const u8, utf8_len: u32) => { if let Ok(utf8) = this.memory.get(utf8_data, utf8_len as usize) { diff --git a/core/finality-grandpa/src/lib.rs b/core/finality-grandpa/src/lib.rs index b2bc701d7bd8e..416aff8284644 100644 --- a/core/finality-grandpa/src/lib.rs +++ b/core/finality-grandpa/src/lib.rs @@ -517,7 +517,6 @@ impl, N, RA> voter::Environment( round, self.set_id, diff --git a/core/network/src/consensus_gossip.rs b/core/network/src/consensus_gossip.rs index f865e4a8fe96c..2b281f534ef44 100644 --- a/core/network/src/consensus_gossip.rs +++ b/core/network/src/consensus_gossip.rs @@ -75,7 +75,6 @@ impl ConsensusGossip { if roles.intersects(Roles::AUTHORITY) { trace!(target:"gossip", "Registering {:?} {}", roles, who); // Send out all known messages to authorities. - // FIXME: limit by size let mut known_messages = HashSet::new(); for entry in self.messages.iter() { known_messages.insert((entry.topic, entry.message_hash)); diff --git a/core/network/src/on_demand.rs b/core/network/src/on_demand.rs index c9e8236eb370f..a9b00dc1200ca 100644 --- a/core/network/src/on_demand.rs +++ b/core/network/src/on_demand.rs @@ -213,7 +213,7 @@ impl OnDemandService for OnDemand where B::Header: HeaderT, { fn on_connect(&self, peer: NodeIndex, role: Roles, best_number: NumberFor) { - if !role.intersects(Roles::FULL | Roles::AUTHORITY) { // FIXME: correct? + if !role.intersects(Roles::FULL | Roles::AUTHORITY) { return; } diff --git a/core/network/src/protocol.rs b/core/network/src/protocol.rs index 0525c2e8b2cab..baa107c79d4be 100644 --- a/core/network/src/protocol.rs +++ b/core/network/src/protocol.rs @@ -357,7 +357,6 @@ impl, H: ExHashT> Protocol { message::FromBlock::Number(n) => BlockId::Number(n), }; let max = cmp::min(request.max.unwrap_or(u32::max_value()), MAX_BLOCK_DATA_RESPONSE) as usize; - // FIXME: receipts, etc. let get_header = request.fields.contains(message::BlockAttributes::HEADER); let get_body = request.fields.contains(message::BlockAttributes::BODY); let get_justification = request.fields.contains(message::BlockAttributes::JUSTIFICATION); @@ -396,7 +395,6 @@ impl, H: ExHashT> Protocol { } fn on_block_response(&self, io: &mut SyncIo, peer: NodeIndex, request: message::BlockRequest, response: message::BlockResponse) { - // FIXME: validate response let blocks_range = match ( response.blocks.first().and_then(|b| b.header.as_ref().map(|h| h.number())), response.blocks.last().and_then(|b| b.header.as_ref().map(|h| h.number())), diff --git a/core/primitives/src/changes_trie.rs b/core/primitives/src/changes_trie.rs index 29e4295b52473..924e5928db4c0 100644 --- a/core/primitives/src/changes_trie.rs +++ b/core/primitives/src/changes_trie.rs @@ -49,7 +49,7 @@ impl ChangesTrieConfiguration { return 1; } - // FIXME: use saturating_pow when available + // FIXME: use saturating_pow once stabilized - https://github.com/rust-lang/rust/issues/48320 let mut max_digest_interval = self.digest_interval; for _ in 1..self.digest_levels { max_digest_interval = match max_digest_interval.checked_mul(self.digest_interval) { From 2fe7a9ac14732f399c6cb59fe3373415f9f6f9c1 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Fri, 25 Jan 2019 14:09:09 +0100 Subject: [PATCH 6/8] more cleaning up of tickets --- core/basic-authorship/src/basic_authorship.rs | 4 ++-- core/client/db/src/storage_cache.rs | 2 +- core/client/src/client.rs | 2 -- core/consensus/aura/src/lib.rs | 7 +++---- core/consensus/rhd/src/lib.rs | 2 +- core/rpc/src/chain/number.rs | 3 ++- core/service/src/chain_ops.rs | 2 +- core/service/src/components.rs | 1 - core/service/src/lib.rs | 3 +-- core/sr-io/without_std.rs | 4 ---- core/sr-primitives/src/generic/unchecked_extrinsic.rs | 1 - .../src/generic/unchecked_mortal_compact_extrinsic.rs | 1 - .../src/generic/unchecked_mortal_extrinsic.rs | 1 - core/sr-primitives/src/lib.rs | 9 ++++----- core/state-machine/src/trie_backend_essence.rs | 2 +- core/test-client/src/lib.rs | 2 +- core/trie/src/lib.rs | 6 +++--- node/cli/src/chain_spec.rs | 2 +- node/cli/src/service.rs | 5 ++--- srml/consensus/src/lib.rs | 1 - srml/contract/src/lib.rs | 4 ---- srml/contract/src/wasm/runtime.rs | 2 -- srml/session/src/lib.rs | 4 ++-- srml/staking/src/lib.rs | 6 +++--- srml/staking/src/tests.rs | 1 - srml/support/procedural/src/storage/mod.rs | 4 ++-- srml/support/procedural/tools/src/lib.rs | 4 +--- srml/support/src/storage/generator.rs | 3 +-- srml/support/src/storage/mod.rs | 2 -- srml/system/src/lib.rs | 4 ++-- 30 files changed, 34 insertions(+), 60 deletions(-) diff --git a/core/basic-authorship/src/basic_authorship.rs b/core/basic-authorship/src/basic_authorship.rs index 750224977fbea..aa46919224437 100644 --- a/core/basic-authorship/src/basic_authorship.rs +++ b/core/basic-authorship/src/basic_authorship.rs @@ -16,8 +16,8 @@ //! A consensus proposer for "basic" chains which use the primitive inherent-data. -// FIXME: move this into substrate-consensus-common - https://github.com/paritytech/substrate/issues/1021 - +// FIXME #1021 move this into substrate-consensus-common +// use std::{sync::Arc, self}; use log::{info, trace}; diff --git a/core/client/db/src/storage_cache.rs b/core/client/db/src/storage_cache.rs index 3998ee70b0a5e..da07aa4d5a923 100644 --- a/core/client/db/src/storage_cache.rs +++ b/core/client/db/src/storage_cache.rs @@ -45,7 +45,7 @@ pub type SharedCache = Arc>>; /// Create new shared cache instance with given max memory usage. pub fn new_shared_cache(shared_cache_size: usize) -> SharedCache { - let cache_items = shared_cache_size / 100; // Estimated average item size. FIXME: more accurate tracking + let cache_items = shared_cache_size / 100; // Guestimate, potentially inaccurate Arc::new(Mutex::new(Cache { storage: LruCache::new(cache_items), hashes: LruCache::new(cache_items), diff --git a/core/client/src/client.rs b/core/client/src/client.rs index 549a5e948f04b..e9bb0f040f918 100644 --- a/core/client/src/client.rs +++ b/core/client/src/client.rs @@ -324,7 +324,6 @@ impl Client where /// Get the RuntimeVersion at a given block. pub fn runtime_version_at(&self, id: &BlockId) -> error::Result { - // FIXME: Post Poc-2 return an error if version is missing self.executor.runtime_version(id) } @@ -741,7 +740,6 @@ impl Client where // https://github.com/paritytech/substrate/issues/1232 let (storage_update,changes_update,storage_changes) = self.block_execution(&operation.op, &import_headers, origin, hash, body.clone())?; - // FIXME: non longest-chain rule. let is_new_best = finalized || match fork_choice { ForkChoiceStrategy::LongestChain => import_headers.post().number() > &last_best_number, ForkChoiceStrategy::Custom(v) => v, diff --git a/core/consensus/aura/src/lib.rs b/core/consensus/aura/src/lib.rs index 25bf983de67c3..38b5ce53a4460 100644 --- a/core/consensus/aura/src/lib.rs +++ b/core/consensus/aura/src/lib.rs @@ -392,7 +392,7 @@ enum CheckedHeader { /// check a header has been signed by the right key. If the slot is too far in the future, an error will be returned. /// if it's successful, returns the pre-header, the slot number, and the signat. // -// FIXME: needs misbehavior types - https://github.com/paritytech/substrate/issues/1018 +// FIXME #1018 needs misbehavior types fn check_header(slot_now: u64, mut header: B::Header, hash: B::Hash, authorities: &[Ed25519AuthorityId]) -> Result, String> where DigestItemFor: CompatibleDigestItem @@ -537,8 +537,7 @@ impl Verifier for AuraVerifier where ); // we add one to allow for some small drift. - // FIXME: in the future, alter this queue to allow deferring of headers - // https://github.com/paritytech/substrate/issues/1019 + // FIXME #1019 in the future, alter this queue to allow deferring of headers let checked_header = check_header::(slot_now + 1, header, hash, &authorities[..])?; match checked_header { CheckedHeader::Checked(pre_header, slot_num, sig) => { @@ -577,7 +576,7 @@ impl Verifier for AuraVerifier where fork_choice: ForkChoiceStrategy::LongestChain, }; - // FIXME: extract authorities - https://github.com/paritytech/substrate/issues/1019 + // FIXME #1019 extract authorities Ok((import_block, None)) } CheckedHeader::Deferred(a, b) => { diff --git a/core/consensus/rhd/src/lib.rs b/core/consensus/rhd/src/lib.rs index 86f1ba4168b6a..71c34fd79b44d 100644 --- a/core/consensus/rhd/src/lib.rs +++ b/core/consensus/rhd/src/lib.rs @@ -31,7 +31,7 @@ //! set for this block height. #![cfg(feature="rhd")] -// FIXME: doesn't compile - https://github.com/paritytech/substrate/issues/1020 +// FIXME #1020 doesn't compile use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/core/rpc/src/chain/number.rs b/core/rpc/src/chain/number.rs index 32df8ee88612e..4d8659fcf32dd 100644 --- a/core/rpc/src/chain/number.rs +++ b/core/rpc/src/chain/number.rs @@ -41,7 +41,8 @@ impl> NumberOrHex { match self { NumberOrHex::Number(n) => Ok(n), NumberOrHex::Hex(h) => { - // FIXME this only supports `u64` since `BlockNumber` is `As` we could possibly go with `u128`. (#1377) + // FIXME #1377 this only supports `u64` since `BlockNumber` + // is `As` we could possibly go with `u128`. let l = h.low_u64(); if U256::from(l) != h { Err(format!("`{}` does not fit into the block number type.", h)) diff --git a/core/service/src/chain_ops.rs b/core/service/src/chain_ops.rs index 522f60a5cf7ff..ca9e78fdd15f0 100644 --- a/core/service/src/chain_ops.rs +++ b/core/service/src/chain_ops.rs @@ -106,7 +106,7 @@ pub fn import_blocks( impl Link for DummyLink { } let client = new_client::(&config)?; - // FIXME: this shouldn't need a mutable config. https://github.com/paritytech/substrate/issues/1134 + // FIXME #1134 this shouldn't need a mutable config. let queue = components::FullComponents::::build_import_queue(&mut config, client.clone())?; queue.start(DummyLink)?; diff --git a/core/service/src/components.rs b/core/service/src/components.rs index 8bc89026aff6d..c966911996b62 100644 --- a/core/service/src/components.rs +++ b/core/service/src/components.rs @@ -217,7 +217,6 @@ impl MaintainTransactionPool for C where ComponentClient: ProvideRuntimeApi, as ProvideRuntimeApi>::Api: TaggedTransactionQueue>, { - // FIXME [ToDr] Optimize and re-use tags from the pool. fn on_block_imported( id: &BlockId>, client: &ComponentClient, diff --git a/core/service/src/lib.rs b/core/service/src/lib.rs index 0eab32c10e044..abffc2b74c1f3 100644 --- a/core/service/src/lib.rs +++ b/core/service/src/lib.rs @@ -137,7 +137,7 @@ impl Service { let mut keystore = Keystore::open(config.keystore_path.as_str().into())?; // This is meant to be for testing only - // FIXME: remove this - https://github.com/paritytech/substrate/issues/1063 + // FIXME #1063 remove this for seed in &config.keys { keystore.generate_from_seed(seed)?; } @@ -274,7 +274,6 @@ impl Service { // extrinsic notifications let network = Arc::downgrade(&network); let events = transaction_pool.import_notification_stream() - // FIXME [ToDr] Consider throttling? .for_each(move |_| { if let Some(network) = network.upgrade() { network.trigger_repropagate(); diff --git a/core/sr-io/without_std.rs b/core/sr-io/without_std.rs index 7be671709236e..67eccb0df870f 100644 --- a/core/sr-io/without_std.rs +++ b/core/sr-io/without_std.rs @@ -312,8 +312,6 @@ pub fn trie_root< B: AsRef<[u8]>, >(_input: I) -> [u8; 32] { unimplemented!() - // FIXME Maybe implement (though probably easier/cleaner to have blake2 be the only thing - // implemneted natively and compile the trie logic as wasm). } /// A trie root formed from the enumerated items. @@ -323,8 +321,6 @@ pub fn ordered_trie_root< A: AsRef<[u8]> >(_input: I) -> [u8; 32] { unimplemented!() - // FIXME Maybe implement (though probably easier/cleaner to have blake2 be the only thing - // implemneted natively and compile the trie logic as wasm). } /// The current relay chain identifier. diff --git a/core/sr-primitives/src/generic/unchecked_extrinsic.rs b/core/sr-primitives/src/generic/unchecked_extrinsic.rs index 461876bccea92..2bcb2f5fb2202 100644 --- a/core/sr-primitives/src/generic/unchecked_extrinsic.rs +++ b/core/sr-primitives/src/generic/unchecked_extrinsic.rs @@ -156,7 +156,6 @@ impl } } -/// FIXME: use derive when possible. #[cfg(feature = "std")] impl fmt::Debug for UncheckedExtrinsic diff --git a/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs b/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs index 560bd1d95eeaa..953d200113039 100644 --- a/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs +++ b/core/sr-primitives/src/generic/unchecked_mortal_compact_extrinsic.rs @@ -168,7 +168,6 @@ impl serde::Serialize } } -/// FIXME: use derive when possible. #[cfg(feature = "std")] impl fmt::Debug for UncheckedMortalCompactExtrinsic where Address: fmt::Debug, diff --git a/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs b/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs index 229cb7d9f320c..8aa6faa467411 100644 --- a/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs +++ b/core/sr-primitives/src/generic/unchecked_mortal_extrinsic.rs @@ -166,7 +166,6 @@ impl serde::Ser } } -/// FIXME: use derive when possible. #[cfg(feature = "std")] impl fmt::Debug for UncheckedMortalExtrinsic where Address: fmt::Debug, diff --git a/core/sr-primitives/src/lib.rs b/core/sr-primitives/src/lib.rs index 3d53ae91432d3..0aef2c0d21cb8 100644 --- a/core/sr-primitives/src/lib.rs +++ b/core/sr-primitives/src/lib.rs @@ -123,11 +123,11 @@ impl BuildStorage for StorageMap { #[derive(Encode, Decode, Default, Copy, Clone, PartialEq, Eq)] pub struct Permill(u32); -// FIXME: impl Mul for N where N: As +// FIXME #1577 Permill needs improvements impl Permill { /// Multiplication. pub fn times + ::rstd::ops::Mul + ::rstd::ops::Div>(self, b: N) -> N { - // FIXME: handle overflows + // FIXME #1577 handle overflows b * >::sa(self.0 as u64) / >::sa(1000000) } @@ -178,11 +178,11 @@ impl From> for Permill { #[derive(Encode, Decode, Default, Copy, Clone, PartialEq, Eq)] pub struct Perbill(u32); -// FIXME: impl Mul for N where N: As +// FIXME #1577 impl Mul for N where N: As impl Perbill { /// Attenuate `b` by self. pub fn times + ::rstd::ops::Mul + ::rstd::ops::Div>(self, b: N) -> N { - // FIXME: handle overflows + // FIXME #1577 handle overflows b * >::sa(self.0 as u64) / >::sa(1_000_000_000) } @@ -573,7 +573,6 @@ mod tests { pub enum RawLog { B1(AuthorityId), B2(AuthorityId) } } - // FIXME try to avoid redundant brackets: a(AuthoritiesChange), b impl_outer_log! { pub enum Log(InternalLog: DigestItem) for Runtime { a(AuthoritiesChange), b() diff --git a/core/state-machine/src/trie_backend_essence.rs b/core/state-machine/src/trie_backend_essence.rs index b286f73903b6d..9163f5ded0f14 100644 --- a/core/state-machine/src/trie_backend_essence.rs +++ b/core/state-machine/src/trie_backend_essence.rs @@ -176,7 +176,7 @@ impl<'a, where H::Out: HeapSizeOf { fn keys(&self) -> HashMap { - self.overlay.keys() // FIXME: iterate backing + self.overlay.keys() } fn get(&self, key: &H::Out) -> Option { diff --git a/core/test-client/src/lib.rs b/core/test-client/src/lib.rs index 811353e2af9fb..1e759fb9bcb4a 100644 --- a/core/test-client/src/lib.rs +++ b/core/test-client/src/lib.rs @@ -49,7 +49,7 @@ use keyring::Keyring; mod local_executor { #![allow(missing_docs)] use super::runtime; - // FIXME: change the macro and pass in the `BlakeHasher` that dispatch needs from here instead + // FIXME #1576 change the macro and pass in the `BlakeHasher` that dispatch needs from here instead native_executor_instance!( pub LocalExecutor, runtime::api::dispatch, diff --git a/core/trie/src/lib.rs b/core/trie/src/lib.rs index 58eff5811792b..9013530f141a8 100644 --- a/core/trie/src/lib.rs +++ b/core/trie/src/lib.rs @@ -16,7 +16,7 @@ //! Utility functions to interact with Substrate's Base-16 Modified Merkle Patricia tree ("trie"). -// FIXME: no_std +// FIXME: no_std - https://github.com/paritytech/substrate/issues/1574 extern crate trie_root; extern crate parity_codec as codec; @@ -85,7 +85,7 @@ pub fn delta_trie_root(db: &mut HashDB, mut root: H::Out, for (key, change) in delta { match change { Some(val) => trie.insert(key.as_ref(), val.as_ref())?, - None => trie.remove(key.as_ref())?, // FIXME: archive mode + None => trie.remove(key.as_ref())?, }; } } @@ -165,7 +165,7 @@ pub fn child_delta_trie_root(_storage_key: &[u8], db: &mut H for (key, change) in delta { match change { Some(val) => trie.insert(key.as_ref(), val.as_ref())?, - None => trie.remove(key.as_ref())?, // FIXME: archive mode + None => trie.remove(key.as_ref())?, }; } } diff --git a/node/cli/src/chain_spec.rs b/node/cli/src/chain_spec.rs index bf44250808547..8ed966a5e6ef0 100644 --- a/node/cli/src/chain_spec.rs +++ b/node/cli/src/chain_spec.rs @@ -57,7 +57,7 @@ fn staging_testnet_config_genesis() -> GenesisConfig { GenesisConfig { consensus: Some(ConsensusConfig { - code: include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm").to_vec(), // FIXME change + code: include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm").to_vec(), // FIXME change once we have #1252 authorities: initial_authorities.clone(), }), system: None, diff --git a/node/cli/src/service.rs b/node/cli/src/service.rs index eb0e5a4f80a6e..f9c3fd496031c 100644 --- a/node/cli/src/service.rs +++ b/node/cli/src/service.rs @@ -43,8 +43,7 @@ construct_simple_protocol! { /// Node specific configuration pub struct NodeConfig { /// grandpa connection to import block - // FIXME: rather than putting this on the config, let's have an actual intermediate setup state - // https://github.com/paritytech/substrate/issues/1134 + // FIXME #1134 rather than putting this on the config, let's have an actual intermediate setup state pub grandpa_import_setup: Option<(Arc>, grandpa::LinkHalfForService)>, inherent_data_providers: InherentDataProviders, } @@ -103,7 +102,7 @@ construct_service_factory! { executor.spawn(grandpa::run_grandpa( grandpa::Config { local_key, - // FIXME: make this available through chainspec? + // FIXME #1578 make this available through chainspec gossip_duration: Duration::new(4, 0), justification_period: 4096, name: Some(service.config.name.clone()) diff --git a/srml/consensus/src/lib.rs b/srml/consensus/src/lib.rs index cf74cc5d6fd78..bd4b564985b36 100644 --- a/srml/consensus/src/lib.rs +++ b/srml/consensus/src/lib.rs @@ -201,7 +201,6 @@ decl_module! { /// Report some misbehaviour. fn report_misbehavior(origin, _report: Vec) { ensure_signed(origin)?; - // FIXME: requires extension trait. } /// Note the previous block's validator missed their opportunity to propose a block. diff --git a/srml/contract/src/lib.rs b/srml/contract/src/lib.rs index b44fd480a665b..2f278b2a2c8fb 100644 --- a/srml/contract/src/lib.rs +++ b/srml/contract/src/lib.rs @@ -347,12 +347,8 @@ decl_storage! { } } -// FIXME: consider storing upper-bound for contract's gas limit in fixed-length runtime -// code in contract itself and use that. - /// The storage items associated with an account/key. /// -/// FIXME: keys should also be able to take AsRef to ensure Vecs can be passed as &[u8] pub(crate) struct StorageOf(rstd::marker::PhantomData); impl StorageDoubleMap for StorageOf { const PREFIX: &'static [u8] = b"con:sto:"; diff --git a/srml/contract/src/wasm/runtime.rs b/srml/contract/src/wasm/runtime.rs index e860a5715243f..03f56cbc3d6ff 100644 --- a/srml/contract/src/wasm/runtime.rs +++ b/srml/contract/src/wasm/runtime.rs @@ -196,8 +196,6 @@ fn write_sandbox_memory( // * AFTER MAKING A CHANGE MAKE SURE TO UPDATE COMPLEXITY.MD * // *********************************************************** -// FIXME: ext_balance, ext_address, ext_callvalue, etc. - // Define a function `fn init_env() -> HostFunctionSet` that returns // a function set which can be imported by an executed contract. define_env!(Env, , diff --git a/srml/session/src/lib.rs b/srml/session/src/lib.rs index ea607acbd8a32..032b3328a3dfc 100644 --- a/srml/session/src/lib.rs +++ b/srml/session/src/lib.rs @@ -138,7 +138,7 @@ decl_storage! { impl Module { /// The number of validators currently. pub fn validator_count() -> u32 { - >::get().len() as u32 // FIXME: can probably optimised + >::get().len() as u32 } /// The last length change, if there was one, zero if not. @@ -158,7 +158,7 @@ impl Module { /// Called by `staking::new_era()` only. `next_session` should be called after this in order to /// update the session keys to the next validator set. pub fn set_validators(new: &[T::AccountId]) { - >::put(&new.to_vec()); // FIXME: optimise. + >::put(&new.to_vec()); >::set_authorities( &new.iter().cloned().map(T::ConvertAccountIdToSessionKey::convert).collect::>() ); diff --git a/srml/staking/src/lib.rs b/srml/staking/src/lib.rs index 590975271b2e2..9b4083f28660f 100644 --- a/srml/staking/src/lib.rs +++ b/srml/staking/src/lib.rs @@ -355,7 +355,7 @@ impl Module { let noms = Self::current_nominators_for(v); let total = noms.iter().map(>::total_balance).fold(T::Balance::zero(), |acc, x| acc + x); if !total.is_zero() { - let safe_mul_rational = |b| b * rem / total;// FIXME: avoid overflow + let safe_mul_rational = |b| b * rem / total;// FIXME #1572 avoid overflow for n in noms.iter() { let _ = >::slash(n, safe_mul_rational(>::total_balance(n))); // best effort - not much that can be done on fail. } @@ -376,7 +376,7 @@ impl Module { .map(>::total_balance) .fold(>::total_balance(who), |acc, x| acc + x) .max(One::one()); - let safe_mul_rational = |b| b * reward / total;// FIXME: avoid overflow + let safe_mul_rational = |b| b * reward / total;// FIXME #1572: avoid overflow for n in noms.iter() { let _ = >::reward(n, safe_mul_rational(>::total_balance(n))); } @@ -454,7 +454,7 @@ impl Module { // combination of validators, then use session::internal::set_validators(). // for now, this just orders would-be stakers by their balances and chooses the top-most // >::get() of them. - // FIXME: this is not sound. this should be moved to an off-chain solution mechanism. + // FIXME #1571 this is not sound. this should be moved to an off-chain solution mechanism. let mut intentions = Self::intentions() .into_iter() .map(|v| (Self::slashable_balance(&v), v)) diff --git a/srml/staking/src/tests.rs b/srml/staking/src/tests.rs index ebfcfa14dc74c..e6496159a1b03 100644 --- a/srml/staking/src/tests.rs +++ b/srml/staking/src/tests.rs @@ -416,7 +416,6 @@ fn nominating_slashes_should_work() { assert_eq!(Balances::total_balance(&2), 20); //not slashed assert_eq!(Balances::total_balance(&3), 10); //slashed assert_eq!(Balances::total_balance(&4), 30); //slashed - // FIXME: change slash % to something sensible. }); } diff --git a/srml/support/procedural/src/storage/mod.rs b/srml/support/procedural/src/storage/mod.rs index 9a8023c180036..b3cf50ece0fbf 100644 --- a/srml/support/procedural/src/storage/mod.rs +++ b/srml/support/procedural/src/storage/mod.rs @@ -74,7 +74,7 @@ struct AddExtraGenesisLine { pub extra_field: ext::Parens, pub coldot_token: Token![:], pub extra_type: syn::Type, - // FIXME use a custom ext::Option instead (syn option on '=' fails) + // FIXME #1570: use a custom ext::Option instead (syn option on '=' fails) pub default_value: ext::Seq, } @@ -91,7 +91,7 @@ struct DeclStorageLine { pub build: Option, pub coldot_token: Token![:], pub storage_type: DeclStorageType, - // FIXME use a custom ext::Option instead (syn option on '=' fails) + // FIXME #1570: use a custom ext::Option instead (syn option on '=' fails) pub default_value: ext::Seq, } diff --git a/srml/support/procedural/tools/src/lib.rs b/srml/support/procedural/tools/src/lib.rs index 49d012017b5c4..a768f5ea0b921 100644 --- a/srml/support/procedural/tools/src/lib.rs +++ b/srml/support/procedural/tools/src/lib.rs @@ -57,9 +57,7 @@ macro_rules! custom_keyword { } -// FIXME following functions are copied from sr-api-macros : do a merge to get a unique procedural -// macro tooling crate (this crate path does not look good for it) - +// FIXME #1569, remove the following functions, which are copied from sr-api-macros use proc_macro2::{TokenStream, Span}; use syn::Ident; diff --git a/srml/support/src/storage/generator.rs b/srml/support/src/storage/generator.rs index cba8e5f849edc..0415b45f02f85 100644 --- a/srml/support/src/storage/generator.rs +++ b/srml/support/src/storage/generator.rs @@ -194,7 +194,7 @@ pub trait StorageMap { fn mutate R, S: Storage>(key: &K, f: F, storage: &S) -> R; } -// FIXME: Remove this in favour of `decl_storage` macro. +// FIXME #1568 Remove this in favour of `decl_storage` macro. /// Declares strongly-typed wrappers around codec-compatible types in storage. #[macro_export] macro_rules! storage_items { @@ -445,7 +445,6 @@ macro_rules! __storage_items_internal { } /// Get the key used to put the length field. - // FIXME: concat macro should accept byte literals. fn len_key() -> $crate::rstd::vec::Vec { let mut key = $prefix.to_vec(); key.extend(b"len"); diff --git a/srml/support/src/storage/mod.rs b/srml/support/src/storage/mod.rs index ffb4a25189423..c788c7c4021f4 100644 --- a/srml/support/src/storage/mod.rs +++ b/srml/support/src/storage/mod.rs @@ -24,8 +24,6 @@ use codec::{Codec, Decode, KeyedVec, Input}; #[macro_use] pub mod generator; -// FIXME: consider using blake256 to avoid possible preimage attack. - struct IncrementalInput<'a> { key: &'a [u8], pos: usize, diff --git a/srml/system/src/lib.rs b/srml/system/src/lib.rs index f6d3821675456..c47c970a98692 100644 --- a/srml/system/src/lib.rs +++ b/srml/system/src/lib.rs @@ -344,9 +344,9 @@ impl Module { #[cfg(any(feature = "std", test))] pub fn externalities() -> TestExternalities { TestExternalities::new(map![ - twox_128(&>::key_for(T::BlockNumber::zero())).to_vec() => [69u8; 32].encode(), // FIXME: replace with Hash::default().encode + twox_128(&>::key_for(T::BlockNumber::zero())).to_vec() => [69u8; 32].encode(), twox_128(>::key()).to_vec() => T::BlockNumber::one().encode(), - twox_128(>::key()).to_vec() => [69u8; 32].encode(), // FIXME: replace with Hash::default().encode + twox_128(>::key()).to_vec() => [69u8; 32].encode(), twox_128(>::key()).to_vec() => T::Hash::default().encode() ]) } From a3d7a24e59a5ad6b80d1768e9dbfe5029cbdf134 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Fri, 25 Jan 2019 14:30:57 +0100 Subject: [PATCH 7/8] clean up related code --- core/primitives/src/ed25519.rs | 16 ---------------- srml/staking/src/lib.rs | 2 +- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/core/primitives/src/ed25519.rs b/core/primitives/src/ed25519.rs index 42a0cf96459f1..ba43be841bb5f 100644 --- a/core/primitives/src/ed25519.rs +++ b/core/primitives/src/ed25519.rs @@ -238,16 +238,6 @@ impl Pair { r.copy_from_slice(pk); Public(r) } - - /// Derive a child key. Probably unsafe and broken. - // FIXME: proper HD derivation https://cardanolaunch.com/assets/Ed25519_BIP.pdf - pub fn derive_child_probably_bad(&self, chain_data: &[u8]) -> Pair { - let sig = self.sign(chain_data); - let mut seed = [0u8; 32]; - seed.copy_from_slice(&sig[..32]); - - Pair::from_seed(&seed) - } } /// Verify a signature on a message. Returns true if the signature is good. @@ -350,12 +340,6 @@ mod test { assert_eq!(pair1.public(), pair2.public()); } - #[test] - fn derive_child() { - let pair = Pair::generate(); - let _pair2 = pair.derive_child_probably_bad(b"session_1234"); - } - #[test] fn ss58check_roundtrip_works() { let pair = Pair::from_seed(b"12345678901234567890123456789012"); diff --git a/srml/staking/src/lib.rs b/srml/staking/src/lib.rs index 9b4083f28660f..5ae7634831f03 100644 --- a/srml/staking/src/lib.rs +++ b/srml/staking/src/lib.rs @@ -70,7 +70,7 @@ pub enum LockStatus { /// Preference of what happens on a slash event. #[derive(PartialEq, Eq, Clone, Encode, Decode)] #[cfg_attr(feature = "std", derive(Debug))] -pub struct ValidatorPrefs { // FIXME: @bkchr shouldn't need this Copy but derive(Encode) breaks otherwise +pub struct ValidatorPrefs { /// Validator should ensure this many more slashes than is necessary before being unstaked. #[codec(compact)] pub unstake_threshold: u32, From 8c897cb71d0ec44d36f08f7ea4683453a3cd3ad9 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Fri, 25 Jan 2019 14:49:35 +0100 Subject: [PATCH 8/8] update links --- core/client/src/client.rs | 6 ++---- core/finality-grandpa/src/lib.rs | 2 +- srml/support/src/storage/generator.rs | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/client/src/client.rs b/core/client/src/client.rs index 9449cdeae250f..e8c46156f701a 100644 --- a/core/client/src/client.rs +++ b/core/client/src/client.rs @@ -736,8 +736,7 @@ impl Client where self.apply_finality_with_block_hash(operation, parent_hash, None, last_best, make_notifications)?; } - // TODO: correct path logic for when to execute this function - // https://github.com/paritytech/substrate/issues/1232 + // FIXME #1232: correct path logic for when to execute this function let (storage_update,changes_update,storage_changes) = self.block_execution(&operation.op, &import_headers, origin, hash, body.clone())?; let is_new_best = finalized || match fork_choice { @@ -1170,8 +1169,7 @@ impl Client where // header may be on a dead fork -- the only leaves that are considered are // those which can still be finalized. // - // TODO: only issue this warning when not on a dead fork - // part of https://github.com/paritytech/substrate/issues/1558 + // FIXME #1558 only issue this warning when not on a dead fork warn!( "Block {:?} exists in chain but not found when following all \ leaves backwards. Number limit = {:?}", diff --git a/core/finality-grandpa/src/lib.rs b/core/finality-grandpa/src/lib.rs index 497e4f5b1d878..346bad37fd033 100644 --- a/core/finality-grandpa/src/lib.rs +++ b/core/finality-grandpa/src/lib.rs @@ -841,7 +841,7 @@ fn finalize_block, E, RA>( // lock must be held through writing to DB to avoid race let mut authority_set = authority_set.inner().write(); - // TODO [andre]: clone only when changed (#1483) + // FIXME #1483: clone only when changed let old_authority_set = authority_set.clone(); // needed in case there is an authority set change, used for reverting in // case of error diff --git a/srml/support/src/storage/generator.rs b/srml/support/src/storage/generator.rs index 0415b45f02f85..79469d761fbeb 100644 --- a/srml/support/src/storage/generator.rs +++ b/srml/support/src/storage/generator.rs @@ -194,7 +194,7 @@ pub trait StorageMap { fn mutate R, S: Storage>(key: &K, f: F, storage: &S) -> R; } -// FIXME #1568 Remove this in favour of `decl_storage` macro. +// FIXME #1466 Remove this in favour of `decl_storage` macro. /// Declares strongly-typed wrappers around codec-compatible types in storage. #[macro_export] macro_rules! storage_items {