Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
874fb2a7
Unverified
Commit
874fb2a7
authored
3 months ago
by
bgallois
Browse files
Options
Downloads
Patches
Plain Diff
formatting
parent
b9bda4f6
No related branches found
No related tags found
1 merge request
!312
Upgrade polkadot v1.17.0
Pipeline
#39704
passed
3 months ago
Stage: labels
Stage: quality
Stage: build
Stage: tests
Stage: deploy
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
runtime/common/src/apis.rs
+294
-296
294 additions, 296 deletions
runtime/common/src/apis.rs
with
294 additions
and
296 deletions
runtime/common/src/apis.rs
+
294
−
296
View file @
874fb2a7
...
@@ -14,9 +14,12 @@
...
@@ -14,9 +14,12 @@
// You should have received a copy of the GNU Affero General Public License
// You should have received a copy of the GNU Affero General Public License
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
// This file is not formatted automatically due to the nested macro definition.
// It can be formatted by commenting out the last line, the first five lines,
// and then running `rustfmt` on `runtime/common/src/apis.rs`.
#[macro_export]
#[macro_export]
macro_rules!
runtime_apis
{
macro_rules!
runtime_apis
{
{
$
(
$custom:tt
)
*
}
=>
{
(
$
(
$custom:tt
)
*
)
=>
{
impl_runtime_apis!
{
impl_runtime_apis!
{
$
(
$custom
)
*
$
(
$custom
)
*
...
@@ -73,10 +76,7 @@ macro_rules! runtime_apis {
...
@@ -73,10 +76,7 @@ macro_rules! runtime_apis {
)
->
Option
<
()
>
{
)
->
Option
<
()
>
{
let
key_owner_proof
=
key_owner_proof
.decode
()
?
;
let
key_owner_proof
=
key_owner_proof
.decode
()
?
;
Babe
::
submit_unsigned_equivocation_report
(
Babe
::
submit_unsigned_equivocation_report
(
equivocation_proof
,
key_owner_proof
)
equivocation_proof
,
key_owner_proof
,
)
}
}
}
}
...
@@ -98,9 +98,11 @@ macro_rules! runtime_apis {
...
@@ -98,9 +98,11 @@ macro_rules! runtime_apis {
fn
metadata
()
->
OpaqueMetadata
{
fn
metadata
()
->
OpaqueMetadata
{
OpaqueMetadata
::
new
(
Runtime
::
metadata
()
.into
())
OpaqueMetadata
::
new
(
Runtime
::
metadata
()
.into
())
}
}
fn
metadata_at_version
(
version
:
u32
)
->
Option
<
OpaqueMetadata
>
{
fn
metadata_at_version
(
version
:
u32
)
->
Option
<
OpaqueMetadata
>
{
Runtime
::
metadata_at_version
(
version
)
Runtime
::
metadata_at_version
(
version
)
}
}
fn
metadata_versions
()
->
Vec
<
u32
>
{
fn
metadata_versions
()
->
Vec
<
u32
>
{
Runtime
::
metadata_versions
()
Runtime
::
metadata_versions
()
}
}
...
@@ -115,9 +117,7 @@ macro_rules! runtime_apis {
...
@@ -115,9 +117,7 @@ macro_rules! runtime_apis {
Executive
::
finalize_block
()
Executive
::
finalize_block
()
}
}
fn
inherent_extrinsics
(
fn
inherent_extrinsics
(
data
:
sp_inherents
::
InherentData
)
->
Vec
<<
Block
as
BlockT
>
::
Extrinsic
>
{
data
:
sp_inherents
::
InherentData
,
)
->
Vec
<<
Block
as
BlockT
>
::
Extrinsic
>
{
data
.create_extrinsics
()
data
.create_extrinsics
()
}
}
...
@@ -136,8 +136,7 @@ macro_rules! runtime_apis {
...
@@ -136,8 +136,7 @@ macro_rules! runtime_apis {
block_hash
:
<
Block
as
BlockT
>
::
Hash
,
block_hash
:
<
Block
as
BlockT
>
::
Hash
,
)
->
TransactionValidity
{
)
->
TransactionValidity
{
// Filtered calls should not enter the tx pool.
// Filtered calls should not enter the tx pool.
if
!<
Runtime
as
frame_system
::
Config
>
::
BaseCallFilter
::
contains
(
&
tx
.function
)
if
!<
Runtime
as
frame_system
::
Config
>
::
BaseCallFilter
::
contains
(
&
tx
.function
)
{
{
return
sp_runtime
::
transaction_validity
::
InvalidTransaction
::
Call
.into
();
return
sp_runtime
::
transaction_validity
::
InvalidTransaction
::
Call
.into
();
}
}
Executive
::
validate_transaction
(
source
,
tx
,
block_hash
)
Executive
::
validate_transaction
(
source
,
tx
,
block_hash
)
...
@@ -151,9 +150,7 @@ macro_rules! runtime_apis {
...
@@ -151,9 +150,7 @@ macro_rules! runtime_apis {
}
}
impl
sp_session
::
SessionKeys
<
Block
>
for
Runtime
{
impl
sp_session
::
SessionKeys
<
Block
>
for
Runtime
{
fn
decode_session_keys
(
fn
decode_session_keys
(
encoded
:
Vec
<
u8
>
)
->
Option
<
Vec
<
(
Vec
<
u8
>
,
KeyTypeId
)
>>
{
encoded
:
Vec
<
u8
>
,
)
->
Option
<
Vec
<
(
Vec
<
u8
>
,
KeyTypeId
)
>>
{
opaque
::
SessionKeys
::
decode_into_raw_public_keys
(
&
encoded
)
opaque
::
SessionKeys
::
decode_into_raw_public_keys
(
&
encoded
)
}
}
...
@@ -198,8 +195,7 @@ macro_rules! runtime_apis {
...
@@ -198,8 +195,7 @@ macro_rules! runtime_apis {
}
}
}
}
impl
pallet_transaction_payment_rpc_runtime_api
::
TransactionPaymentApi
<
Block
,
Balance
>
impl
pallet_transaction_payment_rpc_runtime_api
::
TransactionPaymentApi
<
Block
,
Balance
>
for
Runtime
{
for
Runtime
{
fn
query_info
(
fn
query_info
(
uxt
:
<
Block
as
BlockT
>
::
Extrinsic
,
uxt
:
<
Block
as
BlockT
>
::
Extrinsic
,
len
:
u32
,
len
:
u32
,
...
@@ -213,9 +209,11 @@ macro_rules! runtime_apis {
...
@@ -213,9 +209,11 @@ macro_rules! runtime_apis {
)
->
pallet_transaction_payment
::
FeeDetails
<
Balance
>
{
)
->
pallet_transaction_payment
::
FeeDetails
<
Balance
>
{
TransactionPayment
::
query_fee_details
(
uxt
,
len
)
TransactionPayment
::
query_fee_details
(
uxt
,
len
)
}
}
fn
query_weight_to_fee
(
weight
:
Weight
)
->
Balance
{
fn
query_weight_to_fee
(
weight
:
Weight
)
->
Balance
{
TransactionPayment
::
weight_to_fee
(
weight
)
TransactionPayment
::
weight_to_fee
(
weight
)
}
}
fn
query_length_to_fee
(
length
:
u32
)
->
Balance
{
fn
query_length_to_fee
(
length
:
u32
)
->
Balance
{
TransactionPayment
::
length_to_fee
(
length
)
TransactionPayment
::
length_to_fee
(
length
)
}
}
...
@@ -247,44 +245,44 @@ macro_rules! runtime_apis {
...
@@ -247,44 +245,44 @@ macro_rules! runtime_apis {
signature_check
:
bool
,
signature_check
:
bool
,
select
:
frame_try_runtime
::
TryStateSelect
,
select
:
frame_try_runtime
::
TryStateSelect
,
)
->
Weight
{
)
->
Weight
{
Executive
::
try_execute_block
(
block
,
state_root_check
,
signature_check
,
select
)
.expect
(
"execute-block failed"
)
Executive
::
try_execute_block
(
block
,
state_root_check
,
signature_check
,
select
)
.expect
(
"execute-block failed"
)
}
}
}
}
#[cfg(feature
=
"runtime-benchmarks"
)]
#[cfg(feature
=
"runtime-benchmarks"
)]
impl
frame_benchmarking
::
Benchmark
<
Block
>
for
Runtime
{
impl
frame_benchmarking
::
Benchmark
<
Block
>
for
Runtime
{
fn
benchmark_metadata
(
extra
:
bool
)
->
(
fn
benchmark_metadata
(
extra
:
bool
,
)
->
(
Vec
<
frame_benchmarking
::
BenchmarkList
>
,
Vec
<
frame_benchmarking
::
BenchmarkList
>
,
Vec
<
frame_support
::
traits
::
StorageInfo
>
,
Vec
<
frame_support
::
traits
::
StorageInfo
>
,
)
{
)
{
use
frame_benchmarking
::{
list_benchmark
,
Benchmark
ing
,
Benchmark
List
};
use
frame_benchmarking
::{
list_benchmark
,
Benchmark
List
,
Benchmark
ing
};
use
frame_support
::
traits
::
StorageInfoTrait
;
use
frame_support
::
traits
::
StorageInfoTrait
;
use
pallet_session_benchmarking
::
Pallet
as
SessionBench
;
use
frame_system_benchmarking
::
Pallet
as
SystemBench
;
use
frame_system_benchmarking
::
extensions
::
Pallet
as
SystemExtensionsBench
;
use
frame_benchmarking
::
baseline
::
Pallet
as
Baseline
;
use
frame_benchmarking
::
baseline
::
Pallet
as
Baseline
;
use
frame_system_benchmarking
::{
extensions
::
Pallet
as
SystemExtensionsBench
,
Pallet
as
SystemBench
,
};
use
pallet_session_benchmarking
::
Pallet
as
SessionBench
;
let
mut
list
=
Vec
::
<
BenchmarkList
>
::
new
();
let
mut
list
=
Vec
::
<
BenchmarkList
>
::
new
();
list_benchmarks!
(
list
,
extra
);
list_benchmarks!
(
list
,
extra
);
let
storage_info
=
AllPalletsWithSystem
::
storage_info
();
let
storage_info
=
AllPalletsWithSystem
::
storage_info
();
return
(
list
,
storage_info
)
return
(
list
,
storage_info
)
;
}
}
fn
dispatch_benchmark
(
fn
dispatch_benchmark
(
config
:
frame_benchmarking
::
BenchmarkConfig
config
:
frame_benchmarking
::
BenchmarkConfig
,
)
->
Result
<
)
->
Result
<
Vec
<
frame_benchmarking
::
BenchmarkBatch
>
,
scale_info
::
prelude
::
string
::
String
>
{
Vec
<
frame_benchmarking
::
BenchmarkBatch
>
,
use
frame_benchmarking
::{
baseline
::
Pallet
as
Baseline
,
BenchmarkBatch
,
Benchmarking
};
scale_info
::
prelude
::
string
::
String
,
use
frame_support
::
traits
::{
TrackedStorageKey
,
WhitelistedStorageKeys
};
>
{
use
frame_system_benchmarking
::{
use
frame_benchmarking
::{
Benchmarking
,
BenchmarkBatch
};
extensions
::
Pallet
as
SystemExtensionsBench
,
Pallet
as
SystemBench
,
use
frame_support
::
traits
::
TrackedStorageKey
;
};
use
frame_support
::
traits
::
WhitelistedStorageKeys
;
use
pallet_session_benchmarking
::
Pallet
as
SessionBench
;
use
pallet_session_benchmarking
::
Pallet
as
SessionBench
;
use
frame_system_benchmarking
::
Pallet
as
SystemBench
;
use
frame_system_benchmarking
::
extensions
::
Pallet
as
SystemExtensionsBench
;
use
frame_benchmarking
::
baseline
::
Pallet
as
Baseline
;
impl
pallet_session_benchmarking
::
Config
for
Runtime
{}
impl
pallet_session_benchmarking
::
Config
for
Runtime
{}
impl
frame_system_benchmarking
::
Config
for
Runtime
{}
impl
frame_system_benchmarking
::
Config
for
Runtime
{}
...
@@ -310,10 +308,10 @@ let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storag
...
@@ -310,10 +308,10 @@ let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storag
let
params
=
(
&
config
,
&
whitelist
);
let
params
=
(
&
config
,
&
whitelist
);
add_benchmarks!
(
params
,
batches
);
add_benchmarks!
(
params
,
batches
);
if
batches
.is_empty
()
{
return
Err
(
"Benchmark not found for this pallet."
.into
())
}
if
batches
.is_empty
()
{
Ok
(
batches
)
return
Err
(
"Benchmark not found for this pallet."
.into
());
}
}
}
Ok
(
batches
)
}
}
};
}
}
}};}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment