Fix unreadable Grant instruction validator
error message
#2369
Labels
Enhancement
New feature or request
iroha2-dev
The re-implementation of a BFT hyperledger in RUST
Security
This issue asks for improved security
Problem
Take a look at
default_permissions()
atpermissions_validators/src/public_blockchain/mod.rs
. This configuration is used for checking instrucitons in Iroha 2 by default right now.The first part of validators configuration is called
grant_instruction_validator
. If this part fails then it produces error message that says pretty nothing:All we can retrieve from this message is that something is wrong with some
Grant
instruction. We don't know which instruction and what is exactly wrong.That was a problem while debugging #2081
Suggested solution
I, personally, think that using
Result
doesn't fit well for validators, because we can't tell what (Err
orOk
) should be returned from validator if it gets unexpected instruction. Right nowGrant
validators returnErr
, butInstruction
validators returnOk
. We need a unified way to do it. We need 3 variants:Ok
,Err
andSkip
. We could useOption<Result<...>>
but it looks ugly in my opinion.So my suggestions is to introduce another return type for validators and refactor complex validators construction. This will allow us to tell which validators have failed in
any_should_succeed()
and etc. Altough I think thatany_should_succeed()
andall_should_succeed()
will be less usable then and we can introducenoone_should_fail()
which would meen "All should returnSkip
orOk
". And maybeat_least_one_success()
The text was updated successfully, but these errors were encountered: