Skip to content

Commit

Permalink
refactor(schema): remove DomainId from TriggerId and `FindTrigger…
Browse files Browse the repository at this point in the history
…sByDomainId`

Signed-off-by: Nurzhan Sakén <nurzhan.sakenov@gmail.com>
  • Loading branch information
nxsaken committed May 23, 2024
1 parent 2fc39f4 commit 8f9a95a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 27 deletions.
6 changes: 3 additions & 3 deletions data_model/src/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Name {
/// # Errors
/// Fails if not valid [`Name`].
fn validate_str(candidate: &str) -> Result<(), ParseError> {
const FORBIDDEN_CHARS: [char; 3] = ['@', '#', '$'];
const FORBIDDEN_CHARS: [char; 2] = ['@', '#'];

if candidate.is_empty() {
return Err(ParseError {
Expand All @@ -83,7 +83,7 @@ impl Name {
#[allow(clippy::non_ascii_literal)]
return Err(ParseError {
reason: "The `@` character is reserved for `account@domain` constructs, \
`#` — for `asset#domain` and `$` — for `trigger$domain`.",
and `#` — for `asset#domain`.",
});
}
Ok(())
Expand Down Expand Up @@ -156,7 +156,7 @@ mod tests {

use super::*;

const INVALID_NAMES: [&str; 5] = ["", " ", "@", "#", "$"];
const INVALID_NAMES: [&str; 4] = ["", " ", "@", "#"];

#[test]
fn deserialize_name() {
Expand Down
29 changes: 6 additions & 23 deletions docs/source/references/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1549,14 +1549,6 @@
}
]
},
"FindTriggersByDomainId": {
"Struct": [
{
"name": "domain_id",
"type": "DomainId"
}
]
},
"ForwardCursor": {
"Struct": [
{
Expand Down Expand Up @@ -2868,34 +2860,29 @@
"discriminant": 32,
"type": "FindTriggerKeyValueByIdAndKey"
},
{
"tag": "FindTriggersByDomainId",
"discriminant": 33,
"type": "FindTriggersByDomainId"
},
{
"tag": "FindAllRoles",
"discriminant": 34,
"discriminant": 33,
"type": "FindAllRoles"
},
{
"tag": "FindAllRoleIds",
"discriminant": 35,
"discriminant": 34,
"type": "FindAllRoleIds"
},
{
"tag": "FindRoleByRoleId",
"discriminant": 36,
"discriminant": 35,
"type": "FindRoleByRoleId"
},
{
"tag": "FindRolesByAccountId",
"discriminant": 37,
"discriminant": 36,
"type": "FindRolesByAccountId"
},
{
"tag": "FindAllParameters",
"discriminant": 38,
"discriminant": 37,
"type": "FindAllParameters"
}
]
Expand Down Expand Up @@ -4151,10 +4138,6 @@
},
"TriggerId": {
"Struct": [
{
"name": "domain_id",
"type": "Option<DomainId>"
},
{
"name": "name",
"type": "Name"
Expand Down Expand Up @@ -4401,4 +4384,4 @@
"u8": {
"Int": "FixedWidth"
}
}
}
1 change: 0 additions & 1 deletion smart_contract/executor/src/permission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ pub mod trigger {
/// `authority` is owner of `trigger_id` if:
/// - `trigger.action.authority` is `authority`
/// - `trigger.action.authority.domain_id` is owned by `authority`
/// - `trigger.domain_id` is not none and domain is owned by `authority`
///
/// # Errors
/// - `FindTrigger` fails
Expand Down

0 comments on commit 8f9a95a

Please sign in to comment.