Closed bdeneux closed 1 month ago
The changes across various files focus on enhancing error handling related to gas management and bank operations, improving test case clarity, and removing obsolete functions. These updates aim to boost the reliability and maintainability of the codebase while providing more context in error messages.
File Path | Change Summary |
---|---|
x/logic/keeper/grpc_query_ask_test.go |
Added imports for Cosmos SDK types and bank types, updated test cases with new queries and errors, and included a new test case for bank balances. |
x/logic/keeper/interpreter.go |
Added import for sdkerrors , modified error handling in newInterpreter using a switch statement, and specifically addressed out-of-gas errors. |
x/logic/prolog/error.go |
Removed imports related to store types, eliminated the AtomResourceGas and ResourceGas functions. |
x/logic/util/prolog.go |
Added imports for error handling and SDK types, and modified logic to include checks for out-of-gas errors in solutions. |
Not applicable for these changes as they are too varied and do not introduce new features or control flow modifications.
In the code, where logic weaves,
Errors now are caught with ease,
Gas is handled with a care,
Bank balances checked, oh so fair.
Out-of-gas, no more fear,
Error handling, crystal clear.
Coding changes, oh so bright,
Bringing clarity, day and night.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Attention: Patch coverage is 30.00000%
with 14 lines
in your changes missing coverage. Please review.
@@ Coverage Diff @@
## main #694 +/- ##
==========================================
- Coverage 54.35% 54.23% -0.12%
==========================================
Files 74 74
Lines 2896 2906 +10
==========================================
+ Hits 1574 1576 +2
- Misses 1226 1234 +8
Partials 96 96
Files | Coverage Δ | |
---|---|---|
x/logic/prolog/error.go | 0.00% <ø> (ø) |
|
x/logic/keeper/interpreter.go | 93.10% <75.00%> (-0.95%) |
:arrow_down: |
x/logic/util/prolog.go | 0.00% <0.00%> (ø) |
@bdeneux Thanks!
I wonder why we've integrated the out of gas as a prolog error, it creates a discrepancy in the way the ask
query answers: either as a gRPC error or a success containing a prolog error. Moreover, out of gas errors having a sense at the sdk level this feels a bit wrong to me.
@ccamel I'd be really interested in your insights on that, I may be missing something :)
Fixe #692, see issue description for complete details.
Note: I was forced to moveQueryInterpreter
utility method into the keeper since using the commonResourceGas
predicate error coming from keeper package lead to a cycle import betweenutils
andprolog
packages.EDIT: Now all
OutOfGas
errors that occurs in the interpreter or at predicate cost will return an GRPC error instead of a predicate prolog error.Summary by CodeRabbit
Bug Fixes
Refactor
if
statements toswitch
statements for better code readability and maintainability.