-
Notifications
You must be signed in to change notification settings - Fork 121
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
If contract instantiates sub-contracts, cargo contract instantiate
returns wrong contract account id
#777
Comments
Same issue as use-ink/cargo-contract#777.
Same issue as use-ink/cargo-contract#777.
* Update `contracts-node.scale` Executed for `substrate-contracts-node` v0.21.0: cargo install subxt-cli subxt metadata > contracts-node.scale * Update dependency paths * Fix wrong label * Add helper function `extract_wasm` * Add helper function `set_current_nonce` * Fix issue with wrong contract id Same issue as use-ink/cargo-contract#777. * Implement cross-contract testing * Adjust TODO comments * Add E2E tests for `delegator` * Adapt `contract-transfer` E2E tests for new API * Rename `RETURN` to `ReturnType` * Build additional contracts only once for all E2E tests I had to remove `skip_build` as keeping it work would become too complex right now. Will create a follow-up ticket for it. * Fix field name in error message
That's true, I spend a lot of hours to note this bug 👎 cargo contract instantiate shows this accountID: This is the second system:NewAccount and first contracts:Instantiated. The correct accountID for cargo contract instantiate would be: |
Bug
If a contract instantiates sub-contracts,
cargo contract instantiate
displays the wrong contract account id in its output. It displays the id of the sub-contract.I'm referring to this output:
How to replicate
Our
delegator
example instantiates three sub-contracts in its constructor and shows the bug.The method
switch
exists only on thedelegator/lib.rs
contract, but we call the first instantiated sub-contract here (due to the bug) and it doesn't have a methodswitch
. The command thus fails:Where to start looking
instantiate.rs
:I think this should be
find_last
instead, as theInstantiated
event from the first sub-contract is otherwise taken.What else to think about
Above the code linked right above there is the same
find_first
forCodeStored
:I'm not sure if it should be
find_last
there as well. For this to be faulty the contract would have to be able to upload another contract and I don't think that's possible right now.The text was updated successfully, but these errors were encountered: