-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Custom instructions in executor #4645
Conversation
client/tests/integration/smartcontracts/executor_custom_data_model/src/complex.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the approach of custom instruction in this PR is the following, as I understand:
- In Executor, users can define whatever parsing logic around
Custom { payload: String }
instruction - On client side, users must know how to serialize the
Custom
instruction, and there is no way to know it via Iroha API
This goes against the current design. We had a discussion with @mversic, and the idea is that all executor-defined types must be defined in some schema and clients should be able to retrieve it and use it.
So, I guess this PR should came after #4597 and extend ExecutorDataModel
with a set of instruction types, and then to have Custom
instruction somehow this way:
struct Custom {
id: CustomInstructionId, // or just Name?
payload: JsonString
}
great work |
I think you should make |
client/tests/integration/smartcontracts/executor_custom_isi_complex/src/lib.rs
Outdated
Show resolved
Hide resolved
Created #4658
IMO, technically, there is no need to have an id. This would suffice: struct ExecutorDataModel {
schema: String,
// -- snip --
// type id in the schema
custom_instruction_definition_id: Option<Name>
}
enum Instruction {
// -- snip --
Custom(JsonString)
} Clients will know how to serialize |
there is obviously no need in this PR, but I still maintain it might be useful. Maybe for migrations. Will @Erigara do you have opinion on the matter? |
I see your point, though, it sounds vague and this possible future-proof solution doesn't sound very robust to me. Due to that, I would prefer a minimal implementation now, as we are not 100% sure that having |
I don't have strong arguments for adding instruction id. Except that we could have nicer Display/Debug implementation, without dumping the whole payload. If we decide that instructions won't have ids, then permissions shouldn't either |
I didn't want to focus on future-proofing. It was more about |
Looks cool, give ability to implement custom instructions without too much changes. One concern i can think of is that custom instructions work more like an extension, so executor can't for example completely replace isi with own DSL for example. Alternative design i was thinking about was to make transaction payload opaque to the core iroha (just bytes essentially). |
Do we need this ability since whole custom isi execution is on the executor? |
client/tests/integration/smartcontracts/executor_custom_instructions_complex/src/lib.rs
Outdated
Show resolved
Hide resolved
client/tests/integration/smartcontracts/executor_custom_instructions_simple/src/lib.rs
Outdated
Show resolved
Hide resolved
having |
but the lookups are completely unnecessary. They only happen because we keep list of permission ids in wsv. There is no need for that |
4ef7a16
to
890e7de
Compare
created #4702 for further discussion, but I don't see any reason to keep |
26eb6a9
to
7b6b8cb
Compare
7b6b8cb
to
b8ad92b
Compare
Signed-off-by: Dmitry Murzin <diralik@yandex.ru>
Signed-off-by: Dmitry Murzin <diralik@yandex.ru>
b8ad92b
to
09665d4
Compare
Description
Added ISI for custom instructions, and two tests demonstrating possible use:
MintAssetForAllAccounts
Linked issue
Closes #4599
Benefits
Checklist
CONTRIBUTING.md