Skip to content

Commit

Permalink
Enable the rest of the Ethereum E2Es (#4879)
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitar Dinev <mitkojc@gmail.com>
  • Loading branch information
dimitar-dinev committed Feb 28, 2023
1 parent 8553ce0 commit 6c8fb62
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.hedera.node.app.service.mono.utils.EntityIdUtils.EVM_ADDRESS_SIZE;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.CONTRACT_NEGATIVE_GAS;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.CONTRACT_NEGATIVE_VALUE;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_ACCOUNT_ID;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_CONTRACT_ID;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.MAX_GAS_LIMIT_EXCEEDED;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.OK;
Expand Down Expand Up @@ -123,7 +122,7 @@ public void doStateTransitionOperation(
&& properties.isLazyCreationEnabled()) {
// allow Ethereum transactions to lazy create a hollow account
// if `to` is non-existent and `value` is non-zero
validateTrue(op.getAmount() > 0, INVALID_ACCOUNT_ID);
validateTrue(op.getAmount() > 0, INVALID_CONTRACT_ID);
final var evmAddress = op.getContractID().getEvmAddress();
validateTrue(evmAddress.size() == EVM_ADDRESS_SIZE, INVALID_CONTRACT_ID);
receiver = new Account(evmAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static com.hedera.test.utils.TxnUtils.assertFailsWith;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.CONTRACT_NEGATIVE_GAS;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.CONTRACT_NEGATIVE_VALUE;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_ACCOUNT_ID;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_CONTRACT_ID;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.MAX_GAS_LIMIT_EXCEEDED;
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.OK;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
Expand Down Expand Up @@ -387,7 +387,7 @@ void verifyEthLazyCreateThrowsWhenAmountIsZero() {
relayerAccount.getId(),
maxGas,
biOfferedGasPrice),
INVALID_ACCOUNT_ID);
INVALID_CONTRACT_ID);
}

@Test
Expand Down
58 changes: 0 additions & 58 deletions test-clients/src/eet/java/EndToEndTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,6 @@ Collection<DynamicContainer> contractOpenZeppelin() {
);
}

@Tag("contract")
@Tag("contract.openzeppelin.eth")
@TestFactory
Collection<DynamicContainer> contractOpenZeppelinEth() {
return List.of(
// extractSpecsFromSuiteForEth(ERC20ContractInteractions::new),
// extractSpecsFromSuiteForEth(ERC721ContractInteractions::new),
// extractSpecsFromSuiteForEth(ERC1155ContractInteractions::new)
);
}

@Tag("contract")
@Tag("contract.records")
@TestFactory
Expand All @@ -172,16 +161,6 @@ Collection<DynamicContainer> contractRecords() {
);
}

@Tag("contract")
@Tag("contract.records.eth")
@TestFactory
Collection<DynamicContainer> contractRecordsEth() {
return List.of(
// extractSpecsFromSuiteForEth(LogsSuite::new),
// extractSpecsFromSuiteForEth(RecordsSuite::new)
);
}

@Tag("contract")
@Tag("contract.opcodes")
@TestFactory
Expand All @@ -202,26 +181,6 @@ Collection<DynamicContainer> contractOpcodes() {
);
}

@Tag("contract")
@Tag("contract.opcodes.eth")
@TestFactory
Collection<DynamicContainer> contractOpcodesEth() {
return List.of(
// extractSpecsFromSuiteForEth(BalanceOperationSuite::new),
// extractSpecsFromSuiteForEth(CallCodeOperationSuite::new),
// extractSpecsFromSuiteForEth(CallOperationSuite::new),
// extractSpecsFromSuiteForEth(CreateOperationSuite::new),
// extractSpecsFromSuiteForEth(DelegateCallOperationSuite::new),
// extractSpecsFromSuiteForEth(ExtCodeCopyOperationSuite::new),
// extractSpecsFromSuiteForEth(ExtCodeHashOperationSuite::new),
// extractSpecsFromSuiteForEth(ExtCodeSizeOperationSuite::new),
// extractSpecsFromSuiteForEth(GlobalPropertiesSuite::new),
// extractSpecsFromSuiteForEth(StaticCallOperationSuite::new),
// extractSpecsFromSuiteForEth(SelfDestructSuite::new),
// extractSpecsFromSuiteForEth(SStoreSuite::new)
);
}

@Tag("contract")
@Tag("contract.hapi")
@TestFactory
Expand All @@ -239,23 +198,6 @@ Collection<DynamicContainer> contractHapi() {
});
}

@Tag("contract")
@Tag("contract.hapi.eth")
@TestFactory
Collection<DynamicContainer> contractHapiEth() {
return List.of(
new DynamicContainer[] {
// extractSpecsFromSuiteForEth(ContractCallLocalSuite::new),
// extractSpecsFromSuiteForEth(ContractCallSuite::new),
// extractSpecsFromSuiteForEth(ContractCreateSuite::new),
// extractSpecsFromSuiteForEth(ContractDeleteSuite::new),
// extractSpecsFromSuiteForEth(ContractGetBytecodeSuite::new),
// extractSpecsFromSuiteForEth(ContractGetInfoSuite::new),
// extractSpecsFromSuiteForEth(ContractMusicalChairsSuite::new),
// extractSpecsFromSuiteForEth(ContractUpdateSuite::new)
});
}

@Tag("crypto")
@TestFactory
Collection<DynamicContainer> crypto() {
Expand Down
31 changes: 30 additions & 1 deletion test-clients/src/itest/java/ConcurrentSuites.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ static Supplier<HapiSuite>[] all() {
CryptoUpdateSuite::new,
SelfDestructSuite::new,
// contract.hapi
LogsSuite::new,
ContractCallLocalSuite::new,
ContractCallSuite::new,
ContractCreateSuite::new,
Expand Down Expand Up @@ -183,6 +182,7 @@ static Supplier<HapiSuite>[] all() {
TokenUpdatePrecompileSuite::new,
WipeTokenAccountPrecompileSuite::new,
// contract.records
LogsSuite::new,
RecordsSuite::new,
// contract.ethereum
EthereumSuite::new,
Expand Down Expand Up @@ -225,6 +225,35 @@ static Supplier<HapiSuite>[] ethereumSuites() {
TokenInfoHTSSuite::new,
TokenUpdatePrecompileSuite::new,
WipeTokenAccountPrecompileSuite::new,
// contract opcodes
BalanceOperationSuite::new,
CallCodeOperationSuite::new,
CallOperationSuite::new,
CreateOperationSuite::new,
DelegateCallOperationSuite::new,
ExtCodeCopyOperationSuite::new,
ExtCodeHashOperationSuite::new,
ExtCodeSizeOperationSuite::new,
GlobalPropertiesSuite::new,
SelfDestructSuite::new,
SStoreSuite::new,
StaticCallOperationSuite::new,
// contract.hapi
ContractCallLocalSuite::new,
ContractCallSuite::new,
ContractCreateSuite::new,
ContractDeleteSuite::new,
ContractGetBytecodeSuite::new,
ContractGetInfoSuite::new,
ContractMusicalChairsSuite::new,
ContractUpdateSuite::new,
// contracts.openZeppelin
ERC20ContractInteractions::new,
ERC721ContractInteractions::new,
ERC1155ContractInteractions::new,
// contract.records
RecordsSuite::new,
LogsSuite::new,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2800,14 +2800,16 @@ private HapiSpec lpFarmSimulation() {
farm,
setSauceAbi,
asHeadlongAddress(sauceAddr.get()))
.gas(gasToOffer)),
.gas(gasToOffer)
.refusingEthConversion()),
sourcing(
() ->
contractCallWithFunctionAbi(
farm,
transferAbi,
asHeadlongAddress(ownerAddr.get()))
.gas(gasToOffer)))
.gas(gasToOffer)
.refusingEthConversion()))
.when(
sourcing(
() ->
Expand All @@ -2818,7 +2820,8 @@ private HapiSpec lpFarmSimulation() {
asHeadlongAddress(lpTokenAddr.get()))
.via("add")
.payingWith(OWNER)
.gas(gasToOffer)),
.gas(gasToOffer)
.refusingEthConversion()),
newKeyNamed("contractControl").shape(KeyShape.CONTRACT.signedWith(farm)),
tokenUpdate(sauce).supplyKey("contractControl"),
sourcing(
Expand All @@ -2830,7 +2833,8 @@ private HapiSpec lpFarmSimulation() {
BigInteger.valueOf(100_000))
.sending(ONE_HUNDRED_HBARS)
.payingWith(dev)
.gas(gasToOffer)),
.gas(gasToOffer)
.refusingEthConversion()),
sleepFor(1000),
sourcing(
() ->
Expand All @@ -2842,7 +2846,8 @@ private HapiSpec lpFarmSimulation() {
.sending(ONE_HUNDRED_HBARS)
.payingWith(dev)
.gas(gasToOffer)
.via("second")),
.via("second")
.refusingEthConversion()),
getTxnRecord("second").andAllChildRecords().logged())
.then(
sourcing(
Expand All @@ -2853,7 +2858,8 @@ private HapiSpec lpFarmSimulation() {
BigInteger.ZERO,
BigInteger.valueOf(200_000))
.payingWith(dev)
.gas(gasToOffer)));
.gas(gasToOffer)
.refusingEthConversion()));
}

private HapiSpec consTimeManagementWorksWithRevertedInternalCreations() {
Expand Down

0 comments on commit 6c8fb62

Please sign in to comment.