Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 0 additions & 29 deletions framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -159,35 +159,6 @@ test {
}
}

task stest(type: Test) {

useTestNG {
suites(file('src/test/resources/testng.xml'))
parallel 'tests'
threadCount 4

}

testLogging {
exceptionFormat = 'full'
showStackTraces = "true"
}

jacoco {
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpDir = file("$buildDir/jacoco/classpathdumps")
}
}

task dailyBuild(type: Test) {
useTestNG {
suites(file('src/test/resources/daily-build.xml'))
parallel 'tests'
threadCount 1
}
}


jacocoTestReport {
reports {
xml.enabled true
Expand Down
12 changes: 1 addition & 11 deletions framework/src/main/resources/config-localtest.conf
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ genesis.block = {
accountType = "AssetIssue"
address = "TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW"
balance = "25000000000000000"
#priKey = D95611A9AF2A2A45359106222ED1AFED48853D9A44DEFF8DC7913F5CBA727366
#password = 2VYRqa8qKkU1kQYiLtGv7UiFPZpE3v+Nx5E/XLpyc2Y=
},

# the account of payment
Expand All @@ -198,8 +196,6 @@ genesis.block = {
accountType = "AssetIssue"
address = "TGehVcNhud84JDCGrNHKVz9jEAVKUpbuiv"
balance = "10000000000000000"
#priKey = cba92a516ea09f620a16ff7ee95ce0df1d56550a8babe9964981a7144c8a784a
#password = y6kqUW6gn2IKFv9+6Vzg3x1WVQqLq+mWSYGnFEyKeEo=
},

# the account of coin burn
Expand All @@ -208,8 +204,6 @@ genesis.block = {
accountType = "AssetIssue"
address = "THKrowiEfCe8evdbaBzDDvQjM5DGeB3s3F"
balance = "-9223372036854775808"
#priKey = 8E812436A0E3323166E1F0E8BA79E19E217B2C4A53C970D4CCA0CFB1078979DF
#password = joEkNqDjMjFm4fDounnhniF7LEpTyXDUzKDPsQeJed8=
}
]

Expand All @@ -218,27 +212,23 @@ genesis.block = {
address: TN3zfjYUmMFK3ZsHSsrdJoNRtGkQmZLBLz
url = "http://Test.org",
voteCount = 106
#priKey = f4df789d3210ac881cb900464dd30409453044d2777060a0c391cbdf4c6a4f57 6666
},
// {
// address: TPrLL5ckUdMaPNgJYmGv23qtYjBE34aBf8
// url = "http://Mercury.org",
// voteCount = 105
// #priKey = f5583fd20e13073900a513f333ed13db8c9e83e7e3cf37e74adacef96c5afeaa 7777
// },
// {
// address: TEZBh76rouEQpB2zqYVopbRXGx7RfyWorT
// #address: 27TfVERREG3FeWMHEAQ95tWHG4sb3ANn3Qe
// url = "http://Venus.org",
// voteCount = 104
// #priKey = 9f5c5e48bf87cf92017313082e8cf0f58ccfce423097f0fcebf801695fc99bd4 8888
// },
// {
// address: TN27wbfCLEN1gP2PZAxHgU3QZrntsLyxdj
// #address: 27b8RUuyZnNPFNZGct2bZkNu9MnGWNAdH3Z
// url = "http://Earth.org",
// voteCount = 103
// #priKey = 6781f44d9a2083b14fad1702b8e9ba82749162b795e2fc3f136192fc63f80de2 9999
// },
]

