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
9f1450f8
Commit
9f1450f8
authored
1 year ago
by
bgallois
Committed by
Hugo Trentesaux
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
remove unused type
parent
b5c84371
No related branches found
No related tags found
1 merge request
!256
Refactor node implementation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
node/src/command.rs
+1
-8
1 addition, 8 deletions
node/src/command.rs
node/src/service/client.rs
+33
-25
33 additions, 25 deletions
node/src/service/client.rs
with
34 additions
and
33 deletions
node/src/command.rs
+
1
−
8
View file @
9f1450f8
...
@@ -51,14 +51,7 @@ macro_rules! unwrap_client {
...
@@ -51,14 +51,7 @@ macro_rules! unwrap_client {
$code:expr
$code:expr
)
=>
{
)
=>
{
match
$client
.as_ref
()
{
match
$client
.as_ref
()
{
#[cfg(feature
=
"g1"
)]
crate
::
service
::
client
::
Client
::
Client
(
$client
)
=>
$code
,
crate
::
service
::
client
::
Client
::
G1
(
$client
)
=>
$code
,
#[cfg(feature
=
"gtest"
)]
crate
::
service
::
client
::
Client
::
GTest
(
$client
)
=>
$code
,
#[cfg(feature
=
"gdev"
)]
crate
::
service
::
client
::
Client
::
GDev
(
$client
)
=>
$code
,
#[allow(unreachable_patterns)]
_
=>
panic!
(
"unknown runtime"
),
}
}
};
};
}
}
...
...
This diff is collapsed.
Click to expand it.
node/src/service/client.rs
+
33
−
25
View file @
9f1450f8
...
@@ -294,23 +294,28 @@ trait BenchmarkCallSigner<RuntimeCall: Encode + Clone, Signer: Pair> {
...
@@ -294,23 +294,28 @@ trait BenchmarkCallSigner<RuntimeCall: Encode + Clone, Signer: Pair> {
}
}
#[cfg(feature
=
"g1"
)]
#[cfg(feature
=
"g1"
)]
use
g1_runtime
as
runtime
;
type
FullClient
=
super
::
FullClient
<
#[cfg(feature
=
"g1"
)]
super
::
runtime_executor
::
runtime
::
RuntimeApi
,
type
FullClient
=
super
::
FullClient
<
runtime
::
RuntimeApi
,
super
::
runtime_executor
::
Executor
>
;
super
::
runtime_executor
::
Executor
,
#[cfg(feature
=
"gdev"
)]
>
;
use
gdev_runtime
as
runtime
;
#[cfg(feature
=
"gdev"
)]
#[cfg(feature
=
"gdev"
)]
type
FullClient
=
super
::
FullClient
<
runtime
::
RuntimeApi
,
super
::
runtime_executor
::
Executor
>
;
type
FullClient
=
super
::
FullClient
<
super
::
runtime_executor
::
runtime
::
RuntimeApi
,
super
::
runtime_executor
::
Executor
,
>
;
#[cfg(feature
=
"gtest"
)]
#[cfg(feature
=
"gtest"
)]
use
gtest_runtime
as
runtime
;
type
FullClient
=
super
::
FullClient
<
#[cfg(feature
=
"gtest"
)]
super
::
runtime_executor
::
runtime
::
RuntimeApi
,
type
FullClient
=
super
::
FullClient
<
runtime
::
RuntimeApi
,
super
::
runtime_executor
::
Executor
>
;
super
::
runtime_executor
::
Executor
,
>
;
#[cfg(any(feature
=
"gdev"
,
feature
=
"gtest"
,
feature
=
"g1"
))]
#[cfg(any(feature
=
"gdev"
,
feature
=
"gtest"
,
feature
=
"g1"
))]
impl
BenchmarkCallSigner
<
runtime
::
RuntimeCall
,
sp_core
::
sr25519
::
Pair
>
for
FullClient
{
impl
BenchmarkCallSigner
<
super
::
runtime_executor
::
runtime
::
RuntimeCall
,
sp_core
::
sr25519
::
Pair
>
for
FullClient
{
fn
sign_call
(
fn
sign_call
(
&
self
,
&
self
,
call
:
runtime
::
RuntimeCall
,
call
:
super
::
runtime_executor
::
runtime
::
RuntimeCall
,
nonce
:
u32
,
nonce
:
u32
,
current_block
:
u64
,
current_block
:
u64
,
period
:
u64
,
period
:
u64
,
...
@@ -319,17 +324,20 @@ impl BenchmarkCallSigner<runtime::RuntimeCall, sp_core::sr25519::Pair> for FullC
...
@@ -319,17 +324,20 @@ impl BenchmarkCallSigner<runtime::RuntimeCall, sp_core::sr25519::Pair> for FullC
)
->
sp_runtime
::
OpaqueExtrinsic
{
)
->
sp_runtime
::
OpaqueExtrinsic
{
// use runtime;
// use runtime;
let
extra
:
runtime
::
SignedExtra
=
(
let
extra
:
super
::
runtime_executor
::
runtime
::
SignedExtra
=
(
frame_system
::
CheckNonZeroSender
::
<
runtime
::
Runtime
>
::
new
(),
frame_system
::
CheckNonZeroSender
::
<
super
::
runtime_executor
::
runtime
::
Runtime
>
::
new
(),
frame_system
::
CheckSpecVersion
::
<
runtime
::
Runtime
>
::
new
(),
frame_system
::
CheckSpecVersion
::
<
super
::
runtime_executor
::
runtime
::
Runtime
>
::
new
(),
frame_system
::
CheckTxVersion
::
<
runtime
::
Runtime
>
::
new
(),
frame_system
::
CheckTxVersion
::
<
super
::
runtime_executor
::
runtime
::
Runtime
>
::
new
(),
frame_system
::
CheckGenesis
::
<
runtime
::
Runtime
>
::
new
(),
frame_system
::
CheckGenesis
::
<
super
::
runtime_executor
::
runtime
::
Runtime
>
::
new
(),
frame_system
::
CheckMortality
::
<
runtime
::
Runtime
>
::
from
(
frame_system
::
CheckMortality
::
<
super
::
runtime_executor
::
runtime
::
Runtime
>
::
from
(
sp_runtime
::
generic
::
Era
::
mortal
(
period
,
current_block
),
sp_runtime
::
generic
::
Era
::
mortal
(
period
,
current_block
),
),
),
frame_system
::
CheckNonce
::
<
runtime
::
Runtime
>
::
from
(
nonce
)
.into
(),
frame_system
::
CheckNonce
::
<
super
::
runtime_executor
::
runtime
::
Runtime
>
::
from
(
nonce
)
frame_system
::
CheckWeight
::
<
runtime
::
Runtime
>
::
new
(),
.into
(),
pallet_transaction_payment
::
ChargeTransactionPayment
::
<
runtime
::
Runtime
>
::
from
(
0
),
frame_system
::
CheckWeight
::
<
super
::
runtime_executor
::
runtime
::
Runtime
>
::
new
(),
pallet_transaction_payment
::
ChargeTransactionPayment
::
<
super
::
runtime_executor
::
runtime
::
Runtime
,
>
::
from
(
0
),
);
);
let
payload
=
sp_runtime
::
generic
::
SignedPayload
::
from_raw
(
let
payload
=
sp_runtime
::
generic
::
SignedPayload
::
from_raw
(
...
@@ -337,8 +345,8 @@ impl BenchmarkCallSigner<runtime::RuntimeCall, sp_core::sr25519::Pair> for FullC
...
@@ -337,8 +345,8 @@ impl BenchmarkCallSigner<runtime::RuntimeCall, sp_core::sr25519::Pair> for FullC
extra
.clone
(),
extra
.clone
(),
(
(
(),
(),
runtime
::
VERSION
.spec_version
,
super
::
runtime_executor
::
runtime
::
VERSION
.spec_version
,
runtime
::
VERSION
.transaction_version
,
super
::
runtime_executor
::
runtime
::
VERSION
.transaction_version
,
genesis
,
genesis
,
genesis
,
genesis
,
(),
(),
...
@@ -348,7 +356,7 @@ impl BenchmarkCallSigner<runtime::RuntimeCall, sp_core::sr25519::Pair> for FullC
...
@@ -348,7 +356,7 @@ impl BenchmarkCallSigner<runtime::RuntimeCall, sp_core::sr25519::Pair> for FullC
);
);
let
signature
=
payload
.using_encoded
(|
p
|
acc
.sign
(
p
));
let
signature
=
payload
.using_encoded
(|
p
|
acc
.sign
(
p
));
runtime
::
UncheckedExtrinsic
::
new_signed
(
super
::
runtime_executor
::
runtime
::
UncheckedExtrinsic
::
new_signed
(
call
,
call
,
sp_runtime
::
AccountId32
::
from
(
acc
.public
())
.into
(),
sp_runtime
::
AccountId32
::
from
(
acc
.public
())
.into
(),
common_runtime
::
Signature
::
Sr25519
(
signature
),
common_runtime
::
Signature
::
Sr25519
(
signature
),
...
@@ -370,10 +378,10 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for Client {
...
@@ -370,10 +378,10 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for Client {
fn
build
(
&
self
,
nonce
:
u32
)
->
std
::
result
::
Result
<
sp_runtime
::
OpaqueExtrinsic
,
&
'static
str
>
{
fn
build
(
&
self
,
nonce
:
u32
)
->
std
::
result
::
Result
<
sp_runtime
::
OpaqueExtrinsic
,
&
'static
str
>
{
with_client!
{
with_client!
{
self
,
client
,
{
self
,
client
,
{
let
call
=
runtime
::
RuntimeCall
::
System
(
runtime
::
SystemCall
::
remark
{
remark
:
vec!
[]
});
let
call
=
super
::
runtime_executor
::
runtime
::
RuntimeCall
::
System
(
super
::
runtime_executor
::
runtime
::
SystemCall
::
remark
{
remark
:
vec!
[]
});
let
signer
=
sp_keyring
::
Sr25519Keyring
::
Bob
.pair
();
let
signer
=
sp_keyring
::
Sr25519Keyring
::
Bob
.pair
();
let
period
=
runtime
::
BlockHashCount
::
get
()
.checked_next_power_of_two
()
.map
(|
c
|
c
/
2
)
.unwrap_or
(
2
)
as
u64
;
let
period
=
super
::
runtime_executor
::
runtime
::
BlockHashCount
::
get
()
.checked_next_power_of_two
()
.map
(|
c
|
c
/
2
)
.unwrap_or
(
2
)
as
u64
;
let
genesis
=
client
.usage_info
()
.chain.best_hash
;
let
genesis
=
client
.usage_info
()
.chain.best_hash
;
Ok
(
client
.sign_call
(
call
,
nonce
,
0
,
period
,
genesis
,
signer
))
Ok
(
client
.sign_call
(
call
,
nonce
,
0
,
period
,
genesis
,
signer
))
...
...
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