Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove member tables from whitelist #1041

Merged
merged 2 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 12 additions & 28 deletions src/node/rpc/test/member_voting_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,11 +832,11 @@ DOCTEST_TEST_CASE("Propose raw writes")
GenesisGenerator gen(network, gen_tx);
gen.init_values();
StubNodeState node;
// manually add a member in state active (not recommended)
const Cert member_cert = {1, 2, 3};
nlohmann::json params;
params["cert"] = member_cert;
params["keyshare"] = dummy_key_share;
nlohmann::json recovery_threshold = 4;

Store::Tx tx_before;
auto configuration = tx_before.get_view(network.config)->get(0);
DOCTEST_REQUIRE_FALSE(configuration.has_value());

const auto expected_state =
should_succeed ? ProposalState::ACCEPTED : ProposalState::OPEN;
Expand All @@ -845,39 +845,23 @@ DOCTEST_TEST_CASE("Propose raw writes")
gen,
node,
{R"xxx(
local tables, param = ...
local STATE_ACTIVE = "ACTIVE"
local NEXT_MEMBER_ID_VALUE = 0
local tables, recovery_threshold = ...
local p = Puts:new()
-- get id
local member_id = tables["ccf.values"]:get(NEXT_MEMBER_ID_VALUE)
-- increment id
p:put("ccf.values", NEXT_MEMBER_ID_VALUE, member_id + 1)
-- write member info and status
p:put("ccf.members", member_id, {cert = param.cert, keyshare = param.keyshare, status = STATE_ACTIVE})
p:put("ccf.member_certs", param.cert, member_id)
p:put("ccf.config", 0, {recovery_threshold = recovery_threshold})
return Calls:call("raw_puts", p)
)xxx"s,
params},
4},
n_members,
pro_votes);
DOCTEST_CHECK(proposal_info.state == expected_state);
if (!should_succeed)
continue;

// check results
Store::Tx tx;
const auto next_mid =
tx.get_view(network.values)->get(ValueIds::NEXT_MEMBER_ID);
DOCTEST_CHECK(next_mid);
DOCTEST_CHECK(*next_mid == n_members + 1);
const auto m = tx.get_view(network.members)->get(n_members);
DOCTEST_CHECK(m);
DOCTEST_CHECK(m->status == MemberStatus::ACTIVE);
const auto member_id =
tx.get_view(network.member_certs)->get(member_cert);
DOCTEST_CHECK(member_id);
DOCTEST_CHECK(*member_id == n_members);
Store::Tx tx_after;
configuration = tx_after.get_view(network.config)->get(0);
DOCTEST_CHECK(configuration.has_value());
DOCTEST_CHECK(configuration->recovery_threshold == recovery_threshold);
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/runtime_config/default_whitelists.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ namespace ccf
{MEMBER_CAN_PROPOSE,
{Tables::USERS,
Tables::USER_CERTS,
Tables::MEMBERS,
Tables::MEMBER_CERTS,
Tables::VALUES,
Tables::WHITELISTS,
Tables::GOV_SCRIPTS,
Expand Down