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

refactor(crypto): invalidate blocks with expired transactions #2528

Merged
merged 10 commits into from May 7, 2019

Conversation

Projects
None yet
5 participants
@supaiku0
Copy link
Contributor

commented May 3, 2019

Summary

The expiration is now height based, but it's still possible to forge expired transactions when bypassing the pool. This PR prevents expired transactions from entering the pool and blocks which contain expired transactions are now invalid.

What kind of change does this PR introduce?

  • Bugfix
  • New feature
  • Refactoring / Performance Improvements
  • Build-related changes
  • Documentation
  • Tests / Continuous Integration
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

Does this PR release a new version?

  • Yes
    • All tests are passing
    • All benchmarks are passing without any major regressions
    • Sync from 0 works on mainnet
    • Sync from 0 works on devnet
    • Starting a new network and forging on it work
    • Explorer is fully functional
    • Wallets are fully functional
  • No

Checklist

  • I have read the CONTRIBUTING documentation
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
@ArkEcosystemBot

This comment has been minimized.

Copy link
Member

commented May 3, 2019

The ci/circleci: test-node10-unit job is failing as of d53c0b737b681ec5b52f0fb1c97111593a77b111. Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@ArkEcosystemBot

This comment has been minimized.

Copy link
Member

commented May 3, 2019

The ci/circleci: test-node11-functional job is failing as of 5a5830286265a3e6ae14098a7b98bd7db60ca5ef. Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@supaiku0 supaiku0 changed the title refactor(crypto): add expiration check to schema [WIP] refactor(crypto): add expiration check to schema May 4, 2019

@vasild

This comment has been minimized.

Copy link
Contributor

commented May 6, 2019

Actually that should be part of block validation - if a block at height H contains a transaction with expiration <= H, then that block is invalid.

@supaiku0 supaiku0 changed the title [WIP] refactor(crypto): add expiration check to schema refactor(crypto): invalidate blocks with expired transactions May 6, 2019

@supaiku0

This comment has been minimized.

Copy link
Contributor Author

commented May 6, 2019

Actually that should be part of block validation - if a block at height H contains a transaction with expiration <= H, then that block is invalid.

Yeah, updated the PR. I went with the schema approach first, because then I wouldnt need to touch the tx pool/block validation at all, but it turns out that there are too many edge cases which require more complex changes to handle expired transactions correctly.

supaiku0 added some commits May 6, 2019

@codecov-io

This comment has been minimized.

Copy link

commented May 6, 2019

Codecov Report

Merging #2528 into develop will decrease coverage by 0.01%.
The diff coverage is 44.44%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2528      +/-   ##
===========================================
- Coverage    67.18%   67.17%   -0.02%     
===========================================
  Files          399      399              
  Lines         8758     8767       +9     
  Branches       453      415      -38     
===========================================
+ Hits          5884     5889       +5     
- Misses        2819     2824       +5     
+ Partials        55       54       -1
Impacted Files Coverage Δ
packages/crypto/src/transactions/types/schemas.ts 100% <ø> (ø) ⬆️
packages/crypto/src/blocks/block.ts 90.42% <0%> (-1.97%) ⬇️
...src/transactions/builders/transactions/transfer.ts 90.9% <33.33%> (-9.1%) ⬇️
packages/core-transaction-pool/src/processor.ts 80.26% <75%> (+1.09%) ⬆️
packages/core-logger-winston/src/formatter.ts 41.66% <0%> (ø) ⬆️
...es/core-blockchain/src/replay/replay-blockchain.ts 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9ff377c...7061448. Read the comment docs.

@faustbrian faustbrian merged commit 7dac85a into ArkEcosystem:develop May 7, 2019

12 checks passed

ci/circleci: test-node10-benchmark Your tests passed on CircleCI!
Details
ci/circleci: test-node10-e2e Your tests passed on CircleCI!
Details
ci/circleci: test-node10-functional Your tests passed on CircleCI!
Details
ci/circleci: test-node10-integration-0 Your tests passed on CircleCI!
Details
ci/circleci: test-node10-integration-1 Your tests passed on CircleCI!
Details
ci/circleci: test-node10-unit Your tests passed on CircleCI!
Details
ci/circleci: test-node11-benchmark Your tests passed on CircleCI!
Details
ci/circleci: test-node11-e2e Your tests passed on CircleCI!
Details
ci/circleci: test-node11-functional Your tests passed on CircleCI!
Details
ci/circleci: test-node11-integration-0 Your tests passed on CircleCI!
Details
ci/circleci: test-node11-integration-1 Your tests passed on CircleCI!
Details
ci/circleci: test-node11-unit Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.