Using Property-Based Testing in Blockchain …...Property based testing Blockchain properties Forall...
Transcript of Using Property-Based Testing in Blockchain …...Property based testing Blockchain properties Forall...
UsingProperty-BasedTestinginBlockchainapplications
ThomasArts
Anodeinadistributednetwork
Anodeinadistributednetwork
Anodeinadistributednetwork
Anodeinadistributednetwork
Anodeinadistributednetwork
Anodeinadistributednetwork
AFORK
Testingchallenges
Acomplexdistributedsystem,theusualchallengeofinfinitelymanypossiblestatesForexample:synchronization,differentkindsoftransactions,unpredictableorderofevents,cryptographyhardtomock,...
QuickCheck
London2018 15
Instead of writing test cases.... they are automatically generated from properties Useful for Unit Testing, Component Testing, System Testing Less work, better testing, more fun
QuickCheckinaNutshell
PropertiesTestcaseTestcaseTestcaseTestcaseTestcase
MinimalTestcase
QuickCheck
APIundertest
Aminimalfailingexample
DEMO
Propertybasedtesting
BlockchainpropertiesForallsequencesoftransactions:thetotalamountoftokensinthechainstaysthesameInvalidtransactionsarenotacceptedonthechain(e.g.toolowfee,toolittleinaccount,etc)
Propertybasedtesting
DistributedsystemForallpossiblenet-splits,crashesandforks,ifnetworkisstablelongenough,nodesagreeuponchain.
Conclusions
Blockchaintesting• generatedtestsfoundmanycornercases• onsystemleveleasytoaddonefeatureandtestthousandsofnewtestsincludingfeature
• hardtomockcrypto
Questions
• https://aeternity.com/• https://github.com/aeternity/epoch/• https://github.com/Quviq/epoch-eqc
Anodeinadistributednetwork
synchronization