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

Re-export initialize_contract function #1077

Merged
merged 4 commits into from
Feb 17, 2022
Merged

Conversation

HCastano
Copy link
Contributor

@HCastano HCastano commented Dec 9, 2021

I don't think users should be accessing stuff from the codegen module directly, so this
PR re-exports initialize_contract so it can be used from the ink_lang module instead.

@Robbepop
Copy link
Collaborator

Robbepop commented Dec 9, 2021

I want to keep ink_lang root clean from functionality such as this API.
The reason why I introduced the API to the hidden codegen module is that I do not think that it will be stable for long which is yet another reason we should not be putting this API into ink_lang root before ink! 3.0 stable release.
As a compromise we could put it into a utils submodule of root.

@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2021

Codecov Report

Merging #1077 (17fd88d) into master (67b457c) will decrease coverage by 3.47%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1077      +/-   ##
==========================================
- Coverage   78.70%   75.22%   -3.48%     
==========================================
  Files         253      253              
  Lines        9411     9409       -2     
==========================================
- Hits         7407     7078     -329     
- Misses       2004     2331     +327     
Impacted Files Coverage Δ
...lang/tests/ui/contract/pass/example-erc20-works.rs 1.51% <0.00%> (ø)
...ang/tests/ui/contract/pass/example-erc721-works.rs 0.67% <0.00%> (ø)
crates/lang/ir/src/ir/contract.rs 0.00% <0.00%> (-100.00%) ⬇️
crates/lang/ir/src/ir/ink_test.rs 0.00% <0.00%> (-87.50%) ⬇️
crates/lang/ir/src/ir/trait_def/mod.rs 0.00% <0.00%> (-66.67%) ⬇️
crates/lang/ir/src/ir/blake2.rs 20.00% <0.00%> (-60.00%) ⬇️
crates/lang/ir/src/ir/trait_def/item/trait_item.rs 45.31% <0.00%> (-43.75%) ⬇️
crates/lang/ir/src/ir/trait_def/config.rs 7.69% <0.00%> (-38.47%) ⬇️
crates/lang/ir/src/ir/utils.rs 53.84% <0.00%> (-30.77%) ⬇️
crates/lang/ir/src/ir/item_mod.rs 62.28% <0.00%> (-27.43%) ⬇️
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67b457c...17fd88d. Read the comment docs.

@HCastano
Copy link
Contributor Author

It's unclear if we're gonna keep initialize_contract, so I'm gonna close this

@HCastano HCastano closed this Jan 13, 2022
@HCastano HCastano reopened this Feb 15, 2022
@HCastano HCastano force-pushed the hc-re-export-initialize-contract branch from 7cde1ac to 17fd88d Compare February 15, 2022 18:27
@paritytech-cicd-pr
Copy link

🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑

These are the results when building the examples/* contracts from this branch with cargo-contract 0.17.0-942c50c and comparing them to ink! master:

Δ Optimized Size Δ Used Gas Total Optimized Size Total Used Gas
accumulator 1.44 K
adder 2.94 K
contract-terminate 1.31 K 215_704
contract-transfer 8.55 K 15_704
delegator 7.63 K 51_343
dns 10.20 K 47_112
erc1155 28.32 K 94_224
erc20 9.80 K 47_112
erc721 13.70 K 125_632
flipper 1.76 K 15_704
incrementer 1.64 K 15_704
multisig 26.76 K 103_580
proxy 3.87 K 32_304
rand-extension 5.12 K 15_704
subber 2.96 K
trait-erc20 10.10 K 47_112
trait-flipper 1.53 K 15_704
trait-incrementer 1.62 K 31_408

Link to the run | Last update: Tue Feb 15 20:04:37 CET 2022

@HCastano
Copy link
Contributor Author

Resurrected because use-ink/cargo-contract#431 is moving forward, which looks for instances of initialize_contract

@xgreenx
Copy link
Collaborator

xgreenx commented Feb 16, 2022

Resurrected because paritytech/cargo-contract#431 is moving forward, which looks for instances of initialize_contract

Sorry, I already mention that, but I didn't get any comment=) What do you think about that idea?

It allows us to simplify the definition of the constructor for the user and it also is more intuitive for Solidity developers.

@cmichi cmichi merged commit e345679 into master Feb 17, 2022
@cmichi cmichi deleted the hc-re-export-initialize-contract branch February 17, 2022 06:34
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.

None yet

7 participants