From 46de15a3458538eb9043975fdc087d60dc9d1032 Mon Sep 17 00:00:00 2001 From: 0g-peterzhb <158457852+0g-peterzhb@users.noreply.github.com> Date: Thu, 2 Oct 2025 10:39:32 +0800 Subject: [PATCH] fix context error (#396) * fix context error * fix context error --- node/miner/src/watcher.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/node/miner/src/watcher.rs b/node/miner/src/watcher.rs index 8ba7bc7..7b43d4f 100644 --- a/node/miner/src/watcher.rs +++ b/node/miner/src/watcher.rs @@ -26,6 +26,10 @@ pub type MineContextMessage = Option; lazy_static! { pub static ref EMPTY_HASH: H256 = H256::from_str("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").unwrap(); + pub static ref COMPUTE_WORKER_CONTEXT_CALLER: Address = + "0x000000000000000000000000000000000000000A" + .parse() + .unwrap(); } const PORA_VERSION: u64 = 1; @@ -139,6 +143,8 @@ impl MineContextWatcher { } let miner_id = self.miner_id.0; + + // Use eth_call with specific caller address for read-only access let WorkerContext { context, pora_target, @@ -147,6 +153,7 @@ impl MineContextWatcher { } = self .mine_contract .compute_worker_context(miner_id) + .from(*COMPUTE_WORKER_CONTEXT_CALLER) .call() .await .map_err(|e| format!("Failed to query mining context: {:?}", e))?;