Expand All @@ -256,7 +246,7 @@ genesis.block = {
//localWitnessAccountAddress = TN3zfjYUmMFK3ZsHSsrdJoNRtGkQmZLBLz

localwitness = [
f4df789d3210ac881cb900464dd30409453044d2777060a0c391cbdf4c6a4f57

]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
import org.tron.common.crypto.sm2.SM2;
import org.tron.common.utils.Sha256Hash;

/**
* The reason the test case uses the private key plaintext is to ensure that,
* after the ECkey tool or algorithm is upgraded,
* the upgraded differences can be verified.
*/
public class BouncyCastleTest {

private String privString = "c85ef7d79691fe79573b1a7064c19c1a9819ebdbd1faaab1a8ec92344438aaf4";
Expand Down
5 changes: 5 additions & 0 deletions framework/src/test/java/org/tron/common/crypto/ECKeyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
import org.tron.common.crypto.ECKey.ECDSASignature;
import org.tron.core.Wallet;

/**
* The reason the test case uses the private key plaintext is to ensure that,
* after the ECkey tool or algorithm is upgraded,
* the upgraded differences can be verified.
*/
@Slf4j
public class ECKeyTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
import org.tron.common.crypto.sm2.SM2Signer;
import org.tron.core.Wallet;

/**
* The reason the test case uses the private key plaintext is to ensure that,
* after the ECkey tool or algorithm is upgraded,
* the upgraded differences can be verified.
*/
@Slf4j
public class SM2KeyTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,26 @@
import org.bouncycastle.util.encoders.Hex;
import org.junit.Test;
import org.tron.common.crypto.sm2.SM2;
import org.tron.common.utils.PublicMethod;


@Slf4j
public class SignatureInterfaceTest {

private String SM2_privString = "128B2FA8BD433C6C068C8D803DFF79792A519A5517"
+ "1B1B650C23661D15897263";
private String SM2_privString = PublicMethod.getSM2RandomPrivateKey();
private byte[] SM2_privateKey = Hex.decode(SM2_privString);

private String SM2_pubString = "04d5548c7825cbb56150a3506cd57464af8a1ae0519"
+ "dfaf3c58221dc810caf28dd921073768fe3d59ce54e79a49445cf73fed23086537"
+ "027264d168946d479533e";
private String SM2_compressedPubString =
"02d5548c7825cbb56150a3506cd57464af8a1ae0519dfaf3c58221dc810caf28dd";
private String SM2_pubString = PublicMethod.getSM2PublicByPrivateKey(SM2_privString);
private byte[] SM2_pubKey = Hex.decode(SM2_pubString);
private byte[] SM2_compressedPubKey = Hex.decode(SM2_compressedPubString);
private String SM2_address = "62e49e4c2f4e3c0653a02f8859c1e6991b759e87";
private String SM2_address = PublicMethod.getSM2AddressByPrivateKey(SM2_privString);


private String EC_privString = "c85ef7d79691fe79573b1a7064c19c1a9819ebdbd1faaab1a8ec92344438aaf4";
private String EC_privString = PublicMethod.getRandomPrivateKey();
private byte[] EC_privateKey = Hex.decode(EC_privString);

private String EC_pubString = "040947751e3022ecf3016be03ec77ab0ce3c2662b4843898cb068d74f698ccc"
+ "8ad75aa17564ae80a20bb044ee7a6d903e8e8df624b089c95d66a0570f051e5a05b";
private String EC_compressedPubString =
"030947751e3022ecf3016be03ec77ab0ce3c2662b4843898cb068d74f6" + "98ccc8ad";
private String EC_pubString = PublicMethod.getPublicByPrivateKey(EC_privString);
private byte[] EC_pubKey = Hex.decode(EC_pubString);
private byte[] EC_compressedPubKey = Hex.decode(EC_compressedPubString);
private String EC_address = "cd2a3d9f938e13cd947ec05abc7fe734df8dd826";
private String EC_address = PublicMethod.getHexAddressByPrivateKey(EC_privString);



@Test
Expand Down Expand Up @@ -83,11 +74,12 @@ public void testAddress() {
SignInterface sign = new SM2(SM2_pubKey, false);
byte[] prefix_address = sign.getAddress();
byte[] address = Arrays.copyOfRange(prefix_address, 1, prefix_address.length);
assertEquals(SM2_address, Hex.toHexString(address));

byte[] addressTmp = Arrays.copyOfRange(Hex.decode(SM2_address), 1, prefix_address.length);
assertEquals(Hex.toHexString(addressTmp), Hex.toHexString(address));
sign = new ECKey(EC_pubKey, false);
prefix_address = sign.getAddress();
address = Arrays.copyOfRange(prefix_address, 1, prefix_address.length);
assertEquals(EC_address, Hex.toHexString(address));
byte[] ecAddressTmp = Arrays.copyOfRange(Hex.decode(EC_address), 1, prefix_address.length);
assertEquals(Hex.toHexString(ecAddressTmp), Hex.toHexString(address));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.util.encoders.Hex;
import org.tron.common.crypto.Hash;
import org.tron.common.utils.PublicMethod;
import org.tron.common.utils.WalletUtil;
import org.tron.common.utils.client.Parameter.CommonConstant;
import org.tron.common.utils.client.WalletClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.tron.core.services.jsonrpc.TronJsonRpcImpl;
import org.tron.protos.Protocol.Transaction;


@Slf4j
public class Create2Test extends VMTestBase {
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.junit.Test;
import org.tron.common.utils.ByteArray;
import org.tron.common.utils.FileUtil;
import org.tron.common.utils.PublicMethod;
import org.tron.core.Constant;
import org.tron.core.config.args.Args;
import org.tron.core.db2.common.WrappedByteArray;
Expand Down Expand Up @@ -86,7 +87,7 @@ public void initDb() {
@Test
public void testPutGet() {
dataSourceTest.resetDb();
String key1 = "2c0937534dd1b3832d05d865e8e6f2bf23218300b33a992740d45ccab7d4f519";
String key1 = PublicMethod.getRandomPrivateKey();
byte[] key = key1.getBytes();
dataSourceTest.initDB();
String value1 = "50000";
Expand Down Expand Up @@ -115,9 +116,9 @@ public void testupdateByBatchInner() {
Args.getInstance().getOutputDirectory(), "test_updateByBatch");
dataSource.initDB();
dataSource.resetDb();
String key1 = "431cd8c8d5abe5cb5944b0889b32482d85772fbb98987b10fbb7f17110757350";
String key1 = PublicMethod.getRandomPrivateKey();
String value1 = "50000";
String key2 = "431cd8c8d5abe5cb5944b0889b32482d85772fbb98987b10fbb7f17110757351";
String key2 = PublicMethod.getRandomPrivateKey();
String value2 = "10000";

Map<byte[], byte[]> rows = new HashMap<>();
Expand All @@ -137,7 +138,7 @@ public void testdeleteData() {
LevelDbDataSourceImpl dataSource = new LevelDbDataSourceImpl(
Args.getInstance().getOutputDirectory(), "test_delete");
dataSource.initDB();
String key1 = "431cd8c8d5abe5cb5944b0889b32482d85772fbb98987b10fbb7f17110757350";
String key1 = PublicMethod.getRandomPrivateKey();
byte[] key = key1.getBytes();
dataSource.deleteData(key);
byte[] value = dataSource.getData(key);
Expand All @@ -153,14 +154,14 @@ public void testallKeys() {
dataSource.initDB();
dataSource.resetDb();

String key1 = "431cd8c8d5abe5cb5944b0889b32482d85772fbb98987b10fbb7f17110757321";
String key1 = PublicMethod.getRandomPrivateKey();
byte[] key = key1.getBytes();

String value1 = "50000";
byte[] value = value1.getBytes();

dataSource.putData(key, value);
String key3 = "431cd8c8d5abe5cb5944b0889b32482d85772fbb98987b10fbb7f17110757091";
String key3 = PublicMethod.getRandomPrivateKey();
byte[] key2 = key3.getBytes();

String value3 = "30000";
Expand Down Expand Up @@ -331,4 +332,4 @@ public void prefixQueryTest() {
dataSource.resetDb();
dataSource.closeDB();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.tron.common.utils.ByteArray;
import org.tron.common.utils.FileUtil;
import org.tron.common.utils.PropUtil;
import org.tron.common.utils.PublicMethod;
import org.tron.core.config.args.Args;
import org.tron.core.db2.common.WrappedByteArray;

Expand Down Expand Up @@ -76,7 +77,7 @@ public static void initDb() {
@Test
public void testPutGet() {
dataSourceTest.resetDb();
String key1 = "2c0937534dd1b3832d05d865e8e6f2bf23218300b33a992740d45ccab7d4f519";
String key1 = PublicMethod.getRandomPrivateKey();
byte[] key = key1.getBytes();
dataSourceTest.initDB();
String value1 = "50000";
Expand Down Expand Up @@ -105,9 +106,9 @@ public void testupdateByBatchInner() {
Args.getInstance().getOutputDirectory(), "test_updateByBatch");
dataSource.initDB();
dataSource.resetDb();
String key1 = "431cd8c8d5abe5cb5944b0889b32482d85772fbb98987b10fbb7f17110757350";
String key1 = PublicMethod.getRandomPrivateKey();
String value1 = "50000";
String key2 = "431cd8c8d5abe5cb5944b0889b32482d85772fbb98987b10fbb7f17110757351";
String key2 = PublicMethod.getRandomPrivateKey();
String value2 = "10000";

Map<byte[], byte[]> rows = new HashMap<>();
Expand All @@ -127,7 +128,7 @@ public void testdeleteData() {
RocksDbDataSourceImpl dataSource = new RocksDbDataSourceImpl(
Args.getInstance().getOutputDirectory(), "test_delete");
dataSource.initDB();
String key1 = "431cd8c8d5abe5cb5944b0889b32482d85772fbb98987b10fbb7f17110757350";
String key1 = PublicMethod.getRandomPrivateKey();
byte[] key = key1.getBytes();
dataSource.deleteData(key);
byte[] value = dataSource.getData(key);
Expand All @@ -143,14 +144,14 @@ public void testallKeys() {
dataSource.initDB();
dataSource.resetDb();

String key1 = "431cd8c8d5abe5cb5944b0889b32482d85772fbb98987b10fbb7f17110757321";
String key1 = PublicMethod.getRandomPrivateKey();
byte[] key = key1.getBytes();

String value1 = "50000";
byte[] value = value1.getBytes();

dataSource.putData(key, value);
String key3 = "431cd8c8d5abe5cb5944b0889b32482d85772fbb98987b10fbb7f17110757091";
String key3 = PublicMethod.getRandomPrivateKey();
byte[] key2 = key3.getBytes();

String value3 = "30000";
Expand Down
Loading