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

Boogie not support creating new contract #468

Open
wmanshu opened this issue Aug 22, 2019 · 0 comments
Open

Boogie not support creating new contract #468

wmanshu opened this issue Aug 22, 2019 · 0 comments

Comments

@wmanshu
Copy link

wmanshu commented Aug 22, 2019

Example file: reentry-attack.flint

contract MiniDAO {
  var balances: [Address: Int]
  var total: Wei
}


MiniDAO :: (any) {
  public init()
  mutates (Wei.rawValue)
  {
    self.balances = [:]
    self.total = Wei(0)
  }
}

contract Attacker {
  var stack: Int = 0
  let stackLimit: Int = 10
  var amount: Int
  var dao: MiniDAO
}

Attacker :: caller <- (any) {
  @payable
  public init(implicit value: inout Wei)
  mutates (Wei.rawValue, MiniDAO.total, MiniDAO.balances)
  pre (value.rawValue > 0)
  {
    self.dao = MiniDAO()
    self.amount = value.rawValue
  }

error message:

Error in /home/manshu/Desktop/FromSolidityToFlint:
  Flint to Boogie translation error. Unsupported construct used.
  Details: /tmp/AE0CC45C-0D1F-4AC5-BE37-AF6C2D80BFC3.bpl(617,26): Error: undeclared identifier: nextInstance_MiniDAO
  (Translation Line: 617)
Error in /home/manshu/Desktop/FromSolidityToFlint:
  Flint to Boogie translation error. Unsupported construct used.
  Details: /tmp/AE0CC45C-0D1F-4AC5-BE37-AF6C2D80BFC3.bpl(658,0): Error: wrong number of result variables in call to init_MiniDAO: 1
  (Translation Line: 658)

error happens with self.dao = MiniDAO(), but this contract compiles when skipping the verifier. So I suppose the problem is there isn't a way to translate this line to boogie. ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants