This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Customizable ink address#10521
Merged
paritytech-processbot[bot] merged 1 commit intoparitytech:masterfrom Dec 23, 2021
Merged
Conversation
athei
suggested changes
Dec 21, 2021
Member
athei
left a comment
There was a problem hiding this comment.
Looks good. Just missing rust doc.
|
|
||
| /// The address generator function used to determine the address of a contract. | ||
| pub trait AddressGenerator<T: frame_system::Config> { | ||
| fn generate_address( |
Member
There was a problem hiding this comment.
Every public item needs rust doc.
Member
There was a problem hiding this comment.
Thanks. I think we need to document some warnings here though:
- Implementer must make sure that there are no collisions (same output for different inputs).
- Implementer must make sure that the same inputs lead to the same output (including environmental inputs like your storage location).
- Changing the implementation through a runtime upgrade without a proper storage migration would be a a catastrophic event.
Contributor
Author
There was a problem hiding this comment.
Thanks for the suggestion. Appended them to the doc.
9b87c56 to
9ca34d0
Compare
Contributor
|
LGTM |
9ca34d0 to
4570bc0
Compare
athei
approved these changes
Dec 23, 2021
ascjones
approved these changes
Dec 23, 2021
Member
|
bot merge |
HCastano
added a commit
to paritytech/canvas
that referenced
this pull request
Jan 8, 2022
cmichi
pushed a commit
to paritytech/canvas
that referenced
this pull request
Jan 10, 2022
* Bump Cumulus, Polkadot, and Substrate Also bumps some other depenencies * Remove duplicate `polkadot` dependency * Update `service.rs` Changes related to: paritytech/cumulus#835 * Update `command.rs` * Add `AddressGenerator` config type From: paritytech/substrate#10521 * Allow Root to execute overweight XCMP messages From: paritytech/cumulus#799 * Add `header` argument to `collect_collation_info` From: paritytech/cumulus#882 * Update Cumulus and friends again * Add Fork ID to genesis config paritytech/cumulus#870 * Add `state_version` field paritytech/substrate#9732 * Add `MaxConsumers` config parameter paritytech/substrate#10382 * Update Substrate compatibility note in README
grishasobol
pushed a commit
to gear-tech/substrate
that referenced
this pull request
Mar 28, 2022
ark0f
pushed a commit
to gear-tech/substrate
that referenced
this pull request
Feb 27, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
We are using the pallet-contracts to implement phala's smart contract. We constructed a minimal substrate runtime which include only pallet-contracts and it's dependencies. The runtime then can runs on multiple seperate storage instance. The problem is that contracts instantiated in different storage instance can have the same address, and we want the address to be unique in global.
Summary
To solve the problem, this PR adds a type parameter to generate ink addresses. The DefaultAddressGenerator keeps the original formula. And users can customize the address generation formula by implement a custom AddressGenerator.