Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
hive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
47
Issues
47
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
hive
hive
Commits
0203e90f
Commit
0203e90f
authored
Dec 02, 2020
by
Mariusz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proposals aren't removed automatically
parent
6a69dc1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
11 deletions
+46
-11
libraries/chain/util/sps_processor.cpp
libraries/chain/util/sps_processor.cpp
+11
-1
tests/unit/tests/proposal_tests.cpp
tests/unit/tests/proposal_tests.cpp
+35
-10
No files found.
libraries/chain/util/sps_processor.cpp
View file @
0203e90f
...
...
@@ -48,7 +48,17 @@ void sps_processor::remove_proposals( const time_point_sec& head_time )
while
(
itr
!=
found
)
{
itr
=
sps_helper
::
remove_proposal
<
by_end_date
>
(
itr
,
proposalIndex
,
votesIndex
,
byVoterIdx
,
obj_perf
);
/*
It was decided that automatic removing of old proposals will be blocked.
In result it will be possible to find expired proposals, by API call `list_proposals` with `expired` flag.
Maybe in the future removing will be re-enabled.
Proposals can be removed only by explicit call of `remove_proposal_operation`.
*/
if
(
itr
->
removed
)
itr
=
sps_helper
::
remove_proposal
<
by_end_date
>
(
itr
,
proposalIndex
,
votesIndex
,
byVoterIdx
,
obj_perf
);
else
++
itr
;
if
(
obj_perf
.
done
)
break
;
}
...
...
tests/unit/tests/proposal_tests.cpp
View file @
0203e90f
...
...
@@ -770,20 +770,32 @@ BOOST_AUTO_TEST_CASE( proposals_maintenance)
BOOST_REQUIRE
(
exist_proposal
(
id_proposal_01
)
);
BOOST_REQUIRE
(
exist_proposal
(
id_proposal_02
)
);
/*
Take a look at comment in `sps_processor::remove_proposals`
*/
generate_blocks
(
start_time
+
fc
::
minutes
(
11
)
);
BOOST_REQUIRE
(
!
exist_proposal
(
id_proposal_00
)
);
//BOOST_REQUIRE( !exist_proposal( id_proposal_00 ) ); //earlier
BOOST_REQUIRE
(
exist_proposal
(
id_proposal_00
)
);
//now
BOOST_REQUIRE
(
exist_proposal
(
id_proposal_01
)
);
BOOST_REQUIRE
(
exist_proposal
(
id_proposal_02
)
);
generate_blocks
(
start_time
+
fc
::
minutes
(
21
)
);
BOOST_REQUIRE
(
!
exist_proposal
(
id_proposal_00
)
);
//BOOST_REQUIRE( !exist_proposal( id_proposal_00 ) ); //earlier
BOOST_REQUIRE
(
exist_proposal
(
id_proposal_00
)
);
//now
BOOST_REQUIRE
(
exist_proposal
(
id_proposal_01
)
);
BOOST_REQUIRE
(
!
exist_proposal
(
id_proposal_02
)
);
//BOOST_REQUIRE( !exist_proposal( id_proposal_02 ) ); //earlier
BOOST_REQUIRE
(
exist_proposal
(
id_proposal_02
)
);
//now
generate_blocks
(
start_time
+
fc
::
minutes
(
31
)
);
BOOST_REQUIRE
(
!
exist_proposal
(
id_proposal_00
)
);
BOOST_REQUIRE
(
!
exist_proposal
(
id_proposal_01
)
);
BOOST_REQUIRE
(
!
exist_proposal
(
id_proposal_02
)
);
// BOOST_REQUIRE( !exist_proposal( id_proposal_00 ) ); //earlier
// BOOST_REQUIRE( !exist_proposal( id_proposal_01 ) ); //earlier
// BOOST_REQUIRE( !exist_proposal( id_proposal_02 ) ); //earlier
BOOST_REQUIRE
(
exist_proposal
(
id_proposal_00
)
);
//now
BOOST_REQUIRE
(
exist_proposal
(
id_proposal_01
)
);
//now
BOOST_REQUIRE
(
exist_proposal
(
id_proposal_02
)
);
//now
}
validate_database
();
...
...
@@ -2209,7 +2221,11 @@ BOOST_AUTO_TEST_CASE( proposals_maintenance_01 )
current_active_proposals
-=
threshold
;
auto
found
=
calc_proposals
(
proposal_idx
,
proposals_id
);
BOOST_REQUIRE
(
current_active_proposals
==
found
);
/*
Take a look at comment in `sps_processor::remove_proposals`
*/
//BOOST_REQUIRE( current_active_proposals == found ); //earlier
BOOST_REQUIRE
(
nr_proposals
==
found
);
//now
}
BOOST_REQUIRE
(
current_active_proposals
==
0
);
...
...
@@ -2313,7 +2329,11 @@ BOOST_AUTO_TEST_CASE( proposals_maintenance_02 )
auto
found_proposals
=
calc_proposals
(
proposal_idx
,
proposals_id
);
auto
found_votes
=
calc_votes
(
proposal_vote_idx
,
proposals_id
);
BOOST_REQUIRE
(
current_active_anything
==
found_proposals
+
found_votes
);
/*
Take a look at comment in `sps_processor::remove_proposals`
*/
//BOOST_REQUIRE( current_active_anything == found_proposals + found_votes ); //earlier
BOOST_REQUIRE
(
(
current_active_proposals
+
current_active_votes
)
==
found_proposals
+
found_votes
);
//now
}
BOOST_REQUIRE
(
current_active_anything
==
0
);
...
...
@@ -3547,8 +3567,13 @@ BOOST_AUTO_TEST_CASE( proposals_removing_with_threshold_03 )
generate_blocks
(
1
);
BOOST_REQUIRE
(
calc_proposals
(
proposal_idx
,
proposals_id
)
==
0
);
BOOST_REQUIRE
(
calc_votes
(
proposal_vote_idx
,
proposals_id
)
==
0
);
/*
Take a look at comment in `sps_processor::remove_proposals`
*/
//BOOST_REQUIRE( calc_proposals( proposal_idx, proposals_id ) == 0 ); //earlier
//BOOST_REQUIRE( calc_votes( proposal_vote_idx, proposals_id ) == 0 ); //earlier
BOOST_REQUIRE
(
calc_proposals
(
proposal_idx
,
proposals_id
)
==
current_active_proposals
);
//now
BOOST_REQUIRE
(
calc_votes
(
proposal_vote_idx
,
proposals_id
)
==
current_active_votes
);
//now
int32_t
benchmark_time
=
get_time
(
*
db
,
sps_processor
::
get_removing_name
()
);
idump
(
(
benchmark_time
)
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment