-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing logics and validations from services p1 (#8157)
**AccessorBasedUsages#estimateCryptoTransfer - token multiplier** Add `MirrorNodeEvmProperties` in `AccessorBasedUsages`, `ServiceConfiguration`. Add `feesTransferUsageMultiplier` with default value 380 in `MirrorNodeEvmProperties`. Set token multiplier value from `mirrorNodeEvmProperties` in `AccessorBasedUsages`. Modification in `AccessorBasedUsagesTest`. **HederaSelfDestructOperationV038 - reasonToHalt missing if statements** Add `contractIsTokenTreasury`, `contractHasAnyBalance`, `contractOwnsNfts` in` HederaEvmStackedWorldStateUpdater`, because they are needed in `reasonToHalt` statements. Add more tests in `HederaSelfDestructOperationV038 `- `rejectsSelfDestructIfTreasury()`, `rejectsSelfDestructIfContractHasAnyTokenBalance()`, `rejectsSelfDestructIfContractHasAnyNfts()`. **AbstractAutoCreationLogic#create - missing analyzeTokenTransferCreations part** Add `tokenAliasMap`, `analyzeTokenTransferCreations` and `reset` in `AbstractAutoCreationLogic`. Add `getTokenAliasMap` in `AutoCreationLogic`. Add needed modifications in `MirrorEvmMessageCallProcessorTest`, `TransferLogicTest`, `SyntheticTxnFactoryTest`, `TransferPrecompileTest`. Add new tests in `AutoCreationLogicTest`. **SyntethicTxnFactory#createHollowAccount - setMaxAutomaticTokenAssociations** Add `maxAutoAssociations`in `createHollowAccount`. --------- Signed-off-by: Zhivko Petkov <zhpetkov9@gmail.com> Signed-off-by: Zhivko Petkov <119669063+zhpetkov@users.noreply.github.com>
- Loading branch information
Showing
37 changed files
with
880 additions
and
321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...in/java/com/hedera/services/evm/contracts/operations/HederaSelfDestructOperationBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.hedera.services.evm.contracts.operations; | ||
|
||
import com.hedera.mirror.web3.evm.store.contract.HederaEvmStackedWorldStateUpdater; | ||
import com.hedera.node.app.service.evm.contracts.operations.HederaExceptionalHaltReason; | ||
import edu.umd.cs.findbugs.annotations.Nullable; | ||
import org.hyperledger.besu.datatypes.Address; | ||
import org.hyperledger.besu.datatypes.Wei; | ||
import org.hyperledger.besu.evm.account.Account; | ||
import org.hyperledger.besu.evm.frame.ExceptionalHaltReason; | ||
import org.hyperledger.besu.evm.gascalculator.GasCalculator; | ||
import org.hyperledger.besu.evm.operation.SelfDestructOperation; | ||
|
||
public class HederaSelfDestructOperationBase extends SelfDestructOperation { | ||
|
||
public HederaSelfDestructOperationBase(final GasCalculator gasCalculator) { | ||
super(gasCalculator); | ||
} | ||
|
||
@Nullable | ||
protected ExceptionalHaltReason reasonToHalt(final Address toBeDeleted, | ||
final Address beneficiaryAddress, | ||
final HederaEvmStackedWorldStateUpdater updater) { | ||
if (toBeDeleted.equals(beneficiaryAddress)) { | ||
return HederaExceptionalHaltReason.SELF_DESTRUCT_TO_SELF; | ||
} | ||
|
||
if (updater.contractIsTokenTreasury(toBeDeleted)) { | ||
return HederaExceptionalHaltReason.CONTRACT_IS_TREASURY; | ||
} | ||
|
||
if (updater.contractHasAnyBalance(toBeDeleted)) { | ||
return HederaExceptionalHaltReason.TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES; | ||
} | ||
|
||
if (updater.contractOwnsNfts(toBeDeleted)) { | ||
return HederaExceptionalHaltReason.CONTRACT_STILL_OWNS_NFTS; | ||
} | ||
return null; | ||
} | ||
|
||
protected OperationResult reversionWith(final Account beneficiary, final ExceptionalHaltReason reason) { | ||
final long cost = gasCalculator().selfDestructOperationGasCost(beneficiary, Wei.ONE); | ||
return new OperationResult(cost, reason); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.