Skip to content

Commit

Permalink
add deprecation warnings to help and log messages (#7902)
Browse files Browse the repository at this point in the history
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
  • Loading branch information
macfarla authored Nov 27, 2024
1 parent 27592b5 commit 58fbbe3
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,40 @@ public class PermissionsOptions {
"Account permissioning config TOML file (default: a file named \"permissions_config.toml\" in the Besu data folder)")
private String accountPermissionsConfigFile = null;

private static final String DEPRECATION_PREFIX =
"Deprecated. Onchain permissioning is deprecated. See CHANGELOG for alternative options. ";

@CommandLine.Option(
names = {"--permissions-nodes-contract-address"},
description = "Address of the node permissioning smart contract",
description = DEPRECATION_PREFIX + "Address of the node permissioning smart contract",
arity = "1")
private final Address permissionsNodesContractAddress = null;

@CommandLine.Option(
names = {"--permissions-nodes-contract-version"},
description = "Version of the EEA Node Permissioning interface (default: ${DEFAULT-VALUE})")
description =
DEPRECATION_PREFIX
+ "Version of the EEA Node Permissioning interface (default: ${DEFAULT-VALUE})")
private final Integer permissionsNodesContractVersion = 1;

@CommandLine.Option(
names = {"--permissions-nodes-contract-enabled"},
description = "Enable node level permissions via smart contract (default: ${DEFAULT-VALUE})")
description =
DEPRECATION_PREFIX
+ "Enable node level permissions via smart contract (default: ${DEFAULT-VALUE})")
private final Boolean permissionsNodesContractEnabled = false;

@CommandLine.Option(
names = {"--permissions-accounts-contract-address"},
description = "Address of the account permissioning smart contract",
description = DEPRECATION_PREFIX + "Address of the account permissioning smart contract",
arity = "1")
private final Address permissionsAccountsContractAddress = null;

@CommandLine.Option(
names = {"--permissions-accounts-contract-enabled"},
description =
"Enable account level permissions via smart contract (default: ${DEFAULT-VALUE})")
DEPRECATION_PREFIX
+ "Enable account level permissions via smart contract (default: ${DEFAULT-VALUE})")
private final Boolean permissionsAccountsContractEnabled = false;

/** Default constructor. */
Expand Down Expand Up @@ -151,6 +159,7 @@ public Optional<PermissioningConfiguration> permissioningConfiguration(
SmartContractPermissioningConfiguration.createDefault();

if (Boolean.TRUE.equals(permissionsNodesContractEnabled)) {
logger.warn("Onchain (contract) node permissioning options are " + DEPRECATION_PREFIX);
if (permissionsNodesContractAddress == null) {
throw new CommandLine.ParameterException(
commandLine,
Expand All @@ -170,6 +179,7 @@ public Optional<PermissioningConfiguration> permissioningConfiguration(
}

if (Boolean.TRUE.equals(permissionsAccountsContractEnabled)) {
logger.warn("Onchain (contract) account permissioning options are " + DEPRECATION_PREFIX);
if (permissionsAccountsContractAddress == null) {
throw new CommandLine.ParameterException(
commandLine,
Expand Down

0 comments on commit 58fbbe3

Please sign in to comment.