Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zombienet-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
parity
Mirrored projects
zombienet-sdk
Commits
6ac956e9
Verified
Commit
6ac956e9
authored
1 year ago
by
Loris Moulin
Browse files
Options
Downloads
Patches
Plain Diff
feat: replaced boxed errors in ParachainConfigBuilder with anyhow
parent
2fe8efa4
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
crates/configuration/src/parachain.rs
+19
-13
19 additions, 13 deletions
crates/configuration/src/parachain.rs
with
19 additions
and
13 deletions
crates/configuration/src/parachain.rs
+
19
−
13
View file @
6ac956e9
...
...
@@ -115,7 +115,7 @@ states! {
#[derive(Debug)]
pub
struct
ParachainConfigBuilder
<
S
>
{
config
:
ParachainConfig
,
errors
:
Vec
<
Box
<
dyn
Error
>
>
,
errors
:
Vec
<
anyhow
::
Error
>
,
_state
:
PhantomData
<
S
>
,
}
...
...
@@ -145,7 +145,7 @@ impl Default for ParachainConfigBuilder<Initial> {
impl
<
A
>
ParachainConfigBuilder
<
A
>
{
fn
transition
<
B
>
(
config
:
ParachainConfig
,
errors
:
Vec
<
Box
<
dyn
Error
>
>
,
errors
:
Vec
<
anyhow
::
Error
>
,
)
->
ParachainConfigBuilder
<
B
>
{
ParachainConfigBuilder
{
config
,
...
...
@@ -196,7 +196,7 @@ impl ParachainConfigBuilder<WithAtLeastOneCollator> {
pub
fn
with_chain
<
T
>
(
self
,
chain
:
T
)
->
Self
where
T
:
TryInto
<
Chain
>
,
T
::
Error
:
Error
+
'static
,
T
::
Error
:
Error
+
Send
+
Sync
+
'static
,
{
match
chain
.try_into
()
{
Ok
(
chain
)
=>
Self
::
transition
(
...
...
@@ -208,7 +208,7 @@ impl ParachainConfigBuilder<WithAtLeastOneCollator> {
),
Err
(
error
)
=>
Self
::
transition
(
self
.config
,
merge_errors
(
self
.errors
,
FieldError
::
Chain
(
error
)
.into
()),
merge_errors
(
self
.errors
,
FieldError
::
Chain
(
error
.into
()
)
.into
()),
),
}
}
...
...
@@ -246,7 +246,7 @@ impl ParachainConfigBuilder<WithAtLeastOneCollator> {
pub
fn
with_genesis_wasm_generator
<
T
>
(
self
,
command
:
T
)
->
Self
where
T
:
TryInto
<
Command
>
,
T
::
Error
:
Error
+
'static
,
T
::
Error
:
Error
+
Send
+
Sync
+
'static
,
{
match
command
.try_into
()
{
Ok
(
command
)
=>
Self
::
transition
(
...
...
@@ -258,7 +258,10 @@ impl ParachainConfigBuilder<WithAtLeastOneCollator> {
),
Err
(
error
)
=>
Self
::
transition
(
self
.config
,
merge_errors
(
self
.errors
,
FieldError
::
GenesisWasmGenerator
(
error
)
.into
()),
merge_errors
(
self
.errors
,
FieldError
::
GenesisWasmGenerator
(
error
.into
())
.into
(),
),
),
}
}
...
...
@@ -276,7 +279,7 @@ impl ParachainConfigBuilder<WithAtLeastOneCollator> {
pub
fn
with_genesis_state_generator
<
T
>
(
self
,
command
:
T
)
->
Self
where
T
:
TryInto
<
Command
>
,
T
::
Error
:
Error
+
'static
,
T
::
Error
:
Error
+
Send
+
Sync
+
'static
,
{
match
command
.try_into
()
{
Ok
(
command
)
=>
Self
::
transition
(
...
...
@@ -288,7 +291,10 @@ impl ParachainConfigBuilder<WithAtLeastOneCollator> {
),
Err
(
error
)
=>
Self
::
transition
(
self
.config
,
merge_errors
(
self
.errors
,
FieldError
::
GenesisStateGenerator
(
error
)
.into
()),
merge_errors
(
self
.errors
,
FieldError
::
GenesisStateGenerator
(
error
.into
())
.into
(),
),
),
}
}
...
...
@@ -316,7 +322,7 @@ impl ParachainConfigBuilder<WithAtLeastOneCollator> {
pub
fn
with_bootnodes_addresses
<
T
>
(
self
,
bootnodes_addresses
:
Vec
<
T
>
)
->
Self
where
T
:
TryInto
<
Multiaddr
>
+
ToString
+
Copy
,
T
::
Error
:
Error
+
'static
,
T
::
Error
:
Error
+
Send
+
Sync
+
'static
,
{
let
mut
addrs
=
vec!
[];
let
mut
errors
=
vec!
[];
...
...
@@ -324,9 +330,9 @@ impl ParachainConfigBuilder<WithAtLeastOneCollator> {
for
(
index
,
addr
)
in
bootnodes_addresses
.into_iter
()
.enumerate
()
{
match
addr
.try_into
()
{
Ok
(
addr
)
=>
addrs
.push
(
addr
),
Err
(
error
)
=>
{
errors
.push
(
FieldError
::
BootnodesAddress
(
index
,
addr
.to_string
(),
error
)
.into
()
)
}
,
Err
(
error
)
=>
errors
.push
(
FieldError
::
BootnodesAddress
(
index
,
addr
.to_string
(),
error
.into
()
)
.into
()
,
)
,
}
}
...
...
@@ -364,7 +370,7 @@ impl ParachainConfigBuilder<WithAtLeastOneCollator> {
}
}
pub
fn
build
(
self
)
->
Result
<
ParachainConfig
,
(
ParaId
,
Vec
<
Box
<
dyn
Error
>
>
)
>
{
pub
fn
build
(
self
)
->
Result
<
ParachainConfig
,
(
ParaId
,
Vec
<
anyhow
::
Error
>
)
>
{
if
!
self
.errors
.is_empty
()
{
return
Err
((
self
.config.id
,
self
.errors
));
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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