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

[env] pass salt argument to instantiate host function #599

Merged
merged 14 commits into from
Jan 19, 2021

Conversation

ascjones
Copy link
Collaborator

@ascjones ascjones commented Nov 27, 2020

Fixes #593. Rel paritytech/substrate#7482

Allows specifying salt when instantiating a contract from within a contract e.g. (from delegator):

let adder = Adder::new(accumulator.clone())
    .endowment(total_balance / 4)
    .code_hash(adder_code_hash)
    .salt_bytes(salt)
    .instantiate()
    .expect("failed at instantiating the `Adder` contract");

todo

  • How to choose type of salt - currently hardcoded to [u8; 4]. Is it possible/desirable to make this generic with the constructor builder. If not should Salt be added to the Environment trait?

@ascjones ascjones marked this pull request as ready for review January 19, 2021 13:38
@Robbepop
Copy link
Collaborator

doc tests seem to be failing

crates/env/src/api.rs Show resolved Hide resolved
crates/env/src/backend.rs Show resolved Hide resolved
crates/env/src/call/create_builder.rs Outdated Show resolved Hide resolved
crates/env/src/call/create_builder.rs Show resolved Hide resolved
crates/env/src/engine/on_chain/impls.rs Outdated Show resolved Hide resolved
crates/lang/codegen/src/generator/cross_calling.rs Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Jan 19, 2021

Codecov Report

Merging #599 (de5f0c6) into master (01f987d) will decrease coverage by 2.90%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #599      +/-   ##
==========================================
- Coverage   82.66%   79.76%   -2.91%     
==========================================
  Files         161      161              
  Lines        7414     7389      -25     
==========================================
- Hits         6129     5894     -235     
- Misses       1285     1495     +210     
Impacted Files Coverage Δ
crates/env/src/api.rs 43.75% <ø> (ø)
crates/env/src/backend.rs 0.00% <ø> (ø)
crates/env/src/call/create_builder.rs 0.00% <0.00%> (ø)
crates/env/src/engine/off_chain/impls.rs 52.63% <ø> (ø)
crates/lang/codegen/src/generator/cross_calling.rs 94.34% <ø> (ø)
crates/lang/src/env_access.rs 27.27% <ø> (ø)
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/item_mod.rs 59.06% <0.00%> (-32.22%) ⬇️
crates/lang/ir/src/ir/selector.rs 50.00% <0.00%> (-25.00%) ⬇️
... and 16 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 01f987d...de5f0c6. Read the comment docs.

Copy link
Collaborator

@Robbepop Robbepop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ascjones ascjones merged commit 1daf6a8 into master Jan 19, 2021
@ascjones ascjones deleted the aj-instantiate-salt branch January 19, 2021 17:48
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.

Add salt argument for seal_instantiate host function
3 participants