Changed 'require' function return type to Unit #598

Merged
zxq9 merged 1 commits from github/fork/radrow/master into master 2019-07-21 04:05:40 +09:00
zxq9 commented 2019-07-20 01:19:09 +09:00 (Migrated from gitlab.com)

Created by: radrow

require function could be used to exploit type system, because it was returning 'a type instead of ():

bug copyright (c) Martin Grigorov

contract Identity =
  type state = ()
  entrypoint main(x : int) = x
  
  entrypoint sum(a: int, b: int) = a + b
  
  entrypoint test_sum_correct() =
        let result = 5
        require(sum(2,3)== 5, "Result of sum is incorrect!")
*Created by: radrow* `require` function could be used to exploit type system, because it was returning `'a` type instead of `()`: bug copyright (c) Martin Grigorov ``` contract Identity = type state = () entrypoint main(x : int) = x entrypoint sum(a: int, b: int) = a + b entrypoint test_sum_correct() = let result = 5 require(sum(2,3)== 5, "Result of sum is incorrect!") ```
zxq9 commented 2019-07-20 01:19:50 +09:00 (Migrated from gitlab.com)

Created by: radrow

cc @UlfNorell @hanssv

*Created by: radrow* cc @UlfNorell @hanssv
zxq9 commented 2019-07-20 01:20:08 +09:00 (Migrated from gitlab.com)

Created by: UlfNorell

Review: Approved

*Created by: UlfNorell* **Review:** Approved
zxq9 commented 2019-07-21 04:04:59 +09:00 (Migrated from gitlab.com)

Created by: hanssv

Review: Approved

*Created by: hanssv* **Review:** Approved
zxq9 commented 2019-07-21 04:05:40 +09:00 (Migrated from gitlab.com)

Merged by: hanssv at 2019-07-20 19:05:40 UTC

*Merged by: hanssv at 2019-07-20 19:05:40 UTC*
Sign in to join this conversation.
No description provided.