mirror of
				https://github.com/0glabs/0g-storage-node.git
				synced 2025-11-04 00:27:39 +00:00 
			
		
		
		
	fmt code (#3)
This commit is contained in:
		
							parent
							
								
									5253436226
								
							
						
					
					
						commit
						971d344acd
					
				@ -3,7 +3,7 @@ use crate::sync_manager::log_query::LogQuery;
 | 
			
		||||
use crate::sync_manager::{repeat_run_and_log, RETRY_WAIT_MS};
 | 
			
		||||
use anyhow::{anyhow, bail, Result};
 | 
			
		||||
use append_merkle::{Algorithm, Sha3Algorithm};
 | 
			
		||||
use contract_interface::{ZgsFlow, SubmissionNode, SubmitFilter};
 | 
			
		||||
use contract_interface::{SubmissionNode, SubmitFilter, ZgsFlow};
 | 
			
		||||
use ethers::abi::RawLog;
 | 
			
		||||
use ethers::prelude::{BlockNumber, EthLogDecode, Http, Log, Middleware, Provider, U256};
 | 
			
		||||
use ethers::providers::{FilterKind, HttpRateLimitRetryPolicy, RetryClient, RetryClientBuilder};
 | 
			
		||||
 | 
			
		||||
@ -2,9 +2,9 @@ use crate::{CustomMineRange, PoraLoader};
 | 
			
		||||
use blake2::{Blake2b512, Digest};
 | 
			
		||||
use contract_interface::zgs_flow::MineContext;
 | 
			
		||||
use ethereum_types::{H256, U256};
 | 
			
		||||
use zgs_spec::{BYTES_PER_SCRATCHPAD, BYTES_PER_SEAL, SECTORS_PER_LOAD, SECTORS_PER_SEAL};
 | 
			
		||||
use storage::log_store::MineLoadChunk;
 | 
			
		||||
use tiny_keccak::{Hasher, Keccak};
 | 
			
		||||
use zgs_spec::{BYTES_PER_SCRATCHPAD, BYTES_PER_SEAL, SECTORS_PER_LOAD, SECTORS_PER_SEAL};
 | 
			
		||||
 | 
			
		||||
pub const BLAKE2B_OUTPUT_BYTES: usize = 64;
 | 
			
		||||
pub const KECCAK256_OUTPUT_BYTES: usize = 32;
 | 
			
		||||
 | 
			
		||||
@ -7,12 +7,12 @@ use tokio::{
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
use contract_interface::{EpochRangeWithContextDigest, ZgsFlow};
 | 
			
		||||
use zgs_spec::SECTORS_PER_SEAL;
 | 
			
		||||
use storage::{
 | 
			
		||||
    error::Result,
 | 
			
		||||
    log_store::{SealAnswer, SealTask, Store},
 | 
			
		||||
};
 | 
			
		||||
use task_executor::TaskExecutor;
 | 
			
		||||
use zgs_spec::SECTORS_PER_SEAL;
 | 
			
		||||
 | 
			
		||||
use crate::config::{MineServiceMiddleware, MinerConfig};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
use contract_interface::PoraAnswer;
 | 
			
		||||
use contract_interface::{ZgsFlow, PoraMine};
 | 
			
		||||
use contract_interface::{PoraMine, ZgsFlow};
 | 
			
		||||
use ethers::providers::PendingTransaction;
 | 
			
		||||
use shared_types::FlowRangeProof;
 | 
			
		||||
use std::sync::Arc;
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
#![allow(unused)]
 | 
			
		||||
 | 
			
		||||
use contract_interface::{zgs_flow::MineContext, ZgsFlow, PoraMine};
 | 
			
		||||
use contract_interface::{zgs_flow::MineContext, PoraMine, ZgsFlow};
 | 
			
		||||
use ethereum_types::{Address, H256, U256};
 | 
			
		||||
use ethers::{
 | 
			
		||||
    contract::Contract,
 | 
			
		||||
 | 
			
		||||
@ -22,8 +22,8 @@ pub(crate) use protocol::{InboundRequest, RPCProtocol};
 | 
			
		||||
 | 
			
		||||
pub use handler::SubstreamId;
 | 
			
		||||
pub use methods::{
 | 
			
		||||
    DataByHashRequest, GetChunksRequest, GoodbyeReason, MaxRequestBlocks, ZgsData,
 | 
			
		||||
    RPCResponseErrorCode, ResponseTermination, StatusMessage, MAX_REQUEST_BLOCKS,
 | 
			
		||||
    DataByHashRequest, GetChunksRequest, GoodbyeReason, MaxRequestBlocks, RPCResponseErrorCode,
 | 
			
		||||
    ResponseTermination, StatusMessage, ZgsData, MAX_REQUEST_BLOCKS,
 | 
			
		||||
};
 | 
			
		||||
pub(crate) use outbound::OutboundRequest;
 | 
			
		||||
pub use protocol::{max_rpc_size, Protocol, RPCError};
 | 
			
		||||
 | 
			
		||||
@ -7,8 +7,8 @@ mod admin;
 | 
			
		||||
mod config;
 | 
			
		||||
mod error;
 | 
			
		||||
mod miner;
 | 
			
		||||
mod zgs;
 | 
			
		||||
mod types;
 | 
			
		||||
mod zgs;
 | 
			
		||||
 | 
			
		||||
use crate::miner::RpcServer as MinerRpcServer;
 | 
			
		||||
use admin::RpcServer as AdminRpcServer;
 | 
			
		||||
@ -18,8 +18,6 @@ use jsonrpsee::core::RpcResult;
 | 
			
		||||
use jsonrpsee::http_server::{HttpServerBuilder, HttpServerHandle};
 | 
			
		||||
use network::NetworkGlobals;
 | 
			
		||||
use network::NetworkMessage;
 | 
			
		||||
use zgs::RpcServer as ZgsRpcServer;
 | 
			
		||||
use zgs_miner::MinerMessage;
 | 
			
		||||
use std::error::Error;
 | 
			
		||||
use std::sync::Arc;
 | 
			
		||||
use storage_async::Store;
 | 
			
		||||
@ -27,6 +25,8 @@ use sync::{SyncRequest, SyncResponse, SyncSender};
 | 
			
		||||
use task_executor::ShutdownReason;
 | 
			
		||||
use tokio::sync::broadcast;
 | 
			
		||||
use tokio::sync::mpsc::UnboundedSender;
 | 
			
		||||
use zgs::RpcServer as ZgsRpcServer;
 | 
			
		||||
use zgs_miner::MinerMessage;
 | 
			
		||||
 | 
			
		||||
pub use config::Config as RPCConfig;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,6 @@ use crate::{try_option, ZgsKeyValueDB};
 | 
			
		||||
use anyhow::{anyhow, bail, Result};
 | 
			
		||||
use append_merkle::{MerkleTreeInitialData, MerkleTreeRead};
 | 
			
		||||
use itertools::Itertools;
 | 
			
		||||
use zgs_spec::{BYTES_PER_SECTOR, SEALS_PER_LOAD, SECTORS_PER_LOAD, SECTORS_PER_SEAL};
 | 
			
		||||
use shared_types::{ChunkArray, DataRoot, FlowProof};
 | 
			
		||||
use ssz::{Decode, Encode};
 | 
			
		||||
use ssz_derive::{Decode as DeriveDecode, Encode as DeriveEncode};
 | 
			
		||||
@ -17,6 +16,7 @@ use std::fmt::Debug;
 | 
			
		||||
use std::sync::Arc;
 | 
			
		||||
use std::{cmp, mem};
 | 
			
		||||
use tracing::{debug, error, trace};
 | 
			
		||||
use zgs_spec::{BYTES_PER_SECTOR, SEALS_PER_LOAD, SECTORS_PER_LOAD, SECTORS_PER_SEAL};
 | 
			
		||||
 | 
			
		||||
pub struct FlowStore {
 | 
			
		||||
    db: FlowDBStore,
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,10 @@
 | 
			
		||||
use anyhow::{bail, Result};
 | 
			
		||||
use zgs_spec::{BYTES_PER_LOAD, BYTES_PER_SECTOR, SECTORS_PER_LOAD, SECTORS_PER_SEAL};
 | 
			
		||||
use shared_types::{bytes_to_chunks, DataRoot};
 | 
			
		||||
use ssz_derive::{Decode, Encode};
 | 
			
		||||
use std::fmt::{Debug, Formatter};
 | 
			
		||||
use std::mem;
 | 
			
		||||
use tracing::error;
 | 
			
		||||
use zgs_spec::{BYTES_PER_LOAD, BYTES_PER_SECTOR, SECTORS_PER_LOAD, SECTORS_PER_SEAL};
 | 
			
		||||
 | 
			
		||||
pub enum EntryBatchData {
 | 
			
		||||
    Complete(Vec<u8>),
 | 
			
		||||
@ -377,8 +377,8 @@ mod tests {
 | 
			
		||||
    use crate::log_store::load_chunk::chunk_data::PartialBatch;
 | 
			
		||||
 | 
			
		||||
    use super::EntryBatchData;
 | 
			
		||||
    use zgs_spec::{BYTES_PER_LOAD, BYTES_PER_SECTOR, SECTORS_PER_LOAD};
 | 
			
		||||
    use rand::{rngs::StdRng, RngCore, SeedableRng};
 | 
			
		||||
    use zgs_spec::{BYTES_PER_LOAD, BYTES_PER_SECTOR, SECTORS_PER_LOAD};
 | 
			
		||||
 | 
			
		||||
    fn test_data() -> Vec<u8> {
 | 
			
		||||
        let mut data = vec![0u8; BYTES_PER_LOAD];
 | 
			
		||||
 | 
			
		||||
@ -12,12 +12,12 @@ use ssz_derive::{Decode, Encode};
 | 
			
		||||
use crate::log_store::log_manager::data_to_merkle_leaves;
 | 
			
		||||
use crate::try_option;
 | 
			
		||||
use append_merkle::{Algorithm, MerkleTreeRead, Sha3Algorithm};
 | 
			
		||||
use shared_types::{ChunkArray, DataRoot, Merkle};
 | 
			
		||||
use tracing::trace;
 | 
			
		||||
use zgs_spec::{
 | 
			
		||||
    BYTES_PER_LOAD, BYTES_PER_SEAL, BYTES_PER_SECTOR, SEALS_PER_LOAD, SECTORS_PER_LOAD,
 | 
			
		||||
    SECTORS_PER_SEAL,
 | 
			
		||||
};
 | 
			
		||||
use shared_types::{ChunkArray, DataRoot, Merkle};
 | 
			
		||||
use tracing::trace;
 | 
			
		||||
 | 
			
		||||
use super::SealAnswer;
 | 
			
		||||
use chunk_data::EntryBatchData;
 | 
			
		||||
 | 
			
		||||
@ -174,9 +174,9 @@ impl SealInfo {
 | 
			
		||||
mod tests {
 | 
			
		||||
    use ethereum_types::H256;
 | 
			
		||||
    use hex_literal::hex;
 | 
			
		||||
    use rand::{rngs::StdRng, RngCore, SeedableRng};
 | 
			
		||||
    use zgs_seal;
 | 
			
		||||
    use zgs_spec::BYTES_PER_SEAL;
 | 
			
		||||
    use rand::{rngs::StdRng, RngCore, SeedableRng};
 | 
			
		||||
 | 
			
		||||
    use super::{SealContextInfo, SealInfo};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,9 +1,9 @@
 | 
			
		||||
use append_merkle::MerkleTreeInitialData;
 | 
			
		||||
use ethereum_types::H256;
 | 
			
		||||
use zgs_spec::{BYTES_PER_SEAL, SEALS_PER_LOAD};
 | 
			
		||||
use shared_types::{
 | 
			
		||||
    Chunk, ChunkArray, ChunkArrayWithProof, ChunkWithProof, DataRoot, FlowRangeProof, Transaction,
 | 
			
		||||
};
 | 
			
		||||
use zgs_spec::{BYTES_PER_SEAL, SEALS_PER_LOAD};
 | 
			
		||||
 | 
			
		||||
use crate::error::Result;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user