mirror of
				https://github.com/0glabs/0g-storage-node.git
				synced 2025-11-04 08:37:27 +00:00 
			
		
		
		
	Merge be14ba647d into 74074dfa2f
				
					
				
			This commit is contained in:
		
						commit
						c845d91682
					
				
							
								
								
									
										2
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							@ -977,6 +977,7 @@ dependencies = [
 | 
				
			|||||||
 "iana-time-zone",
 | 
					 "iana-time-zone",
 | 
				
			||||||
 "js-sys",
 | 
					 "js-sys",
 | 
				
			||||||
 "num-traits",
 | 
					 "num-traits",
 | 
				
			||||||
 | 
					 "serde",
 | 
				
			||||||
 "wasm-bindgen",
 | 
					 "wasm-bindgen",
 | 
				
			||||||
 "windows-targets 0.52.6",
 | 
					 "windows-targets 0.52.6",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
@ -6420,6 +6421,7 @@ name = "pruner"
 | 
				
			|||||||
version = "0.1.0"
 | 
					version = "0.1.0"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "anyhow",
 | 
					 "anyhow",
 | 
				
			||||||
 | 
					 "chrono",
 | 
				
			||||||
 "contract-interface",
 | 
					 "contract-interface",
 | 
				
			||||||
 "ethereum-types 0.14.1",
 | 
					 "ethereum-types 0.14.1",
 | 
				
			||||||
 "ethers",
 | 
					 "ethers",
 | 
				
			||||||
 | 
				
			|||||||
@ -15,4 +15,5 @@ tracing = "0.1.40"
 | 
				
			|||||||
ethereum-types = "0.14.1"
 | 
					ethereum-types = "0.14.1"
 | 
				
			||||||
contract-interface = { path = "../../common/contract-interface" }
 | 
					contract-interface = { path = "../../common/contract-interface" }
 | 
				
			||||||
ethers = "^2"
 | 
					ethers = "^2"
 | 
				
			||||||
zgs_spec = { path = "../../common/spec" }
 | 
					zgs_spec = { path = "../../common/spec" }
 | 
				
			||||||
 | 
					chrono = { version = "0.4", features = ["serde"] }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,5 @@
 | 
				
			|||||||
use anyhow::{bail, Result};
 | 
					use anyhow::{bail, Result};
 | 
				
			||||||
 | 
					use chrono::Utc;
 | 
				
			||||||
use contract_interface::ChunkLinearReward;
 | 
					use contract_interface::ChunkLinearReward;
 | 
				
			||||||
use ethereum_types::Address;
 | 
					use ethereum_types::Address;
 | 
				
			||||||
use ethers::prelude::{Http, Provider};
 | 
					use ethers::prelude::{Http, Provider};
 | 
				
			||||||
@ -117,7 +118,15 @@ impl Pruner {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            // Check no reward chunks and prune.
 | 
					            // Check no reward chunks and prune.
 | 
				
			||||||
            match self.reward_contract.first_rewardable_chunk().call().await {
 | 
					            match self.reward_contract.first_rewardable_chunk().call().await {
 | 
				
			||||||
                Ok(new_first_rewardable) => {
 | 
					                Ok((new_first_rewardable, chain_timestamp)) => {
 | 
				
			||||||
 | 
					                    if (Utc::now().timestamp() - (chain_timestamp.as_u64() as i64)).abs() > 60 * 60
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        debug!(
 | 
				
			||||||
 | 
					                            chain_timestamp = chain_timestamp.as_u64(),
 | 
				
			||||||
 | 
					                            "chain timestamp is weird, skip pruning"
 | 
				
			||||||
 | 
					                        );
 | 
				
			||||||
 | 
					                        continue;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    if let Some(no_reward_list) = self
 | 
					                    if let Some(no_reward_list) = self
 | 
				
			||||||
                        .maybe_forward_first_rewardable(new_first_rewardable)
 | 
					                        .maybe_forward_first_rewardable(new_first_rewardable)
 | 
				
			||||||
                        .await?
 | 
					                        .await?
 | 
				
			||||||
 | 
				
			|||||||
@ -1 +1 @@
 | 
				
			|||||||
1e931c7b168f9bc2b55f7b8fd96946e35b373048
 | 
					2772838c13c041dcebcf586a982c4bc8a7f09359
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -40,8 +40,8 @@
 | 
				
			|||||||
      "type": "function"
 | 
					      "type": "function"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "bytecode": "0x608060405234801561001057600080fd5b5060be8061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806361ec5082146037578063da6eb36a14604b575b600080fd5b600060405190815260200160405180910390f35b605b6056366004605d565b505050565b005b600080600060608486031215607157600080fd5b50508135936020830135935060409092013591905056fea264697066735822122080db0b00f4b93cc320a2df449a74e503451a2675da518eff0fc5b7cf0ae8c90c64736f6c63430008100033",
 | 
					  "bytecode": "0x608060405234801561001057600080fd5b5060be8061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806361ec5082146037578063da6eb36a14604b575b600080fd5b600060405190815260200160405180910390f35b605b6056366004605d565b505050565b005b600080600060608486031215607157600080fd5b50508135936020830135935060409092013591905056fea264697066735822122046b53f2984cbf5adf3e9850bdbd978b04bf2673faae23f82bb65f6ed17a8ca6164736f6c63430008100033",
 | 
				
			||||||
  "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806361ec5082146037578063da6eb36a14604b575b600080fd5b600060405190815260200160405180910390f35b605b6056366004605d565b505050565b005b600080600060608486031215607157600080fd5b50508135936020830135935060409092013591905056fea264697066735822122080db0b00f4b93cc320a2df449a74e503451a2675da518eff0fc5b7cf0ae8c90c64736f6c63430008100033",
 | 
					  "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806361ec5082146037578063da6eb36a14604b575b600080fd5b600060405190815260200160405180910390f35b605b6056366004605d565b505050565b005b600080600060608486031215607157600080fd5b50508135936020830135935060409092013591905056fea264697066735822122046b53f2984cbf5adf3e9850bdbd978b04bf2673faae23f82bb65f6ed17a8ca6164736f6c63430008100033",
 | 
				
			||||||
  "linkReferences": {},
 | 
					  "linkReferences": {},
 | 
				
			||||||
  "deployedLinkReferences": {}
 | 
					  "deployedLinkReferences": {}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -18,6 +18,12 @@
 | 
				
			|||||||
          "name": "beneficiary",
 | 
					          "name": "beneficiary",
 | 
				
			||||||
          "type": "address"
 | 
					          "type": "address"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          "indexed": true,
 | 
				
			||||||
 | 
					          "internalType": "bytes32",
 | 
				
			||||||
 | 
					          "name": "minerId",
 | 
				
			||||||
 | 
					          "type": "bytes32"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          "indexed": false,
 | 
					          "indexed": false,
 | 
				
			||||||
          "internalType": "uint256",
 | 
					          "internalType": "uint256",
 | 
				
			||||||
@ -70,8 +76,8 @@
 | 
				
			|||||||
      "type": "function"
 | 
					      "type": "function"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "bytecode": "0x608060405234801561001057600080fd5b5060f18061001f6000396000f3fe60806040526004361060265760003560e01c806359e9670014602b578063b7a3c04c14603c575b600080fd5b603a60363660046058565b5050565b005b348015604757600080fd5b50603a60533660046079565b505050565b60008060408385031215606a57600080fd5b50508035926020909101359150565b600080600060608486031215608d57600080fd5b8335925060208401356001600160a01b038116811460aa57600080fd5b92959294505050604091909101359056fea2646970667358221220d2f22ec6a41724281bad8a768c241562927a5fcc8ba600f3b3784f584a68c65864736f6c63430008100033",
 | 
					  "bytecode": "0x608060405234801561001057600080fd5b5060f18061001f6000396000f3fe60806040526004361060265760003560e01c806359e9670014602b578063b7a3c04c14603c575b600080fd5b603a60363660046058565b5050565b005b348015604757600080fd5b50603a60533660046079565b505050565b60008060408385031215606a57600080fd5b50508035926020909101359150565b600080600060608486031215608d57600080fd5b8335925060208401356001600160a01b038116811460aa57600080fd5b92959294505050604091909101359056fea264697066735822122007df1d2999303b3bd440ba3a542d4ba59318a16f2d33109615522c89b0f299dc64736f6c63430008100033",
 | 
				
			||||||
  "deployedBytecode": "0x60806040526004361060265760003560e01c806359e9670014602b578063b7a3c04c14603c575b600080fd5b603a60363660046058565b5050565b005b348015604757600080fd5b50603a60533660046079565b505050565b60008060408385031215606a57600080fd5b50508035926020909101359150565b600080600060608486031215608d57600080fd5b8335925060208401356001600160a01b038116811460aa57600080fd5b92959294505050604091909101359056fea2646970667358221220d2f22ec6a41724281bad8a768c241562927a5fcc8ba600f3b3784f584a68c65864736f6c63430008100033",
 | 
					  "deployedBytecode": "0x60806040526004361060265760003560e01c806359e9670014602b578063b7a3c04c14603c575b600080fd5b603a60363660046058565b5050565b005b348015604757600080fd5b50603a60533660046079565b505050565b60008060408385031215606a57600080fd5b50508035926020909101359150565b600080600060608486031215608d57600080fd5b8335925060208401356001600160a01b038116811460aa57600080fd5b92959294505050604091909101359056fea264697066735822122007df1d2999303b3bd440ba3a542d4ba59318a16f2d33109615522c89b0f299dc64736f6c63430008100033",
 | 
				
			||||||
  "linkReferences": {},
 | 
					  "linkReferences": {},
 | 
				
			||||||
  "deployedLinkReferences": {}
 | 
					  "deployedLinkReferences": {}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user