-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(revive): add contract instantiated event #8789
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
Changes from 2 commits
d7f4038
44872e8
02868c9
5a9d86c
c41a259
e5eb49e
b12b59a
4bd566e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 | ||
| # See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json | ||
|
|
||
| title: '[pallet-revive] Add contract instantiated event' | ||
|
|
||
| doc: | ||
| - audience: Runtime Dev | ||
| description: ' `instantiate` and `instantiate_with_code` emit a `Instantiated` event.' | ||
|
|
||
| crates: | ||
| - name: pallet-revive | ||
| bump: minor |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1142,6 +1142,13 @@ fn instantiation_work_with_success_output() { | |
| ContractInfo::<Test>::load_code_hash(&instantiated_contract_id).unwrap(), | ||
| dummy_ch | ||
| ); | ||
| assert_eq!( | ||
| &events(), | ||
| &[Event::Instantiated { | ||
| deployer: ALICE_ADDR, | ||
| contract: instantiated_contract_address | ||
| }] | ||
| ); | ||
|
Comment on lines
+1148
to
+1154
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only test that was effected. I've checked there's also a test that already checks the case when the instantiation call succeeds but the contract is reverted - In that case there's already an assertion that checks that no events should be emitted. See All these tests were done previously, but updated the event assertions when #7164 removed the events. The only one that needed to be updated is this one. |
||
| }); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this within
exec, inrun_instantiatewhich is called only from the top frame. The other possibility was to have this inbare_instantiateof the pallet's lib.rs, but I thought it would be better to have it in here since this is the function performing the instantiation (and some tests are actually calling this function directly).