2626import org .tron .core .config .args .Args ;
2727import org .tron .core .exception .ContractValidateException ;
2828import org .tron .core .store .StoreFactory ;
29- import org .tron .core .vm .EnergyCost ;
30- import org .tron .core .vm .JumpTable ;
31- import org .tron .core .vm .Op ;
32- import org .tron .core .vm .Operation ;
33- import org .tron .core .vm .OperationRegistry ;
34- import org .tron .core .vm .VM ;
29+ import org .tron .core .vm .*;
3530import org .tron .core .vm .config .ConfigLoader ;
3631import org .tron .core .vm .config .VMConfig ;
3732import org .tron .core .vm .program .Program ;
@@ -891,6 +886,12 @@ public void testSuicideCost() throws ContractValidateException {
891886 Assert .assertEquals (25000 , EnergyCost .getSuicideCost2 (program ));
892887 invoke .getDeposit ().createAccount (receiver2 , Protocol .AccountType .Normal );
893888 Assert .assertEquals (0 , EnergyCost .getSuicideCost2 (program ));
889+
890+ byte [] receiver3 = generateRandomAddress ();
891+ program .stackPush (new DataWord (receiver3 ));
892+ Assert .assertEquals (30000 , EnergyCost .getSuicideCost2 (program ));
893+ invoke .getDeposit ().createAccount (receiver3 , Protocol .AccountType .Normal );
894+ Assert .assertEquals (5000 , EnergyCost .getSuicideCost2 (program ));
894895 }
895896
896897 @ Test
@@ -957,11 +958,14 @@ public void testSuicideAction2() throws ContractValidateException {
957958
958959 VMConfig .initAllowEnergyAdjustment (1 );
959960 VMConfig .initAllowTvmSelfdestructRestriction (1 );
961+ VMConfig .initAllowTvmFreeze (1 );
962+ VMConfig .initAllowTvmFreezeV2 (1 );
963+ VMConfig .initAllowTvmCompatibleEvm (1 );
964+ VMConfig .initAllowTvmVote (1 );
960965 byte prePrefixByte = DecodeUtil .addressPreFixByte ;
961966 DecodeUtil .addressPreFixByte = Constant .ADD_PRE_FIX_BYTE_MAINNET ;
962967
963- program .suicide2 (new DataWord (
964- dbManager .getAccountStore ().getBlackhole ().getAddress ().toByteArray ()));
968+ OperationActions .suicideAction2 (program );
965969
966970 Assert .assertEquals (1 , program .getResult ().getDeleteAccounts ().size ());
967971
@@ -984,6 +988,10 @@ public void testSuicideAction2() throws ContractValidateException {
984988 DecodeUtil .addressPreFixByte = prePrefixByte ;
985989 VMConfig .initAllowEnergyAdjustment (0 );
986990 VMConfig .initAllowTvmSelfdestructRestriction (0 );
991+ VMConfig .initAllowTvmFreeze (0 );
992+ VMConfig .initAllowTvmFreezeV2 (0 );
993+ VMConfig .initAllowTvmCompatibleEvm (0 );
994+ VMConfig .initAllowTvmVote (0 );
987995 }
988996
989997 @ Test
0 commit comments