You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In summary, I think there is a bug, where it says there's a max of 4x topics during build if you use >4x topics, but if you only use 4x topics for an event then it'll build successfully but then generate error Cross-contract instantiation failed with CalleeTrapped during instantiation, then if you change to <4x topics it'll successfully build and instantiate.
Detailed report is as follows:
I'm using the latest cargo-contract 3.0.1-unknown-x86_64-unknown-linux-gnu
It outputs an error since I've tried to use 5x event topics when only 4x topics are allowed
error[E0277]: the trait bound `EventTopics<5>: RespectTopicLimit<4>` is not satisfied
--> /app/dapps/xcm/unnamed/oracle_contract/lib.rs:26:5
|
26 | /// Emitted when create new market guess for market id.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `RespectTopicLimit<4>` is not implemented for `EventTopics<5>`
|
= help: the following other types implement trait `RespectTopicLimit<N>`:
<EventTopics<5> as RespectTopicLimit<10>>
<EventTopics<5> as RespectTopicLimit<11>>
<EventTopics<5> as RespectTopicLimit<12>>
<EventTopics<5> as RespectTopicLimit<5>>
<EventTopics<5> as RespectTopicLimit<6>>
<EventTopics<5> as RespectTopicLimit<7>>
<EventTopics<5> as RespectTopicLimit<8>>
<EventTopics<5> as RespectTopicLimit<9>>
note: required by a bound in `EventRespectsTopicLimit`
--> /usr/local/cargo/git/checkouts/ink-c26a90e68a5d1f57/d372cce/crates/ink/src/codegen/event/topics.rs:45:43
|
45 | <Event as EventLenTopics>::LenTopics: RespectTopicLimit<LEN_MAX_TOPICS>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EventRespectsTopicLimit`
So I think that's an easy fix, I just comment out one of the #[ink(topic)], so I'm only using 4x topics instead of 5x topics.
Dry-running new (skip with --skip-dry-run)
Result ModuleError: Contracts::ContractTrapped: ["Contract trapped during execution."]
Gas Consumed Weight { ref_time: 4480251726, proof_size: 71307 }
Gas Required Weight { ref_time: 10884204205, proof_size: 267367 }
Storage Deposit StorageDeposit::Charge(0)
Debug Message 77
panicked at 'Cross-contract instantiation failed with CalleeTrapped', /usr/local/cargo/git/checkouts/ink-c26a90e68a5d1f57/d372cce/crates/env/src/call/create_builder.rs:260:17
ERROR: Pre-submission dry-run failed. Use --skip-dry-run to skip this step.
So I then I try only using 3x topics (even though it said there was max. 4x topics) by commenting out two of the #[ink(topic)] lines instead of only commenting out one:
And that builds successfully, and it also instantiates successfully
So I think it's a bug in ink! or a bug in cargo-contract where user is told that the max amount of topics they can use is one more than the actual amount of topics they can use.
it's telling me that the max. amount of topics is 4x when building, but when it instantiates it just panics with error Cross-contract instantiation failed with CalleeTrapped, and the solution to that error is to use "one less" than it tells me is the max. amount of topics during build.
The text was updated successfully, but these errors were encountered:
In summary, I think there is a bug, where it says there's a max of 4x topics during build if you use >4x topics, but if you only use 4x topics for an event then it'll build successfully but then generate error
Cross-contract instantiation failed with CalleeTrapped
during instantiation, then if you change to <4x topics it'll successfully build and instantiate.Detailed report is as follows:
I'm using the latest
cargo-contract 3.0.1-unknown-x86_64-unknown-linux-gnu
If in my code I use 5x topics like this
And I emit that event with:
Then when I build the contract with
It outputs an error since I've tried to use 5x event topics when only 4x topics are allowed
So I think that's an easy fix, I just comment out one of the
#[ink(topic)]
, so I'm only using 4x topics instead of 5x topics.That change builds successfully,
but when I then try to instantiate it with:
It outputs the following error
So I then I try only using 3x topics (even though it said there was max. 4x topics) by commenting out two of the
#[ink(topic)]
lines instead of only commenting out one:And that builds successfully, and it also instantiates successfully
So I think it's a bug in ink! or a bug in cargo-contract where user is told that the max amount of topics they can use is one more than the actual amount of topics they can use.
it's telling me that the max. amount of topics is 4x when building, but when it instantiates it just panics with error
Cross-contract instantiation failed with CalleeTrapped
, and the solution to that error is to use "one less" than it tells me is the max. amount of topics during build.The text was updated successfully, but these errors were encountered: