Joystream / Joystream/joystream
App action commitment should include action type
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
**The problem**
Currently the app action commitment generator function takes 5 values into account:
- `nonce`
- `creatorId`
- `assets`
- `rawAction`
- `rawAppActionMetadata`
The problem is that the way `nonce` is validated will depend on the type of the action (whether it's video creation or channel creation):
- For channel creation action it has to equal `Membership.totalChannelsCreated`
- For video (content) creation action it has to equal `Membership.totalVideosCreated`
However the action type cannot be determined from any of those values.
Moreover, this also means that a signing app like Orion doesn't really know how the message it is signing will end up being used. For example, it may think it's signing an app action to create a new video, but the app action is actually going to be used to create a channel, which may not have been allowed in this case.
**The solution**
One solution I can think of would be to include the action type as part of both the `AppAction` message and app action commitment, ie.:
```
syntax = "proto2";
enum ActionType {
CREATE_VIDEO = 0;
CREATE_CHANNEL = 1;
}
message AppAction {
// ID of application
required string app_id = 999;
// Metadata
optional bytes metadata = 2;
// Raw metadata of wrapped action
optional bytes raw_action = 3;
// Signature over app commitment
optional bytes signature = 4;
// Nonce to prevent signature reusal
optional uint32 nonce = 5;
// Type of the runtime-level action to be performed
optional ActionType action_type = 6;
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.