Skip to content

Commit

Permalink
Make smart contract permissioning features work with london fork (hyp…
Browse files Browse the repository at this point in the history
…erledger#5727)

* Make smart contract permissioning features work with london fork

Override the transactionSimulator's default TransactionValidationParams with one that allows for exceeding the account balance (which effectively zeros the baseFee).
This mimics the way that eth_estimateGas and eth_call are implemented.
Similar change to hyperledger#5277

Update ATs to use londonBlock (existing genesis allocs necessitate zeroBaseFee as well)

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>

* changelog
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>

---------

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
  • Loading branch information
siladu authored and daniellehrner committed Aug 4, 2023
1 parent 3ebafb3 commit 8221324
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Add missing methods to the `Transaction` interface [#5732](https://github.com/hyperledger/besu/pull/5732)

### Bug Fixes
- Make smart contract permissioning features work with london fork [#5727](https://github.com/hyperledger/besu/pull/5727)

### Download Links

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"config": {
"chainId": 999,
"petersburgBlock": 0,
"londonBlock": 0,
"zeroBaseFee": true,
"ethash": {
"fixeddifficulty": 100
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"config": {
"chainId": 999,
"petersburgBlock": 0,
"londonBlock": 0,
"zeroBaseFee": true,
"ibft2": {
"blockperiodseconds": 5,
"epochlength": 30000,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"config": {
"chainId": 999,
"petersburgBlock": 0,
"londonBlock": 0,
"zeroBaseFee": true,
"ethash": {
"fixeddifficulty": 100
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder;
import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.mainnet.ImmutableTransactionValidationParams;
import org.hyperledger.besu.ethereum.mainnet.MainnetTransactionProcessor;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
Expand Down Expand Up @@ -102,7 +103,10 @@ public Optional<TransactionSimulatorResult> process(
public Optional<TransactionSimulatorResult> processAtHead(final CallParameter callParams) {
return process(
callParams,
TransactionValidationParams.transactionSimulator(),
ImmutableTransactionValidationParams.builder()
.from(TransactionValidationParams.transactionSimulator())
.isAllowExceedingBalance(true)
.build(),
OperationTracer.NO_TRACING,
(mutableWorldState, transactionSimulatorResult) -> transactionSimulatorResult,
blockchain.getChainHeadHeader());
Expand Down

0 comments on commit 8221324

Please sign in to comment.