Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions frontend/mina-signer/tests/party.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ let otherParties = {
setTokenSymbol: "Signature",
incrementNonce: "Signature",
setVotingFor: "Signature",
setTiming: "Signature",
},
zkappUri: null,
tokenSymbol: null,
Expand Down
63 changes: 63 additions & 0 deletions graphql_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,22 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "setTiming",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "AuthRequired",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": [
Expand Down Expand Up @@ -1436,6 +1452,20 @@
}
},
"defaultValue": null
},
{
"name": "setTiming",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "AuthRequired",
"ofType": null
}
},
"defaultValue": null
}
],
"interfaces": null,
Expand Down Expand Up @@ -7955,6 +7985,22 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "setTiming",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "AuthRequired",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
Expand Down Expand Up @@ -10891,6 +10937,23 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "setTiming",
"description":
"Authorization required to set the timing of the account",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "ENUM",
"name": "AccountAuthRequired",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
Expand Down
4 changes: 4 additions & 0 deletions src/app/archive/archive_lib/load_data.ml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ let update_of_id pool update_id =
; set_token_symbol
; increment_nonce
; set_voting_for
; set_timing
} =
query_db ~f:(fun db -> Processor.Zkapp_permissions.load db id)
in
Expand All @@ -190,6 +191,7 @@ let update_of_id pool update_id =
; set_token_symbol
; increment_nonce
; set_voting_for
; set_timing
}
: Permissions.t ) )
in
Expand Down Expand Up @@ -746,6 +748,7 @@ let get_account_accessed ~pool (account : Processor.Accounts_accessed.t) :
; set_token_symbol
; increment_nonce
; set_voting_for
; set_timing
} =
query_db ~f:(fun db -> Processor.Zkapp_permissions.load db permissions_id)
in
Expand All @@ -760,6 +763,7 @@ let get_account_accessed ~pool (account : Processor.Accounts_accessed.t) :
; set_token_symbol
; increment_nonce
; set_voting_for
; set_timing
}
: Permissions.t )
in
Expand Down
3 changes: 3 additions & 0 deletions src/app/archive/archive_lib/processor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ module Zkapp_permissions = struct
; set_token_symbol : Permissions.Auth_required.t
; increment_nonce : Permissions.Auth_required.t
; set_voting_for : Permissions.Auth_required.t
; set_timing : Permissions.Auth_required.t
}
[@@deriving fields, hlist]

Expand All @@ -418,6 +419,7 @@ module Zkapp_permissions = struct
; auth_required_typ
; auth_required_typ
; auth_required_typ
; auth_required_typ
]

let table_name = "zkapp_permissions"
Expand All @@ -435,6 +437,7 @@ module Zkapp_permissions = struct
; set_token_symbol = perms.set_token_symbol
; increment_nonce = perms.increment_nonce
; set_voting_for = perms.set_voting_for
; set_timing = perms.set_timing
}
in
Mina_caqti.select_insert_into_cols ~select:("id", Caqti_type.int)
Expand Down
1 change: 1 addition & 0 deletions src/app/archive/zkapp_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ CREATE TABLE zkapp_permissions
, set_token_symbol zkapp_auth_required_type NOT NULL
, increment_nonce zkapp_auth_required_type NOT NULL
, set_voting_for zkapp_auth_required_type NOT NULL
, set_timing zkapp_auth_required_type NOT NULL
);

CREATE TABLE zkapp_timing_info
Expand Down
5 changes: 3 additions & 2 deletions src/app/replayer/test/archive_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,8 @@ CREATE TABLE public.zkapp_permissions (
edit_sequence_state public.zkapp_auth_required_type NOT NULL,
set_token_symbol public.zkapp_auth_required_type NOT NULL,
increment_nonce public.zkapp_auth_required_type NOT NULL,
set_voting_for public.zkapp_auth_required_type NOT NULL
set_voting_for public.zkapp_auth_required_type NOT NULL,
set_timing public.zkapp_auth_required_type NOT NULL
);


Expand Down Expand Up @@ -2434,7 +2435,7 @@ COPY public.zkapp_party_failures (id, index, failures) FROM stdin;
-- Data for Name: zkapp_permissions; Type: TABLE DATA; Schema: public; Owner: -
--

