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

Revise AionBlockStore for supporting unity-protocol #981

Merged
merged 1 commit into from
Sep 14, 2019
Merged

Conversation

AionJayT
Copy link
Collaborator

Notice

Please submit your PR to the master branch and rebase your code on master before opening the pull request.

Description

Please include a brief summary of the change that this pull request proposes. Include any relevant motivation and context. List any dependencies required for this change.

Fixes Issue # .

Type of change

Insert x into the following checkboxes to confirm (eg. [x]):

  • Bug fix.
  • New feature.
  • Enhancement.
  • Unit test.
  • Breaking change (a fix or feature that causes existing functionality to not work as expected).
  • Requires documentation update.

Testing

Please describe the tests you used to validate this pull request. Provide any relevant details for test configurations as well as any instructions to reproduce these results.

@@ -3,6 +3,7 @@
import static com.google.common.truth.Truth.assertThat;
import static org.aion.zero.impl.blockchain.BlockchainTestUtils.generateRandomChain;
import static org.aion.zero.impl.blockchain.BlockchainTestUtils.generateRandomChainWithoutTransactions;
import static org.junit.Assert.assertNull;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accidental import

} else {
System.out.print(" " + shortHash(blockInfo.getHash()) + " ");
}
@SuppressWarnings("unchecked")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has not changed, so it shouldn't be part of the diff.

@@ -1511,140 +1796,199 @@ public void load() {
}

public enum IntegrityCheckResult {
ERROR,
MISSING_GENESIS,
MISSING_LEVEL,
FIXED,
CORRECT
}

public IntegrityCheckResult indexIntegrityCheck() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be preferable to disable this and write an issue to add tests. Without tests to ensure correctness, this may end up corrupting the database.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AKI-370

@@ -2084,7 +2087,8 @@ public synchronized boolean recoverIndexEntry(Repository repository, Block block
other.getShortHash(),
other.getNumber(),
other.getTransactionsList().size());
totalDiff = repo.getBlockStore().correctIndexEntry(other, totalDiff);
//TODO: [unity] revise it after the blockchainImpl class introducing the unity difficulty concept
totalDiff = repo.getBlockStore().correctIndexEntry(other, totalDiff, BigInteger.ONE).getCumulativeDifficulty();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This recovery option should be disabled and an issue created to re-enable it with tests for correct functionality with staking blocks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AKI-371

@AionJayT AionJayT merged commit 0d59bba into master Sep 14, 2019
@AionJayT AionJayT added this to the 0.4.2 milestone Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants