Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ members = [
, "podnet/identity-github"]

[workspace.dependencies]
pod2 = { git = "https://github.com/0xPARC/pod2", rev = "b02d0ec46247f3f64bd4d2e30db9da7f40903409", default-features = false, features = [ "backend_plonky2", "zk", "examples", "disk_cache" ] }
pod2 = { git = "https://github.com/0xPARC/pod2", rev = "5de08da32cdbd3e8e4476585a6a97529c578ac68", default-features = false, features = [ "backend_plonky2", "zk", "examples", "disk_cache" ] }
pod2_solver = { path = "core/new_solver" }
podnet-models = { path = "core/models" }
pod-utils = { path = "core/utils" }
Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/lib/features/authoring/monaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const PodlangMonarchLanguage: languages.IMonarchLanguage = {
}
],

// Anchored Keys: ?var["key"]
// Anchored Keys: var["key"]
[/\\?[a-zA-Z_][a-zA-Z0-9_]*\\["[^"]*"\\]/, "variable.anchored.Podlang"],

// Variables: start with '?', use explicit char class
Expand Down Expand Up @@ -282,8 +282,8 @@ export function getDefaultEditorContent(): string {
//
// Example:
// REQUEST(
// Equal(?pod1["field1"], ?pod2["field1"])
// Lt(?pod1["timestamp"], 1234567890)
// Equal(pod1["field1"], pod2["field1"])
// Lt(pod1["timestamp"], 1234567890)
// )

`;
Expand Down
8 changes: 4 additions & 4 deletions apps/simple-zukyc/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export default function Home() {

const request = `
REQUEST(
NotContains(?sanctions["sanctionList"], ?gov["idNumber"])
Lt(?gov["dateOfBirth"], 1169909388)
Equal(?pay["startDate"], 1706367566)
Equal(?gov["socialSecurityNumber"], ?pay["socialSecurityNumber"])
NotContains(sanctions["sanctionList"], gov["idNumber"])
Lt(gov["dateOfBirth"], 1169909388)
Equal(pay["startDate"], 1706367566)
Equal(gov["socialSecurityNumber"], pay["socialSecurityNumber"])
)
`;

Expand Down
44 changes: 22 additions & 22 deletions core/models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,15 +508,15 @@ pub struct UpvoteRequest {
pub fn get_publish_verification_predicate() -> String {
r#"
identity_verified(username, identity_pod) = AND(
Equal(?identity_pod["username"], ?username)
Equal(identity_pod["username"], username)
)

publish_verified(username, data, identity_server_pk, private: identity_pod, document_pod) = AND(
identity_verified(?username, ?identity_pod)
Equal(?document_pod["request_type"], "publish")
Equal(?document_pod["data"], ?data)
SignedBy(?document_pod, ?identity_pod["user_public_key"])
SignedBy(?identity_pod, ?identity_server_pk)
identity_verified(username, identity_pod)
Equal(document_pod["request_type"], "publish")
Equal(document_pod["data"], data)
SignedBy(document_pod, identity_pod["user_public_key"])
SignedBy(identity_pod, identity_server_pk)
)
"#.to_string()
}
Expand All @@ -525,20 +525,20 @@ pub fn get_publish_verification_predicate() -> String {
pub fn get_upvote_verification_predicate() -> String {
r#"
identity_verified(username, identity_pod) = AND(
Equal(?identity_pod["username"], ?username)
Equal(identity_pod["username"], username)
)

upvote_verified(content_hash, upvote_pod) = AND(
Equal(?upvote_pod["content_hash"], ?content_hash)
Equal(?upvote_pod["request_type"], "upvote")
Equal(upvote_pod["content_hash"], content_hash)
Equal(upvote_pod["request_type"], "upvote")
)

upvote_verification(username, content_hash, identity_server_pk, private: identity_pod, upvote_pod, upvote_pod_signer) = AND(
identity_verified(?username, ?identity_pod)
upvote_verified(?content_hash, ?upvote_pod)
SignedBy(?identity_pod, ?identity_server_pk)
SignedBy(?upvote_pod, ?upvote_pod_signer)
Equal(?identity_pod["user_public_key"], ?upvote_pod_signer)
identity_verified(username, identity_pod)
upvote_verified(content_hash, upvote_pod)
SignedBy(identity_pod, identity_server_pk)
SignedBy(upvote_pod, upvote_pod_signer)
Equal(identity_pod["user_public_key"], upvote_pod_signer)
)
"#.to_string()
}
Expand All @@ -550,20 +550,20 @@ pub fn get_upvote_count_predicate(upvote_batch_id: Hash) -> String {
use _, _, upvote_verification from 0x{id}

upvote_count_base(count, content_hash, private: data_pod) = AND(
Equal(?count, 0)
Equal(?data_pod["content_hash"], ?content_hash)
Equal(count, 0)
Equal(data_pod["content_hash"], content_hash)
)

upvote_count_ind(count, content_hash, private: intermed, username, identity_server_pk) = AND(
upvote_count(?intermed, ?content_hash)
SumOf(?count, ?intermed, 1)
upvote_verification(?username, ?content_hash, ?identity_server_pk)
Lt(0, ?count)
upvote_count(intermed, content_hash)
SumOf(count, intermed, 1)
upvote_verification(username, content_hash, identity_server_pk)
Lt(0, count)
)

upvote_count(count, content_hash) = OR(
upvote_count_base(?count, ?content_hash)
upvote_count_ind(?count, ?content_hash)
upvote_count_base(count, content_hash)
upvote_count_ind(count, content_hash)
)
"#,
id = upvote_batch_id.encode_hex::<String>(),
Expand Down
16 changes: 8 additions & 8 deletions core/models/src/mainpod/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ use super::{MainPodError, MainPodResult};
pub fn get_delete_verification_predicate() -> String {
r#"
identity_verified(username, identity_pod) = AND(
Equal(?identity_pod["username"], ?username)
Equal(identity_pod["username"], username)
)

document_verified(data, timestamp_pod, private: identity_pod, document_pod) = AND(
Equal(?document_pod["request_type"], "delete")
Equal(?document_pod["data"], ?data)
Equal(?document_pod["timestamp_pod"], ?timestamp_pod)
SignedBy(?document_pod, ?identity_pod["user_public_key"])
Equal(document_pod["request_type"], "delete")
Equal(document_pod["data"], data)
Equal(document_pod["timestamp_pod"], timestamp_pod)
SignedBy(document_pod, identity_pod["user_public_key"])
)

delete_verified(username, data, identity_server_pk, timestamp_pod, private: identity_pod, document_pod) = AND(
identity_verified(?username, ?identity_pod)
document_verified(?data, ?timestamp_pod)
SignedBy(?identity_pod, ?identity_server_pk)
identity_verified(username, identity_pod)
document_verified(data, timestamp_pod)
SignedBy(identity_pod, identity_server_pk)
)
"#.to_string()
}
Expand Down
12 changes: 6 additions & 6 deletions core/models/src/mainpod/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ mod tests {

let query = r#"
identity_verified(username, identity_pod) = AND(
Equal(?identity_pod["username"], ?username)
Equal(identity_pod["username"], username)
)

publish_verified(username, data, identity_server_pk, private: identity_pod, document_pod) = AND(
identity_verified(?username, ?identity_pod)
Equal(?document_pod["request_type"], "publish")
Equal(?document_pod["data"], ?data)
SignedBy(?document_pod, ?identity_pod["user_public_key"])
SignedBy(?identity_pod, ?identity_server_pk)
identity_verified(username, identity_pod)
Equal(document_pod["request_type"], "publish")
Equal(document_pod["data"], data)
SignedBy(document_pod, identity_pod["user_public_key"])
SignedBy(identity_pod, identity_server_pk)
)

REQUEST(
Expand Down
16 changes: 8 additions & 8 deletions core/models/src/mainpod/upvote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,20 +446,20 @@ mod tests {
).unwrap();
let query = r#"
identity_verified(username, identity_pod) = AND(
Equal(?identity_pod["username"], ?username)
Equal(identity_pod["username"], username)
)

upvote_verified(content_hash, upvote_pod) = AND(
Equal(?upvote_pod["content_hash"], ?content_hash)
Equal(?upvote_pod["request_type"], "upvote")
Equal(upvote_pod["content_hash"], content_hash)
Equal(upvote_pod["request_type"], "upvote")
)

upvote_verification(username, content_hash, identity_server_pk, private: identity_pod, upvote_pod, upvote_pod_signer) = AND(
identity_verified(?username, ?identity_pod)
upvote_verified(?content_hash, ?upvote_pod)
SignedBy(?identity_pod, ?identity_server_pk)
SignedBy(?upvote_pod, ?upvote_pod_signer)
Equal(?identity_pod["user_public_key"], ?upvote_pod_signer)
identity_verified(username, identity_pod)
upvote_verified(content_hash, upvote_pod)
SignedBy(identity_pod, identity_server_pk)
SignedBy(upvote_pod, upvote_pod_signer)
Equal(identity_pod["user_public_key"], upvote_pod_signer)
)


Expand Down
16 changes: 8 additions & 8 deletions core/models/tests/upvote_count_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@ fn test_simple_upvote_count() {
// Create a simple predicate that just does counting without verification
let simple_predicate = r#"
upvote_count_base(count, content_hash, private: data_pod) = AND(
Equal(?count, 0)
Equal(?data_pod["content_hash"], ?content_hash)
Equal(count, 0)
Equal(data_pod["content_hash"], content_hash)
)

upvote_count_ind(count, content_hash, private: data_pod, intermed) = AND(
upvote_count(?intermed, ?content_hash)
SumOf(?count, ?intermed, 1)
Equal(?data_pod["content_hash"], ?content_hash)
Lt(0, ?count)
upvote_count(intermed, content_hash)
SumOf(count, intermed, 1)
Equal(data_pod["content_hash"], content_hash)
Lt(0, count)
)

upvote_count(count, content_hash) = OR(
upvote_count_base(?count, ?content_hash)
upvote_count_ind(?count, ?content_hash)
upvote_count_base(count, content_hash)
upvote_count_ind(count, content_hash)
)
"#;

Expand Down
Loading