Skip to content

Commit cb36410

Browse files
committed
feat: embedded validation responses on keeper
1 parent 6ae450a commit cb36410

15 files changed

Lines changed: 1014 additions & 19 deletions

File tree

crates/erc-8004-contract-clients/src/validation_registry.rs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,40 @@ sol! {
1919
bytes32 requestHash,
2020
uint64 snapshotId
2121
) external;
22+
23+
function validationResponse(
24+
bytes32 requestHash,
25+
uint8 response,
26+
string calldata responseURI,
27+
bytes32 responseHash,
28+
string calldata tag
29+
) external;
30+
31+
event ValidationRequest(
32+
address indexed validatorAddress,
33+
uint256 indexed agentId,
34+
string requestURI,
35+
bytes32 indexed requestHash
36+
);
37+
38+
event ValidationResponse(
39+
address indexed validatorAddress,
40+
uint256 indexed agentId,
41+
bytes32 indexed requestHash,
42+
uint8 response,
43+
string responseURI,
44+
bytes32 responseHash,
45+
string tag
46+
);
2247
}
2348
}
2449

2550
use ValidationRegistryUpgradeable::ValidationRegistryUpgradeableInstance;
2651

52+
// Event type re-exports
53+
pub type ValidationRequestEvent = ValidationRegistryUpgradeable::ValidationRequest;
54+
pub type ValidationResponseEvent = ValidationRegistryUpgradeable::ValidationResponse;
55+
2756
/// Client for interacting with the ValidationRegistryUpgradeable contract.
2857
#[derive(Clone)]
2958
pub struct ValidationRegistryClient<P: Provider + Clone> {
@@ -82,4 +111,30 @@ impl<P: Provider + Clone> ValidationRegistryClient<P> {
82111
);
83112
self.submitter.invoke("validationRequest", call).await
84113
}
114+
115+
/// Submit a validation response.
116+
///
117+
/// # Arguments
118+
/// * `request_hash` - The request hash identifying the validation request
119+
/// * `response` - Response value 0-100 (0=invalid, 100=valid)
120+
/// * `response_uri` - Optional URI pointing to response details
121+
/// * `response_hash` - Hash of the response data (can be zero)
122+
/// * `tag` - Tag identifying the response source (e.g., "heartbeat")
123+
pub async fn validation_response(
124+
&self,
125+
request_hash: B256,
126+
response: u8,
127+
response_uri: String,
128+
response_hash: B256,
129+
tag: String,
130+
) -> Result<B256> {
131+
let call = self.contract.validationResponse(
132+
request_hash,
133+
response,
134+
response_uri,
135+
response_hash,
136+
tag,
137+
);
138+
self.submitter.invoke("validationResponse", call).await
139+
}
85140
}

docker-compose.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ services:
3535
- L2_HEARTBEAT_MANAGER_ADDRESS=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707
3636
- L2_JAILING_POLICY_ADDRESS=0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6
3737
- L1_EMISSIONS_CONTROLLER_ADDRESS=0x0165878A594ca255338adfa4d48449f69242Eb8F
38+
# ERC-8004 Keeper configuration
39+
- ENABLE_ERC8004_KEEPER=true
40+
- L2_VALIDATION_REGISTRY_ADDRESS=0x3Aa5ebB10DC797CAC828524e59A333d0A371443c
41+
- RUST_LOG=info
3842

3943
# NilCC Simulator - Submits HTXs to the contract
4044
simulator:
@@ -97,7 +101,7 @@ services:
97101
- PRIVATE_KEY=0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
98102
- IDENTITY_REGISTRY_CONTRACT_ADDRESS=0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1
99103
- VALIDATION_REGISTRY_CONTRACT_ADDRESS=0x3Aa5ebB10DC797CAC828524e59A333d0A371443c
100-
- HEARTBEAT_MANAGER_ADDRESS=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707
104+
- VALIDATOR_ADDRESS=0x90F79bf6EB2c4f870365E785982E1f101E93b906
101105
- AGENT_URI=https://api.nilai.nillion.network/v1/health/
102106
- RUST_LOG=info
103107
networks:

keeper/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ tracing = "0.1"
1616
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
1717

1818
blacklight-contract-clients = { path = "../crates/blacklight-contract-clients" }
19+
erc-8004-contract-clients = { path = "../crates/erc-8004-contract-clients" }

0 commit comments

Comments
 (0)