COPY public.zkapp_permissions (id, edit_state, send, receive, set_delegate, set_permissions, set_verification_key, set_zkapp_uri, edit_sequence_state, set_token_symbol, increment_nonce, set_voting_for) FROM stdin;
COPY public.zkapp_permissions (id, edit_state, send, receive, set_delegate, set_permissions, set_verification_key, set_zkapp_uri, edit_sequence_state, set_token_symbol, increment_nonce, set_voting_for, set_timing) FROM stdin;
1 signature signature none signature signature signature signature signature signature signature signature
2 proof signature none signature signature signature signature proof signature signature signature
3 signature either either either either either either either either either either
Expand Down
4 changes: 4 additions & 0 deletions src/app/zkapp_test_transaction/zkapp_test_transaction.ml
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ let update_permissions =
and set_voting_for =
Param.flag "--set-voting-for" ~doc:"Proof|Signature|Either|None"
Param.(required string)
and set_timing =
Param.flag "--set-timing" ~doc:"Proof|Signature|Either|None"
Param.(required string)
and current_auth =
Param.flag "--current-auth"
~doc:
Expand All @@ -446,6 +449,7 @@ let update_permissions =
; set_token_symbol = Util.auth_of_string set_token_symbol
; increment_nonce = Util.auth_of_string increment_nonce
; set_voting_for = Util.auth_of_string set_voting_for
; set_timing = Util.auth_of_string set_timing
}
in
if Currency.Fee.(fee < Flags.min_fee) then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ module Accounts = struct
; set_token_symbol
; increment_nonce
; set_voting_for
; set_timing
} ->
let auth_required a =
match a with
Expand All @@ -86,6 +87,7 @@ module Accounts = struct
; set_token_symbol = auth_required set_token_symbol
; increment_nonce = auth_required increment_nonce
; set_voting_for = auth_required set_voting_for
; set_timing = auth_required set_timing
}
in
let token_permissions =
Expand Down Expand Up @@ -241,6 +243,7 @@ module Accounts = struct
; set_token_symbol
; increment_nonce
; set_voting_for
; set_timing
} =
account.permissions
in
Expand All @@ -257,6 +260,7 @@ module Accounts = struct
; set_token_symbol = auth_required set_token_symbol
; increment_nonce = auth_required increment_nonce
; set_voting_for = auth_required set_voting_for
; set_timing = auth_required set_timing
}
in
let zkapp =
Expand Down
2 changes: 2 additions & 0 deletions src/lib/integration_test_cloud_engine/kubernetes_network.ml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ module Node = struct
setTokenSymbol
setVerificationKey
setVotingFor
setTiming
}
sequenceEvents
zkappState
Expand Down Expand Up @@ -501,6 +502,7 @@ module Node = struct
; set_verification_key =
to_auth_required account_permissions#setVerificationKey
; set_voting_for = to_auth_required account_permissions#setVotingFor
; set_timing = to_auth_required account_permissions#setTiming
}

let graphql_uri node = Graphql.ingress_uri node |> Uri.to_string
Expand Down
1 change: 1 addition & 0 deletions src/lib/integration_test_cloud_engine/mina_automation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ module Network_config = struct
; set_token_symbol = None
; increment_nonce = None
; set_voting_for = None
; set_timing = None
}
in
let default = Runtime_config.Accounts.Single.default in
Expand Down
16 changes: 12 additions & 4 deletions src/lib/mina_base/permissions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ module Poly = struct
; set_token_symbol : 'controller
; increment_nonce : 'controller
; set_voting_for : 'controller
; set_timing : 'controller
}
[@@deriving annot, sexp, equal, compare, hash, yojson, hlist, fields]
end
Expand All @@ -332,6 +333,7 @@ module Poly = struct
~receive:(f controller) ~set_zkapp_uri:(f controller)
~edit_sequence_state:(f controller) ~set_token_symbol:(f controller)
~increment_nonce:(f controller) ~set_voting_for:(f controller)
~set_timing:(f controller)
|> List.reduce_exn ~f:Random_oracle.Input.Chunked.append
end

Expand Down Expand Up @@ -368,6 +370,7 @@ let gen ~auth_tag : t Quickcheck.Generator.t =
let%bind set_token_symbol = auth_required_gen in
let%bind increment_nonce = auth_required_gen in
let%bind set_voting_for = auth_required_gen in
let%bind set_timing = auth_required_gen in
return
{ Poly.edit_state
; send
Expand All @@ -380,6 +383,7 @@ let gen ~auth_tag : t Quickcheck.Generator.t =
; set_token_symbol
; increment_nonce
; set_voting_for
; set_timing
}

