Skip to content

Commit defa218

Browse files
usmansaleemdaniellehrner
authored andcommitted
Fix javadoc for ethereum api module, graphql package (besu-eth#7272)
* javadoc - Adding missing javadocs ethereum:api graphql package Signed-off-by: Usman Saleem <usman@usmans.info> Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
1 parent 1bf0a34 commit defa218

29 files changed

+1465
-44
lines changed

build.gradle

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,65 @@ allprojects {
365365
options.addBooleanOption('Xdoclint/package:-org.hyperledger.besu.privacy.contracts.generated,' +
366366
'-org.hyperledger.besu.tests.acceptance.*,' +
367367
'-org.hyperledger.besu.tests.web3j.generated,' +
368-
// TODO: these are temporary disabled (ethereum and sub modules), it should be removed in a future PR.
369-
'-org.hyperledger.besu.ethereum.*,' +
370-
'-org.hyperledger.besu.evmtool',
368+
// TODO: these are temporary excluded from lint (ethereum sub modules), it should be removed in a future PR.
369+
// ethereum api module
370+
'-org.hyperledger.besu.ethereum.api.handlers,' +
371+
'-org.hyperledger.besu.ethereum.api.jsonrpc,' +
372+
'-org.hyperledger.besu.ethereum.api.jsonrpc.*,' +
373+
'-org.hyperledger.besu.ethereum.api.query,' +
374+
'-org.hyperledger.besu.ethereum.api.query.*,' +
375+
'-org.hyperledger.besu.ethereum.api.tls,' +
376+
'-org.hyperledger.besu.ethereum.api.util,' +
377+
// ethereum blockcreation module
378+
'-org.hyperledger.besu.ethereum.blockcreation,' +
379+
'-org.hyperledger.besu.ethereum.blockcreation.*,' +
380+
// ethereum core module
381+
'-org.hyperledger.besu.ethereum.chain,' +
382+
'-org.hyperledger.besu.ethereum.core,' +
383+
'-org.hyperledger.besu.ethereum.core.*,' +
384+
'-org.hyperledger.besu.ethereum.debug,' +
385+
'-org.hyperledger.besu.ethereum.difficulty.fixed,' +
386+
'-org.hyperledger.besu.ethereum.forkid,' +
387+
'-org.hyperledger.besu.ethereum.mainnet,' +
388+
'-org.hyperledger.besu.ethereum.mainnet.*,' +
389+
'-org.hyperledger.besu.ethereum.privacy,' +
390+
'-org.hyperledger.besu.ethereum.privacy.*,' +
391+
'-org.hyperledger.besu.ethereum.processing,' +
392+
'-org.hyperledger.besu.ethereum.proof,' +
393+
'-org.hyperledger.besu.ethereum.storage,' +
394+
'-org.hyperledger.besu.ethereum.storage.*,' +
395+
'-org.hyperledger.besu.ethereum.transaction,' +
396+
'-org.hyperledger.besu.ethereum.trie.*,' +
397+
'-org.hyperledger.besu.ethereum.util,' +
398+
'-org.hyperledger.besu.ethereum.vm,' +
399+
'-org.hyperledger.besu.ethereum.worldstate,' +
400+
// ethereum eth module
401+
'-org.hyperledger.besu.ethereum.eth.*,' +
402+
'-org.hyperledger.besu.ethereum.eth,' +
403+
'-org.hyperledger.besu.consensus.merge,' +
404+
// evmtool module
405+
'-org.hyperledger.besu.evmtool,' +
406+
// p2p module
407+
'-org.hyperledger.besu.ethereum.p2p,' +
408+
'-org.hyperledger.besu.ethereum.p2p.*,' +
409+
// permissioning module
410+
'-org.hyperledger.besu.ethereum.permissioning,' +
411+
'-org.hyperledger.besu.ethereum.permissioning.*,' +
412+
// referencetests module
413+
'-org.hyperledger.besu.ethereum.referencetests,' +
414+
// retesteth module
415+
'-org.hyperledger.besu.ethereum.retesteth.methods,' +
416+
'-org.hyperledger.besu.ethereum.retesteth,' +
417+
//rlp module
418+
'-org.hyperledger.besu.ethereum.rlp,' +
419+
// stratum module
420+
'-org.hyperledger.besu.ethereum.stratum,' +
421+
// trie module
422+
'-org.hyperledger.besu.ethereum.trie.*,' +
423+
'-org.hyperledger.besu.ethereum.trie,' +
424+
// verkle trie module
425+
'-org.hyperledger.besu.ethereum.verkletrie,' +
426+
'-org.hyperledger.besu.ethereum.verkletrie.*',
371427
true)
372428
options.addStringOption('Xmaxerrs','65535')
373429
options.addStringOption('Xmaxwarns','65535')

ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/ApiConfiguration.java

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,58 +18,125 @@
1818

1919
import org.immutables.value.Value;
2020

21+
/**
22+
* The ApiConfiguration class provides configuration for the API. It includes default values for gas
23+
* price, max logs range, gas cap, and other parameters.
24+
*/
2125
@Value.Immutable
2226
@Value.Style(allParameters = true)
2327
public abstract class ApiConfiguration {
2428

29+
/**
30+
* The default lower bound coefficient for gas and priority fee. This value is used as the default
31+
* lower bound when calculating the gas and priority fee.
32+
*/
2533
public static final long DEFAULT_LOWER_BOUND_GAS_AND_PRIORITY_FEE_COEFFICIENT = 0L;
34+
35+
/**
36+
* The default upper bound coefficient for gas and priority fee. This value is used as the default
37+
* upper bound when calculating the gas and priority fee.
38+
*/
2639
public static final long DEFAULT_UPPER_BOUND_GAS_AND_PRIORITY_FEE_COEFFICIENT = Long.MAX_VALUE;
2740

41+
/** Constructs a new ApiConfiguration with default values. */
42+
protected ApiConfiguration() {}
43+
44+
/**
45+
* Returns the number of blocks to consider for gas price calculations. Default value is 100.
46+
*
47+
* @return the number of blocks for gas price calculations
48+
*/
2849
@Value.Default
2950
public long getGasPriceBlocks() {
3051
return 100;
3152
}
3253

54+
/**
55+
* Returns the percentile to use for gas price calculations. Default value is 50.0.
56+
*
57+
* @return the percentile for gas price calculations
58+
*/
3359
@Value.Default
3460
public double getGasPricePercentile() {
3561
return 50.0d;
3662
}
3763

64+
/**
65+
* Returns the maximum gas price. Default value is 500 GWei.
66+
*
67+
* @return the maximum gas price
68+
*/
3869
@Value.Default
3970
public Wei getGasPriceMax() {
4071
return Wei.of(500_000_000_000L); // 500 GWei
4172
}
4273

74+
/**
75+
* Returns the fraction to use for gas price calculations. This is derived from the gas price
76+
* percentile.
77+
*
78+
* @return the fraction for gas price calculations
79+
*/
4380
@Value.Derived
4481
public double getGasPriceFraction() {
4582
return getGasPricePercentile() / 100.0;
4683
}
4784

85+
/**
86+
* Returns the maximum range for logs. Default value is 5000.
87+
*
88+
* @return the maximum range for logs
89+
*/
4890
@Value.Default
4991
public Long getMaxLogsRange() {
5092
return 5000L;
5193
}
5294

95+
/**
96+
* Returns the gas cap. Default value is 0.
97+
*
98+
* @return the gas cap
99+
*/
53100
@Value.Default
54101
public Long getGasCap() {
55102
return 0L;
56103
}
57104

105+
/**
106+
* Returns whether gas and priority fee limiting is enabled. Default value is false.
107+
*
108+
* @return true if gas and priority fee limiting is enabled, false otherwise
109+
*/
58110
@Value.Default
59111
public boolean isGasAndPriorityFeeLimitingEnabled() {
60112
return false;
61113
}
62114

115+
/**
116+
* Returns the lower bound coefficient for gas and priority fee. Default value is 0.
117+
*
118+
* @return the lower bound coefficient for gas and priority fee
119+
*/
63120
@Value.Default
64121
public Long getLowerBoundGasAndPriorityFeeCoefficient() {
65122
return DEFAULT_LOWER_BOUND_GAS_AND_PRIORITY_FEE_COEFFICIENT;
66123
}
67124

125+
/**
126+
* Returns the upper bound coefficient for gas and priority fee. Default value is Long.MAX_VALUE.
127+
*
128+
* @return the upper bound coefficient for gas and priority fee
129+
*/
68130
@Value.Default
69131
public Long getUpperBoundGasAndPriorityFeeCoefficient() {
70132
return DEFAULT_UPPER_BOUND_GAS_AND_PRIORITY_FEE_COEFFICIENT;
71133
}
72134

135+
/**
136+
* Returns the maximum range for trace filter. Default value is 1000.
137+
*
138+
* @return the maximum range for trace filter
139+
*/
73140
@Value.Default
74141
public Long getMaxTraceFilterRange() {
75142
return 1000L;

ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/GraphQLConfiguration.java

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,33 @@
2626

2727
import com.google.common.base.MoreObjects;
2828

29+
/**
30+
* Represents the configuration for GraphQL. This class is used to set and get the configuration
31+
* details for GraphQL such as enabling GraphQL, setting the port and host, setting the allowed
32+
* domains for CORS, setting the hosts allowlist, and setting the HTTP timeout.
33+
*/
2934
public class GraphQLConfiguration {
3035
private static final String DEFAULT_GRAPHQL_HTTP_HOST = "127.0.0.1";
36+
37+
/** The default port number for the GraphQL HTTP server. */
3138
public static final int DEFAULT_GRAPHQL_HTTP_PORT = 8547;
3239

3340
private boolean enabled;
3441
private int port;
3542
private String host;
3643
private List<String> corsAllowedDomains = Collections.emptyList();
37-
private List<String> hostsAllowlist = Arrays.asList("localhost", "127.0.0.1");
44+
private List<String> hostsAllowlist = Arrays.asList("localhost", DEFAULT_GRAPHQL_HTTP_HOST);
3845
private long httpTimeoutSec = TimeoutOptions.defaultOptions().getTimeoutSeconds();
3946

47+
/**
48+
* Creates a default configuration for GraphQL.
49+
*
50+
* <p>This method initializes a new GraphQLConfiguration object with default settings. The default
51+
* settings are: - GraphQL is not enabled - The port is set to the default GraphQL HTTP port - The
52+
* host is set to the default GraphQL HTTP host - The HTTP timeout is set to the default timeout
53+
*
54+
* @return a GraphQLConfiguration object with default settings
55+
*/
4056
public static GraphQLConfiguration createDefault() {
4157
final GraphQLConfiguration config = new GraphQLConfiguration();
4258
config.setEnabled(false);
@@ -48,52 +64,112 @@ public static GraphQLConfiguration createDefault() {
4864

4965
private GraphQLConfiguration() {}
5066

67+
/**
68+
* Checks if GraphQL is enabled.
69+
*
70+
* @return true if GraphQL is enabled, false otherwise
71+
*/
5172
public boolean isEnabled() {
5273
return enabled;
5374
}
5475

76+
/**
77+
* Sets the enabled status of GraphQL.
78+
*
79+
* @param enabled the status to set. true to enable GraphQL, false to disable it
80+
*/
5581
public void setEnabled(final boolean enabled) {
5682
this.enabled = enabled;
5783
}
5884

85+
/**
86+
* Retrieves the port number for the GraphQL HTTP server.
87+
*
88+
* @return the port number
89+
*/
5990
public int getPort() {
6091
return port;
6192
}
6293

94+
/**
95+
* Sets the port number for the GraphQL HTTP server.
96+
*
97+
* @param port the port number to set
98+
*/
6399
public void setPort(final int port) {
64100
this.port = port;
65101
}
66102

103+
/**
104+
* Retrieves the host for the GraphQL HTTP server.
105+
*
106+
* @return the host
107+
*/
67108
public String getHost() {
68109
return host;
69110
}
70111

112+
/**
113+
* Sets the host for the GraphQL HTTP server.
114+
*
115+
* @param host the host to set
116+
*/
71117
public void setHost(final String host) {
72118
this.host = host;
73119
}
74120

121+
/**
122+
* Retrieves the allowed domains for CORS.
123+
*
124+
* @return a collection of allowed domains for CORS
125+
*/
75126
Collection<String> getCorsAllowedDomains() {
76127
return corsAllowedDomains;
77128
}
78129

130+
/**
131+
* Sets the allowed domains for CORS.
132+
*
133+
* @param corsAllowedDomains a list of allowed domains for CORS
134+
*/
79135
public void setCorsAllowedDomains(final List<String> corsAllowedDomains) {
80136
checkNotNull(corsAllowedDomains);
81137
this.corsAllowedDomains = corsAllowedDomains;
82138
}
83139

140+
/**
141+
* Retrieves the hosts allowlist.
142+
*
143+
* @return a collection of hosts in the allowlist
144+
*/
84145
Collection<String> getHostsAllowlist() {
85146
return Collections.unmodifiableCollection(this.hostsAllowlist);
86147
}
87148

149+
/**
150+
* Sets the hosts allowlist.
151+
*
152+
* @param hostsAllowlist a list of hosts to be added to the allowlist
153+
*/
88154
public void setHostsAllowlist(final List<String> hostsAllowlist) {
89155
checkNotNull(hostsAllowlist);
90156
this.hostsAllowlist = hostsAllowlist;
91157
}
92158

159+
/**
160+
* Retrieves the HTTP timeout in seconds.
161+
*
162+
* @return the HTTP timeout in seconds
163+
*/
93164
public Long getHttpTimeoutSec() {
94165
return httpTimeoutSec;
95166
}
96167

168+
/**
169+
* Sets the HTTP timeout in seconds.
170+
*
171+
* @param httpTimeoutSec the HTTP timeout to set in seconds
172+
*/
97173
public void setHttpTimeoutSec(final long httpTimeoutSec) {
98174
this.httpTimeoutSec = httpTimeoutSec;
99175
}

ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/GraphQLContextType.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,33 @@
1414
*/
1515
package org.hyperledger.besu.ethereum.api.graphql;
1616

17-
/** Internal GraphQL Context */
17+
/**
18+
* Enum representing various context types for GraphQL.
19+
*
20+
* <p>These context types are used internally by GraphQL to manage different aspects of the system.
21+
*/
1822
public enum GraphQLContextType {
23+
/** Represents blockchain queries context. */
1924
BLOCKCHAIN_QUERIES,
25+
26+
/** Represents protocol schedule context. */
2027
PROTOCOL_SCHEDULE,
28+
29+
/** Represents transaction pool context. */
2130
TRANSACTION_POOL,
31+
32+
/** Represents mining coordinator context. */
2233
MINING_COORDINATOR,
34+
35+
/** Represents synchronizer context. */
2336
SYNCHRONIZER,
37+
38+
/** Represents is alive handler context. */
2439
IS_ALIVE_HANDLER,
40+
41+
/** Represents chain ID context. */
2542
CHAIN_ID,
43+
44+
/** Represents gas cap context. */
2645
GAS_CAP
2746
}

0 commit comments

Comments
 (0)