gear
gear copied to clipboard
Fix `gr_read` gas compensation on operation failure
Proposal
This is more about refactoring, but not a bug. Related to this PR https://github.com/gear-tech/gear/pull/3901.
It's impossible to make a "transactional" implementation of the gr_read in current design, so on any failure gas will be reimbursed. That's because only lock_payload is a transactional in gr_read implementation on the core-backend. Other procedures inside the gr_read impl are fallible, so on failure they do not return the consumed gas.
https://github.com/gear-tech/gear/pull/3901#discussion_r1599827111
As a solution could be the case, that we can probably now borrow with a shared (non mutable) reference the payload inside the gr_read core-backend implementation.