[%%ifdef consensus_mechanism]
Expand All @@ -399,15 +403,15 @@ module Checked = struct
Poly.Fields.map ~edit_state:c ~send:c ~receive:c ~set_delegate:c
~set_permissions:c ~set_verification_key:c ~set_zkapp_uri:c
~edit_sequence_state:c ~set_token_symbol:c ~increment_nonce:c
~set_voting_for:c
~set_voting_for:c ~set_timing:c

let constant (t : Stable.Latest.t) : t =
let open Core_kernel.Field in
let a f = Auth_required.Checked.constant (get f t) in
Poly.Fields.map ~edit_state:a ~send:a ~receive:a ~set_delegate:a
~set_permissions:a ~set_verification_key:a ~set_zkapp_uri:a
~edit_sequence_state:a ~set_token_symbol:a ~increment_nonce:a
~set_voting_for:a
~set_voting_for:a ~set_timing:a
end

let typ =
Expand All @@ -424,6 +428,7 @@ let typ =
; Auth_required.typ
; Auth_required.typ
; Auth_required.typ
; Auth_required.typ
]
~var_to_hlist:to_hlist ~var_of_hlist:of_hlist ~value_to_hlist:to_hlist
~value_of_hlist:of_hlist
Expand All @@ -444,6 +449,7 @@ let user_default : t =
; set_token_symbol = Signature
; increment_nonce = Signature
; set_voting_for = Signature
; set_timing = Signature
}

let empty : t =
Expand All @@ -458,6 +464,7 @@ let empty : t =
; set_token_symbol = None
; increment_nonce = None
; set_voting_for = None
; set_timing = None
}

(* deriving-fields-related stuff *)
Expand Down Expand Up @@ -500,7 +507,7 @@ let deriver obj =
~set_permissions:!.auth_required ~set_verification_key:!.auth_required
~set_zkapp_uri:!.auth_required ~edit_sequence_state:!.auth_required
~set_token_symbol:!.auth_required ~increment_nonce:!.auth_required
~set_voting_for:!.auth_required
~set_voting_for:!.auth_required ~set_timing:!.auth_required
|> finish "Permissions" ~t_toplevel_annots:Poly.t_toplevel_annots

let%test_unit "json roundtrip" =
Expand All @@ -526,6 +533,7 @@ let%test_unit "json value" =
editSequenceState: "Signature",
setTokenSymbol: "Signature",
incrementNonce: "Signature",
setVotingFor: "Signature"
setVotingFor: "Signature",
setTiming: "Signature"
}|json}
|> Yojson.Safe.from_string |> Yojson.Safe.to_string )
1 change: 1 addition & 0 deletions src/lib/mina_base/permissions.mli
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module Poly : sig
; set_token_symbol : 'controller
; increment_nonce : 'controller
; set_voting_for : 'controller
; set_timing : 'controller
}
[@@deriving sexp, equal, compare, hash, yojson, hlist, fields]
end
Expand Down
1 change: 1 addition & 0 deletions src/lib/mina_generators/user_command_generators.ml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ let parties_with_ledger () =
; set_token_symbol = Either
; increment_nonce = Either
; set_voting_for = Either
; set_timing = Either
}
in
let verification_key =
Expand Down
5 changes: 5 additions & 0 deletions src/lib/mina_graphql/mina_graphql.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,11 @@ module Types = struct
~args:Arg.[]
~resolve:(fun _ permission ->
permission.Permissions.Poly.set_voting_for )
; field "setTiming" ~typ:(non_null auth_required)
~doc:"Authorization required to set the timing of the account"
~args:Arg.[]
~resolve:(fun _ permission ->
permission.Permissions.Poly.set_timing )
] )

let account_vk =
Expand Down
2 changes: 2 additions & 0 deletions src/lib/runtime_config/runtime_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ module Json_layout = struct
; set_token_symbol : Auth_required.t [@default None]
; increment_nonce : Auth_required.t [@default None]
; set_voting_for : Auth_required.t [@default None]
; set_timing : Auth_required.t [@default None]
}
[@@deriving yojson, dhall_type, sexp, bin_io_unversioned]

Expand All @@ -136,6 +137,7 @@ module Json_layout = struct
; "set_token_symbol"
; "increment_nonce"
; "set_voting_for"
; "set_timing"
|]

let of_yojson json = of_yojson_generic ~fields of_yojson json
Expand Down
Loading