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

Very high gas on function #271

Closed
mikeshultz opened this issue Jun 5, 2017 · 3 comments
Closed

Very high gas on function #271

mikeshultz opened this issue Jun 5, 2017 · 3 comments

Comments

@mikeshultz
Copy link

Same test contract as #270.

owner: address
depositors: wei_value[address]
depositorsNext: num

def __init__(_owner: address):
    self.owner = _owner
    self.depositorsNext = 1

def check_balance() -> wei_value:
    # Return our current balance 
    return(self.balance)

def drain():
    # Send all stored value to owner
    send(self.owner, self.balance)

def deposit() -> bool:
    # Deposit value in the contract and record the sender and value 
    
    assert(msg.value > 0)

    if self.depositors[msg.sender]:
        self.depositors[msg.sender] += msg.value
        return True
    else:
        self.depositors[msg.sender] = msg.value
        return True

When using geth to estimate gas on the deposit function, I'm getting gas higher than the block limit. Is this a viper compiler error, or just a really poorly defined function on my part?

> test_contract.deposit.estimateGas()
4712388
@vbuterin
Copy link
Contributor

Maybe geth's gas estimator has no idea how to handle Viper's way of doing conditional throws (PC JUMPI) ?

@DavidKnott
Copy link
Contributor

@mikeshultz Is this still happening? If it is I'll look into it.

@DavidKnott
Copy link
Contributor

@mikeshultz I'm closing this issue, if it's still a problem please create another issue

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

No branches or pull requests

3 participants