fix context error (#396)

* fix context error

* fix context error
This commit is contained in:
0g-peterzhb 2025-10-02 10:39:32 +08:00 committed by GitHub
parent 88287333b5
commit 46de15a345
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,6 +26,10 @@ pub type MineContextMessage = Option<PoraPuzzle>;
lazy_static! { lazy_static! {
pub static ref EMPTY_HASH: H256 = pub static ref EMPTY_HASH: H256 =
H256::from_str("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").unwrap(); H256::from_str("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").unwrap();
pub static ref COMPUTE_WORKER_CONTEXT_CALLER: Address =
"0x000000000000000000000000000000000000000A"
.parse()
.unwrap();
} }
const PORA_VERSION: u64 = 1; const PORA_VERSION: u64 = 1;
@ -139,6 +143,8 @@ impl MineContextWatcher {
} }
let miner_id = self.miner_id.0; let miner_id = self.miner_id.0;
// Use eth_call with specific caller address for read-only access
let WorkerContext { let WorkerContext {
context, context,
pora_target, pora_target,
@ -147,6 +153,7 @@ impl MineContextWatcher {
} = self } = self
.mine_contract .mine_contract
.compute_worker_context(miner_id) .compute_worker_context(miner_id)
.from(*COMPUTE_WORKER_CONTEXT_CALLER)
.call() .call()
.await .await
.map_err(|e| format!("Failed to query mining context: {:?}", e))?; .map_err(|e| format!("Failed to query mining context: {:?}", e))?;