Skip to content

Commit

Permalink
Merge pull request #211 from semuxgo/core-block-limit
Browse files Browse the repository at this point in the history
Core: remove block size limit
  • Loading branch information
semuxgo authored Jul 7, 2019
2 parents d055e62 + 9714fd5 commit 23a4c22
Show file tree
Hide file tree
Showing 30 changed files with 632 additions and 691 deletions.
12 changes: 1 addition & 11 deletions src/main/java/org/semux/Kernel.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public enum State {

protected State state = State.STOPPED;

protected final ReentrantReadWriteLock stateLock = new ReentrantReadWriteLock();
protected Config config;
protected Genesis genesis;

Expand Down Expand Up @@ -362,7 +361,7 @@ public synchronized void stop() {
client.close();

// make sure no thread is reading/writing the state
ReentrantReadWriteLock.WriteLock lock = stateLock.writeLock();
ReentrantReadWriteLock.WriteLock lock = chain.getStateLock().writeLock();
lock.lock();
try {
for (DatabaseName name : DatabaseName.values()) {
Expand Down Expand Up @@ -456,15 +455,6 @@ public Config getConfig() {
return config;
}

/**
* Returns the state lock.
*
* @return
*/
public ReentrantReadWriteLock getStateLock() {
return stateLock;
}

/**
* Returns the syncing manager.
*
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/semux/api/v2/TypeFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,7 @@ public static TransactionType transactionType(Transaction tx) {

public static TransactionResultType transactionResultType(Transaction tx, TransactionResult result, long number) {
// gas price is in nano sem, not wei
boolean isVMTransaction = (tx.getType() == org.semux.core.TransactionType.CREATE
|| tx.getType() == org.semux.core.TransactionType.CALL);
Amount fee = isVMTransaction ? Amount.mul(result.getGasPrice(), result.getGasUsed()) : tx.getFee();
Amount fee = tx.isVMTransaction() ? Amount.mul(result.getGasPrice(), result.getGasUsed()) : tx.getFee();

return new TransactionResultType()
.blockNumber(Long.toString(number))
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/org/semux/config/AbstractConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public abstract class AbstractConfig implements Config, ChainSpec {
// Chain spec
// =========================
protected long maxBlockGasLimit = 10_000_000L; // 10m gas
protected int maxBlockTransactionsSize = 1024 * 1024;
protected Amount minTransactionFee = MILLI_SEM.of(5);
protected Amount minDelegateBurnAmount = SEM.of(1000);
protected long nonVMTransactionGasCost = 21_000L;
Expand Down Expand Up @@ -160,11 +159,6 @@ public long maxBlockGasLimit() {
return maxBlockGasLimit;
}

@Override
public int maxBlockTransactionsSize() {
return maxBlockTransactionsSize;
}

@Override
public int maxTransactionDataSize(TransactionType type) {
switch (type) {
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/org/semux/config/ChainSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ public interface ChainSpec {
*/
long maxBlockGasLimit();

/**
* Returns the max total size of all transactions in a block, encoding overhead
* not counted.
*
* @return
*/
int maxBlockTransactionsSize();

/**
* Returns the max data size for the given transaction type.
*
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/org/semux/config/TestnetConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ public class TestnetConfig extends AbstractConfig {
public TestnetConfig(String dataDir) {
super(dataDir, Network.TESTNET, Constants.TESTNET_VERSION);

// testnet allows a much larger block size for performance tuning (8MB)
this.maxBlockTransactionsSize = 8 * 1024 * 1024;

this.forkUniformDistributionEnabled = true;
this.forkVirtualMachineEnabled = true;
}
Expand Down
Loading

0 comments on commit 23a4c22

Please sign in to comment.