This commit is contained in:
0g-peterzhb 2025-03-28 01:16:57 +00:00 committed by GitHub
commit c845d91682
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 49 additions and 20 deletions

2
Cargo.lock generated
View File

@ -977,6 +977,7 @@ dependencies = [
"iana-time-zone",
"js-sys",
"num-traits",
"serde",
"wasm-bindgen",
"windows-targets 0.52.6",
]
@ -6420,6 +6421,7 @@ name = "pruner"
version = "0.1.0"
dependencies = [
"anyhow",
"chrono",
"contract-interface",
"ethereum-types 0.14.1",
"ethers",

View File

@ -15,4 +15,5 @@ tracing = "0.1.40"
ethereum-types = "0.14.1"
contract-interface = { path = "../../common/contract-interface" }
ethers = "^2"
zgs_spec = { path = "../../common/spec" }
zgs_spec = { path = "../../common/spec" }
chrono = { version = "0.4", features = ["serde"] }

View File

@ -1,4 +1,5 @@
use anyhow::{bail, Result};
use chrono::Utc;
use contract_interface::ChunkLinearReward;
use ethereum_types::Address;
use ethers::prelude::{Http, Provider};
@ -117,7 +118,15 @@ impl Pruner {
// Check no reward chunks and prune.
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
.maybe_forward_first_rewardable(new_first_rewardable)
.await?

View File

@ -1 +1 @@
1e931c7b168f9bc2b55f7b8fd96946e35b373048
2772838c13c041dcebcf586a982c4bc8a7f09359

File diff suppressed because one or more lines are too long

View File

@ -40,8 +40,8 @@
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5060be8061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806361ec5082146037578063da6eb36a14604b575b600080fd5b600060405190815260200160405180910390f35b605b6056366004605d565b505050565b005b600080600060608486031215607157600080fd5b50508135936020830135935060409092013591905056fea264697066735822122080db0b00f4b93cc320a2df449a74e503451a2675da518eff0fc5b7cf0ae8c90c64736f6c63430008100033",
"deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806361ec5082146037578063da6eb36a14604b575b600080fd5b600060405190815260200160405180910390f35b605b6056366004605d565b505050565b005b600080600060608486031215607157600080fd5b50508135936020830135935060409092013591905056fea264697066735822122080db0b00f4b93cc320a2df449a74e503451a2675da518eff0fc5b7cf0ae8c90c64736f6c63430008100033",
"bytecode": "0x608060405234801561001057600080fd5b5060be8061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060325760003560e01c806361ec5082146037578063da6eb36a14604b575b600080fd5b600060405190815260200160405180910390f35b605b6056366004605d565b505050565b005b600080600060608486031215607157600080fd5b50508135936020830135935060409092013591905056fea264697066735822122046b53f2984cbf5adf3e9850bdbd978b04bf2673faae23f82bb65f6ed17a8ca6164736f6c63430008100033",
"deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060325760003560e01c806361ec5082146037578063da6eb36a14604b575b600080fd5b600060405190815260200160405180910390f35b605b6056366004605d565b505050565b005b600080600060608486031215607157600080fd5b50508135936020830135935060409092013591905056fea264697066735822122046b53f2984cbf5adf3e9850bdbd978b04bf2673faae23f82bb65f6ed17a8ca6164736f6c63430008100033",
"linkReferences": {},
"deployedLinkReferences": {}
}

View File

@ -18,6 +18,12 @@
"name": "beneficiary",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "minerId",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint256",
@ -70,8 +76,8 @@
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5060f18061001f6000396000f3fe60806040526004361060265760003560e01c806359e9670014602b578063b7a3c04c14603c575b600080fd5b603a60363660046058565b5050565b005b348015604757600080fd5b50603a60533660046079565b505050565b60008060408385031215606a57600080fd5b50508035926020909101359150565b600080600060608486031215608d57600080fd5b8335925060208401356001600160a01b038116811460aa57600080fd5b92959294505050604091909101359056fea2646970667358221220d2f22ec6a41724281bad8a768c241562927a5fcc8ba600f3b3784f584a68c65864736f6c63430008100033",
"deployedBytecode": "0x60806040526004361060265760003560e01c806359e9670014602b578063b7a3c04c14603c575b600080fd5b603a60363660046058565b5050565b005b348015604757600080fd5b50603a60533660046079565b505050565b60008060408385031215606a57600080fd5b50508035926020909101359150565b600080600060608486031215608d57600080fd5b8335925060208401356001600160a01b038116811460aa57600080fd5b92959294505050604091909101359056fea2646970667358221220d2f22ec6a41724281bad8a768c241562927a5fcc8ba600f3b3784f584a68c65864736f6c63430008100033",
"bytecode": "0x608060405234801561001057600080fd5b5060f18061001f6000396000f3fe60806040526004361060265760003560e01c806359e9670014602b578063b7a3c04c14603c575b600080fd5b603a60363660046058565b5050565b005b348015604757600080fd5b50603a60533660046079565b505050565b60008060408385031215606a57600080fd5b50508035926020909101359150565b600080600060608486031215608d57600080fd5b8335925060208401356001600160a01b038116811460aa57600080fd5b92959294505050604091909101359056fea264697066735822122007df1d2999303b3bd440ba3a542d4ba59318a16f2d33109615522c89b0f299dc64736f6c63430008100033",
"deployedBytecode": "0x60806040526004361060265760003560e01c806359e9670014602b578063b7a3c04c14603c575b600080fd5b603a60363660046058565b5050565b005b348015604757600080fd5b50603a60533660046079565b505050565b60008060408385031215606a57600080fd5b50508035926020909101359150565b600080600060608486031215608d57600080fd5b8335925060208401356001600160a01b038116811460aa57600080fd5b92959294505050604091909101359056fea264697066735822122007df1d2999303b3bd440ba3a542d4ba59318a16f2d33109615522c89b0f299dc64736f6c63430008100033",
"linkReferences": {},
"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