Skip to content
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

Fix warnings on non-exhaustive matches for rules #2248

Open
anvacaru opened this issue Jan 10, 2024 · 2 comments
Open

Fix warnings on non-exhaustive matches for rules #2248

anvacaru opened this issue Jan 10, 2024 · 2 comments
Labels

Comments

@anvacaru
Copy link
Contributor

anvacaru commented Jan 10, 2024

These warnings are emitted during the kompilation process.

[Warning] Compiler: Non exhaustive match detected:
`#lenOfHead(_)_EVM-ABI_Int_TypedArg`(`abi_type_tuple`(_))
        Source(/nix/store/0ldpwmslqv838p5gcw0cadyxnd96nbdm-python3.10-kevm-pyk-1.0.406/lib/python3.10/site-packages/kevm_pyk/kproj/evm-semantics/abi.md)
        Location(291,20,291,61)
        291 |       syntax Int ::= #lenOfHead ( TypedArg ) [function, total]
            .                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Warning] Compiler: Non exhaustive match detected:
`#isStaticType(_)_EVM-ABI_Bool_TypedArg`(`abi_type_tuple`(_))
        Source(/nix/store/0ldpwmslqv838p5gcw0cadyxnd96nbdm-python3.10-kevm-pyk-1.0.406/lib/python3.10/site-packages/kevm_pyk/kproj/evm-semantics/abi.md)
        Location(402,21,402,65)
        402 |       syntax Bool ::= #isStaticType ( TypedArg ) [function, total]
            .                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Warning] Compiler: Non exhaustive match detected:
`_<Gas__GAS-SYNTAX_Bool_Gas_Gas`(infGas(_),_)
        Source(/nix/store/0ldpwmslqv838p5gcw0cadyxnd96nbdm-python3.10-kevm-pyk-1.0.406/lib/python3.10/site-packages/kevm_pyk/kproj/evm-semantics/gas.md)
        Location(23,21,23,54)
        23 |        syntax Bool ::= Gas  "<Gas" Gas [function, total]
           .                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Warning] Compiler: Non exhaustive match detected:
`_<=Gas__GAS-SYNTAX_Bool_Gas_Gas`(infGas(_),infGas(_))
        Source(/nix/store/0ldpwmslqv838p5gcw0cadyxnd96nbdm-python3.10-kevm-pyk-1.0.406/lib/python3.10/site-packages/kevm_pyk/kproj/evm-semantics/gas.md)
        Location(24,21,24,54)
        24 |                      | Gas "<=Gas" Gas [function, total]
        ```
@anvacaru
Copy link
Contributor Author

`#lenOfHead(_)_EVM-ABI_Int_TypedArg`(`abi_type_tuple`(_))

The rule for #lenOfHead( #tuple(_) ) is missing. Maybe refactor all #lenOfHead rules into a single rule like:

rule #lenOfHead ( _ ) => 32
`#isStaticType(_)_EVM-ABI_Bool_TypedArg`(`abi_type_tuple`(_))

The rule for #isStaticType (#tuple ( TUPLE_ARGS )) is missing. We should add some logic here that does an OR on isStaticType() for each argument in TUPLE_ARGS.

  1. and 4. Both rules below are marked as simplification, so the llvm-backend issues Non-Exhaustive match on the operators <Gas, <=Gas for these cases (source here).
    rule #gas(_)  <Gas _       => false [simplification]
    rule _       <=Gas #gas(_) => true  [simplification]

Why do they have to be marked as simplification? Should the entire INFINITE-GAS module be marked as symbolic?
cc @ehildenb @dkcumming

@dkcumming
Copy link
Contributor

@anvacaru I believe the original rules that this module was replacing marked the rules as [simplification], and that I was getting slower results for performance if [simplification] was not added for this module. I concluded that it must be doing short circuit evaluation and avoiding evaluation LHS and RHS of the comparison if the attribute was added, but I don't have much confidence in that now. It is entirely possible that they ought not be marked [simplification].

I am not sure if the whole module should be marked as symbolic sorry, perhaps @ehildenb can offer more insight.

@anvacaru anvacaru changed the title Address warnings on non-exhaustive matches for rules Fix warnings on non-exhaustive matches for rules Jan 18, 2024
@anvacaru anvacaru removed their assignment Jan 18, 2024
@yale-vinson yale-vinson added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants