Skip to content
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

EIP-7692 "Mega" EOF Implementation #7169

Merged
merged 125 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
3b8c43f
Simple subcontainer parsing
shemnon Mar 23, 2023
195c33a
change subcontainer size limit.
shemnon Mar 23, 2023
d7e1568
Legacy EXTCODE operation legacy->EOF changes
shemnon Apr 21, 2023
99d087a
rework validation table as Java records
shemnon Mar 23, 2023
12d6e05
prototype no EOF delegate call to legacy code
shemnon Mar 24, 2023
3e828e2
EOF CALL series, but not wired in yet.
shemnon Mar 24, 2023
f8a4b49
EoFLayout to record
shemnon Mar 27, 2023
0fad80e
data ops implementations
shemnon Mar 28, 2023
5da098f
dupn/swapn impl
shemnon Mar 28, 2023
4a3a911
Renumber EOF ant Transient storage
shemnon Jun 8, 2023
78f2ecb
add DupN, SwapN, and DataLoad operations.
shemnon Jun 8, 2023
955eb9b
add mcopy operation to validation
shemnon Jun 8, 2023
f3610b5
wire in CALL2, DELEGATECALL2, and STATICCALL2
shemnon Jun 9, 2023
bb67bef
EOF opcodes are invalid when not in EOF code
shemnon Jun 10, 2023
caa5cb7
move immediate argument extraction into `Code` object
shemnon Jun 13, 2023
ff699d5
fix import rebase error
shemnon Oct 16, 2023
4a218b8
EOF Spec Updates
shemnon Jan 22, 2024
af7a859
Simple subcontainer parsing
shemnon Mar 23, 2023
7781c4d
change subcontainer size limit.
shemnon Mar 23, 2023
34e2dc4
Legacy EXTCODE operation legacy->EOF changes
shemnon Apr 21, 2023
c03bc21
EOF CALL series, but not wired in yet.
shemnon Mar 24, 2023
59ec422
EoFLayout to record
shemnon Mar 27, 2023
2a8ae81
data ops implementations
shemnon Mar 28, 2023
01062ec
Renumber EOF ant Transient storage
shemnon Jun 8, 2023
dc1c611
add mcopy operation to validation
shemnon Jun 8, 2023
3a3abe5
wire in CALL2, DELEGATECALL2, and STATICCALL2
shemnon Jun 9, 2023
a04ea6a
EOF opcodes are invalid when not in EOF code
shemnon Jun 10, 2023
7b55ec9
move immediate argument extraction into `Code` object
shemnon Jun 13, 2023
a3b6386
EOF Spec Updates
shemnon Jan 26, 2024
e9abad1
EVMTool eof-test support
shemnon Jan 29, 2024
9a0deb3
RJUMPV recentering
shemnon Jan 29, 2024
dbb65ca
validation fixes
shemnon Jan 31, 2024
09fd0ff
remove debug
shemnon Feb 1, 2024
b14d833
Integreate EOFTests into build
shemnon Feb 2, 2024
d3c8bbe
Add Amsterdam, Polis, and Bangkok to the fork list
shemnon Feb 2, 2024
ddf0f19
Prague Activation
shemnon Feb 9, 2024
176429f
propagate subcontainer errors
shemnon Feb 9, 2024
dfe3c52
Create3
shemnon Feb 12, 2024
d5e3c26
fix tests
shemnon Feb 13, 2024
ac66764
spotless and dedup rebase merge
shemnon Feb 14, 2024
a0d3e9e
CREATE version lock
shemnon Feb 14, 2024
3573e14
non-stack validation fixes
shemnon Feb 15, 2024
bc30431
begin stack rewrite
shemnon Feb 20, 2024
74ac2e8
stack validation and unused code sections
shemnon Feb 23, 2024
4379976
refactor, fix style, and re-key error strings.
shemnon Feb 23, 2024
c780e4f
javadoc
shemnon Feb 24, 2024
47a7ae2
rename create3 and call2
shemnon Mar 4, 2024
b844e4d
Add code pretty-print support to EvmTool
shemnon Mar 7, 2024
60c185a
address some validation test failures
shemnon Mar 8, 2024
639c706
update EXT*CALL return values to match EIP-7069
shemnon Mar 8, 2024
a65c773
merge main
shemnon Mar 21, 2024
9b723cd
Merge branch 'main' of github.com:hyperledger/besu into mega-eof
shemnon Mar 23, 2024
e82cbc7
exchange operation
shemnon Apr 5, 2024
5415ecd
Align exchange with EVMONE
shemnon Apr 5, 2024
39d097b
Refactor Gas Calculator Create methods
shemnon Apr 8, 2024
5c22d55
Merge branch 'main' into refactor-create-gas-calculator
shemnon Apr 8, 2024
50d8831
javadoc
shemnon Apr 8, 2024
26ce584
Merge remote-tracking branch 'refs/remotes/origin/refactor-create-gas…
shemnon Apr 8, 2024
ac51b80
preliminary TXCREATE support
shemnon Apr 8, 2024
ad7df01
Testing fixes
shemnon Apr 9, 2024
93b1442
EOFCreate and TXCreate operation unit tests
shemnon Apr 9, 2024
5a1ddaa
initcode transaction tests
shemnon Apr 10, 2024
43f14a0
merge main
shemnon Apr 15, 2024
b3c420c
merge main
shemnon Apr 16, 2024
eccf5ea
swap and dup are now u8 not u16
shemnon Apr 16, 2024
a4a28fc
create transaction support
shemnon Apr 17, 2024
8552f69
update reference tests
shemnon Apr 17, 2024
1ae44f6
fix legacy to eof code copy
shemnon Apr 18, 2024
2637685
trace immediate data
shemnon Apr 18, 2024
29c2e0a
build fixes
shemnon Apr 18, 2024
145df0b
Add return stack depth to trace
shemnon Apr 19, 2024
9bb05e6
fix DATA operations
shemnon Apr 19, 2024
3deb305
sample invalid EOF
shemnon Apr 20, 2024
7f88355
spotless
shemnon Apr 20, 2024
d9217bb
remove TXCREATE and InitcodeTransaction
shemnon Apr 9, 2024
6bb42ef
update submodule
shemnon Apr 25, 2024
e4d0404
fix reference test findings
shemnon Apr 28, 2024
b096765
Adopt subcontainer Validation
shemnon Apr 26, 2024
d232459
Update data operation gas costs
shemnon May 2, 2024
eb55a86
remove in-operation JUMPF validation checks
shemnon May 2, 2024
e48e1dc
pretty-print improvements
shemnon May 2, 2024
7a2c412
merge main
shemnon May 2, 2024
908592d
Correct JUMPF cost
shemnon May 2, 2024
20bbd11
Adopt subcontainer Validation (#7001)
shemnon May 2, 2024
9778a8f
swapn off by one
shemnon May 2, 2024
cf2f6ce
Align EOFCREATE with evmone
shemnon May 2, 2024
7fd5bf1
Merge branch 'main' of github.com:hyperledger/besu into mega-eof
shemnon May 3, 2024
60eaa47
EXCHAGNE oepration
shemnon May 3, 2024
11a838b
add non-returning to pretty-print
shemnon May 3, 2024
2d9d813
Merge branch 'main' of github.com:hyperledger/besu into mega-eof
shemnon May 3, 2024
b12acb0
Merge branch 'main' of github.com:hyperledger/besu into mega-eof
shemnon May 4, 2024
381ad93
spotless
shemnon May 4, 2024
db5147e
Remove impossible checks
shemnon May 5, 2024
e444b96
fix execution spec tests
shemnon May 5, 2024
814c89f
Merge branch 'main' of github.com:hyperledger/besu into mega-eof
shemnon May 6, 2024
1d88063
merge main
shemnon May 13, 2024
12daf14
Handle ASE checks in EXTCALL series
shemnon May 13, 2024
d3fc708
merge main
shemnon May 20, 2024
160758b
merge nyota fixes
shemnon May 20, 2024
45fd5b2
remove unneeded changes
shemnon May 21, 2024
ac5d03f
spotless and test fixes
shemnon May 21, 2024
af470ff
Merge branch 'main' of github.com:hyperledger/besu into mega-eof
shemnon May 28, 2024
2bc885c
remove som unused methods and fix a merge tpyo
shemnon May 28, 2024
ae0b965
extdelegatecall to EOAs and empty accounts is fine
shemnon May 28, 2024
fa99048
merge main
shemnon May 29, 2024
984570d
fix truncated detection of eof container when auzdata size is zero
shemnon May 29, 2024
0efc449
fix rjump prettyprint
shemnon May 31, 2024
7d3e0c0
Add PragueEOF fork
shemnon Jun 3, 2024
653f52c
Merge branch 'main' of github.com:hyperledger/besu into mega-eof
shemnon Jun 3, 2024
af8a629
Merge branch 'main' of github.com:hyperledger/besu into mega-eof
shemnon Jun 4, 2024
97b9d4e
Fix reference test tooling
shemnon Jun 4, 2024
8032d0b
Always validate deep
shemnon Jun 5, 2024
e1d7423
update returndataload and returndatacopy
shemnon Jun 6, 2024
5f29832
updated EXTDELEGATECALL won't work with EOA/empty
shemnon Jun 7, 2024
3c2c43f
updated EXTDELEGATECALL won't work with EOA/empty
shemnon Jun 7, 2024
b185371
Merge branch 'main' of github.com:hyperledger/besu into mega-eof
shemnon Jun 7, 2024
4a4b790
javadoc
shemnon Jun 7, 2024
b6c0ee2
Correct EXT*CALL Gas
shemnon Jun 11, 2024
99f8d12
javadoc
shemnon Jun 11, 2024
2aa48cb
Merge branch 'main' of github.com:hyperledger/besu into mega-eof
shemnon Jun 11, 2024
4a0c376
fix delegate test
shemnon Jun 11, 2024
f29cbdd
Merge branch 'main' into mega-eof
shemnon Jun 12, 2024
c08ad23
merge main
shemnon Jun 12, 2024
6ec7ffe
missed a deleted file in the merge
shemnon Jun 12, 2024
3ab5c89
changelog
shemnon Jun 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- Improve the selection of the most profitable built block [#7174](https://github.com/hyperledger/besu/pull/7174)
- Support for eth_maxPriorityFeePerGas [#5658](https://github.com/hyperledger/besu/issues/5658)
- Enable continuous profiling with default setting [#7006](https://github.com/hyperledger/besu/pull/7006)
- A full and up to date implementation of EOF for Prague [#7169](https://github.com/hyperledger/besu/pull/7169)

### Bug fixes
- Make `eth_gasPrice` aware of the base fee market [#7102](https://github.com/hyperledger/besu/pull/7102)
Expand Down
3 changes: 2 additions & 1 deletion besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,8 @@ private void configureNativeLibs() {
}

if (genesisConfigOptionsSupplier.get().getCancunTime().isPresent()
|| genesisConfigOptionsSupplier.get().getPragueTime().isPresent()) {
|| genesisConfigOptionsSupplier.get().getPragueTime().isPresent()
|| genesisConfigOptionsSupplier.get().getPragueEOFTime().isPresent()) {
if (kzgTrustedSetupFile != null) {
KZGPointEvalPrecompiledContract.init(kzgTrustedSetupFile);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ default boolean isConsensusMigration() {
*/
OptionalLong getPragueTime();

/**
* Gets Prague EOF time.
*
* @return the prague time
*/
OptionalLong getPragueEOFTime();

/**
* Gets future eips time.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ public OptionalLong getPragueTime() {
return getOptionalLong("praguetime");
}

@Override
public OptionalLong getPragueEOFTime() {
return getOptionalLong("pragueeoftime");
}

@Override
public OptionalLong getFutureEipsTime() {
return getOptionalLong("futureeipstime");
Expand Down Expand Up @@ -457,6 +462,7 @@ public Map<String, Object> asMap() {
getShanghaiTime().ifPresent(l -> builder.put("shanghaiTime", l));
getCancunTime().ifPresent(l -> builder.put("cancunTime", l));
getPragueTime().ifPresent(l -> builder.put("pragueTime", l));
getPragueEOFTime().ifPresent(l -> builder.put("pragueEOFTime", l));
getTerminalBlockNumber().ifPresent(l -> builder.put("terminalBlockNumber", l));
getTerminalBlockHash().ifPresent(h -> builder.put("terminalBlockHash", h.toHexString()));
getFutureEipsTime().ifPresent(l -> builder.put("futureEipsTime", l));
Expand Down Expand Up @@ -605,6 +611,7 @@ public List<Long> getForkBlockTimestamps() {
getShanghaiTime(),
getCancunTime(),
getPragueTime(),
getPragueEOFTime(),
getFutureEipsTime(),
getExperimentalEipsTime());
// when adding forks add an entry to ${REPO_ROOT}/config/src/test/resources/all_forks.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable
private OptionalLong shanghaiTime = OptionalLong.empty();
private OptionalLong cancunTime = OptionalLong.empty();
private OptionalLong pragueTime = OptionalLong.empty();
private OptionalLong pragueEOFTime = OptionalLong.empty();
private OptionalLong futureEipsTime = OptionalLong.empty();
private OptionalLong experimentalEipsTime = OptionalLong.empty();
private OptionalLong terminalBlockNumber = OptionalLong.empty();
Expand Down Expand Up @@ -242,6 +243,11 @@ public OptionalLong getPragueTime() {
return pragueTime;
}

@Override
public OptionalLong getPragueEOFTime() {
return pragueEOFTime;
}

@Override
public OptionalLong getFutureEipsTime() {
return futureEipsTime;
Expand Down Expand Up @@ -635,6 +641,18 @@ public StubGenesisConfigOptions pragueTime(final long timestamp) {
return this;
}

/**
* PragueEOF time.
*
* @param timestamp the timestamp
* @return the stub genesis config options
*/
public StubGenesisConfigOptions pragueEOFTime(final long timestamp) {
pragueTime = OptionalLong.of(timestamp);
pragueEOFTime = pragueTime;
return this;
}

/**
* Future EIPs Time block.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ void shouldGetPragueTime() {
assertThat(config.getPragueTime()).hasValue(1670470143);
}

@Test
void shouldGetPragueEOFTime() {
final GenesisConfigOptions config =
fromConfigOptions(singletonMap("pragueEOFTime", 1670470143));
assertThat(config.getPragueEOFTime()).hasValue(1670470143);
}

@Test
void shouldGetFutureEipsTime() {
final GenesisConfigOptions config = fromConfigOptions(singletonMap("futureEipsTime", 1337));
Expand Down Expand Up @@ -232,6 +239,7 @@ void shouldNotReturnEmptyOptionalWhenBlockNumberNotSpecified() {
assertThat(config.getShanghaiTime()).isEmpty();
assertThat(config.getCancunTime()).isEmpty();
assertThat(config.getPragueTime()).isEmpty();
assertThat(config.getPragueEOFTime()).isEmpty();
assertThat(config.getFutureEipsTime()).isEmpty();
assertThat(config.getExperimentalEipsTime()).isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,14 @@ private static boolean isPragueAtGenesis(final GenesisConfigFile genesis) {
if (pragueTimestamp.isPresent()) {
return genesis.getTimestamp() >= pragueTimestamp.getAsLong();
}
return isPragueEOFAtGenesis(genesis);
}

private static boolean isPragueEOFAtGenesis(final GenesisConfigFile genesis) {
final OptionalLong pragueEOFTimestamp = genesis.getConfigOptions().getPragueEOFTime();
if (pragueEOFTimestamp.isPresent()) {
return genesis.getTimestamp() >= pragueEOFTimestamp.getAsLong();
}
return isFutureEipsTimeAtGenesis(genesis);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,17 @@ public ProtocolSpecBuilder pragueDefinition(final GenesisConfigOptions genesisCo
miningParameters);
}

public ProtocolSpecBuilder pragueEOFDefinition(final GenesisConfigOptions genesisConfigOptions) {
return MainnetProtocolSpecs.pragueEOFDefinition(
chainId,
contractSizeLimit,
evmStackSize,
isRevertReasonEnabled,
genesisConfigOptions,
evmConfiguration,
miningParameters);
}

/**
* The "future" fork consists of EIPs that have been approved for Ethereum Mainnet but not
* scheduled for a fork. This is also known as "Eligible For Inclusion" (EFI) or "Considered for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator;
import org.hyperledger.besu.evm.gascalculator.LondonGasCalculator;
import org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator;
import org.hyperledger.besu.evm.gascalculator.PragueEOFGasCalculator;
import org.hyperledger.besu.evm.gascalculator.PragueGasCalculator;
import org.hyperledger.besu.evm.gascalculator.ShanghaiGasCalculator;
import org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator;
Expand Down Expand Up @@ -735,9 +736,6 @@ static ProtocolSpecBuilder pragueDefinition(
final GenesisConfigOptions genesisConfigOptions,
final EvmConfiguration evmConfiguration,
final MiningParameters miningParameters) {
final int contractSizeLimit =
configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
final int stackSizeLimit = configStackSizeLimit.orElse(MessageFrame.DEFAULT_MAX_STACK_SIZE);

final Address depositContractAddress =
genesisConfigOptions.getDepositContractAddress().orElse(DEFAULT_DEPOSIT_CONTRACT_ADDRESS);
Expand All @@ -750,47 +748,64 @@ static ProtocolSpecBuilder pragueDefinition(
genesisConfigOptions,
evmConfiguration,
miningParameters)
// EVM changes to support EOF EIPs (3670, 4200, 4750, 5450)
// EIP-3074 AUTH and AUTCALL gas
.gasCalculator(PragueGasCalculator::new)
// EIP-3074 AUTH and AUTCALL
.evmBuilder(
(gasCalculator, jdCacheConfig) ->
MainnetEVMs.prague(
gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration))
// change contract call creator to accept EOF code

// EIP-2537 BLS12-381 precompiles
.precompileContractRegistryBuilder(MainnetPrecompiledContractRegistries::prague)

// EIP-7002 Withdrawls / EIP-6610 Deposits / EIP-7685 Requests
.requestsValidator(pragueRequestsValidator(depositContractAddress))
// EIP-7002 Withdrawls / EIP-6610 Deposits / EIP-7685 Requests
.requestProcessorCoordinator(pragueRequestsProcessors(depositContractAddress))

// EIP-2935 Blockhash processor
.blockHashProcessor(new PragueBlockHashProcessor())
.name("Prague");
}

static ProtocolSpecBuilder pragueEOFDefinition(
final Optional<BigInteger> chainId,
final OptionalInt configContractSizeLimit,
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final GenesisConfigOptions genesisConfigOptions,
final EvmConfiguration evmConfiguration,
final MiningParameters miningParameters) {
final int contractSizeLimit =
configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);

return pragueDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,
enableRevertReason,
genesisConfigOptions,
evmConfiguration,
miningParameters)
// EIP-7692 EOF v1 Gas calculator
.gasCalculator(PragueEOFGasCalculator::new)
// EIP-7692 EOF v1 EVM and opcodes
.evmBuilder(
(gasCalculator, jdCacheConfig) ->
MainnetEVMs.pragueEOF(
gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration))
// EIP-7698 EOF v1 creation transaction
.contractCreationProcessorBuilder(
(gasCalculator, evm) ->
new ContractCreationProcessor(
gasCalculator,
evm,
true,
List.of(
MaxCodeSizeRule.of(contractSizeLimit), EOFValidationCodeRule.of(1, false)),
List.of(MaxCodeSizeRule.of(contractSizeLimit), EOFValidationCodeRule.of(1)),
1,
SPURIOUS_DRAGON_FORCE_DELETE_WHEN_EMPTY_ADDRESSES))
// warm blockahsh contract
.transactionProcessorBuilder(
(gasCalculator,
feeMarket,
transactionValidator,
contractCreationProcessor,
messageCallProcessor) ->
new MainnetTransactionProcessor(
gasCalculator,
transactionValidator,
contractCreationProcessor,
messageCallProcessor,
true,
true,
stackSizeLimit,
feeMarket,
CoinbaseFeePriceCalculator.eip1559()))

// use prague precompiled contracts
.precompileContractRegistryBuilder(MainnetPrecompiledContractRegistries::prague)
.requestsValidator(pragueRequestsValidator(depositContractAddress))
.requestProcessorCoordinator(pragueRequestsProcessors(depositContractAddress))
.blockHashProcessor(new PragueBlockHashProcessor())
.name("Prague");
.name("PragueEOF");
}

static ProtocolSpecBuilder futureEipsDefinition(
Expand All @@ -803,7 +818,7 @@ static ProtocolSpecBuilder futureEipsDefinition(
final MiningParameters miningParameters) {
final int contractSizeLimit =
configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
return pragueDefinition(
return pragueEOFDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,
Expand All @@ -823,8 +838,7 @@ static ProtocolSpecBuilder futureEipsDefinition(
gasCalculator,
evm,
true,
List.of(
MaxCodeSizeRule.of(contractSizeLimit), EOFValidationCodeRule.of(1, false)),
List.of(MaxCodeSizeRule.of(contractSizeLimit), EOFValidationCodeRule.of(1)),
1,
SPURIOUS_DRAGON_FORCE_DELETE_WHEN_EMPTY_ADDRESSES))
// use future configured precompiled contracts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult;
import org.hyperledger.besu.ethereum.transaction.TransactionInvalidReason;
import org.hyperledger.besu.ethereum.trie.MerkleTrieException;
import org.hyperledger.besu.evm.Code;
import org.hyperledger.besu.evm.account.Account;
import org.hyperledger.besu.evm.account.MutableAccount;
import org.hyperledger.besu.evm.code.CodeInvalid;
import org.hyperledger.besu.evm.code.CodeV0;
import org.hyperledger.besu.evm.frame.ExceptionalHaltReason;
import org.hyperledger.besu.evm.frame.MessageFrame;
Expand Down Expand Up @@ -382,13 +384,14 @@ public TransactionProcessingResult processTransaction(
Address.contractAddress(senderAddress, sender.getNonce() - 1L);

final Bytes initCodeBytes = transaction.getPayload();
Code code = contractCreationProcessor.getCodeFromEVMForCreation(initCodeBytes);
initialFrame =
commonMessageFrameBuilder
.type(MessageFrame.Type.CONTRACT_CREATION)
.address(contractAddress)
.contract(contractAddress)
.inputData(Bytes.EMPTY)
.code(contractCreationProcessor.getCodeFromEVMUncached(initCodeBytes))
.inputData(initCodeBytes.slice(code.getSize()))
shemnon marked this conversation as resolved.
Show resolved Hide resolved
.code(code)
.build();
} else {
@SuppressWarnings("OptionalGetWithoutIsPresent") // isContractCall tests isPresent
Expand All @@ -415,12 +418,17 @@ public TransactionProcessingResult processTransaction(
} else {
initialFrame.setState(MessageFrame.State.EXCEPTIONAL_HALT);
initialFrame.setExceptionalHaltReason(Optional.of(ExceptionalHaltReason.INVALID_CODE));
validationResult =
ValidationResult.invalid(
TransactionInvalidReason.EOF_CODE_INVALID,
((CodeInvalid) initialFrame.getCode()).getInvalidReason());
}

if (initialFrame.getState() == MessageFrame.State.COMPLETED_SUCCESS) {
worldUpdater.commit();
} else {
if (initialFrame.getExceptionalHaltReason().isPresent()) {
if (initialFrame.getExceptionalHaltReason().isPresent()
&& initialFrame.getCode().isValid()) {
validationResult =
ValidationResult.invalid(
TransactionInvalidReason.EXECUTION_HALTED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ private void validateEthereumForkOrdering() {
lastForkBlock = validateForkOrder("Shanghai", config.getShanghaiTime(), lastForkBlock);
lastForkBlock = validateForkOrder("Cancun", config.getCancunTime(), lastForkBlock);
lastForkBlock = validateForkOrder("Prague", config.getPragueTime(), lastForkBlock);
lastForkBlock = validateForkOrder("PragueEOF", config.getPragueEOFTime(), lastForkBlock);
lastForkBlock = validateForkOrder("FutureEips", config.getFutureEipsTime(), lastForkBlock);
lastForkBlock =
validateForkOrder("ExperimentalEips", config.getExperimentalEipsTime(), lastForkBlock);
Expand Down Expand Up @@ -331,6 +332,7 @@ private Stream<Optional<BuilderMapEntry>> createMilestones(
timestampMilestone(config.getShanghaiTime(), specFactory.shanghaiDefinition(config)),
timestampMilestone(config.getCancunTime(), specFactory.cancunDefinition(config)),
timestampMilestone(config.getPragueTime(), specFactory.pragueDefinition(config)),
timestampMilestone(config.getPragueEOFTime(), specFactory.pragueEOFDefinition(config)),
timestampMilestone(config.getFutureEipsTime(), specFactory.futureEipsDefinition(config)),
timestampMilestone(
config.getExperimentalEipsTime(), specFactory.experimentalEipsDefinition(config)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult;
import org.hyperledger.besu.ethereum.transaction.TransactionInvalidReason;
import org.hyperledger.besu.evm.Code;
import org.hyperledger.besu.evm.account.Account;
import org.hyperledger.besu.evm.account.MutableAccount;
import org.hyperledger.besu.evm.code.CodeV0;
Expand Down Expand Up @@ -138,13 +139,14 @@ public TransactionProcessingResult processTransaction(
privacyGroupId);

final Bytes initCodeBytes = transaction.getPayload();
Code code = contractCreationProcessor.getCodeFromEVMForCreation(initCodeBytes);
initialFrame =
commonMessageFrameBuilder
.type(MessageFrame.Type.CONTRACT_CREATION)
.address(privateContractAddress)
.contract(privateContractAddress)
.inputData(Bytes.EMPTY)
.code(contractCreationProcessor.getCodeFromEVMUncached(initCodeBytes))
.inputData(initCodeBytes.slice(code.getSize()))
.code(code)
.build();
} else {
final Address to = transaction.getTo().get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public enum TransactionInvalidReason {
INVALID_BLOBS,
PLUGIN_TX_POOL_VALIDATOR,
EXECUTION_HALTED,
EOF_CODE_INVALID,
// Private Transaction Invalid Reasons
PRIVATE_TRANSACTION_INVALID,
PRIVATE_TRANSACTION_FAILED,
Expand Down
Loading
Loading