-
Notifications
You must be signed in to change notification settings - Fork 860
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
Implement miner_setMinPriorityFee and miner_getMinPriorityFee #6080
Merged
macfarla
merged 40 commits into
hyperledger:main
from
Gabriel-Trintinalia:change-min-priority-fee
Oct 25, 2023
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
c57c2ac
Refactor mining options
fab-10 b408b64
Fix null pointer exception
fab-10 da79e09
fix another null pointer exception
fab-10 7684d7e
uncomment code
fab-10 78741da
Move miner options tests
fab-10 18bcce3
Unit test fixes
fab-10 59fbe8e
Removed the commented code
fab-10 8f14dd3
WIP
fab-10 2280e02
Merge branch 'main' into mining-options-refactor
fab-10 65bdabd
WIP
fab-10 5e012d0
New miner option: min-priority-fee
fab-10 84919f4
Remove not relevant for this feature
fab-10 e89a244
Remove not relevant for this feature
fab-10 20e498b
Merge branch 'main' into mining-options-refactor
fab-10 a260a7d
Merge branch 'mining-options-refactor' into min-priority-fee
fab-10 86b9a6e
Merge branch 'main' into mining-options-refactor
fab-10 2267bc7
Fix javadoc
fab-10 c6b56d2
Remove code not belonging to this PR
fab-10 477acf9
coinbase is an updatable parameter
fab-10 4626230
Move MiningOptions to upper package
fab-10 25b1522
Fix coinbase for *bft
fab-10 38feb6d
Merge branch 'mining-options-refactor' into min-priority-fee
fab-10 b7f4213
Implement methods to get and set min priority fee
Gabriel-Trintinalia ae775ae
Merge branch 'main' into mining-options-refactor
fab-10 31f2183
Fix spotless
Gabriel-Trintinalia 16315a4
Merge branch 'main' into mining-options-refactor
macfarla 2700930
Merge branch 'mining-options-refactor' of github.com:fab-10/besu into…
fab-10 e55392b
Apply suggestions from code review
fab-10 d710e5c
Merge branch 'main' into mining-options-refactor
fab-10 639af82
Update besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
fab-10 232caa6
Merge branch 'mining-options-refactor' of github.com:fab-10/besu into…
fab-10 878969d
Merge branch 'main' into mining-options-refactor
fab-10 07dc4e0
Merge branch 'mining-options-refactor' into min-priority-fee
fab-10 4cb4f6c
Merge branch 'min-priority-fee' into change-min-priority-fee
Gabriel-Trintinalia e2bf4e4
Add new config option to everything config
Gabriel-Trintinalia 65b84e5
Fix unit test
Gabriel-Trintinalia 2e823ac
Merge branch 'main' into change-min-priority-fee
Gabriel-Trintinalia 9027349
Merge branch 'main' into change-min-priority-fee
pinges f0a4c97
Accept PR suggestions
Gabriel-Trintinalia dca9676
Merge branch 'change-min-priority-fee' of https://github.com/Gabriel-…
Gabriel-Trintinalia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
.../hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinPriorityFee.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright Hyperledger Besu Contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.miner; | ||
|
||
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; | ||
import org.hyperledger.besu.ethereum.core.MiningParameters; | ||
|
||
public class MinerGetMinPriorityFee implements JsonRpcMethod { | ||
private final MiningParameters miningParameters; | ||
|
||
public MinerGetMinPriorityFee(final MiningParameters miningParameters) { | ||
this.miningParameters = miningParameters; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return RpcMethod.MINER_GET_MIN_PRIORITY_FEE.getMethodName(); | ||
} | ||
|
||
@Override | ||
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { | ||
return new JsonRpcSuccessResponse( | ||
requestContext.getRequest().getId(), miningParameters.getMinPriorityFeePerGas().getValue()); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
.../hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinPriorityFee.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright Hyperledger Besu Contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.miner; | ||
|
||
import org.hyperledger.besu.datatypes.Wei; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; | ||
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; | ||
import org.hyperledger.besu.ethereum.core.MiningParameters; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class MinerSetMinPriorityFee implements JsonRpcMethod { | ||
private static final Logger LOG = LoggerFactory.getLogger(MinerSetMinPriorityFee.class); | ||
|
||
private final MiningParameters miningParameters; | ||
|
||
public MinerSetMinPriorityFee(final MiningParameters miningParameters) { | ||
this.miningParameters = miningParameters; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return RpcMethod.MINER_SET_MIN_PRIORITY_FEE.getMethodName(); | ||
} | ||
|
||
@Override | ||
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { | ||
try { | ||
final Wei minPriorityFeePerGas = Wei.of(requestContext.getRequiredParameter(0, Long.class)); | ||
miningParameters.setMinPriorityFeePerGas(minPriorityFeePerGas); | ||
LOG.debug("min priority fee per gas changed to {}", minPriorityFeePerGas); | ||
return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), true); | ||
} catch (final IllegalArgumentException invalidJsonRpcParameters) { | ||
return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), false); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a slight concern on the signed Long usage for Wei, which is much smaller than
UInt256
, which is what under the hood of Wei and is a theoretical maximum.