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

pink: Use customized ink address as contract id #610

Merged
merged 7 commits into from
Dec 30, 2021

Conversation

kvinwang
Copy link
Collaborator

Waiting for this upstream PR.

@kvinwang kvinwang force-pushed the custom-ink-address branch 3 times, most recently from a9c61c5 to e32e89e Compare December 27, 2021 07:29
@kvinwang
Copy link
Collaborator Author

There some unresolved compilation errors:

error[E0277]: the trait bound `<T as frame_system::Config>::AccountId: std::default::Default` is not satisfied
    --> pallets/phala/src/stakepool.rs:698:20
     |
698  |             pool_info: &mut PoolInfo<T::AccountId, BalanceOf<T>>,
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `<T as frame_system::Config>::AccountId`
     |
note: required by a bound in `stakepool::pallet::PoolInfo`
    --> pallets/phala/src/stakepool.rs:1127:33
     |
1127 |     pub struct PoolInfo<AccountId: Default, Balance> {
     |                                    ^^^^^^^ required by this bound in `stakepool::pallet::PoolInfo`
help: consider further restricting the associated type
     |
700  |         ) where <T as frame_system::Config>::AccountId: std::default::Default {
error[E0046]: not all trait items implemented, missing: `MaxConsumers`
     --> /home/kvin/codes/chain/phala/phala-blockchain/standalone/runtime/src/lib.rs:214:1
      |
  214 | impl frame_system::Config for Runtime {
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `MaxConsumers` in implementation
      |
      = help: implement the missing item: `type MaxConsumers = Type;`

  error[E0046]: not all trait items implemented, missing: `PreimageProvider`, `NoPreimagePostponement`
     --> /home/kvin/codes/chain/phala/phala-blockchain/standalone/runtime/src/lib.rs:355:1
      |
  355 | impl pallet_scheduler::Config for Runtime {
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `PreimageProvider`, `NoPreimagePostponement` in implementation
      |
      = help: implement the missing item: `type PreimageProvider = Type;`
      = help: implement the missing item: `type NoPreimagePostponement = Type;`

  error[E0046]: not all trait items implemented, missing: `BenchmarkingConfig`
     --> /home/kvin/codes/chain/phala/phala-blockchain/standalone/runtime/src/lib.rs:525:1
      |
  525 | impl pallet_staking::Config for Runtime {
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `BenchmarkingConfig` in implementation
      |
      = help: implement the missing item: `type BenchmarkingConfig = Type;`

  error[E0046]: not all trait items implemented, missing: `ChildBountyManager`
     --> /home/kvin/codes/chain/phala/phala-blockchain/standalone/runtime/src/lib.rs:881:1
      |
  881 | impl pallet_bounties::Config for Runtime {
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `ChildBountyManager` in implementation
      |
      = help: implement the missing item: `type ChildBountyManager = Type;`

  error[E0308]: mismatched types
    --> /home/kvin/codes/chain/phala/phala-blockchain/standalone/runtime/src/impls.rs:26:30
     |
  26 |         Balances::resolve_creating(&Authorship::author(), amount);
     |                                    ^^^^^^^^^^^^^^^^^^^^^ expected struct `AccountId32`, found enum `Option`
     |

@h4x3rotab
Copy link
Contributor

Oh, I know this one. There's an upstream bug fix to a security problem. As a part of the fix, default value (0x0) for AccountId was disabled. So here we need to either remove the default derivation or manually assign the zero value to the account field. The later case is suboptimal because we may accidentally trigger the security problem.

Side note: if the zero account is used as the public key, anyone can make a zero signature that can bypass some ill crypto implementation

@h4x3rotab
Copy link
Contributor

The other problems are mostly additional generic config items by the pallets. Usually we can follow the upstream usage to give it some config. You can take a look at Substrate bin/runtime and Polkadot's runtime code

@kvinwang kvinwang marked this pull request as ready for review December 30, 2021 02:16
@kvinwang kvinwang merged commit d0ff13b into instantiate-native Dec 30, 2021
@kvinwang kvinwang deleted the custom-ink-address branch December 30, 2021 02:17
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.

2 participants