Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
917dcb1d
Unverified
Commit
917dcb1d
authored
Jan 27, 2021
by
Shawn Tabrizi
Committed by
GitHub
Jan 27, 2021
Browse files
Use Extensible Multiaddress in all Polkadot Runtimes (#2126)
* Use extensible multiaddress * copy pasta
parent
0fb3d76e
Pipeline
#121939
passed with stages
in 30 minutes and 10 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
runtime/kusama/src/lib.rs
View file @
917dcb1d
...
...
@@ -43,7 +43,7 @@ use sp_runtime::{
transaction_validity
::{
TransactionValidity
,
TransactionSource
,
TransactionPriority
},
curve
::
PiecewiseLinear
,
traits
::{
BlakeTwo256
,
Block
as
BlockT
,
OpaqueKeys
,
ConvertInto
,
Identity
Lookup
,
BlakeTwo256
,
Block
as
BlockT
,
OpaqueKeys
,
ConvertInto
,
AccountId
Lookup
,
Extrinsic
as
ExtrinsicT
,
SaturatedConversion
,
Verify
,
},
};
...
...
@@ -138,7 +138,7 @@ impl frame_system::Config for Runtime {
type
Hash
=
Hash
;
type
Hashing
=
BlakeTwo256
;
type
AccountId
=
AccountId
;
type
Lookup
=
Identity
Lookup
<
Self
::
AccountId
>
;
type
Lookup
=
AccountId
Lookup
<
AccountId
,
()
>
;
type
Header
=
generic
::
Header
<
BlockNumber
,
BlakeTwo256
>
;
type
Event
=
Event
;
type
BlockHashCount
=
BlockHashCount
;
...
...
@@ -662,6 +662,7 @@ impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for R
account
:
AccountId
,
nonce
:
<
Runtime
as
frame_system
::
Config
>
::
Index
,
)
->
Option
<
(
Call
,
<
UncheckedExtrinsic
as
ExtrinsicT
>
::
SignaturePayload
)
>
{
use
sp_runtime
::
traits
::
StaticLookup
;
// take the biggest period possible.
let
period
=
BlockHashCount
::
get
()
.checked_next_power_of_two
()
...
...
@@ -690,7 +691,8 @@ impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for R
C
::
sign
(
payload
,
public
)
})
?
;
let
(
call
,
extra
,
_
)
=
raw_payload
.deconstruct
();
Some
((
call
,
(
account
,
signature
,
extra
)))
let
address
=
<
Runtime
as
frame_system
::
Config
>
::
Lookup
::
unlookup
(
account
);
Some
((
call
,
(
address
,
signature
,
extra
)))
}
}
...
...
@@ -1031,7 +1033,7 @@ construct_runtime! {
}
/// The address format for describing accounts.
pub
type
Address
=
AccountId
;
pub
type
Address
=
sp_runtime
::
MultiAddress
<
AccountId
,
()
>
;
/// Block header type as expected by this runtime.
pub
type
Header
=
generic
::
Header
<
BlockNumber
,
BlakeTwo256
>
;
/// Block type as expected by this runtime.
...
...
runtime/polkadot/src/lib.rs
View file @
917dcb1d
...
...
@@ -43,7 +43,7 @@ use sp_runtime::{
KeyTypeId
,
Percent
,
Permill
,
Perbill
,
curve
::
PiecewiseLinear
,
transaction_validity
::{
TransactionValidity
,
TransactionSource
,
TransactionPriority
},
traits
::{
BlakeTwo256
,
Block
as
BlockT
,
OpaqueKeys
,
ConvertInto
,
Identity
Lookup
,
BlakeTwo256
,
Block
as
BlockT
,
OpaqueKeys
,
ConvertInto
,
AccountId
Lookup
,
Extrinsic
as
ExtrinsicT
,
SaturatedConversion
,
Verify
,
},
};
...
...
@@ -152,7 +152,7 @@ impl frame_system::Config for Runtime {
type
Hash
=
Hash
;
type
Hashing
=
BlakeTwo256
;
type
AccountId
=
AccountId
;
type
Lookup
=
Identity
Lookup
<
AccountId
>
;
type
Lookup
=
AccountId
Lookup
<
AccountId
,
()
>
;
type
Header
=
generic
::
Header
<
BlockNumber
,
BlakeTwo256
>
;
type
Event
=
Event
;
type
BlockHashCount
=
BlockHashCount
;
...
...
@@ -707,6 +707,7 @@ impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for R
account
:
AccountId
,
nonce
:
<
Runtime
as
frame_system
::
Config
>
::
Index
,
)
->
Option
<
(
Call
,
<
UncheckedExtrinsic
as
ExtrinsicT
>
::
SignaturePayload
)
>
{
use
sp_runtime
::
traits
::
StaticLookup
;
// take the biggest period possible.
let
period
=
BlockHashCount
::
get
()
.checked_next_power_of_two
()
...
...
@@ -736,7 +737,8 @@ impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for R
C
::
sign
(
payload
,
public
)
})
?
;
let
(
call
,
extra
,
_
)
=
raw_payload
.deconstruct
();
Some
((
call
,
(
account
,
signature
,
extra
)))
let
address
=
<
Runtime
as
frame_system
::
Config
>
::
Lookup
::
unlookup
(
account
);
Some
((
call
,
(
address
,
signature
,
extra
)))
}
}
...
...
@@ -1026,7 +1028,7 @@ construct_runtime! {
}
/// The address format for describing accounts.
pub
type
Address
=
AccountId
;
pub
type
Address
=
sp_runtime
::
MultiAddress
<
AccountId
,
()
>
;
/// Block header type as expected by this runtime.
pub
type
Header
=
generic
::
Header
<
BlockNumber
,
BlakeTwo256
>
;
/// Block type as expected by this runtime.
...
...
runtime/rococo/src/lib.rs
View file @
917dcb1d
...
...
@@ -46,7 +46,7 @@ use sp_runtime::{
ApplyExtrinsicResult
,
KeyTypeId
,
Perbill
,
transaction_validity
::{
TransactionValidity
,
TransactionSource
,
TransactionPriority
},
traits
::{
BlakeTwo256
,
Block
as
BlockT
,
OpaqueKeys
,
Identity
Lookup
,
BlakeTwo256
,
Block
as
BlockT
,
OpaqueKeys
,
AccountId
Lookup
,
Extrinsic
as
ExtrinsicT
,
SaturatedConversion
,
Verify
,
},
};
...
...
@@ -119,7 +119,7 @@ pub fn native_version() -> NativeVersion {
}
/// The address format for describing accounts.
pub
type
Address
=
AccountId
;
pub
type
Address
=
sp_runtime
::
MultiAddress
<
AccountId
,
()
>
;
/// Block header type as expected by this runtime.
pub
type
Header
=
generic
::
Header
<
BlockNumber
,
BlakeTwo256
>
;
/// Block type as expected by this runtime.
...
...
@@ -232,7 +232,7 @@ impl frame_system::Config for Runtime {
type
Hash
=
Hash
;
type
Hashing
=
BlakeTwo256
;
type
AccountId
=
AccountId
;
type
Lookup
=
Identity
Lookup
<
Self
::
AccountId
>
;
type
Lookup
=
AccountId
Lookup
<
AccountId
,
()
>
;
type
Header
=
generic
::
Header
<
BlockNumber
,
BlakeTwo256
>
;
type
Event
=
Event
;
type
BlockHashCount
=
BlockHashCount
;
...
...
@@ -264,6 +264,7 @@ impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for R
account
:
AccountId
,
nonce
:
<
Runtime
as
frame_system
::
Config
>
::
Index
,
)
->
Option
<
(
Call
,
<
UncheckedExtrinsic
as
ExtrinsicT
>
::
SignaturePayload
)
>
{
use
sp_runtime
::
traits
::
StaticLookup
;
// take the biggest period possible.
let
period
=
BlockHashCount
::
get
()
.checked_next_power_of_two
()
...
...
@@ -292,7 +293,8 @@ impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for R
C
::
sign
(
payload
,
public
)
})
?
;
let
(
call
,
extra
,
_
)
=
raw_payload
.deconstruct
();
Some
((
call
,
(
account
,
signature
,
extra
)))
let
address
=
<
Runtime
as
frame_system
::
Config
>
::
Lookup
::
unlookup
(
account
);
Some
((
call
,
(
address
,
signature
,
extra
)))
}
}
...
...
runtime/test-runtime/src/lib.rs
View file @
917dcb1d
...
...
@@ -528,7 +528,7 @@ construct_runtime! {
}
/// The address format for describing accounts.
pub
type
Address
=
<
Indices
as
StaticLookup
>
::
Source
;
pub
type
Address
=
sp_runtime
::
MultiAddress
<
AccountId
,
AccountIndex
>
;
/// Block header type as expected by this runtime.
pub
type
Header
=
generic
::
Header
<
BlockNumber
,
BlakeTwo256
>
;
/// Block type as expected by this runtime.
...
...
runtime/westend/src/lib.rs
View file @
917dcb1d
...
...
@@ -41,7 +41,7 @@ use sp_runtime::{
ApplyExtrinsicResult
,
KeyTypeId
,
Perbill
,
curve
::
PiecewiseLinear
,
transaction_validity
::{
TransactionValidity
,
TransactionSource
,
TransactionPriority
},
traits
::{
BlakeTwo256
,
Block
as
BlockT
,
OpaqueKeys
,
ConvertInto
,
Identity
Lookup
,
BlakeTwo256
,
Block
as
BlockT
,
OpaqueKeys
,
ConvertInto
,
AccountId
Lookup
,
Extrinsic
as
ExtrinsicT
,
SaturatedConversion
,
Verify
,
},
};
...
...
@@ -129,7 +129,7 @@ impl frame_system::Config for Runtime {
type
Hash
=
Hash
;
type
Hashing
=
BlakeTwo256
;
type
AccountId
=
AccountId
;
type
Lookup
=
Identity
Lookup
<
Self
::
AccountId
>
;
type
Lookup
=
AccountId
Lookup
<
AccountId
,
()
>
;
type
Header
=
generic
::
Header
<
BlockNumber
,
BlakeTwo256
>
;
type
Event
=
Event
;
type
BlockHashCount
=
BlockHashCount
;
...
...
@@ -442,6 +442,7 @@ impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for R
account
:
AccountId
,
nonce
:
<
Runtime
as
frame_system
::
Config
>
::
Index
,
)
->
Option
<
(
Call
,
<
UncheckedExtrinsic
as
ExtrinsicT
>
::
SignaturePayload
)
>
{
use
sp_runtime
::
traits
::
StaticLookup
;
// take the biggest period possible.
let
period
=
BlockHashCount
::
get
()
.checked_next_power_of_two
()
...
...
@@ -470,7 +471,8 @@ impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for R
C
::
sign
(
payload
,
public
)
})
?
;
let
(
call
,
extra
,
_
)
=
raw_payload
.deconstruct
();
Some
((
call
,
(
account
,
signature
,
extra
)))
let
address
=
<
Runtime
as
frame_system
::
Config
>
::
Lookup
::
unlookup
(
account
);
Some
((
call
,
(
address
,
signature
,
extra
)))
}
}
...
...
@@ -724,7 +726,7 @@ construct_runtime! {
}
/// The address format for describing accounts.
pub
type
Address
=
AccountId
;
pub
type
Address
=
sp_runtime
::
MultiAddress
<
AccountId
,
()
>
;
/// Block header type as expected by this runtime.
pub
type
Header
=
generic
::
Header
<
BlockNumber
,
BlakeTwo256
>
;
/// Block type as expected by this runtime.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment