File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet
evm/src/main/java/org/hyperledger/besu/evm/worldstate Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -501,7 +501,6 @@ public TransactionProcessingResult processTransaction(
501501 coinbaseCalculator .price (usedGas , transactionGasPrice , blockHeader .getBaseFee ());
502502
503503 coinbase .incrementBalance (coinbaseWeiDelta );
504- authorizedCodeService .resetAuthorities ();
505504
506505 operationTracer .traceEndTransaction (
507506 worldUpdater ,
@@ -516,8 +515,13 @@ public TransactionProcessingResult processTransaction(
516515 initialFrame .getSelfDestructs ().forEach (worldState ::deleteAccount );
517516
518517 if (clearEmptyAccounts ) {
519- worldState .clearAccountsThatAreEmpty ();
518+ // TODO remove for devnet-2 and later as in the new version of 7702 the nonce of the
519+ // authorities is increased
520+ // and will not be cleared anymore in case of storage change only
521+ worldState .clearAccountsThatAreEmpty (authorizedCodeService .getAuthorities ());
522+ // worldState.clearAccountsThatAreEmpty();
520523 }
524+ authorizedCodeService .resetAuthorities ();
521525
522526 if (initialFrame .getState () == MessageFrame .State .COMPLETED_SUCCESS ) {
523527 return TransactionProcessingResult .successful (
Original file line number Diff line number Diff line change 2323import java .util .ArrayList ;
2424import java .util .Collection ;
2525import java .util .Optional ;
26+ import java .util .Set ;
2627
2728import org .apache .tuweni .bytes .Bytes ;
2829
@@ -175,6 +176,19 @@ default void clearAccountsThatAreEmpty() {
175176 .stream ().filter (Account ::isEmpty ).forEach (a -> deleteAccount (a .getAddress ()));
176177 }
177178
179+ /**
180+ * Clears any accounts that are empty, excluding those in the provided set
181+ *
182+ * @param excludedAddresses the addresses to exclude from deletion
183+ */
184+ default void clearAccountsThatAreEmpty (final Set <Address > excludedAddresses ) {
185+ new ArrayList <>(getTouchedAccounts ())
186+ .stream ()
187+ .filter (a -> !excludedAddresses .contains (a .getAddress ()))
188+ .filter (Account ::isEmpty )
189+ .forEach (a -> deleteAccount (a .getAddress ()));
190+ }
191+
178192 /** Mark transaction boundary. */
179193 default void markTransactionBoundary () {
180194 // default is to ignore
You can’t perform that action at this time.
0 commit comments