Skip to content

Commit 337a66c

Browse files
authored
Update to pod2 repo with prefixless wildcards (#123)
PODLang breaking change removes ? from wildcards. This PR updates the pod2 repo pointer to the latest, and updates wildcards in this repo to the new format. I did the replacement with a regex in VSCode. Unlike in the pod2 repo, I had to tweak it to avoid several classes of false-positives of things which look like PODLang wildcards but aren't. Documenting the regex I used for posterity, so that others can apply it on their own branches: regex: `(?<!\w|trace(?:.|\n){0,100}|debug(?:.|\n){0,100}|https?://(?:.|\n){0,100})\?([A-Za-z]\w*)(?!\w|=)` replace with: `$1` exclude files: `*.cjs` As far as I can tell from local Rust tests and the GitHub workflow tests above, this seems to be correct. I don't know how to build and run the PODNet Client myself, though, so I haven't tested beyond what's automated. I'm not expecting a line-by-line review here since it's all automated. I'm hoping @robknight can quickly stanity-check any false-positives I may have missed, and confirm the client isn't entirely broken.
1 parent de31d53 commit 337a66c

File tree

33 files changed

+438
-438
lines changed

33 files changed

+438
-438
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ members = [
1414
, "podnet/identity-github"]
1515

1616
[workspace.dependencies]
17-
pod2 = { git = "https://github.com/0xPARC/pod2", rev = "b02d0ec46247f3f64bd4d2e30db9da7f40903409", default-features = false, features = [ "backend_plonky2", "zk", "examples", "disk_cache" ] }
17+
pod2 = { git = "https://github.com/0xPARC/pod2", rev = "5de08da32cdbd3e8e4476585a6a97529c578ac68", default-features = false, features = [ "backend_plonky2", "zk", "examples", "disk_cache" ] }
1818
pod2_solver = { path = "core/new_solver" }
1919
podnet-models = { path = "core/models" }
2020
pod-utils = { path = "core/utils" }

apps/client/src/lib/features/authoring/monaco.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export const PodlangMonarchLanguage: languages.IMonarchLanguage = {
106106
}
107107
],
108108

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

