Skip to content

Commit

Permalink
removed permissioning methods referencing whitelist (hyperledger#7401)
Browse files Browse the repository at this point in the history
* removed whitelist permissioning methods
* removed actual RPC methods

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
  • Loading branch information
macfarla authored Jul 31, 2024
1 parent de957aa commit 4e79c81
Show file tree
Hide file tree
Showing 16 changed files with 9 additions and 1,135 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Allow configuration of Withdrawal Request Contract Address via genesis configuration [#7356](https://github.com/hyperledger/besu/pull/7356)

### Breaking Changes
- Remove long-deprecated `perm*whitelist*` methods [#7401](https://github.com/hyperledger/besu/pull/7401)

### Additions and Improvements

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,12 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermAddAccountsToAllowlist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermAddAccountsToWhitelist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermAddNodesToAllowlist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermAddNodesToWhitelist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermGetAccountsAllowlist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermGetAccountsWhitelist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermGetNodesAllowlist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermGetNodesWhitelist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermReloadPermissionsFromFile;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermRemoveAccountsFromAllowlist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermRemoveAccountsFromWhitelist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermRemoveNodesFromAllowlist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermRemoveNodesFromWhitelist;
import org.hyperledger.besu.ethereum.permissioning.AccountLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;

Expand All @@ -55,17 +49,11 @@ protected String getApiGroup() {
@Override
protected Map<String, JsonRpcMethod> create() {
return mapOf(
new PermAddNodesToWhitelist(nodeAllowlistController),
new PermAddNodesToAllowlist(nodeAllowlistController),
new PermRemoveNodesFromWhitelist(nodeAllowlistController),
new PermRemoveNodesFromAllowlist(nodeAllowlistController),
new PermGetNodesWhitelist(nodeAllowlistController),
new PermGetNodesAllowlist(nodeAllowlistController),
new PermGetAccountsWhitelist(accountsAllowlistController),
new PermGetAccountsAllowlist(accountsAllowlistController),
new PermAddAccountsToWhitelist(accountsAllowlistController),
new PermAddAccountsToAllowlist(accountsAllowlistController),
new PermRemoveAccountsFromWhitelist(accountsAllowlistController),
new PermRemoveAccountsFromAllowlist(accountsAllowlistController),
new PermReloadPermissionsFromFile(accountsAllowlistController, nodeAllowlistController));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
@ExtendWith(MockitoExtension.class)
public class PermAddAccountsToAllowlistTest {

@Mock private AccountLocalConfigPermissioningController accountWhitelist;
@Mock private AccountLocalConfigPermissioningController accountAllowlist;
private PermAddAccountsToAllowlist method;

@BeforeEach
public void before() {
method = new PermAddAccountsToAllowlist(java.util.Optional.of(accountWhitelist));
method = new PermAddAccountsToAllowlist(java.util.Optional.of(accountAllowlist));
}

@Test
Expand All @@ -57,10 +57,10 @@ public void getNameShouldReturnExpectedName() {
}

@Test
public void whenAccountsAreAddedToWhitelistShouldReturnSuccess() {
public void whenAccountsAreAddedToAllowlistShouldReturnSuccess() {
List<String> accounts = Arrays.asList("0x0", "0x1");
JsonRpcResponse expectedResponse = new JsonRpcSuccessResponse(null);
when(accountWhitelist.addAccounts(eq(accounts))).thenReturn(AllowlistOperationResult.SUCCESS);
when(accountAllowlist.addAccounts(eq(accounts))).thenReturn(AllowlistOperationResult.SUCCESS);

JsonRpcResponse actualResponse = method.response(request(accounts));

Expand All @@ -71,7 +71,7 @@ public void whenAccountsAreAddedToWhitelistShouldReturnSuccess() {
public void whenAccountIsInvalidShouldReturnInvalidAccountErrorResponse() {
JsonRpcResponse expectedResponse =
new JsonRpcErrorResponse(null, RpcErrorType.ACCOUNT_ALLOWLIST_INVALID_ENTRY);
when(accountWhitelist.addAccounts(any()))
when(accountAllowlist.addAccounts(any()))
.thenReturn(AllowlistOperationResult.ERROR_INVALID_ENTRY);

JsonRpcResponse actualResponse = method.response(request(new ArrayList<>()));
Expand All @@ -83,7 +83,7 @@ public void whenAccountIsInvalidShouldReturnInvalidAccountErrorResponse() {
public void whenAccountExistsShouldReturnExistingEntryErrorResponse() {
JsonRpcResponse expectedResponse =
new JsonRpcErrorResponse(null, RpcErrorType.ACCOUNT_ALLOWLIST_EXISTING_ENTRY);
when(accountWhitelist.addAccounts(any()))
when(accountAllowlist.addAccounts(any()))
.thenReturn(AllowlistOperationResult.ERROR_EXISTING_ENTRY);

JsonRpcResponse actualResponse = method.response(request(new ArrayList<>()));
Expand All @@ -95,7 +95,7 @@ public void whenAccountExistsShouldReturnExistingEntryErrorResponse() {
public void whenInputHasDuplicatedAccountsShouldReturnDuplicatedEntryErrorResponse() {
JsonRpcResponse expectedResponse =
new JsonRpcErrorResponse(null, RpcErrorType.ACCOUNT_ALLOWLIST_DUPLICATED_ENTRY);
when(accountWhitelist.addAccounts(any()))
when(accountAllowlist.addAccounts(any()))
.thenReturn(AllowlistOperationResult.ERROR_DUPLICATED_ENTRY);

JsonRpcResponse actualResponse = method.response(request(new ArrayList<>()));
Expand All @@ -108,7 +108,7 @@ public void whenEmptyListOnRequestShouldReturnEmptyEntryErrorResponse() {
JsonRpcResponse expectedResponse =
new JsonRpcErrorResponse(null, RpcErrorType.ACCOUNT_ALLOWLIST_EMPTY_ENTRY);

when(accountWhitelist.addAccounts(eq(new ArrayList<>())))
when(accountAllowlist.addAccounts(eq(new ArrayList<>())))
.thenReturn(AllowlistOperationResult.ERROR_EMPTY_ENTRY);

JsonRpcResponse actualResponse = method.response(request(new ArrayList<>()));
Expand Down
Loading

0 comments on commit 4e79c81

Please sign in to comment.