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

Assertion failure during contract deployment #411

Open
fulldecent opened this issue Aug 16, 2019 · 2 comments
Open

Assertion failure during contract deployment #411

fulldecent opened this issue Aug 16, 2019 · 2 comments

Comments

@fulldecent
Copy link
Contributor

Test case:

  1. Clone https://github.com/fulldecent/aion-aip040
  2. Checkout 0xa0beeb017dd82747692965c3ca7b6f1a2a3c1b777d4472ce54174e224ca61962
  3. Initialize
  4. ./mvnw clean install

Expected

AVM never has an assertion failure no matter what customers of AVM do

Actual

AVM has an assertion error

@jennijuju
Copy link

You are only seeing this because you are running test cases using avmrule with debug mode on,
which can show the exact error in the AVM that causes a failure a transaction. That being said, you are only seeing the assertion error because your test cases are running using AVM(avm.jar) directly.
This is a privilege Java gives us for smart contract development. With our avmrule (debugging tooling), it allows users to test and debug their contracts using JUnit tests. User can use breakpoints to find the exact lines in their contracts that are wrong. In addition, with debug mode, users can understand the issue more and find a way to fix it faster.

If you deploy the contract to the real network, your transaction will JUST be rejected and you will only notice a transaction failure.

@fulldecent
Copy link
Contributor Author

I understand what you are saying, but I don't see how it applies here.

In programming, every assert() call should include the name and cell phone number of the programmer who put it there. In the event that assert(false) is called, the programmer gets called, woken up, and they fix it so that assert(false) never happens.

If assert here is being used as a way to point user to an explanation of on error the user made then I recommend an exception, error or other mechanism.

fulldecent added a commit to fulldecent/aion-aip040 that referenced this issue Aug 21, 2019
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

2 participants