Skip to content

Commit

Permalink
Revert "Add hooks to AbstractCreateOperation for library users (hyper…
Browse files Browse the repository at this point in the history
…ledger#5656)"

This reverts commit 2c9cdd9.
  • Loading branch information
davidkngo authored Jul 21, 2023
1 parent 48786b0 commit 21d5c54
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 280 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Changelog

## 23.4.5
Expand All @@ -8,7 +7,6 @@
### Additions and Improvements
- EvmTool now executes the `execution-spec-tests` via the `t8n` and `b11r`. See the [README](ethereum/evmtool/README.md) in EvmTool for more instructions.
- Improve lifecycle management of the transaction pool [#5634](https://github.com/hyperledger/besu/pull/5634)
- Add extension points in AbstractCreateOperation for EVM libraries to react to contract creations [#5656](https://github.com/hyperledger/besu/pull/5656)

### Bug Fixes
- Use the node's configuration to determine if DNS enode URLs are allowed in calls to `admin_addPeer` and `admin_removePeer` [#5584](https://github.com/hyperledger/besu/pull/5584)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@
import org.hyperledger.besu.evm.EVM;
import org.hyperledger.besu.evm.account.MutableAccount;
import org.hyperledger.besu.evm.code.CodeFactory;
import org.hyperledger.besu.evm.code.CodeInvalid;
import org.hyperledger.besu.evm.frame.ExceptionalHaltReason;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.internal.Words;

import java.util.Optional;

import org.apache.tuweni.bytes.Bytes;

/** The Abstract create operation. */
Expand Down Expand Up @@ -188,57 +185,18 @@ private void complete(final MessageFrame frame, final MessageFrame childFrame, f

if (childFrame.getState() == MessageFrame.State.COMPLETED_SUCCESS) {
frame.mergeWarmedUpFields(childFrame);
Address createdAddress = childFrame.getContractAddress();
frame.pushStackItem(Words.fromAddress(createdAddress));
onSuccess(frame, createdAddress);
frame.pushStackItem(Words.fromAddress(childFrame.getContractAddress()));
} else {
frame.setReturnData(childFrame.getOutputData());
frame.pushStackItem(FAILURE_STACK_ITEM);
onFailure(frame, childFrame.getExceptionalHaltReason());
}
} else {
frame.getWorldUpdater().deleteAccount(childFrame.getRecipientAddress());
frame.setReturnData(childFrame.getOutputData());
frame.pushStackItem(FAILURE_STACK_ITEM);
onInvalid(frame, (CodeInvalid) outputCode);
}

final int currentPC = frame.getPC();
frame.setPC(currentPC + 1);
}

/**
* Called when the child {@code CONTRACT_CREATION} message has completed successfully, used to
* give library users a chance to do implementation specific logic.
*
* @param frame the frame running the successful operation
* @param createdAddress the address of the newly created contract
*/
protected void onSuccess(final MessageFrame frame, final Address createdAddress) {
// no-op by default
}

/**
* Called when the child {@code CONTRACT_CREATION} message has failed to execute, used to give
* library users a chance to do implementation specific logic.
*
* @param frame the frame running the successful operation
* @param haltReason the exceptional halt reason of the child frame
*/
protected void onFailure(
final MessageFrame frame, final Optional<ExceptionalHaltReason> haltReason) {
// no-op by default
}

/**
* Called when the child {@code CONTRACT_CREATION} message has completed successfully but the
* returned contract is invalid per chain rules, used to give library users a chance to do
* implementation specific logic.
*
* @param frame the frame running the successful operation
* @param invalidCode the code object containing the invalid code
*/
protected void onInvalid(final MessageFrame frame, final CodeInvalid invalidCode) {
// no-op by default
}
}

This file was deleted.

0 comments on commit 21d5c54

Please sign in to comment.