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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
c4bedc5f
Commit
c4bedc5f
authored
1 year ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
WIP: test pass
parent
373c1ce8
No related branches found
No related tags found
No related merge requests found
Pipeline
#35804
failed
1 year ago
Stage: labels
Stage: quality
Stage: build
Stage: tests
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pallets/duniter-account/src/lib.rs
+1
-3
1 addition, 3 deletions
pallets/duniter-account/src/lib.rs
runtime/gdev/tests/integration_tests.rs
+13
-24
13 additions, 24 deletions
runtime/gdev/tests/integration_tests.rs
with
14 additions
and
27 deletions
pallets/duniter-account/src/lib.rs
+
1
−
3
View file @
c4bedc5f
...
...
@@ -248,8 +248,7 @@ pub mod pallet {
if
account_data
.free
>=
T
::
ExistentialDeposit
::
get
()
+
price
{
// The account can pay the new account price, we should:
// 1. Withdraw the "new account price" amount
// TODO: supprimer 2. Increment consumers to prevent the destruction of the account before the random id is assigned
// 3. Manage the funds collected
// 2. Manage the funds collected
let
res
=
<
pallet_balances
::
Pallet
<
T
>
as
Currency
<
T
::
AccountId
>>
::
withdraw
(
&
account_id
,
price
,
...
...
@@ -261,7 +260,6 @@ pub mod pallet {
"Cannot fail because we checked that the free balance was sufficient"
);
if
let
Ok
(
imbalance
)
=
res
{
// TODO: decrement consumers?
T
::
OnUnbalanced
::
on_unbalanced
(
imbalance
);
total_weight
+=
<
T
as
pallet
::
Config
>
::
WeightInfo
::
on_initialize_with_balance
(
...
...
This diff is collapsed.
Click to expand it.
runtime/gdev/tests/integration_tests.rs
+
13
−
24
View file @
c4bedc5f
...
...
@@ -1034,36 +1034,25 @@ fn test_create_new_account() {
// 100 initial + 300 deposit
assert_eq!
(
Balances
::
free_balance
(
Treasury
::
account_id
()),
400
);
// TODO: yes we can: We can't remove the account until the random id is assigned
run_to_block
(
4
);
// can not remove using transfer
assert_noop!
(
Balances
::
transfer
(
// can remove an account using transfer
assert_ok!
(
Balances
::
transfer
(
frame_system
::
RawOrigin
::
Signed
(
AccountKeyring
::
Eve
.to_account_id
())
.into
(),
MultiAddress
::
Id
(
AccountKeyring
::
Alice
.to_account_id
()),
200
),
sp_runtime
::
DispatchError
::
ConsumerRemaining
,
);
));
// Account reaped
assert_eq!
(
Balances
::
free_balance
(
AccountKeyring
::
Eve
.to_account_id
()),
200
);
// can not remove using transfer_all either
assert_noop!
(
Balances
::
transfer_all
(
frame_system
::
RawOrigin
::
Signed
(
AccountKeyring
::
Eve
.to_account_id
())
.into
(),
MultiAddress
::
Id
(
AccountKeyring
::
Alice
.to_account_id
()),
false
),
sp_runtime
::
DispatchError
::
ConsumerRemaining
,
0
);
// Transfer failed, so free_balance remains the same
assert_eq!
(
Balances
::
free_balance
(
AccountKeyring
::
Eve
.to_account_id
()),
200
frame_system
::
Pallet
::
<
Runtime
>
::
get
(
&
AccountKeyring
::
Eve
.to_account_id
()),
pallet_duniter_account
::
AccountData
::
default
()
);
// TODO detail account removal
System
::
assert_has_event
(
RuntimeEvent
::
System
(
frame_system
::
Event
::
KilledAccount
{
account
:
AccountKeyring
::
Eve
.to_account_id
(),
}));
});
}
...
...
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