Local Policy Simulation
Test Rego policy logic without the network using the Newton CLI:newton.crypto.ecdsa_recover_signer, newton.crypto.ecdsa_recover_signer_personal).
Local Oracle Simulation
Test your WASM data oracle without deploying:--input-json value is passed to your run function as the input string.
Gateway Simulation
Simulate a full policy evaluation via the Gateway RPC without any on-chain interaction:Simulate a Task
Tests the complete evaluation pipeline (data oracle + policy) for a specific PolicyClient:Simulate Policy Only
Test Rego policy evaluation with provided inputs (no oracle execution):Simulate PolicyData Only
Test a WASM oracle execution via the Gateway:- With inline secrets
- With stored secrets
Simulation Endpoints Comparison
Newton provides four distinct simulation endpoints for different phases of policy development:| Endpoint | Purpose | Data Source | Operators | Use Case |
|---|---|---|---|---|
newt_simulatePolicyData | Test WASM plugin execution | Caller provides secrets directly | Yes (delegation) | Iterate WASM before uploading secrets |
newt_simulatePolicyDataWithClient | Verify stored secrets work | Reads secrets from gateway DB | Yes (delegation) | Verify uploaded secrets |
newt_simulatePolicy | Full Rego + WASM evaluation | Delegates to operators for full pipeline | Yes (full pipeline) | Final testing before deployment |
newt_simulateTask | Replay with pre-assembled data | Uses provided PolicyTaskData directly | No (local only) | Replay historical tasks, debugging |
simulatePolicy delegates to an operator via broadcast_first_success — it runs the full data pipeline (fetches WASM from IPFS, decrypts stored secrets, executes each PolicyData plugin, merges outputs, evaluates Rego). simulateTask takes pre-assembled PolicyTaskData and evaluates Rego against it locally — the data pipeline is skipped because data is already assembled.
Recommended development workflow:
- Deploy PolicyData contracts
- Test WASM locally with
newt_simulatePolicyData - Upload secrets via
newt_storeEncryptedSecrets - Verify stored secrets with
newt_simulatePolicyDataWithClient - Test full policy end-to-end with
newt_simulatePolicy - Deploy Policy on-chain
- Submit production tasks with
newt_createTask/newt_sendTask - Debug/replay tasks with
newt_simulateTask
Newton Explorer
The Newton Explorer provides a visual interface for inspecting tasks, attestations, and policy evaluations on-chain. Use it to:- View task status and results
- Inspect attestation details (signers, quorum, expiration)
- Trace the evaluation flow from intent to on-chain verification
BLS Diagnostics
If an attestation fails on-chain verification, check:| Check | How |
|---|---|
| Attestation expiration | Compare attestation.expiration against current block number |
| Signer bitmap | Verify the signer bitmap includes enough operators for quorum |
| Reference block | Ensure the reference block matches the operator set used for verification |
| Chain ID | Confirm the intent’s chainId matches the chain where the PolicyClient is deployed |
Debugging Patterns
| Symptom | Likely Cause | Diagnostic Step |
|---|---|---|
newt_simulateTask returns non-compliant | Policy logic rejects the intent | Run newt_simulatePolicy with the same inputs to isolate the Rego evaluation |
| Oracle returns empty data | WASM run function error or HTTP fetch failure | Test locally with newton-cli policy-data simulate |
| Attestation expires before on-chain submission | Too much time between evaluation and transaction | Reduce latency or increase the expiry_offset parameter |
| On-chain verification fails | Operator set rotated or wrong chain | Check reference block and chain ID |
TaskAlreadyExists error | Duplicate intent hash | Modify the intent nonce or wait for the existing task |
Policy returns CAP instead of ALLOW | Intent value exceeds policy threshold | Check data.params values on your PolicyClient |
SDK Debugging
Enable verbose logging in the Newton SDK:Next Steps
Deployment Checklist
Pre-launch verification checklist
Error Reference
Complete error code reference