pact icon indicating copy to clipboard operation
pact copied to clipboard

Capabilities that return `false` should fail

Open bts opened this issue 5 years ago • 4 comments

The following call to f currently does not fail because we disregard BAR's return value (and always return true) and end up evaluating (enforce true "...")

(module m 'keyset
  (defcap BAR ()
    false)
  (defcap FOO ()
    (enforce (compose-capability (BAR)) "BAR returned false"))

  (defun f:bool ()
    (with-capability (FOO)
      true))
  )

This call to f should fail due to passing false to enforce.

bts avatar Feb 28 '19 17:02 bts

@slpopejoy

bts avatar Feb 28 '19 17:02 bts

@bts do you mind pulling master and checking to see this is fixed as of https://github.com/kadena-io/pact/pull/411 ?

emilypi avatar Mar 01 '19 18:03 emilypi

@emilypi just rebuilt on master and confirmed that this is still an issue

bts avatar Mar 06 '19 13:03 bts

The real issue here is that the bool return type on defcaps is throwaway.

Propose instead we fail a defcap test if it returns anything but true.

sirlensalot avatar Mar 16 '19 22:03 sirlensalot