hyperledger-iroha / iroha

Iroha - A simple, enterprise-grade decentralized ledger
https://wiki.hyperledger.org/display/iroha
Apache License 2.0
444 stars 277 forks source link

Transactional queries execution context #5171

Open mversic opened 1 month ago

mversic commented 1 month ago

After #5151 current block header was introduced into every smart contract executor. For free queries (coming over HTTP) there is no current block so latest block header was used. However, it was incorrectly assumed that this is the case for all queries. For queries executed from a transaction (like from a wasm) there is a current block and it's header should be given to validate_query entrypoint instead of latest block header

s8sato commented 1 month ago

context

My point was that if we introduce query validation, we need to be careful what CommonState each validate_query is based on. There are SmartContract Trigger ExecuteTransaction ExecuteInstruction Migrate ValidateQuery states and for example, by-call trigger executions seems to validate_query as ExecuteTransaction