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

Advanced test environment #1

Open
wants to merge 49 commits into
base: master
Choose a base branch
from

Conversation

Artemka374
Copy link

@Artemka374 Artemka374 commented Jan 3, 2023

This is PR for this issue: Supercolony-net/openbrush-contracts#136 (comment)
that was started in Supercolony-net#4

  • Add support of call_flags
  • Error & revert handling

@Artemka374 Artemka374 marked this pull request as draft January 3, 2023 14:56
@Artemka374 Artemka374 closed this Jan 3, 2023
@Artemka374 Artemka374 reopened this Jan 3, 2023
crates/engine/src/ext.rs Outdated Show resolved Hide resolved
crates/engine/src/ext.rs Outdated Show resolved Hide resolved
crates/engine/src/ext.rs Outdated Show resolved Hide resolved
crates/engine/src/ext.rs Outdated Show resolved Hide resolved
crates/engine/src/ext.rs Outdated Show resolved Hide resolved
crates/engine/src/ext.rs Outdated Show resolved Hide resolved
crates/engine/src/lib.rs Show resolved Hide resolved
crates/env/src/engine/off_chain/impls.rs Show resolved Hide resolved
crates/env/src/engine/off_chain/impls.rs Outdated Show resolved Hide resolved
crates/ink/codegen/src/generator/dispatch.rs Show resolved Hide resolved
@Artemka374 Artemka374 marked this pull request as ready for review January 11, 2023 14:22
@Artemka374 Artemka374 requested a review from coreggon11 January 11, 2023 14:22
crates/engine/src/ext.rs Outdated Show resolved Hide resolved
crates/env/src/engine/off_chain/impls.rs Outdated Show resolved Hide resolved
crates/env/src/engine/off_chain/impls.rs Outdated Show resolved Hide resolved
crates/env/src/engine/off_chain/impls.rs Outdated Show resolved Hide resolved
crates/env/src/engine/off_chain/impls.rs Outdated Show resolved Hide resolved
crates/env/src/engine/off_chain/impls.rs Outdated Show resolved Hide resolved
crates/env/src/error.rs Outdated Show resolved Hide resolved
examples/delegator/adder/lib.rs Outdated Show resolved Hide resolved
examples/reentrancy/contract2/lib.rs Outdated Show resolved Hide resolved
@Artemka374 Artemka374 requested a review from coreggon11 January 11, 2023 21:04
@Artemka374 Artemka374 closed this Jan 12, 2023
@Artemka374 Artemka374 reopened this Jan 19, 2023
crates/engine/src/ext.rs Outdated Show resolved Hide resolved
crates/env/src/backend.rs Show resolved Hide resolved
crates/engine/src/ext.rs Outdated Show resolved Hide resolved
crates/engine/src/ext.rs Show resolved Hide resolved
crates/engine/src/ext.rs Show resolved Hide resolved
crates/engine/src/ext.rs Show resolved Hide resolved
crates/env/src/engine/off_chain/impls.rs Outdated Show resolved Hide resolved
crates/env/src/engine/off_chain/impls.rs Outdated Show resolved Hide resolved
examples/reentrancy/lib.rs Outdated Show resolved Hide resolved
examples/reentrancy/lib.rs Outdated Show resolved Hide resolved
examples/reentrancy/lib.rs Outdated Show resolved Hide resolved
examples/reentrancy/main_contract/lib.rs Outdated Show resolved Hide resolved
@ganesh1997oli
Copy link

ganesh1997oli commented Jan 28, 2023

While calling fallable from Fallback Contract I got Contract trapped during execution. Why MainContract::inc: NotCallable' isn't callable.

Screenshot 2023-01-28 at 10 56 46

@coreggon11
Copy link

@123OLi did you deploy the main contract? Is the account you are calling indeed the main contract's account id?

@ganesh1997oli
Copy link

@123OLi did you deploy the main contract? Is the account you are calling indeed the main contract's account id?

Yes, I have deployed main contract as well and while deploying fallable contract I indeed choose main contract's account id.

@Artemka374
Copy link
Author

@123OLi but actually you can't just set the callee as AccountId for fallback contract, because as you can see, inside of contract it's type is MainContractRef, anyway that's a good point to change the way it works, so everybody could test it on-chain

@ganesh1997oli
Copy link

@123OLi but actually you can't just set the callee as AccountId for fallback contract, because as you can see, inside of contract it's type is MainContractRef, anyway that's a good point to change the way it works, so everybody could test it on-chain

@Artemka374 I set the callee as Main Contract
Screenshot 2023-01-30 18 03 56

@Artemka374
Copy link
Author

@123OLi but it is still AccountId, you can see the type of variable in UI. Also, I've changed the way contracts are deployed and added README, so you can use guide from there. But if you try to just call fallback as you described previously, it won't work, because reentrancy will occur in fallback contract, which is not allowed, so you can try to just call main contract first, and then you will be able to call fallback method directly.

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

Successfully merging this pull request may close these issues.

4 participants