Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Fix partial bind#1227

Merged
rsoeldner merged 1 commit intomasterfrom
rsoeldner/partial-bind
May 13, 2023
Merged

Fix partial bind#1227
rsoeldner merged 1 commit intomasterfrom
rsoeldner/partial-bind

Conversation

@rsoeldner
Copy link
Copy Markdown
Member

Prior this PR, partial binds resulted in a sort-mismatch error (emitted from Z3).
The following example just binds b and resulted in the subsequent error:

(module test G  (defcap G () true)
  (defschema ty
      ""
    a: integer
    b: time
    )
 
  (defun test (x:object{ty})
          @model[(property true)]
          (bind x
              {"b" := _}
            1))
)
(verify 'test true)
*** Data.SBV: Unexpected non-success response from Z3:
***
***    Sent      : (define-fun s6 () (_ BitVec 64) (proj_1_SBVTuple2 s0))
***    Expected  : success
***    Received  : (error "line 23 column 54: invalid function/constant definition, sort mismatch")
***
***    Exit code : ExitFailure (-15)
***    Executable: /home/rsoeldner/Downloads/z3-4.12.1-x64-glibc-2.35/bin/z3
***    Options   : -nw -in -smt2
***
***    Reason    : Check solver response for further information. If your code is correct,
***                please report this as an issue either with SBV or the solver itself!

The reason for this misbehavior is the fact, that we pass the binding schema (in this particular case b) to translateObjBind. The fix relies on the original object schema (here a and b) and our internal machinery to identify the current bind (see evalObjAt from Core.hs where we loop through the elements to identify the bind).

Closes #1173

PR checklist:

  • Test coverage for the proposed changes
  • PR description contains example output from repl interaction or a snippet from unit test output
  • Documentation has been updated if new natives or FV properties have been added. To generate new documentation, issue cabal run tests. If they pass locally, docs are generated.
  • Any changes that could be relevant to users have been recorded in the changelog
  • In case of changes to the Pact trace output (pact -t), make sure pact-lsp is in sync.

Additionally, please justify why you should or should not do the following:

  • Confirm replay/back compat
  • Benchmark regressions
  • (For Kadena engineers) Run integration-tests against a Chainweb built with this version of Pact

@rsoeldner rsoeldner added the FV Formal verification label May 12, 2023
Copy link
Copy Markdown
Contributor

@imalsogreg imalsogreg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Robert for the clear explanation on our call. Makes sense.

@rsoeldner rsoeldner merged commit c696a67 into master May 13, 2023
@rsoeldner rsoeldner deleted the rsoeldner/partial-bind branch May 13, 2023 06:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

FV Formal verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Access to (at 'block-time (chain-data)) breaks FV

4 participants