Skip to content

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
@ascjones ascjones force-pushed the aj-instantiate-salt branch from bd850f5 to ad2a5cb Compare January 19, 2021 15:01
@ascjones ascjones requested a review from Robbepop January 19, 2021 15:33
@Robbepop
Copy link
Collaborator

doc tests seem to be failing

@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

4 participants