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

AKI-603 Redesigned AionPendingStateImpl and Transaction pool #1120

Merged
merged 23 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d756294
added txpool constant for the txpool initial arguments settings
AionJayT Feb 22, 2020
b56ccd7
AKI-605 TxPoolV1 implementation
AionJayT Feb 28, 2020
9a4f608
AKI-605 added tests for TxPoolV1
AionJayT Feb 28, 2020
b163903
AKI-660 implemented pendingTxCacheV1
AionJayT Feb 24, 2020
be1e3cc
AKI-660 added tests for PendingTxCacheV1
AionJayT Feb 24, 2020
9ffb03b
AKI-604 revised transaction life cycle in the AionPendingState with p…
AionJayT Feb 28, 2020
7975018
revised PendingTxCacheV1 methods
AionJayT Feb 28, 2020
83caa53
move magic numbers and the property define to the Constant class
AionJayT Feb 28, 2020
ab4b61f
revised the poolBackup recovery in the pendingStateImpl
AionJayT Feb 27, 2020
752ca8c
revised cachePoolBackup feature
AionJayT Feb 27, 2020
aaa2f7c
removed&refactored the transaction backup methods in the repository l…
AionJayT Feb 27, 2020
baf60f8
refactor the TxResponse
AionJayT Feb 27, 2020
b8d3590
remove unnecessary check and the revised Exception message
AionJayT Feb 27, 2020
368c139
Added TX and TXPOOL default settings in the config file
AionJayT Feb 24, 2020
0651ff3
refactoring addPendingTransactions to small code pieces
AionJayT Feb 28, 2020
ba54185
revised blockEnergyLimit object in TxPoolV1 and exception message
AionJayT Feb 28, 2020
5896fc0
Added more unit tests in TxPoolV1
AionJayT Feb 28, 2020
4ccfec5
Added more unit tests in PendingTxCacheV1
AionJayT Feb 28, 2020
8716902
removed unused argument in the AionPendingStateImpl
AionJayT Feb 28, 2020
8a49e9d
added more pendingStateTest
AionJayT Feb 28, 2020
dbfd31f
adjust the TXPOOL log default level
AionJayT Feb 28, 2020
b91be69
Updated Jenkins setting
AionJayT Feb 28, 2020
bd727f1
Updated kernel version to 1.4
AionJayT Feb 28, 2020
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
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipeline {
'''.stripIndent()).trim()
}

triggers { cron('0 2 * * 6') }
triggers { cron('0 3 * * 6') }

stages {
stage('Build') {
Expand Down Expand Up @@ -133,7 +133,7 @@ pipeline {
timeout(time: 12, unit: 'HOURS') {
dir('pack') {
echo "Start mainnet sync test..."
sh('./oan/aion.sh e port=${P2P_PORT} log GEN=ERROR SYNC=ERROR CONS=ERROR DB=ERROR API=ERROR dev xs=5371168')
sh('./oan/aion.sh e port=${P2P_PORT} log GEN=ERROR SYNC=ERROR CONS=ERROR DB=ERROR API=ERROR dev fs')
echo "finished mainnet sync test..."
sh('rm -rf ./oan')
}
Expand Down
2 changes: 1 addition & 1 deletion modAionImpl/src/org/aion/zero/impl/Version.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.aion.zero.impl;

public class Version {
public static final String KERNEL_VERSION = "1.3";
public static final String KERNEL_VERSION = "1.4";
public static final String REPO_VERSION = "0.1.0";
public static final boolean FORK = true;
}
1 change: 0 additions & 1 deletion modAionImpl/src/org/aion/zero/impl/blockchain/AionHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ private void initializeHub(
blockchain,
cfg.getConsensus().getEnergyStrategy().getUpperBound(),
cfg.getTx().getTxPendingTimeout(),
cfg.getTx().getCacheMax(),
cfg.getTx().getPoolBackup(),
cfg.getTx().isSeedMode(),
cfg.getTx().getPoolDump(),
Expand Down

This file was deleted.

26 changes: 0 additions & 26 deletions modAionImpl/src/org/aion/zero/impl/db/AionRepositoryCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.aion.log.AionLoggerFactory;
Expand Down Expand Up @@ -588,18 +586,6 @@ public void syncToRoot(byte[] root) {
"The tracking cache cannot sync to root. \'Sync to root\' should be called on the tracked repository.");
}

@Override
public void addTxBatch(Map<byte[], byte[]> pendingTx, boolean isPool) {
throw new UnsupportedOperationException(
"addTxBatch should be called on the tracked repository.");
}

@Override
public void removeTxBatch(Set<byte[]> pendingTx, boolean isPool) {
throw new UnsupportedOperationException(
"removeTxBatch should be called on the tracked repository.");
}

@Override
public boolean isValidRoot(byte[] root) {
return this.repository.isValidRoot(root);
Expand All @@ -610,18 +596,6 @@ public boolean isIndexed(byte[] hash, long level) {
return repository.isIndexed(hash, level);
}

@Override
public List<byte[]> getPoolTx() {
throw new UnsupportedOperationException(
"getPoolTx should be called on the tracked repository.");
}

@Override
public List<byte[]> getCacheTx() {
throw new UnsupportedOperationException(
"getCachelTx should be called on the tracked repository.");
}

public InternalVmType getVMUsed(AionAddress contract, byte[] codeHash) {
return repository.getVMUsed(contract, codeHash);
}
Expand Down
70 changes: 50 additions & 20 deletions modAionImpl/src/org/aion/zero/impl/db/AionRepositoryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ public ByteArrayWrapper getStorageValue(AionAddress address, ByteArrayWrapper ke
return (details == null) ? null : details.get(key);
}

@Override
public List<byte[]> getPoolTx() {
public final List<byte[]> getPoolTx() {

List<byte[]> rtn = new ArrayList<>();
rwLock.readLock().lock();
Expand All @@ -344,8 +343,7 @@ public List<byte[]> getPoolTx() {
return rtn;
}

@Override
public List<byte[]> getCacheTx() {
public final List<byte[]> getCacheTx() {

List<byte[]> rtn = new ArrayList<>();
rwLock.readLock().lock();
Expand Down Expand Up @@ -650,39 +648,53 @@ public Repository getSnapshotTo(byte[] root) {
}
}

@Override
public void addTxBatch(Map<byte[], byte[]> pendingTx, boolean isPool) {
public void addPooledTxToDB(Map<byte[], byte[]> pooledTx) {
if (pooledTx.isEmpty()) {
return;
}

rwLock.writeLock().lock();
try {
txPoolDatabase.putBatch(pooledTx);
} finally {
rwLock.writeLock().unlock();
}
}

if (pendingTx.isEmpty()) {
public void addCachedTxToDB(Map<byte[], byte[]> cachedTx) {
if (cachedTx.isEmpty()) {
return;
}

rwLock.writeLock().lock();
try {
if (isPool) {
txPoolDatabase.putBatch(pendingTx);
} else {
pendingTxCacheDatabase.putBatch(pendingTx);
}
pendingTxCacheDatabase.putBatch(cachedTx);
} finally {
rwLock.writeLock().unlock();
}
}

@Override
public void removeTxBatch(Set<byte[]> clearTxSet, boolean isPool) {
public void removePooledTxInDB(List<byte[]> pooledTx) {
if (pooledTx.isEmpty()) {
return;
}

rwLock.writeLock().lock();
try {
txPoolDatabase.deleteBatch(pooledTx);
} finally {
rwLock.writeLock().unlock();
}
}

if (clearTxSet.isEmpty()) {
public void removeCachedTxInDB(List<byte[]> cachedTx) {
if (cachedTx.isEmpty()) {
return;
}

rwLock.writeLock().lock();
try {
if (isPool) {
txPoolDatabase.deleteBatch(clearTxSet);
} else {
pendingTxCacheDatabase.deleteBatch(clearTxSet);
}
pendingTxCacheDatabase.deleteBatch(cachedTx);
} finally {
rwLock.writeLock().unlock();
}
Expand Down Expand Up @@ -1145,6 +1157,24 @@ public InternalVmType getVMUsed(AionAddress contract, byte[] codeHash) {
}
}

public void removePoolTx() {
rwLock.readLock().lock();
try {
txPoolDatabase.drop();
} finally {
rwLock.readLock().unlock();
}
}

public void removeCacheTx() {
rwLock.readLock().lock();
try {
pendingTxCacheDatabase.drop();
} finally {
rwLock.readLock().unlock();
}
}

private static class AionRepositoryImplHolder {
// configuration
private static CfgAion config = CfgAion.inst();
Expand Down
Loading