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
224d6333
Verified
Commit
224d6333
authored
1 year ago
by
Loris Moulin
Browse files
Options
Downloads
Patches
Plain Diff
feat: added Serialization to ParachainConfig type with U128 replacement when needed
parent
f43816d9
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
+13
-7
13 additions, 7 deletions
crates/configuration/src/parachain.rs
with
13 additions
and
7 deletions
crates/configuration/src/parachain.rs
+
13
−
7
View file @
224d6333
use
std
::{
cell
::
RefCell
,
error
::
Error
,
fmt
::
Display
,
marker
::
PhantomData
,
rc
::
Rc
};
use
multiaddr
::
Multiaddr
;
use
serde
::
Serialize
;
use
crate
::
shared
::{
errors
::{
ConfigError
,
FieldError
},
...
...
@@ -8,26 +9,29 @@ use crate::shared::{
macros
::
states
,
node
::{
self
,
NodeConfig
,
NodeConfigBuilder
},
resources
::{
Resources
,
ResourcesBuilder
},
types
::{
Arg
,
AssetLocation
,
Chain
,
ChainDefaultContext
,
Command
,
Image
,
ValidationContext
},
types
::{
Arg
,
AssetLocation
,
Chain
,
ChainDefaultContext
,
Command
,
Image
,
ValidationContext
,
U128
,
},
};
#[derive(Debug,
Clone,
PartialEq)]
#[derive(Debug,
Clone,
PartialEq
,
Serialize
)]
pub
enum
RegistrationStrategy
{
InGenesis
,
UsingExtrinsic
,
}
/// A parachain configuration, composed of collators and fine-grained configuration options.
#[derive(Debug,
Clone,
PartialEq)]
#[derive(Debug,
Clone,
PartialEq
,
Serialize
)]
pub
struct
ParachainConfig
{
id
:
u32
,
chain
:
Option
<
Chain
>
,
registration_strategy
:
Option
<
RegistrationStrategy
>
,
initial_balance
:
u
128
,
initial_balance
:
U
128
,
default_command
:
Option
<
Command
>
,
default_image
:
Option
<
Image
>
,
default_resources
:
Option
<
Resources
>
,
default_db_snapshot
:
Option
<
AssetLocation
>
,
#[serde(skip_serializing_if
=
"std::vec::Vec::is_empty"
)]
default_args
:
Vec
<
Arg
>
,
genesis_wasm_path
:
Option
<
AssetLocation
>
,
genesis_wasm_generator
:
Option
<
Command
>
,
...
...
@@ -35,7 +39,9 @@ pub struct ParachainConfig {
genesis_state_generator
:
Option
<
Command
>
,
chain_spec_path
:
Option
<
AssetLocation
>
,
is_cumulus_based
:
bool
,
#[serde(skip_serializing_if
=
"std::vec::Vec::is_empty"
)]
bootnodes_addresses
:
Vec
<
Multiaddr
>
,
#[serde(skip_serializing_if
=
"std::vec::Vec::is_empty"
)]
collators
:
Vec
<
NodeConfig
>
,
}
...
...
@@ -57,7 +63,7 @@ impl ParachainConfig {
/// The initial balance of the parachain account.
pub
fn
initial_balance
(
&
self
)
->
u128
{
self
.initial_balance
self
.initial_balance
.0
}
/// The default command used for collators.
...
...
@@ -148,7 +154,7 @@ impl Default for ParachainConfigBuilder<Initial> {
id
:
100
,
chain
:
None
,
registration_strategy
:
Some
(
RegistrationStrategy
::
InGenesis
),
initial_balance
:
2_000_000_000_000
,
initial_balance
:
2_000_000_000_000
.into
()
,
default_command
:
None
,
default_image
:
None
,
default_resources
:
None
,
...
...
@@ -257,7 +263,7 @@ impl ParachainConfigBuilder<WithId> {
pub
fn
with_initial_balance
(
self
,
initial_balance
:
u128
)
->
Self
{
Self
::
transition
(
ParachainConfig
{
initial_balance
,
initial_balance
:
initial_balance
.into
()
,
..
self
.config
},
self
.validation_context
,
...
...
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