Loading…
package newton_canary import future.keywords # Mainnet canary: a policy whose only job is to prove Newton evaluates tasks# end to end on Ethereum mainnet: intent decoding, params, the WASM oracle,# and the policy secret.## Allowed only when the request is ping(value, nonce), value is within# data.params.max_value, and the oracle opened the policy secret and found# that its sha256 matches the hash the caller sent. Every failure is listed# in `reasons`. default allow := false allow if count(reasons) == 0 ping_signature := "function ping(uint256 value, bytes32 nonce)" arguments := object.get(input, "decoded_function_arguments", []) well_formed if { input.decoded_function_signature == ping_signature count(arguments) == 2} reasons contains "BAD_REQUEST" if not well_formed value_ok if to_number(arguments[0]) <= data.params.max_value reasons contains "VALUE_TOO_HIGH" if not value_ok # The oracle echoes the nonce, so its answer is tied to this request.secret_ok if { data.wasm.ok == true data.wasm.secret_ok == true lower(data.wasm.nonce) == lower(arguments[1])} reasons contains "SECRET_MISMATCH" if not secret_ok| Client | Policy set | Revision | Slot |
|---|---|---|---|
| 0x0742…005e | 0xcd548174…21f1 | 1 | 0 |
| Key | Type | Required |
|---|---|---|
| max_valueLargest ping value allowed | integer | yes |
| Key | Type | Required |
|---|---|---|
| canary_phraseAny non-empty string; only its sha256 is ever sent in requests | string | yes |
| Task | Sender | Policy | Function | Result | Age |
|---|---|---|---|---|---|
| 0xf9cb25f2… | 0x9934…4559 | newton-canary | function ping | AUTHORIZED | 3d 8h |
| 0xea04cce9… | 0x9934…4559 | newton-canary | function ping | DENIED | 3d 8h |
| 0x1e6201e7… | 0x9934…4559 | newton-canary | function ping | DENIED | 3d 8h |
| 0x71360878… | 0x9934…4559 | newton-canary | function ping | DENIED | 3d 8h |
| 0x5273c6fe… | 0x9934…4559 | newton-canary | function ping | DENIED | 3d 8h |
| 0x76579511… | 0x9934…4559 | newton-canary | function ping | AUTHORIZED | 3d 8h |