112112
// Variables: start with '?', use explicit char class
@@ -282,8 +282,8 @@ export function getDefaultEditorContent(): string {
282282
//
283283
// Example:
284284
// REQUEST(
285-
// Equal(?pod1["field1"], ?pod2["field1"])
286-
// Lt(?pod1["timestamp"], 1234567890)
285+
// Equal(pod1["field1"], pod2["field1"])
286+
// Lt(pod1["timestamp"], 1234567890)
287287
// )
288288
289289
`;

apps/simple-zukyc/src/app/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ export default function Home() {
1212

1313
const request = `
1414
REQUEST(
15-
NotContains(?sanctions["sanctionList"], ?gov["idNumber"])
16-
Lt(?gov["dateOfBirth"], 1169909388)
17-
Equal(?pay["startDate"], 1706367566)
18-
Equal(?gov["socialSecurityNumber"], ?pay["socialSecurityNumber"])
15+
NotContains(sanctions["sanctionList"], gov["idNumber"])
16+
Lt(gov["dateOfBirth"], 1169909388)
17+
Equal(pay["startDate"], 1706367566)
18+
Equal(gov["socialSecurityNumber"], pay["socialSecurityNumber"])
1919
)
2020
`;
2121

core/models/src/lib.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -508,15 +508,15 @@ pub struct UpvoteRequest {
508508
pub fn get_publish_verification_predicate() -> String {
509509
r#"
510510
identity_verified(username, identity_pod) = AND(
511-
Equal(?identity_pod["username"], ?username)
511+
Equal(identity_pod["username"], username)
512512
)
513513
514514
publish_verified(username, data, identity_server_pk, private: identity_pod, document_pod) = AND(
515-
identity_verified(?username, ?identity_pod)
516-
Equal(?document_pod["request_type"], "publish")
517-
Equal(?document_pod["data"], ?data)
518-
SignedBy(?document_pod, ?identity_pod["user_public_key"])
519-
SignedBy(?identity_pod, ?identity_server_pk)
515+
identity_verified(username, identity_pod)
516+
Equal(document_pod["request_type"], "publish")
517+
Equal(document_pod["data"], data)
518+
SignedBy(document_pod, identity_pod["user_public_key"])
519+
SignedBy(identity_pod, identity_server_pk)
520520
)
521521
"#.to_string()
522522
}
@@ -525,20 +525,20 @@ pub fn get_publish_verification_predicate() -> String {
525525
pub fn get_upvote_verification_predicate() -> String {
526526
r#"
527527
identity_verified(username, identity_pod) = AND(
528-
Equal(?identity_pod["username"], ?username)
528+
Equal(identity_pod["username"], username)
529529
)
530530
531531
upvote_verified(content_hash, upvote_pod) = AND(
532-
Equal(?upvote_pod["content_hash"], ?content_hash)
533-
Equal(?upvote_pod["request_type"], "upvote")
532+
Equal(upvote_pod["content_hash"], content_hash)
533+
Equal(upvote_pod["request_type"], "upvote")
534534
)
535535
536536
upvote_verification(username, content_hash, identity_server_pk, private: identity_pod, upvote_pod, upvote_pod_signer) = AND(
537-
identity_verified(?username, ?identity_pod)
538-
upvote_verified(?content_hash, ?upvote_pod)
539-
SignedBy(?identity_pod, ?identity_server_pk)
540-
SignedBy(?upvote_pod, ?upvote_pod_signer)
541-
Equal(?identity_pod["user_public_key"], ?upvote_pod_signer)
537+
identity_verified(username, identity_pod)
538+
upvote_verified(content_hash, upvote_pod)
539+
SignedBy(identity_pod, identity_server_pk)
540+
SignedBy(upvote_pod, upvote_pod_signer)
541+
Equal(identity_pod["user_public_key"], upvote_pod_signer)
542542
)
543543
"#.to_string()
544544
}
@@ -550,20 +550,20 @@ pub fn get_upvote_count_predicate(upvote_batch_id: Hash) -> String {
550550
use _, _, upvote_verification from 0x{id}
551551
552552
upvote_count_base(count, content_hash, private: data_pod) = AND(
553-
Equal(?count, 0)
554-
Equal(?data_pod["content_hash"], ?content_hash)
553+
Equal(count, 0)
554+
Equal(data_pod["content_hash"], content_hash)
555555
)
556556
557557
upvote_count_ind(count, content_hash, private: intermed, username, identity_server_pk) = AND(
558-
upvote_count(?intermed, ?content_hash)
559-
SumOf(?count, ?intermed, 1)
560-
upvote_verification(?username, ?content_hash, ?identity_server_pk)
561-
Lt(0, ?count)
558+
upvote_count(intermed, content_hash)
559+
SumOf(count, intermed, 1)
560+
upvote_verification(username, content_hash, identity_server_pk)
561+
Lt(0, count)
562562
)
563563
564564
upvote_count(count, content_hash) = OR(
565-
upvote_count_base(?count, ?content_hash)
566-
upvote_count_ind(?count, ?content_hash)
565+
upvote_count_base(count, content_hash)
566+
upvote_count_ind(count, content_hash)
567567
)
568568
"#,
569569
id = upvote_batch_id.encode_hex::<String>(),

core/models/src/mainpod/delete.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ use super::{MainPodError, MainPodResult};
2626
pub fn get_delete_verification_predicate() -> String {
2727
r#"
2828
identity_verified(username, identity_pod) = AND(
29-
Equal(?identity_pod["username"], ?username)
29+
Equal(identity_pod["username"], username)
3030
)
3131
3232
document_verified(data, timestamp_pod, private: identity_pod, document_pod) = AND(
33-
Equal(?document_pod["request_type"], "delete")
34-
Equal(?document_pod["data"], ?data)
35-
Equal(?document_pod["timestamp_pod"], ?timestamp_pod)
36-
SignedBy(?document_pod, ?identity_pod["user_public_key"])
33+
Equal(document_pod["request_type"], "delete")
34+
Equal(document_pod["data"], data)
35+
Equal(document_pod["timestamp_pod"], timestamp_pod)
36+
SignedBy(document_pod, identity_pod["user_public_key"])
3737
)
3838
3939
delete_verified(username, data, identity_server_pk, timestamp_pod, private: identity_pod, document_pod) = AND(
40-
identity_verified(?username, ?identity_pod)
41-
document_verified(?data, ?timestamp_pod)
42-
SignedBy(?identity_pod, ?identity_server_pk)
40+
identity_verified(username, identity_pod)
41+
document_verified(data, timestamp_pod)
42+
SignedBy(identity_pod, identity_server_pk)
4343
)
4444
"#.to_string()
4545
}

core/models/src/mainpod/publish.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ mod tests {
165165

166166
let query = r#"
167167
identity_verified(username, identity_pod) = AND(
168-
Equal(?identity_pod["username"], ?username)
168+
Equal(identity_pod["username"], username)
169169
)
170170
171171
publish_verified(username, data, identity_server_pk, private: identity_pod, document_pod) = AND(
172-
identity_verified(?username, ?identity_pod)
173-
Equal(?document_pod["request_type"], "publish")
174-
Equal(?document_pod["data"], ?data)
175-
SignedBy(?document_pod, ?identity_pod["user_public_key"])
176-
SignedBy(?identity_pod, ?identity_server_pk)
172+
identity_verified(username, identity_pod)
173+
Equal(document_pod["request_type"], "publish")
174+
Equal(document_pod["data"], data)
175+
SignedBy(document_pod, identity_pod["user_public_key"])
176+
SignedBy(identity_pod, identity_server_pk)
177177
)
178178
179179
REQUEST(

core/models/src/mainpod/upvote.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -446,20 +446,20 @@ mod tests {
446446
).unwrap();
447447
let query = r#"
448448
identity_verified(username, identity_pod) = AND(
449-
Equal(?identity_pod["username"], ?username)
449+
Equal(identity_pod["username"], username)
450450
)
451451
452452
upvote_verified(content_hash, upvote_pod) = AND(
453-
Equal(?upvote_pod["content_hash"], ?content_hash)
454-
Equal(?upvote_pod["request_type"], "upvote")
453+
Equal(upvote_pod["content_hash"], content_hash)
454+
Equal(upvote_pod["request_type"], "upvote")
455455
)
456456
457457
upvote_verification(username, content_hash, identity_server_pk, private: identity_pod, upvote_pod, upvote_pod_signer) = AND(
458-
identity_verified(?username, ?identity_pod)
459-
upvote_verified(?content_hash, ?upvote_pod)
460-
SignedBy(?identity_pod, ?identity_server_pk)
461-
SignedBy(?upvote_pod, ?upvote_pod_signer)
462-
Equal(?identity_pod["user_public_key"], ?upvote_pod_signer)
458+
identity_verified(username, identity_pod)
459+
upvote_verified(content_hash, upvote_pod)
460+
SignedBy(identity_pod, identity_server_pk)
461+
SignedBy(upvote_pod, upvote_pod_signer)
462+
Equal(identity_pod["user_public_key"], upvote_pod_signer)
463463
)
464464
465465

core/models/tests/upvote_count_test.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,20 @@ fn test_simple_upvote_count() {
7272
// Create a simple predicate that just does counting without verification
7373
let simple_predicate = r#"
7474
upvote_count_base(count, content_hash, private: data_pod) = AND(
75-
Equal(?count, 0)
76-
Equal(?data_pod["content_hash"], ?content_hash)
75+
Equal(count, 0)
76+
Equal(data_pod["content_hash"], content_hash)
7777
)
7878
7979
upvote_count_ind(count, content_hash, private: data_pod, intermed) = AND(
80-
upvote_count(?intermed, ?content_hash)
81-
SumOf(?count, ?intermed, 1)
82-
Equal(?data_pod["content_hash"], ?content_hash)
83-
Lt(0, ?count)
80+
upvote_count(intermed, content_hash)
81+
SumOf(count, intermed, 1)
82+
Equal(data_pod["content_hash"], content_hash)
83+
Lt(0, count)
8484
)
8585
8686
upvote_count(count, content_hash) = OR(
87-
upvote_count_base(?count, ?content_hash)
88-
upvote_count_ind(?count, ?content_hash)
87+
upvote_count_base(count, content_hash)
88+
upvote_count_ind(count, content_hash)
8989
)
9090
"#;
9191

0 commit comments

Comments
 (0)