question
stringclasses
1 value
answer
stringlengths
780
1.55k
source
stringclasses
1 value
No question: Moodle
cs - 438 decentralized systems engineering fall 2024 week 12 advanced consensus & blockchain architectures - motivation - problems v / existings blockchains, e. g. bitcoin - limited tx capacity, congestion / competition, high fees - latoncy : 10 mins ( min ) - ihr - delayed / probabilistic finality - huge energy use of pow - smart contract vm limitations - determinism, no external - world inpot who oracles - can't " hold secrets " on blockchain - public randomness is hard topics fordeta committe - based blotchina - sharding reconfiguration in paxos = x g txs renfig โ†‘x5 ยท d paxos - - instance # i ( abc ) ( bcd ) tomnitee - based blockchainses 1 thing per black byzcoin : improve capacity @ commit latency via pow - selected committies for bft po s : stake instead of cryptopuzzles as basis " control plane " data ina bft chain recontigo sliding windowit robustness to liveness loss tehoices ( design - bitcoin tradition : liveness over safety - paxos traditions safety over liveness proof of state - generic committee - based pos - algorand generic dos config / epochtran a a committee 2 - ~ " staked " coin # algor and
EPFL CS 438 Moodle
No question: Moodle
pos - " east adoptive adversary " instantly - ephemeral committees - do i thing " onyspeak once " - verifiable random function ( vrf ) alternatives to pos - eg. pop ( personhoda in " crypto - ubi " - " stake " distribution - encointer ( urich ) 1 ( per human user ) - idena ( online ) c i decentralized systems engineering cs - 438 โ€“ fall 2024 bryan ford, pierluca borso - tan credits : p. tennage, c. basescu, et al. your lecturers pierluca borso - tan prof. bryan ford โ— distributed system : a system of multiple computers ( nodes ) communicating over a network to achieve a common goal. โ— decentralized system : a distributed system without a single point of control or authority. different nodes or subsets of the network may be owned or controlled by different people, organizations or interests. what are distributed and decentralized systems? 4 โ— centralized distributed systems โ— decentralized distributed systems some examples 6 o โ€œ the internet โ€ o google o netflix o facebook o wechat o e - voting o e - mail o usenet o bittorrent o tor, i2p o bitcoin, ethereum o avionics, control systems course goals 7 โ— understand the fundamental and practical challenges inherent in designing and building decentralized systems. โ— get a feel for the ( limited )
EPFL CS 438 Moodle
No question: Moodle
body of techniques and solutions โ— examine a number of real systems, past and present : how they work, and why they succeeded โ€ฆ or failed โ— become better engineers : solidify this knowledge by applying it! โ†’build a small, but working, usable and robust, decentralized system why study decentralized systems? 8 โ— devise solutions when there is no common authority everyone trusts โ— add new tools to your engineering toolbox โ— learn to think and question your assumptions โ— the world is full of decentralized systems course organization course organization lecturers : prof. bryan ford, pierluca borso - tan tas : pasindu tennage, charly castes, tao lyu aes : derya cogendez, kilian lauener, mariem baccari e - mail : cs438 @ groupes. epfl. ch material : moodle ( lectures, readings, announcements, q & a, etc. ) https : / / go. epfl. ch / cs - 438 assessment : 40 % homework 30 % project 30 % written exam ( mcq ) class participation is not graded, but fundamental to success! 10 weekly workload lectures : monday 10 : 15 - 12 : 00 ( inf1 ) q & a w / tas : friday 15 : 15 - 17 : 00 ( inj218 ) - help understanding concepts, homework requirements & architecting - the tas will not debug your code for you!
EPFL CS 438 Moodle
No question: Moodle
self - guided : monday 13 : 15 - 15 : 00 ( inm200 ) - room open to hack, discuss design / problems, and test with classmates! homework : 8 - 12h depending on your understanding & development skills no sharing or copying code ; everyone implements their own peerster! 11 + sep. 13, this friday! 15 : 15 - 17 : 00 ( cm1 3 ) 12 week content 1 course intro | usenet and gossip 2 jeune federal | exercise session only 3 flooding search and routing 4 structured search and compact routing 5 distributed storage 6 replication and consensus 7 threat modeling and threshold crypto 8 anonymous communication 9 sybil attacks and defenses 10 blockchains and cryptocurrencies 11 smart contracts 12 advanced blockchain architectures 13 testing & chaos engineering 14 decentralized democracy foundations for decentralization blockchains engineering attacks & defenses e - voting course syllabus homework & project build a decentralized system individually : โ— network layer ( introduction to go ) โ— gossiping โ— file sharing โ— consensus & blockchain in groups of ~ 3 students : โ— one of many predefined projects, โ— โ€ฆ or your own! 13 course syllabus 15 homework & project schedule week content hw0 hw1 hw2 hw3 project 1 course intro | usenet and gossip sep 9 > 2 jeune federal | exercise session only network 3 flooding search and routing sep 27 > 4 structured search and compact routing > oct 1 gossiping
EPFL CS 438 Moodle
No question: Moodle
5 distributed storage oct 11 > 6 replication and consensus > oct 15 file 7 threat modeling and threshold crypto sharing nov 1 > 8 anonymous communication > nov 5 consensus & blockchain 9 sybil attacks and defenses 10 blockchains and cryptocurrencies > nov 24 11 smart contracts nov 25 > 12 advanced blockchain architectures your project 13 testing & chaos engineering 14 decentralized democracy > dec 20 homework : your path to success! โ— they build on top of each other โ€™ t skip! previous hw is rewarded โ— defensive programming โ— manage your time โ€™ t wait for the last minute โ€“ you will fail! much is that perfect score worth to you? 16 code quality hw0 hw1 hw2 hw3 total grade hw0 due 1 % 3 % 4 % hw1 due 1 % 1 % 9 % 11 % hw2 due 1 % 1 % 9 % 14 % 25 % hw3 due 4 % 1 % 11 % 15 % 29 % 60 % total 7 % 6 % 29 % 29 % 29 % 100 % homework assessment ( 40 % ) โ— you can talk with each other and exchange ideas, not share code plagiarism will be checked for and dealt with severely 18 homework assessment ( 40 % ) public tests ( 90 % ) : โ— unit tests 55 % โ— integration tests 30 % โ— performance ( benchmarks ) 5 % hidden tests ( 10 % ) : โ— verify robustness / defensive programming project
EPFL CS 438 Moodle
No question: Moodle
: organization โ— group project ( ~ 3 members ) build on top of ( some part of ) peerster โ— guided topic selection, with clear goals โ€ฆ or you can be creative! โ— example project topics secure routing anonymous reputation e - voting crdts project : organization ( cont โ€™ d ) โ— regular meetings with tas ( week 11 + ) โ— final project report ( december 20 ) ( more detailed information will follow later in the semester ) project assessment ( 30 % ) โ— group grade ( 50 % ) โ— report โ— project quality โ— goals achieved โ— individual grade ( 50 % ) โ— contribution to the project โ— ( 1 page ) individual report โ— no winners in a losing team! 22 final exam ( 30 % ) โ— format : multiple - choice questions โ— assessment of : โ— your understanding of fundamental concepts โ— your ability to reason about decentralized systems โ— your ability to engineer such systems ( design, evaluate, test, make trade - offs ) โ— non - goal : โ— you learning the slides by heart โ€“ it won โ€™ t help. 23 support structure lecturer : bryan ford, pierluca borso - tan tas : pasindu tennage, charly castes, tao lyu aes : derya cogendez, kilian lauener, mariem baccari e - mail : cs438 @ groupes. epfl. ch questions : exercise sessions ( fridays ) moodle forums & faqs engineering week 3 : go thinking &
EPFL CS 438 Moodle
No question: Moodle
best practices classes : week 13 : testing & chaos engineering 24 questions? decentralized systems engineering cs - 438 โ€“ fall 2024 bryan ford, pierluca borso - tan credits : p. tennage, c. basescu, et al. why build a decentralized system? 26 โ— sometimes a basic requirement โ— availability, reliability and safety โ— lower resource usage ( in specific scenarios ) โ— enabler for resilient ecosystems โ— nature has shown they can work incredibly well! major topics & applications 28 โ— communication : messaging, chat, voice / video โ— data : storing, sharing, searching and mining โ— collaboration mechanisms โ— social networking โ— deliberation, e - voting, reputation โ— blockchains, cryptocurrencies, and smart contract systems related, but ( mostly ) out of scope in this class : โ— decentralized control systems, industrial automation โ— intelligent agents, self - organizing robotics โ— military & civilian ad - hoc networks ( manet, vanet, fanet, etc. ) recurrent issues and themes โ— identity ( real, sybil ) versus location โ— information integrity and privacy โ— behavior accountability โ— denial - of - service โ— protocol efficiency, in the normal case and under load or attack 30 why might we prefer centralized systems? let โ€™ s think! ~ 2 min, write down your ideas ~ 1 min, discuss with your neighbor then share with the class! 31 why might we prefer centralized systems? simplicity : โ— engineering โ— management โ— security model
EPFL CS 438 Moodle
No question: Moodle
โ— version management thereof : โ— performance / efficiency โ— cost 32 decentralized communication an introduction communicating with a ( known ) peer โ— same machine a file in a shared directory โ— local networking shared drive, file transfer โ— global networking, centralized trust a file on a shared server ( ftp? dropbox? ) โ— decentralized e - mail ( signed, encrypted ) or write command on unix / linux 34 communicating with ( many, unknown ) peers โ— same machine a file in a shared directory, or linux wall command โ— local networking shared drive, intranet website โ— global networking, centralized trust mailing lists, forums, reddit, โ€ฆ โ— decentralized??? โ†’next week โ€™ s lecture 35 communicating with ( many, unknown ) peers โ— decentralized??? โ†’this friday โ€™ s lecture many open questions : โ— how do we reach unknown peers? โ— how do they find out about us / our node? โ— how do we eventually reach every peer? โ— how can we communicate reliably? are they online? is the network ยซ stable ยป? 36 decentralized systems engineering cs - 438 โ€“ fall 2023 bryan ford and pierluca borso - tan credits : b. ford, k. driscoll, r. stutsman, m. freedman, k. jamieson, r. morris, f. kaashoek, n. zeldovich, l. q. torres, et
EPFL CS 438 Moodle
No question: Moodle
al. consensus paxos, multi - paxos & tlc ( homework 3 ) paxos : review key properties : โ— safety : all nodes agree on a ( single ) decision โ— liveness : eventually something is decided assumptions : โ— crash - stop model โ— partially synchronous โ— # acceptors = 2f + 1 protocol ( choose 1 value ) : โ— phase 1 : prepare / promise โ— phase 2 : propose / accept proposers acceptors learner paxos : review ( cont โ€™ d ) propose propose propose propose multi - paxos โ— what if we want to choose multiple values? โ†’ โ†’ value x value y value z how do we make that happen? โ— network messages are tied to a box how do we know the highest box number? โ— leader - based paxos, logical clocks, etc. paxos consensus box : 1 paxos consensus box : 2 paxos consensus box : 3 multi - paxos : leader - based optimization prepare propose accept promise source : a. charapko, pigpaxos commit logical clocks time is hard ( cf. โ€œ utc is enough for everyone โ€ฆ right? โ€ ) โ€ฆ and it can โ€™ t be trusted in a distributed system โ€ฆ unless you โ€™ re google and you control time ( in your datacenter ) can we substitute time with a logical alternative? โ†’pass a logical clock time c ( a counter ) along with events โ— lamport clock a caused b โ†’c (
EPFL CS 438 Moodle
No question: Moodle
a ) < c ( b ) each message contains the logical time, receiving updates the local clock โ— vector clocks c ( a ) < c ( b ) โ†’a caused b similar to g - counter crdt, one counter per node โ— threshold logical clock specialized for threshold applications threshold logical clocks โ†’ โ†’ value x value y value z paxos consensus box : 1 paxos consensus box : 2 paxos consensus box : 3 โ— when a consensus is reached โ†’broadcast logical clock advance โ— when a threshold ( quorum ) of clock advances has been received โ†’move to the next box, even if we haven โ€™ t witnessed the consensus! tlc = 2 tlc = 3 threshold logical clocks some interesting properties : โ— works without synchronous assumptions or timeouts โ— works despite malicious nodes ( with some added crypto ) โ— low latency, low - bandwidth usage โ— it makes consensus implementation much simpler! โ— it exposes a โ€œ synchronous โ€ abstraction to higher layers going byzantine faults and how to survive them byzantine generals problem general 1 general 2 general 3 general 4 โ— coordination = victory โ— no coordination = loss failure model โ€ข arbitrary failures โ€ข general ( = process ) may be malicious โ€ข generals may collude โ€ข network may be malicious โ€ข system may present conflicting info โ€ข computations may be incorrect when stuff goes wrong โ€ฆ โ— fault : underlying defect โ†’active โ€“ injects errors in the system โ†’passive โ€“ latent โ— failure : system not producing the
EPFL CS 438 Moodle
No question: Moodle
desired result โ†’1 + fault ( s ) have made the system useless โ— fault - tolerance : building reliability out of unreliable components โ— denial is not a strategy โ€“ things will fail! redundancy โ— fundamental principle to build fault - tolerant systems โ— redundancy in digital design detect deviations and automatically restore correct behavior space - redundancy : state time - redundancy : ( re ) transmission โ— redundancy in computer systems coding data replication n - version programming byzantine faults โ€“ causes โ— deliberate tampering โ— software bug โ— hardware failure what kind of hardware failures could cause a byzantine fault? network partitions โ— โ€œ network partitions should be rare but net gear continues to cause more issues than it should. โ€ โ€“ james hamilton, amazon web services ( 2010 ) โ— microsoft lan ( 2011 ) avg. 40. 8 failures / day ( 95th % : 136 ) 5 min median time to repair ( up to 1wk ) โ— hp lan ( 2012 ) 67. 1 % of support tickets are due to the network median incident duration 114 - 188 min a space shuttle story โ€“ sts - 124 โ— a crack ( fissure ) through a diode appeared in the data bus of a space shuttle. โ— 3 - 1 split of the four computers that control the shuttle. โ— + 3s : split became 2 - 1 - 1. โ— during troubleshooting : 1 - 1 - 1 - 1 analog digital systems vih vcc vil logical 1 logical 0 logical ยฝ freaky state
EPFL CS 438 Moodle
No question: Moodle
( > 1 / 3 of whole range ) โ— interpreted as 0 or 1, depending on rx threshold โ— affected by every environmental + manufacturing factor imaginable analog digital systems another space shuttle story v vil vih failure modes & effect analysis โ— a whole area of engineering โ— under - used in software approach : โ— analyze system โ— identify what can fail, why, how โ— analyze probability, detectability โ— analyze effects of failure ( cascades? ) โ— mitigate! โ†’redundancy isn โ€™ t enough without bft! โ†’bft can โ€™ t be solved exclusively in software! bft consensus key properties : โ— safety : all nodes agree on a ( single ) decision โ— liveness : eventually something is decided paxos : n > = 2f + 1 byzantine model : โ— malicious node โ€œ x โ€ โ— malicious network โ†’n > = 2f + 1 isn โ€™ t strong enough proposers acceptors 2 1 x v v bft consensus key properties : โ— safety : all nodes agree on a ( single ) decision โ— liveness : eventually something is decided bft : n > = 3f + 1 โ†’no assumption about who โ€™ s honest โ†’1 honest node in intersection proposers acceptors 2 1 x v v v permissionless consensus bitcoin and proof - of - work blockchain structure bitcoin โ€“ key ideas proof - of - work โ— โ€œ miners โ€ solve computational puzzles ( hash with leading n zeros ) computational power = hash rate ( h /
EPFL CS 438 Moodle
No question: Moodle
s ) โ— puzzle difficulty is adjusted to keep block rate ( roughly ) constant โ†’compensates for changes in mining power block 3 10 min bitcoin โ€“ assumptions โ— threshold assumption : majority of mining power is honest โ€ฆ independently of the number of nodes โ— longest / heaviest chain rule โ€ฆ transient safety violations ( e. g. forks, reversed transactions ) are ok โ€ฆ eventually forks will be resolved ( based on expended work )! โ— probabilistic finality โ€“ 6 blocks ( 1h ) โ— economic incentive compatibility safety? โ— network connectivity / propagation โ€“ synchrony assumption ( 10 min ) block 3 block 2 block 1 block 3 โ€™ block 4 block 4 โ€™ block 5 decentralized systems engineering cs - 438 โ€“ fall 2023 pierluca borso - tan credits : b. ford do you need a blockchain? can you permissioned blockchain permissionless blockchain do you need a blockchain? bitcoin revisited goals โ— currency with no trusted, central authority โ— works online ( like a credit card ) โ— anonymous / pseudonymous ( โ€œ like cash โ€ ) โ— non - reversible transactions ( probabilistic finality is ok ) โ— conditional payments ( like contracts ) โ†’permissionless consensus โ†’cryptography โ†’append - only ( โ€œ block chain โ€ ) โ†’later today ; ) blockchain structure transactions transactions key ideas proof - of - work โ— โ€œ miners โ€ solve computational puzzles ( hash with leading n
EPFL CS 438 Moodle
No question: Moodle
zeros ) computational power = hash rate ( h / s ) โ— puzzle difficulty is adjusted to keep block rate ( roughly ) constant โ†’compensates for changes in mining power block 3 10 min assumptions โ— threshold assumption : majority of mining power is honest โ€ฆ independently of the number of nodes โ— longest / heaviest chain rule โ€ฆ transient safety violations ( e. g. forks, reversed transactions ) are ok โ€ฆ eventually forks will be resolved ( based on expended work )! โ— probabilistic finality โ€“ 6 blocks ( 1h ) โ— economic incentive compatibility โ— network connectivity / propagation โ€“ synchrony assumption ( 10 min ) block 3 block 2 block 1 block 3 โ€™ block 4 block 4 โ€™ block 5 transactions โ€“ utxo vs account how can we model transactions? โ— cash ( utxo ) โ†’bitcoin โ— bank ( account ) โ†’ethereum ( later today ) what are the advantages and disadvantages of each? utxo1 utxo2 utxo3 transaction utxo4 utxo5 transaction from to amount sender receiver $ sender account receiver account where are the transactions before a block? bitcoin โ€™ s ( and other blockchains โ€™ ) nodes deal with two storage pools : โ— the blockchain โ†’final ( probabilistically ) โ†’eventually, the single source of truth โ— the memory pool ( aka โ€œ the mempool โ€ ) โ†’ โ€œ in - flight โ€ transactions โ†’propagated
EPFL CS 438 Moodle
No question: Moodle
among nodes โ†’the source of transactions in a block bitcoin transactions utxo 11 utxo 12 utxo 13 utxo 34 utxo 35 version ( 4 bytes ) locktime ( 4 bytes ) inputs outputs version ( 4 bytes ) locktime ( 4 bytes ) inputs outputs utxo 46 utxo 35 utxo 20 bitcoin transactions utxo 11 utxo 12 utxo 13 utxo 34 utxo 35 version ( 4 bytes ) locktime ( 4 bytes ) inputs outputs amount ( 8 bytes ) locking script โ— simple case ( p2pkh ) : check recipient โ€™ s hashed public key & signature โ€œ pay to pubkey hash โ€ bitcoin transactions utxo 11 utxo 12 utxo 13 utxo 34 utxo 35 version ( 4 bytes ) locktime ( 4 bytes ) inputs outputs amount ( 8 bytes ) locking script โ— simple case ( p2pkh ) : recipient โ€™ s public key โ— general case ( p2sh ) : code to check validity of a spend request ( binary output ) โ€œ pay to script hash โ€ bitcoin transactions โ€“ inputs utxo 11 utxo 12 utxo 13 utxo 34 utxo 35 version ( 4 bytes ) locktime ( 4 bytes ) inputs outputs โ— simple case : signature proving ownership of bitcoin โ— general : arbitrary binary input to script transaction hash ( 32 bytes ) unlocking script output index ( 4
EPFL CS 438 Moodle
No question: Moodle
bytes ) bitcoin scripting putting it all together โ€ฆ โ— utxo destination can be a script ( lock script ) โ— script checks spending authorization โ— transaction input must provide data satisfying the check ( unlock script ) enables non - trivial logic : โ— multi - signatures ( t - of - n ) โ— time lock vaults / contracts โ— payment channels ( lightning net ) โ— notaries, side - chains bitcoin scripting : example multi - signer authorization ( multi - sig ) โ— any t of n co - signers can authorize spending โ— ex. logic for t = 2, n = 3 script : a 0 a a + check ( ki, t, i [ 0 โ€ฆ 63 ] ) a a + check ( ki, t, i [ 64 โ€ฆ 127 ] ) a a + check ( ki, t, i [ 128 โ€ฆ 191 ] ) return ( a > = 2 ) scripts โ€“ who runs them? โ— user who wants to spend โ— all miners when including the transaction in a block โ†’first to create the block โ†’then to validate the block โ— miners need to achieve consensus in block validity โ— determinism is paramount! bitcoin scripting limitations โ— only a limited number of bytecodes โ— no backward branches โ— bytecode limited ( 1 block < 1mb, pre - segwit ) โ— completely deterministic โ— inefficiency of deterministic vm ethereum smart contracts ethereum โ€“ generalizing smart contracts โ— account
EPFL CS 438 Moodle
No question: Moodle
- based โ€ฆ account persist across transactions โ— richer bytecode language โ€ฆ still limited โ€ฆ but turing complete, with loops! how can we deal with infinite / unbounded execution? ethereum โ€“ gas โ— deterministic, virtual execution time โ€ฆ ( weighed ) instruction count โ— each script execution has a gas limit โ€ฆ that must be paid up - front ( invoker or script ) โ€ฆ charged based on usage โ— if script succeeds within gas limit, effects yield atomic state change โ— if script exhausts gas limit, no state change โ€“ but gas still charged smart contracts โ€“ applications โ— trustless insurance โ€“ axa fizzy ( flight delays insurance ) โ— new payment / finance methods โ— decentralized naming โ€“ โ€  namecoin ( dns - like ), filecoin, โ€ฆ โ— tokenization โ€“ icos ( initial coin offerings ), nfts, โ€ฆ โ— storage โ€“ on - chain, off - chain management โ— programmable markets โ€“ auctions, prediction markets, quadratic voting, โ€ฆ โ— games โ€“ gambling, cryptokitties, etc. โ— decentralized governance โ€“ daos โ— automated market makers โ€“ uniswap ( trade between coins ) smart contracts โ€“ issues & limitations โ— inefficiency of deterministic vm โ— oracle problem โ— front - running attacks / โ€œ dark forest โ€ โ— secrets โ— smart contract bugs ( ex. โ€œ the dao โ€ ) โ— improvements / evolution is difficult โ†’ewasm โ†’trusted authority โ†’decentralized oracles
EPFL CS 438 Moodle
No question: Moodle
โ†’active research area โ†’keep secrets off - chain + zk - proofs โ†’on - chain secrets ( calypso ) โ†’recourse? recovery? โ†’permissionless innovation? versioning? next steps optional readings : โ— ethereum : a secure decentralised general transaction ledger โ— ethereum is a dark forest โ— the law and legality of smart contracts โ†’use friday โ€™ s session to ask questions 24 decentralized systems engineering cs - 438 โ€“ fall 2024 pierluca borso - tan credits : netflix, dynatrace, wikimedia commons software quality for decentralized and distributed systems or : how i learned to stop worrying & love the tests roadmap for the ( intense ) day โ— why you should care โ— managing quality & software dev lifecycle โ— software testing โ€“ basic principles โ— testing distributed & decentralized systems โ— chaos engineering โ— developing a testing & evaluation strategy ( worked out examples ) โ— testing & evaluation tools in go why you should care what does a bug look like to you? say, an integer overflow june 4, 1996 converting a 64 - bit float into a signed 16 - bit integer. of the need to manage defects a $ 370 million example : ariane 5 ( 1996 ) a race condition caused patients to receive 100x radiation dosage. of the need to manage defects a deadly example : therac - 25 ( 1980s ) fujitsu โ€™ s horizon software said uk post office staff were stealing money. bugs
EPFL CS 438 Moodle
No question: Moodle
led to lawsuits, 700 + people found guilty. dozens were sent to jail. some faced bankruptcy, others committed suicide. https : / / en. wikipedia. org / wiki / british _ post _ office _ scandal of the need to manage defects a sinister example : fujitsu horizon ( 2000 - 2020 ) quality โ€“ a definition what does it mean in business, engineering & manufacturing? according to wikipedia : โ— the non - inferiority or superiority of something โ— being suitable for its intended use ( fitness for purpose ) while satisfying customer expectations. quality โ€“ a simpler view โ— building the right thing, satisfying customer needs โ†’ partially out of scope today โ— building the thing right, to specification & within tolerance โ— preventing defects and keeping costs under control when should you start thinking about quality in a project? software quality โ€“ how? โ— tools ide autocompletion, static analysis / linters, testing, ci / cd, etc. โ— processes code review, pair programming, test - driven development, etc. โ— measurements software complexity, code coverage, etc. โ— documentation requirements documents, code style, traceability matrix, etc. software quality as continuous improvement and investment $... software quality โ€“ summary โ— a way to ensure engineering leads to a โ€œ good โ€ solution functionally structurally โ— a consideration throughout the project lifecycle โ— an ( empowering ) constraint on the development โ— an investment to ensure success managing software quality managing software projects like any project, need to : โ— manage limited resources โ—
EPFL CS 438 Moodle
No question: Moodle
keep costs under control โ— manage risks ( i. e. bad stuff happening ) reduce probability reduce impact โ— quality supports this! software development lifecycle a reminder quality and cost โ€“ a balancing act โ— quality assurance measures are not free! โ— defects are even more expensive! โ— what โ€™ s the trade - off? requirements < 1x quality and cost a balancing act quality and cost technical debt quality and cost technical debt 22 requirements & specifications โ— functional requirements e. g. โ€œ the user can reset a forgotten password โ€ โ— non - functional requirements e. g. โ€œ the system should respond to 99 % of the requests within 100ms โ€ โ— quality impact : shared understanding of the product allow detection of โ€œ specification โ€ bugs informs the system design informs the security of the system ( threat model ) architecture & design architecture & design uml? architecture & design component diagram? architecture & design layered? ad - hoc? why & when is architecture important for quality? architecture & design โ— shared understanding of the software โ— easier to reason about than code โ— reduces complexity โ— divide & conquer โ— manage risk ( throughout the lifecycle ) implementation โ€“ why clean code matters โ— code should be written for readability โ— reviewers will detect bugs more easily โ— automatic tools will understand it better โ— maintainers will find it easy to modify โ— quality impact : โ†’a bad implementation will kill your project. testing โ€“ because your code is buggy ( & mine too ) โ— detect bugs at all levels ( unit, integration
EPFL CS 438 Moodle
No question: Moodle
, system, etc. ) โ— detect defects with respect to specification โ— what else is testing good for? system documentation! โ— quality impact : โ†’limited, poor or absent testing will cost you down the road.... and it will cost a lot! testing the pyramid deployment โ€“ because your code is still buggy! โ— ensure repeatability and consistency โ— detect defects in production, ideally before the users! โ— observability โ€“ making the application behaviour โ€œ visible โ€ in production metrics logs stack traces traces โ— if something goes wrong, this is your debug information! observability โ€“ traces managing software quality โ€“ summary โ— each software lifecycle stage impacts the subsequent ones โ— prevent defects whenever possible โ— detect them as soon as possible โ— perverasive concerns : traceability, repeatability โ— nobody likes documentation, but it โ€™ s fundamental โ— it โ€™ s an investment, always evaluate its return testing and breaking stuff! testing basics โ— a test is a way to determine if an artifact meets its requirements a function โ€™ s api a system โ€™ s specification a given user experience โ— along a specific axis : functionality, performance, security, resilience, etc. โ— types unit, integration, system ( end - to - end ), user acceptance, exploratory, smoke, staging ( pre - production ), a / b testing ( in production ), etc. how are developers and testers different? psychology of testing โ€“ mindset
EPFL CS 438 Moodle
No question: Moodle
matters โ— developer wants to see things work, build them focuses on what the system should be doing โ†’solution - oriented work โ— tester wants to break things focuses on what the user expects โ†’problem - oriented work the ( manual ) test case documenting the what with the how automated tests โ€“ the โ€œ right โ€ way โ— reproducible ( not โ€œ flaky โ€ ) โ— isolated ( testing one thing only ) โ— independent from each other โ— self - contained โ— same code quality as production code โ†’tests are an investment, aim for a good return - on - investment! manual testing automatic testing investment ( creation ) low medium to significant investment ( maintenance ) very low depends on code quality, tooling cost, requirements change,... investment ( execution ) massive minimal, unattended flaws lower reliability, human errors sometimes nearly impossible, test code can also have bugs, unique advantages human adaptability, user perspective immediate results, reusability, practical for what do you think? manual vs automatic testing a clear trade - off naive test case automation what if replaced testers with computers? โ— hard to develop โ— hard to debug โ— they come in too late in the development! requirements < 1x quality and cost a reminder 44 metrics if you can โ€™ t measure it, you can โ€™ t improve it! โ— code coverage โ— mutation coverage โ— code complexity โ— historical bug location โ— automatic ratings โ— risk โ— derived metrics, e. g. complexity vs. coverage review
EPFL CS 438 Moodle
No question: Moodle
of basic concepts โ— unit test โ— integration test โ— end - to - end test โ— mocking โ— dependency injection โ— fuzzing โ— property - based tests โ— formal verification โ— model checking unit testing dealing with coupling unit testing โ€“ outcomes โ— find defects early โ— a failing unit test makes the defect obvious โ— better functional / class design โ— reduction of complexity ( hard to test ) โ— increased code coverage a function / object / etc. could be mocked in a number of ways โ€ข stub - pure data โ€ข mock - data and calls โ€ข fake - fake implementation โ€ข spy - real object, extended with partial mocking โ€ข dummy - necessary object, unused in tests mocks, stubs, fakes a word about terminology concepts span all languages, but each has its own tooling. a few selected tools : 1. go testing, testify / require, gomock, gremlins 2. java junit, mockito, jmock, pitest, etc. 3. scala scalatest, mockito, stryker, etc. 4. javascript jest โ€ฆ or jasmine, mocha, sinon, etc.... and sometimes you might have to roll your own language tooling how to make this work integration testing dealing with coupling integration tests green = code under test yellow = test support ( mocks? ) โ€ข โ€œ integration โ€ can happen at all scales ( classes, modules / packages,... ) โ€ข tools depend on the job : no silver bullet o like unit tests o like
EPFL CS 438 Moodle
No question: Moodle
end - to - end ( e2e ) tests o custom โ€ข typical mocks when testing business logic : o database o network o external apis o filesystem integration testing key points 1. testing how 2 - 3 classes work together 2. web : testing the user interface without a backend 3. server : testing an api endpoint ( without a database ) 4. distributed : testing interaction between a few systems 5. pop : testing the processing of incoming messages integration testing a few examples โ€ข โ€œ end - to - end โ€, because it involves the whole system ( - ish ) โ€ข tools are completely dependent on the test objective, the system under test and the domain embedded? browser - based? server infrastructure? dedicated testing tool? bash script? โ€ข automates โ€œ using the software โ€ โ€ข generally : o the slowest tests o detect defects, but not their cause end - to - end testing key points define a test as : โ€ข a given input data shape โ€ข an operation on the input โ€ข a given set of expectations the test runner will : 1. generate the data 2. try to prove the expectations wrong property - based testing property - based testing an arithmetic example @ property boolean sumiscommutative ( @ forall int a, @ forall int b ) { return add ( a, b ) = = add ( b, a ) ; } @ property boolean sumisassociative ( @ forall int a, @ forall int b, @ for
EPFL CS 438 Moodle
No question: Moodle
##all int c ) { return add ( add ( a, b ), c ) = = add ( a, add ( b, c ) ) ; } / / function under test int add ( int a, int b ) { return a + b ; } @ property boolean sumidentity ( @ forall int a ) { return add ( a, 0 ) = = a ; } @ property boolean sumtwiceismultiplication ( @ forall int a ) { return add ( a, a ) = = 2 * a ; } @ property boolean sumoneincreases ( @ forall int a ) { return add ( a, 1 ) > a ; } so, what kind of tests shall we start with and why? question time! distributed & decentralized testing basic good practices mature testing system โ— at all levels : unit, integration, system separate environments โ— development โ— staging โ— production full observability in production โ— centralized log โ— metrics โ— traces โ€ข what is the testing objective? โ€ข what are the parameters we want to control? โ€ข how do you make the tests reproducible? โ€ข how would you do it in practice? distributed system tests so many parameters... covid contact - tracing system specification : 1. radio - based distance measure 2. support up to 16 devices implementation : 1. separate hw boards 2. finite state machine - based communication protocol radio frequency case study โ€“ a distributed, embedded system
EPFL CS 438 Moodle
No question: Moodle
challenges in distributed / decentralized systems โ— the network is an uncontrolled variable โ— ( virtually ) infinite number of states โ— failures can happen at any layer ( network, hw, os, application,... ) โ— many software versions may coexist backward compatibility forward compatibility application invariants across versions โ— subtle environment differences can mask issues jepsen โ€“ testing distributed storage systems โ— full suite of tools to evaluate distributed systems they โ€™ ve โ€œ broken โ€ dozens of major, well - known systems approach : โ— they test real systems, running on real clusters ( 1 - 4 months of work ) โ— they test under failure modes : faulty networks, unsync โ€™ d clocks, etc. โ— they make abundant use of generative testing : โ†’apply ( many, many ) random operations to the system โ†’build a โ€œ concurrent history โ€ of the results โ†’check history against a model to ensure correctness / verify invariants https : / / jepsen. io / testing ( permissioned ) blockchain nodes unique challenges : โ— node robustness during upgrades? โ— can old and new versions communicate without failures? โ— smart contract determinism across versions? โ— impact of failures? solutions : โ— formal verification ( where feasible ) โ— testing latest version against baseline โ— testing mixed environments, including under failure scenarios โ— testing upgrade paths, including under failure scenarios case study โ€“ netflix case study โ€“ netflix โ— key metric : stream โ€œ play โ€ per second ( sp
EPFL CS 438 Moodle
No question: Moodle
##s ) โ— actual video data comes their content distribution network โ— all the logic ( incl. stream play ) comes from their microservices โ— hundreds of microservice clusters โ†’how do you not break anything? chaos monkey & chaos kong how can we... โ— test that a vm โ€™ s unavailability has no consequences? โ†’kill them! โ†’kill them at random! โ— test that an application is resilient to a cloud region โ€™ s unavailability? โ†’kill it! โ†’run a โ€œ chaos kong โ€ exercise! chaos kong โ€“ a metrics perspective video play ( sps ) video play ( sps ) beyond chaos โ€“ fault injection testing โ— chaos monkey and chaos kong are limited by granularity how can we test a hypothesis? โ— redirect traffic to control / experimental group resources โ— choose % of traffic going to each what kind of hypothesis? โ— arbitrary failures! client, server, network, os,... โ— arbitrary scope! single vm, whole cluster, whole region,... beyond chaos โ€“ fault injection testing how do you minimize the blast radius? โ— if control / experimental group deviate, abort experiment automatically! โ— deviations are measured locally, upstream and globally! many non - trivial engineering considerations โ— assigning requests to groups โ— dealing with โ€œ retry โ€ mechanisms โ— analyzing only experimental data โ— how do we inject faults chaos engineering goal : โ— run scientific experiments on production systems requirements : โ—
EPFL CS 438 Moodle
No question: Moodle
strong observability of the system ( = good monitoring ) โ— โ€œ mature โ€ testing environment ( = moderately reliable software ) โ— enough usage to measure a โ€œ steady state โ€ in the system hypothesis : โ€œ steady state โ€ will continue in both experimental & control groups โ— infrastructure - level separation between experimental and control groups then : โ— inject a failure in the experimental group and observe chaos engineering โ€“ advanced principles โ— risk management : focus on likely / impactful events โ— run experiments in production โ— automate : experiments should run periodically / continuously โ— minimize blast radius : users should not be impacted! โ— want tools & resources? https : / / github. com / dastergon / awesome - chaos - engineering decentralized systems engineering cs - 438 โ€“ fall 2023 bryan ford and pierluca borso - tan credits : b. ford, p. borso - tan e - voting decentralized systems for democracy election phases โ— voter registration โ— prepare ballots โ— mark ballots โ— cast ballots โ— count ballots o equality / fairness โ€“ 1 person, 1 vote o integrity โ€“ mark, cast, counted o authentication / authorization o inclusion / accessibility requirements o transparency โ€“ e2e verifiability o privacy โ€“ ballot, participation o resistant to coercion & vote - buying in - person voting โ— why not just paper? validating user choices inclusion / accessibility ( e. g. visual impairments ) counting efficiency convenience โ— what types? direct - recording electronic ( dr
EPFL CS 438 Moodle
No question: Moodle
##e ) voting machines paper - based โ€“ ballot marking device ( bmd ), optical scan remote online e - voting ( or i - voting ) โ— ballots are marked electronically on voter โ€™ s device โ— transmitted over the internet โ— no paper trail โ— voter hopes ( verifies? ) the vote is counted correctly โ— switzerland : various trials since 2003 โ— estonia : since 2005, > 50 % votes cast online in 2023 remote e - voting phases โ— registration โ— open election โ— cast ballot โ— close election โ— shuffling โ— counting โ†’decide on voter roster โ†’encryption, transmission โ†’randomize order of encrypted ballots โ†’decryption of ballots or tallies end - to - end verifiability key desirable properties : โ— cast - as - intended verifiably : voter โ€™ s intent โ†’encrypted, transmitted ballot โ— recorded - as - cast verifiably : encrypted ballot โ†’ledger of cast ballots approach : public bulletin board, tamper - evident log, ledger / blockchain โ— counted - as - recorded verifiably : all encrypted ballots โ†’ ( shuffled, decrypted, ) counted cast - as - intended : challenges โ— availability โ€“ network connectivity swiss fallback : postal voting, in - person โ— man - in - the - middle โ€“ ballot manipulation requires strong user authentication โ— compromised voter device benolah challenge code voting ( e. g., switzerland ) cross - device
EPFL CS 438 Moodle
No question: Moodle
verification ( votegral ) counted - as - recorded : approaches shuffle - and - decrypt โ— classic mix - nets ballots โ†’mix1 โ†’mix2 โ†’... โ†’mixn โ†’decrypt ballots ( verifying at each step ) โ— cryptographic verifiable shuffles neff shuffle ( elgamal encryption ) generalized zk - snarks โ— cut - and - choose ( scantegrity, assigned reading ) coercion resistance : challenges two broad approaches : โ— re - voting only the last vote counts โ— fake credentials juels - catalano - jakobsson ( jcj ) scheme cf. โ€œ coercion - resistant electronic elections โ€ ( optional reading ) next steps mandatory reading : โ— scantegrity : end - to - end voter - verifiable optical - scan voting optional readings : โ— star - vote : a secure, transparent, auditable, and reliable voting system โ— verifiable internet voting in estonia โ— coercion - resistant electronic elections ( jcj ) โ—... and a few more 11 decentralized systems engineering cs - 438 โ€“ fall 2024 pierluca borso - tan and bryan ford credits : p. tennage, c. basescu, et al. communicating with ( many, unknown ) peers โ— same machine a file in a shared directory, or linux wall command โ— local networking shared drive, intranet website โ— global networking, centralized trust mailing lists
EPFL CS 438 Moodle
No question: Moodle
, forums, reddit, โ€ฆ โ— decentralized??? โ†’today โ€™ s lecture decentralized communication usenet & gossip ( homework 1 ) what is usenet? โ— user โ€™ s network โ— worldwide, distributed discussion system โ— hierarchical organization of topics โ— context โ€“ early 1980s : pre - internet ( 1980 ) mainframes, then minicomputers intermittent, dial - up connections ( at best 56kbit / s ) resilient : censorship - and failure - resistant root comp lang asm c โ€ฆ os theory โ€ฆ sci news alt โ€ฆ early uucp / usenet map 5 why think of usenet in 2023? โ— 1980s computers are still relevant โ€ฆ they are just way smaller today : embedded systems, internet of things ( iot ), sensors, etc. โ— 1980s networks are still relevant : low - power wide - area networks ( e. g. loranet / lorawan ) [ 0. 3, 50 ] kbit / s 256 bytes / message per - message pricing ( ~ 2 chf / mb ) โ— power and batteries are their limit building usenet : specifications โ— worldwide, distributed discussion system โ— hierarchical organization of topics / newsgroups โ— messages are ( eventually ) received by all subscribers โ— it is possible to respond privately ( pre - email ) โ— resilient : censorship - and failure - resistant โ— intermittent, dial - up connections โ€“ slow & costly! โ— limited computing resources ( 1980s
EPFL CS 438 Moodle
No question: Moodle
) building usenet : network messages header body the message itself comes here, after a blank line. hello, world! blank line mhuxt eagle mhuxj mhuxv cbosjd jerry beth โ€ข from : jerry @ eagle. uucp ( jerry schwarz ) โ€ข path : cbosgd! mhuxj! mhuxt! eagle! jerry โ€ข newsgroups : news. announce โ€ข subject : usenet etiquette - - please read โ€ข message - id : < 642 @ eagle. att. com > โ€ข date : fri, 19 nov 82 16 : 14 : 55 gmt โ€ข organization : at & t bell laboratories, murray hill โ€ข expires : sat, 1 jan 83 00 : 00 : 00 - 0500 naive broadcast network a b c bob on receiving message m : send m to all peers ( except sender ) what โ€™ s the problem here? naive broadcast network meltdown! โ— exponential # of messages โ— too costly to operate how do we fix this? 1. recognize messages 2. restrict the graph to a tree e. g., ethernet ( r ) stp a b c bob d e recognizing messages with ids โ— how do you generate message ids? big random number ( e. g., 256 bits ) hash usenet : < sequence number > @ < node > โ— how do you detect / trace node misbehavior? usenet : use message
EPFL CS 438 Moodle
No question: Moodle
propagation path naive broadcast ( fixed! ) a b c d e f on receiving message m : if m is known : ignore else : send m to all peers ( except sender ) which issues do you foresee? broadcast : limitations โ— well - connected nodes often receive the same message many times โ— what happens if some nodes failed? โ— do we need to send the whole message every time? early usenet ( uucp ) โ€œ better than accepting the delay of round - trips โ€ late usenet ( nntp ) - binaries, high traffic volume, etc. โ€œ we can โ€™ t afford to โ€ broadcast efficiency how can we minimize duplication and reduce traffic? by comparing sets of messages! a - > b ihave < id _ 1 >, < id _ 2 >, < id _ 3 >, โ€ฆ < b _ address > a < - b sendme < id _ 3 >, < id _ 5 > < a _ address > what implementation issues can you foresee? message ids : trade - offs โ— how long do you store message ids for? what happens if โ€ฆ โ— you store them forever? โ— you don โ€™ t store them long enough? d e a b c 16 google books ngram viewer ( english, case - insensitive ) what made it so successful? โ— it worked! โ— engineering simplicity โ— decentralization โ— โ€œ democratizing โ€ the life of usenet 17 google books ngram viewer ( english, case
EPFL CS 438 Moodle
No question: Moodle
- insensitive ) the life and death of usenet what killed usenet? cause # 1 : spam! โ— jan 1994 : global alert for all : jesus is coming soon โ— apr 1994 : green card lottery โ€“ final one? other causes : โ— better alternatives โ— slow evolution beyond usenet : gossip efficiency what if we wanted to further minimize traffic? a closer look at ihave / sendme : v message content is only sent once per node x still requires p2p interaction, sending ids redundantly can we minimize bandwidth usage without interaction? naive broadcast ( ), = # nodes, = max. degree of any node can we reduce to? improved gossiping a b c d e f what can we learn from people? rumor mongering on receiving message m : pick random neighbor, send m neighbor replies : new rumor? if new : repeat else : what โ€™ s good about this? which issues do you foresee? flip _ coin ( ) if head : repeat else : stop improved gossiping ( cont โ€™ d ) how can make sure messages reach every node? anti - entropy periodically ( when timer fires ) : pick random neighbor send โ€œ anything new? โ€ reduce entropy ( ihave / sendme ) what โ€™ s good about this? what โ€™ s limiting? this ( slowly ) ensures complete dissemination, at period decentralized systems engineering cs - 438 โ€“ fall 2024 pierluca borso
EPFL CS 438 Moodle
No question: Moodle
- tan and bryan ford credits : p. tennage, c. basescu, et al. decentralized communication gossip ( homework 1 ) recap : improved gossiping a b c d e f what can we learn from people? rumor mongering on receiving message m : pick random neighbor, send m neighbor replies : new rumor? if new : repeat else : what โ€™ s good about this? which issues do you foresee? flip _ coin ( ) if head : repeat else : stop recap : improved gossiping ( cont โ€™ d ) how can make sure messages reach every node? anti - entropy periodically ( when timer fires ) : pick random neighbor send โ€œ anything new? โ€ reduce entropy ( ihave / sendme ) what โ€™ s good about this? what โ€™ s limiting? this ( slowly ) ensures complete dissemination, at period case study : twitter gossip relies on message - ids. how do you pick a good message - id in a ( centralized ) distributed setting? โ— for most applications, they need to be sortable โ— globally unique, even in distributed settings โ†’snowflake ids [ 0 ( 1 bit ) | timestamp ( 41 bits ) | machine id ( 10 bits ) | counter ( 12 bits ) ] announced 2010, adopted by instagram ( 2012 ), discord ( 2015 ) case study : mastodon snowflake ids ( 64 bits ) [ 0 ( 1 bit ) | timestamp ( 41 bits
EPFL CS 438 Moodle
No question: Moodle
) | machine id ( 10 bits ) | counter ( 12 bits ) ] what about a decentralized setting? โ— would this work? โ— what else do we need to do? case study : mastodon {'created _ at': datetime. datetime ( 2022, 11, 13, 0, 52, 37, tzinfo = tzutc ( ) ),'id': 109347716491680514,... message data...'uri':'https : / / example. com / @ user / 109347716173491502 โ€™ } local snowflake id original uri w / snowflake id gossip quality measures is your gossip any good? how can you tell? โ— residue โ— traffic โ—, average & 95th percentile time for rumor โ†’node โ— for rumor โ†’last node broadcast rumor - mongering anti - entropy early : low late : high early : high late : low what are the parameters & trade - offs? rumor - mongering ( fast, randomized ) : โ— feedback vs. blind โ— randomized vs. counter โ— constant : probability / counter anti - entropy ( slow, complete ) : โ— periodicity how can we โ€œ delete โ€ rumors? death certificates โ— when is the rumor deleted? โ— how does this affect propagation? โ— why can rumors resurrect? โ— when can we del
EPFL CS 438 Moodle
No question: Moodle
##ete the death certificate? โ— what if a server is offline? โ€œ dormant โ€ death certificates phased deletion 10 a few applications of gossip โ— metadata propagation โ— failure detection โ— group membership example โ— apache cassandra โ— cockroachdb โ— consul 11 communicating with ( many, unknown ) peers you now understand : โ— how do we reach unknown peers? โ— how do we eventually reach every peer? โ— how can we communicate reliably? are they online? is the network ยซ stable ยป? โ— how do they find out about us / our node? 12 decentralized search finding data ( homework 2 ) finding data among ( many, unknown ) peers โ— same machine build a local index, and / or linux locate, find, grep commands โ— local networking โ— global networking, centralized trust crawling, processing, indexing, then using the ( distributed ) index โ€ฆ google โ— decentralized??? โ†’today โ€™ s and next week โ€™ s lecture finding data among ( many, unknown ) peers many open questions : โ— where can the data be found? โ— does the data even exist? โ— who knows about it? โ— how do we retrieve it? most importantly : โ— what can we assume about the peers and the network? 15 distributed search algorithms two big families : โ— unstructured search robust to churn, instantly adaptive โ†’today โ€™ s lecture โ— structured search much more efficient, many more problems โ†’next week โ€™ s lecture building
EPFL CS 438 Moodle
No question: Moodle
gnutella context ( 1999 โ€“ 2008 ) : โ— no spotify, no netflix โ— no bittorrent โ— people still want entertainment specifications : โ— search any file, anywhere โ— metadata can be searched โ— complex queries are allowed ( ( a or b ) and c ) e. g. artist is โ€œ bob marley โ€ and title contains โ€œ birds โ€ standard, basic algorithm what can we learn from people? flooding โ— gossip searches ( query ) โ— direct response ( query hit ) which issues do you foresee? e b d f c a ken barbie girl โ— unpredictable delays โ— connectivity โ— efficiency : all nodes see & process all searches optimizations can we not flood everyone? expanding - ring search โ— limited flooding ( ttl ) โ— increasing ttl on retry what are the trade - offs? โ— higher latency โ— asymptotically worse โ— pragmatically, it works! e b d c a ken barbie girl optimizations can we make it more efficient? bubblestorm โ— birthday paradox โ— data search & storage random โ€œ meet in the middle โ€ key considerations : โ— asymptotically efficient โ— โ€œ mostly unstructured โ€ โ— tunable parameters โ— extremely robust / resilient ken barbie girl next steps reading on moodle : โ— ( mandatory ) bubblestorm : resilient, probabilistic, & exhaustive p2p search โ†’use friday โ€™ s session to ask questions 21 decentralized systems engineering cs - 438 โ€“ fall
EPFL CS 438 Moodle
No question: Moodle
2024 pierluca borso - tan and bryan ford credits : p. tennage, c. basescu, et al. so far... โ— decentralized communication & search โ— focusing on ( mostly ) unstructured networks characteristics : โ— ( nearly ) stateless โ— simple to engineer โ— expressive search โ— optimizations require ( true ) random sampling ( hard ) โ— inefficient, at best can we aim for? โ†’later today ad - hoc routing protocols finding your way through ad - hoc networks ( homework 1 ) p2p example ( 1 / 2 ) โ€“ your home & epfl networks public internet epfl network icon credits : flaticon diode ( epfl firewall ) private network within epfl 192. 168. 1. 0 / 24 128. 178. 35. 194 18. 29. 2. 34 isp network home router + nat 192. 168. 1. 11 p2p example ( 2 / 2 ) โ€“ ad - hoc networks icon credits : flaticon p2p examples โ€“ quick analysis โ— peers may not be directly accessible โ— peers may join or leave the network at arbitrary times โ— we need to route packets through the system some differences : โ— protocols / physical layer / etc. โ— bandwidth โ— churn โ— node mobility / network reconfiguration naive routing โ€“ don โ€™ t do this at home b d c a nodes advertise a distance to other nodes b โ†’d = 1 a
EPFL CS 438 Moodle
No question: Moodle
โ†’d = 2 ( through b or c ) c โ†’d = 1 1 1 1 1 on link failure, b updates : b โ†’d = 2 ( through c ) then c updates : c โ†’d = 3 ( through b ) 1 reaching arbitrary peers in a network : aodv ad - hoc on - demand distance vector key idea : flooding search for a node ( e. g. e ) nodes remember where the search came from... and build a return path a โ†’b โ†’d โ†’e a b d e reactive ( on - demand ) routing, cached used in the zigbee wireless protocol b d e c a reaching arbitrary peers in a network : dsdv destination - sequenced distance vector key idea : โ— store next hop for any destination ( ) โ— version ( โ€œ sequence โ€ ) routing table entries each node periodically broadcasts its existence : flood the network, with increasing sequence numbers traffic, superseded by newer protocols, versioning idea lives on! a b c d quality factors in ad - hoc routing โ— traffic at rest ( maintenance ) โ— speed of convergence โ— loop - free โ— traffic during updates โ— robustness to churn & movement compact routing & structured search, here we come! general approach โ— build a structured overlay network โ— enables significant efficiency gains we โ€™ ll pay a price : โ— more engineering effort โ— nodes will need local state โ— constant fight against churn โ— loss of generality distributed hash table local hash tables need : โ—
EPFL CS 438 Moodle
No question: Moodle
โ€œ good โ€ hash function โ— random - access memory โ— not too full distributed hash tables considerations : โ— what do we need from the hash function? avoid collisions, not time - sensitive โ†’cryptographic hash, well distributed โ— what are we missing? โ†’ram chord dht โ— hash into a collection of rams โ— circular hash id space ( e. g., sha - 256 ) โ— each node has a pseudo - random hash id what should go into that id? public key! 0 2254 2255 3 2253 e a b c d chord dht how do we approximate ram? โ— divide the space up! โ— each node owns the space to its successor api : โ— put ( key, value ) โ— get ( key ) โ†’value / error keys use same hash function as nodes 0 2254 2255 3 e a b c d successor : b kv4 kv5 kv3 kv2 kv1 chord dht โ€“ reliability how do we prevent data loss? โ— redundancy โ€“ factor โ— copies are stored by โ€œ owner โ€ node + ( ) successors 0 2254 2255 3 e a b c d kv4 kv5 kv3 kv2 kv1 chord dht โ€“ load what is the expected load per node? โ€“ # of nodes โ€“ # of key - value pair โ€“ redundancy factor load ~ 0 2254 2255 3 e a b c d kv4 kv5 kv3 kv2 kv1
EPFL CS 438 Moodle
No question: Moodle
chord dht โ€“ performance how do we make this? ( in storage, network, etc. ) โ— using only successors : routing table size โ— binary search? finger tables! 0 2254 2255 3 e a b c d kv4 kv5 kv3 kv2 kv1 chord dht โ€“ finger tables 0 2254 2255 3 e a b c d kv4 kv5 kv3 kv2 kv1 distance bucket 1 ( successor ) = b ยฝ circle d ยผ circle c b...... chord dht โ€“ churn need to handle : โ— concurrent joining โ— nodes leaving ( gracefully ) โ— nodes leaving ( unresponsive ) approach : โ— split correctness & performance โ— transient failures can be retried 0 2254 2255 3 e a b c d kv4 kv5 kv3 kv2 kv1 chord dht โ€“ degenerate cases 0 2254 2255 3 e a b c d kv4 kv5 kv3 kv2 kv1 network partitions can lead to some ( transient ) degenerate cases. where : b โ€™ s successor is d d โ€™ s successor is a a โ€™ s successor is c c โ€™ s successor is e etc. chord dht โ€“ possible attacks โ— churn attacks โ— sybil attacks โ— eclipse attacks โ— adversarial routing โ— denial of service next steps - readings mandatory : โ— dsdv : routing over a multihop wireless network of mobile computers โ— chord
EPFL CS 438 Moodle
No question: Moodle
: a scalable p2p lookup service for internet applications recommended ( engineering ) : โ— the babel routing protocol ( rfc 8966 ) โ— kademlia : a peer - to - peer information system based on the xor metric... and a few others for the curious among you... โ†’use friday โ€™ s session to ask questions 23 decentralized systems engineering cs - 438 โ€“ fall 2024 pierluca borso - tan and bryan ford credits : c. arad, id2210 / kth, consensys, m. kleppman miscellaneous updates ( hw, evals ) โ— congrats, most of you scored 100 % on hw0! โ— be sure to work on the correct branch, i. e. โ€œ hw1 โ€ for homework 1 โ— hw1 code listing 1 had a mistake, the pdf was updated โ— hw1 comes with benchmarks and hidden tests benchmarks count for 5 % hidden tests for 10 % โ— project deadline โ€“ this sunday! โ— class evaluations this week : please participate! all ( constructive ) feedback is welcome, help us improve! so far... โ— decentralized communication โ— unstructured & structured search โ— can we attack structured search systems? finishing up โ€ฆ chord dht โ€“ possible attacks โ— churn attacks โ— sybil attacks โ— eclipse attacks โ— adversarial routing โ— denial of service so far... โ— decentral
EPFL CS 438 Moodle
No question: Moodle
##ized communication โ— unstructured & structured search โ— can we attack structured search systems? yes, but they โ€™ re still useful! โ— how do we handle the actual underlying data? storing data ( reliably ) โ— local machine raid, fec / ecc / erasure codes, โ€ฆ โ— distributed block -, filesystem - or object - level access ( san, nas, aws s3 ) redundancy concurrency control sharding โ— decentralized??? โ†’today โ€™ s lecture decentralized storage & distribution bittorrent, ipfs and crdts ( homework 2 ) cap theorem โ€“ a reminder a. k. a. brewer โ€™ s theorem trade - offs beyond cap : โ— granularity of cap โ— latency vs consistency โ— eventual consistency definitions : โ— c = read last write ( or error! ) โ— a = requests get non - error reply โ— p = dropped / delayed packets storage & distribution โ€“ goals & challenges ( 1 / 2 ) โ— availability โ— consistency โ— scalability, load - balancing โ— modifiability / mutability robust to churn, individual node failures, etc. how do we stay in sync? weak? strong? efficiency in bandwidth & storage space ( optionally ) how do we manage multi - writers? storage & distribution โ€“ goals & challenges ( 2 / 2 ) โ— malicious security โ— infosec ( cia triad ) โ— ( logical ) data organization โ— ( physical ) data location eclipse, tampering
EPFL CS 438 Moodle
No question: Moodle
& rollback attacks access control, logging, accountability โ€œ flat โ€? files? directories? databases? graph? where should it be stored? building bittorrent : specifications โ— distribute a large, static ( immutable ) files โ€ฆ from a source node with limited bandwidth โ€ฆ to a large number of users โ€ฆ as fast as possible! โ— scalable : 22 % up - and 3 % downstream of global internet traffic ( oct. 2023 ) โ— assume users are self - interested = don โ€™ t assume they want to help how do we build this? core intuition? bittorrent : distribution building bittorrent : sub - problems โ— advertising a file โ— finding peers to download from โ— verifying integrity of large files ( or parts of them ) โ— optimizing performance โ— aligning incentives ( downloaders vs. uploaders ) distribution & integrity of ( large ) files a client should be able to verify : โ— parts of a ( large ) file, as they are downloaded โ— the whole file ( after download ) solution? โ†’chunking โ†’hash tree bittorrent : bootstrapping / finding peers two options : โ— trackers โ— mainline dht ( based on kademlia ) key : merkle root value : the list of peers having ( or downloading ) the file join the swarm and connect to ~ 80 peers bittorrent : publishing new content โ— โ€œ prepare โ€ the file ( chunk & build merkle tree ) โ— register with a โ€œ tracker
EPFL CS 438 Moodle
No question: Moodle
โ€ โ— publish a. torrent file or magnet ( dht ) link bittorrent : performance & incentives โ— download rarest data blocks ( โ€œ chunks โ€ ) first โ€“ entropy maximization โ— tit - for - tat strategy ( โ€œ choking โ€ protocol ) โ€œ chokes โ€ ( punishes ) peers that are not uploading โ€œ unchokes โ€ peers with the highest upload rates โ€œ optimistic unchoking โ€ looks for better / bootstrapping peers โ— make the download rate proportional to the upload rate for each peer bittorrent - inspired solutions โ— twitter โ€™ s โ€œ murder โ€ server deployment system โ— facebook โ€™ s โ— โ€œ blizzard downloader โ€ - world of warcraft, diablo iii โ— wargaming โ€™ s - world of tanks, world of warplanes, etc. โ— windows update โ— others have tried โ€ฆ and failed ( e. g. โ€œ debtorrent โ€ ) โ— interplanetary filesystem ( ipfs ) servers games os bittorrent limits why did debtorrent fail to materialize? โ— ill - suited for small files ( overhead ) โ— ill - suited for sharing overlapping sets of data ( across torrents ) โ— data is immutable ( and not re - usable across torrents ) โ— locality of peers is ignored โ€“ isps do traffic - shaping for debtorrent, both โ€œ 1 huge torrent โ€ or โ€œ 1m + small ones โ€ = inefficient ipfs โ€“ inter - planetary file system โ— protocol for
EPFL CS 438 Moodle
No question: Moodle
p2p distributed file system, fully decentralized โ— designed to address ( perceived ) flaws in http โ— deployed at massive scale 2024 : > 70k servers, millions of unique weekly users, 23 eib capacity ( 2 stored ) โ— a decentralized file system inspired by : kademlia dht bittorrent โ€“ block exchange git versioning self - certifying filesystems reminder : git object database commit object tree object blob object. / test. txt. / test. txt. / new. txt. / test. txt. / test. txt. / new. txt. / bak / test. txt. / new. txt. / test. txt ipfs : representing a filesystem in a dht โ— everything is immutable โ— all objects are self - certifying ( files, links, folders, changes ) id is computed based on object โ€™ s hash โ— any ipfs object ( file, folder ) is represented in the same way : type ipfsobject struct { / / array of links links [ ] ipfslink / / opaque content data data [ ] byte } type ipfslink struct { name string / / target โ€™ s name hash multihash / /... hash size int / /... size } ipfs : representing a file < 256kb { โ€œ links โ€ : [ ], โ€œ
EPFL CS 438 Moodle
No question: Moodle
data โ€ : โ€œ \ u0008 \ u0002 \ u0012 \ rhello world! \ n \ u0018 \ r โ€ } also known as : a blob! ipfs : representing a file > 256kb { โ€œ links โ€ : [ { โ€œ name โ€ : โ€œ โ€, โ€œ hash โ€ : โ€œ qmysk2jy... โ€, โ€œ size โ€ : 262158 }, { โ€œ name โ€ : โ€œ โ€, โ€œ hash โ€ : โ€œ qmqeuqdj... โ€, โ€œ size โ€ : 262158 }, { โ€œ name โ€ : โ€œ โ€, โ€œ hash โ€ : โ€œ qma98bk1... โ€, โ€œ size โ€ : 178947 } ], โ€œ data โ€ : โ€œ \ u0008 \ u0002 \ u0018 * \ u0010 \ u0010 \ n โ€ } also known as : a list! ipfs : representing a directory testing. txt parent directory large file text file ( multiple locations ) also known as : a tree!. / bigfile. js. / my _ dir / my _ file. txt. / my _ dir / testing. txt. / hello. txt ipfs : versioning โ— git - like โ— build a merkle dag ( directed acyclic graph ) โ— build a โ€œ snapshot โ€ of the current state โ— hash
EPFL CS 438 Moodle
No question: Moodle
of both content and its parent commit โ€™ s hash โ— creates a git - like log of versions also known as : a commit! ipfs : naming ( mutable ) data objects are immutable, so : โ— use a separate namespace for mutable data โ— use mutable, signed pointers to immutable data โ— not content - addressable : advertise link on routing system โ— built - in limit to rollback attacks shifting paradigm : local - first software what do these 3 applications have in common? โ— git โ— google docs โ— apple notes they work offline and you ( nearly ) get the full experience! how? โ— multi - version concurrency control i. e. how do you โ€œ merge โ€ versions that forked? local - first software goals โ— local client is first - class citizen โ— works offline โ— eventual consistency โ— ideally : can handle forks what tool do we need to make this happen? โ— conflict - free replicate data types data structure + algorithm + protocol conflict - free replicated data types ( crdts ) various types : โ— values โ— counters โ— sets two main categories : โ— operation - based โ€“ commutative replicated data types ( cmrdts ) โ— state - based โ€“ convergent replicate data types ( cvrdts ) โ†’theoretically equivalent โ— lists โ— log - based โ— text state - based crdt โ€“ formalism let u be the set of update operations, and v the set of values. a state - based
EPFL CS 438 Moodle
No question: Moodle
crdt is a 5 - tuple ( s, s0, q, u, m ), where : โ€ข s is the set of states ; โ€ข s0 โˆˆs is the initial state ; โ€ข q : s โ†’ v is the query function โ€ข u : s ร— u โ†’ s is the update function โ€ข m : s ร— s โ†’ s is the merge function next steps - readings mandatory : โ— incentives build robustness in bittorrent โ— ivy : a read / write peer - to - peer file system recommended ( engineering ) : โ— ipfs : content addressed, versioned, p2p file system โ— peritext : a crdt for rich - text collaboration... and a few others for the curious among you... โ†’use friday โ€™ s session to ask questions 33 decentralized systems engineering cs - 438 โ€“ fall 2024 pierluca borso - tan and bryan ford credits : d. ongaro, j. ousterhout, l. alvisi, a. ghodsi, d. mazieres, l. q. torres, et al. so far... โ— decentralized communication โ— unstructured & structured search โ— data storage let โ€™ s pick up where we left off... conflict - free replicated data types ( crdts ) various types : โ— values โ— counters โ— sets two main categories : โ— operation - based โ€“ commutative replicated data types ( cmrd
EPFL CS 438 Moodle
No question: Moodle
##ts ) โ— state - based โ€“ convergent replicated data types ( cvrdts ) โ†’theoretically equivalent โ— lists โ— log - based โ— text state - based crdt โ€“ formalism let u be the set of update operations, and v the set of values. a state - based crdt is a 5 - tuple ( s, s0, q, u, m ), where : โ€ข s is the set of states ; โ€ข s0 โˆˆs is the initial state ; โ€ข q : s โ†’ v is the query function โ€ข u : s ร— u โ†’ s is the update function โ€ข m : s ร— s โ†’ s is the merge function g - counter crdt specifications : โ— grow - only counter, replicated across n machines โ— add ( x ) updates our local counter โ— query ( ) returns the value โ— merge ( other _ state ) merge โ€™ s other โ€™ s state class gcounter ( object ) : def _ _ init _ _ ( self, i, n ) : self. i = i # server id self. n = n # number of servers self. xs = [ 0 ] * n def add ( self, x ) : assert x > = 0 self. xs [ self. i ] + = x def query ( self ) : return sum ( self. xs ) def merge ( self, other ) : zipped = zip ( self. xs, other. xs ) self. xs =
EPFL CS 438 Moodle
No question: Moodle
[ max ( x, y ) for ( x, y ) in zipped ] g - counter crdt specifications : โ— grow - only counter, replicated across n machines โ— add ( x ) updates our local counter โ— query ( ) returns the value โ— merge ( other _ state ) merge โ€™ s other โ€™ s state 4 2 1 3 tot : 0 tot : 0 tot : 0 tot : 0 g - counter crdt specifications : โ— grow - only counter, replicated across n machines โ— add ( x ) updates our local counter โ— query ( ) returns the value โ— merge ( other _ state ) merge โ€™ s other โ€™ s state 4 2 1 3 5 4 2 tot : 5 tot : 0 tot : 4 tot : 2 g - counter crdt specifications : โ— grow - only counter, replicated across n machines โ— add ( x ) updates our local counter โ— query ( ) returns the value โ— merge ( other _ state ) merge โ€™ s other โ€™ s state 4 2 1 3 5 5 4 5 2 2 tot : 5 tot : 5 tot : 11 tot : 2 g - counter crdt specifications : โ— grow - only counter, replicated across n machines โ— add ( x ) updates our local counter โ— query ( ) returns the value โ— merge ( other _ state ) merge โ€™ s other โ€™ s state 4 2 1 3 5 1 5 4 5 2 2 tot : 5 tot : 6 tot :
EPFL CS 438 Moodle
No question: Moodle
11 tot : 2 g - counter crdt history, as seen locally : node 1 : 0 โ†’5 โ†’6 โ†’12 node 2 : 0 โ†’4 โ†’11 โ†’12 node 3 : 0 โ†’5 โ†’12 node 4 : 0 โ†’2 โ†’12 โ€ฆ eventually consistent! 4 2 1 3 1 4 5 2 1 4 5 2 1 4 5 2 1 4 5 2 tot : 12 tot : 12 tot : 12 tot : 12 local - first software โ€“ simpler backends strong consistency? โ— what if we wanted a shared history of the โ€œ state โ€? google docs approach : โ†’centralize โ†’use time stamps โ†’does not ensure consistency โ— how could we stay distributed ( or even decentralized ) and be consistent? โ— how could we build the same, incremental history of the state? today โ€™ s lecture : replication and consensus! replication and consensus paxos ( homework 3 ) consistent data replication you know of : โ— redundant array of independent disks ( raid ) โ— centralized, distributed databases ( master / slave replication ) our goal, decentralization : โ— no privileged โ€œ master โ€ โ— replicated & consistent data โ†’hard problem, requires consensus consensus โ— consensus is agreeing on one result โ— once a majority agrees on a proposal, that is consensus โ— the consensus is eventually known by everyone โ— involved parties want to agree on any result, not just their own... in the presence of failures โ— types permissioned ( today ) โ€“ known
EPFL CS 438 Moodle
No question: Moodle
nodes permissionless ( week 9 & 10 ) โ€“ anyone single - value consensus ( formally ) we want all nodes ( โ€œ processes โ€ ) to agree on a single value โ— agreement / safety every correct process must agree on the same value โ— termination / liveness eventually, every correct process decides some value โ— integrity / validity ( weak / strong /... ) if all correct processes proposed value x, then correct processes must decide x if a correct process decides x, then x must have been proposed by correct process โ— can fail โ†’failure model? types of ( permissioned ) consensus โ— leader - based โ— electing / rejecting leader is tricky, and requires consensus โ— โ€œ following โ€ is easy & efficient โ— peer - to - peer aka leader - less โ— consensus is needed continuously โ— no โ€œ extra โ€ work when node fails leader follower peer peer peer peer peer building a consensus... easy ( and wrong )! โ— all โ€œ proposers โ€ node vote โ— one acceptor choses the value what if the acceptor crashes... before choosing?... after choosing? p p p a p 1 2 1 1 building a better consensus... โ— all โ€œ proposers โ€ node vote โ— multiple โ€œ acceptors โ€ node โ— value is chosen if accepted by majority easy ( and still wrong ) : split votes! building a better consensus? โ— same as before โ— now, โ€œ acceptors โ€ nodes accept every value they receive โ— value is chosen if accepted by majority โ—
EPFL CS 438 Moodle
No question: Moodle
we need a two - phase protocol! paxos โ— a family of distributed algorithms for consensus three roles : โ— proposers : put forth values to be chosen โ— acceptors : respond to proposers, reach consensus โ— learners : learn the agreed upon value โ— nodes can take any ( or even all ) roles โ— nodes must know how many acceptors make up a majority โ— nodes must be persistent : they can โ€™ t walk back on choices paxos phases : intuition โ— prepare phase proposer : โ€œ will you consider a value i propose? โ€ each acceptor : โ€œ okay โ€ / โ€œ nope... โ€ if a majority is obtained : โ— accept phase proposer : โ€œ here โ€™ s my proposed value : x โ€ acceptors : โ€œ okay for x! โ€ / โ€œ nope! โ€ the paxos algorithm the paxos algorithm the paxos algorithm propose propose the paxos algorithm propose propose propose the paxos algorithm propose propose propose the paxos algorithm propose propose propose the paxos algorithm propose propose propose the paxos algorithm propose propose propose the paxos algorithm propose propose propose the paxos algorithm propose propose propose propose the paxos algorithm propose propose propose propose the paxos algorithm propose propose propose propose paxos challenges โ— contention โ— non crash - stop behaviour asynchrony byzantine faults โ— ( in ) efficiency of simple paxos introducing a leader protocol โ€œ quick wins โ€ โ— choosing multiple, subsequent values ( e. g.
EPFL CS 438 Moodle
No question: Moodle
multi - paxos ) the raft consensus algorithm โ— designed to be easy to understand โ— functionally equivalent to paxos โ— easier to implement ( claim ) โ— widely used in the industry mongodb, cockroachdb etcd, neo4j, rabbitmq... cs - 438 decentralized systems engineering fall 2024 week 7 a versaries and threat modeling no system is 100 % secure assess relevant scopes : assets - what needs to be protected boundaries - administrative domains enclaves adversaries - realistic attacks, motivations algorithms - make security assumptions nodes trusted / not file serves exampledieservers trusted, t clients not extremes impractical : - " frust everyone " - no security - " trust no one " - no way to design systems adversarie - categorizations ( more realistic ) - internal adversaries vs boundaries, admin domains - external adversaries local us global epheral vs persistent ( " advanceda a passive vs active - byzantine " honest but curious " threshold assumptions - f ofa nodes are faulty / malicious - 750 % mining power is " good " common threat rectors - stride mode - sporting - tampering - repudiation - information disclosure ( privacy leaks ) - denial of service - elevation of privilege exphography basics - review symmetric crypto - bothfall parties share a koy - symmetric encryption ke attackerget [ hard to recover p - cryptographic hashes : m texte it
EPFL CS 438 Moodle
No question: Moodle
dived size 2 properties : non - invertible, collision - resistance - messageauthenticationchs face ke hmac ( k, m โ†“ note - authenticated m i ( w / " additionoption ( a hee โ†“monit " lad # metric kila tion mc - publiceye ) k ms - digital signatures threshold cryptography - - t - of - n encryptiono m c kn 00000 he - final implemen c of + m shamir secret sharing - cample : 2 - of - 3 pirate treasure n n points decentralized systems engineering cs - 438 โ€“ fall 2024 pierluca borso - tan credits : b. ford, wikimedia commons, nsa, a. dakhnovich anonymous communication building privacy - preserving systems who has eyes on your internet usage? 3 o ads : google, meta, etc. o parental control o governments o browsers : google, microsoft, mozilla, apple o your employer โ€™ s security solutions ( dlp, idps, etc. ) o internet service provider o dns servers o vpn servers, proxies o platforms : amazon, alphabet, tencent, alibaba, โ€ฆ o spyware hasn โ€™ t tls / encryption solved the problem? metadata absolutely tells you everything about somebody โ€™ s life. if you have enough metadata, you don โ€™ t really need content. โ€“ stewart baker, nsa โ— location, device, used software, visited websites
EPFL CS 438 Moodle
No question: Moodle
, sensor usage, etc. โ— based on a fingerprint database of 42, 027 videos, they identified 99. 5 % of 200 random 20 - minutes video streams correctly, ~ 90 % within 8 minutes. ( gen. michael hayden ) why desire anonymity online? โ—privacy ( individuals ), security ( business, governments ) โ—freedom of speech / journalism / activists โ€“ escaping censorship โ€“ avoid speech being linked to oneself โ—avoid ad targeting, tracking โ—bypass geo - blocking โ—helps criminals stay out of jail โ—helps cops investigate online crimes 5 threat model is our desire to remain anonymous a secret on its own? who are we keeping our identity from? โ— a website โ— advertisers โ— a platform ( e. g. meta, google ) โ— a well - funded government what are their capabilities? โ— cookies, โ€œ supercookies โ€, fingerprinting โ— semi - honest nodes ( โ€œ honest but curious โ€ ) โ— malicious nodes โ— nsa โ€“ xkeyscore, quantum & foxacid ( mitm, mots ) โ— cac ( ๅ›ฝ ๅฎถ ไฟก ๅ…ฌ ) โ€“ censorship, mots, control over platforms threat model threat model the goal โ— sender and receiver cannot be โ€œ linked โ€ by a 3rd party โ— sender and receiver both remain anonymous, including to each other within an anonymity set โ— metadata must be unusable for traffic analysis โ†’what does this entail?
EPFL CS 438 Moodle
No question: Moodle
โ— ideally : censorship - resistant anonymous communication senders receivers how to achieve anonymity 1 - hop approach : โ— proxy / commercial vpn advantages : โ— shields user from website ip - based tracking โ— prevents geolocation problems : โ— vpn knows incoming outgoing mapping โ— vulnerable to traffic analysis โ— vulnerable to hacking / coercion โ— vulnerable to censorship web encrypted ( isp ) vpn how to achieve anonymity 2 - hops approach : โ— apple private relay advantages : โ— shields user from website ip - based tracking โ— in theory, no single party sees both sender & receiver problems : โ— restricted to countries allowing it โ— apple + 3rd party jurisdiction โ— limited to user โ€™ s geography โ— only works with some applications โ— vulnerable to traffic analysis web encrypted ( isp ) 3rd party apr 2 apr 1 mix networks ( e. g. mixminion ) โ— goal : anonymize e - mail / usenet - like traffic โ— key intuition โ— client splits message m in uniform chunks, padded as needed, and encrypts each chunk c for a path through the mix - net mix networks ( e. g. mixminion ) โ— client splits message m in uniform chunks, padded as needed, and encrypts each chunk c for a path through the mix - net s =,,,,,, encrypted ( isp ) mix b mix a mix c mix d mix
EPFL CS 438 Moodle
No question: Moodle
e mix f mix g mix networks โ— client can stay anonymous & provide encrypted return path for replies โ— works with just 1 honest mixer advantage โ— provable ( strong ) anonymity โ— may resist traffic analysis problem : โ— very slow, high latency ( hours ) โ— few users โ†’small anonymity set tor ( the onion router ) โ— can we make mix - net work at interactive speeds? โ†’trade - off with robustness to traffic analysis โ— intuition : could we nest multiple vpn connections? tor network tor ( the onion router ) relays guard ( or bridge ) middle exit tor ( the onion router ) โ— making traffic look uniform : each packet is 514 bytes โ— how do we find tor relays? โ†’hardcoded ( 10 ) directory servers! โ— new list of all known relays every hour โ†’how do they agree on the list? tor ( the onion router ) โ— how can this system be attacked? tor network relays guard ( or bridge ) middle exit tor ( the onion router ) advantage โ— larger anonymity set โ— low - latency โ— usability, interactive web โ— highly effective against weak adversaries problems : โ— weak to traffic analysis attacks โ— web services may block tor โ— adversary may become global passive adversaries from onion โ€ฆ โ€ฆ to garlic routing the i2p approach to traffic analysis resistance dining cryptographers ( dc - nets ) โ— fundamentally different : information coding, not relay - based
EPFL CS 438 Moodle
No question: Moodle
โ— the classic problem : cryptographers are having dinner & a waiter tells them the bill has been paid they want to find out if one of them paid or if someone else ( the nsa ) did without revealing who paid? dining cryptographers ( dc - nets )? 0 1 0 my value = left โŠ•right โŠ• ( i paid ) dining cryptographers ( dc - nets )? 0 1 0 my value = left โŠ•right โŠ• ( i paid ) 0 โŠ•1 โŠ•0 = 1 0 โŠ•1 โŠ•0 = 1 i paid! 0 โŠ•0 โŠ•1 = 1 1 have we paid? 1 โŠ•1 โŠ•1 = 1 dining cryptographers ( dc - nets )? 0 1 0 my value = left โŠ•right โŠ• ( i paid ) 0 โŠ•1 โŠ•0 = 1 0 โŠ•1 โŠ•0 = 1 i did not pay 0 โŠ•0 โŠ•0 = 0 0 have we paid? 1 โŠ•1 โŠ•0 = 0 dining cryptographers ( dc - nets ) advantage : โ— provable, information theoretic anonymity โ— security independent of relays disadvantages : โ— naive implementation is inefficient, easy to disrupt internally โ— many optimizations and strengthening techniques exist and are needed e. g. scaling by avoiding all - to - all communication ( past research at dedis ) few servers ( m ) many clients ( n ) next steps reading on moodle : mandatory : โ— tor : the second - generation onion router โ— the
EPFL CS 438 Moodle
No question: Moodle
dining cryptographers problem optional : โ— plenty of papers on anonymous communication systems 27 decentralized systems engineering cs - 438 โ€“ fall 2024 bryan ford and pierluca borso - tan credits : wikimedia commons, visa, swiss govt. so far โ€ฆ dht, consensus, etc. failure modes at worst : byzantine nodes can misbehave in arbitrary ways we still assumed a known total number of nodes ( and known identities ) โ€ฆ not today! byzantine crash - recovery omission crash - stop sybil attacks and defenses fake it till you break it - thwarting sybils! sybil what? the sybil attack โ€“ john r. douceur, 2002 โ— โ€œ one can have, some claim, as many electronic personas as one has time and energy to create. โ€ โ€“ judith donath โ— fake identities o virtual nodes o astroturfing o fake reviewers o ballot stuffing o social bot o sockpuppets sybil attack โ€“ implications โ— dhts : eclipse attacks censor nodes censor key - value pairs โ— compromise threshold - based security ( t - of - n ) creeping compromise : slowly increase t, n โ— compromise consensus force particular decisions rewrite history equivocate ( multiple histories ) sybil defenses โ€“ an overview โ— permissioned systems โ— stronger identity โ— adding artificial costs โ— social network - based โ— proof of personhood widely used mostly academic or niche projects stronger identities ( 1 / 2 ) โ—
EPFL CS 438 Moodle
No question: Moodle
sign up with phone number ( e. g., whatsapp ) โ— sign up with credit card โ— sign up with e - mail me @ gmail. com vs. me + cs438 @ gmail. com โ— id verification regulatory requirement e. g. โ€œ know your customer โ€ ( kyc ) deterrents : cost, jail, paper trail stronger identities ( 2 / 2 ) โ— biometrics face fingerprints iris biggest biometrics databases? โ—aadhaar ( india ) โ€“ 1. 38b โ—china โ€“? โ—common identity repository ( eu ) โ€“ 350m โ—dpt. of homeland security ( us ) โ€“ 270m stronger identity โ€“ weaknesses? โ— privacy needs centralized database db encoding? db usage for authentication db usage for sybil resistance โ— forgeability fake โ€œ fingerprints โ€ fake โ€œ iris โ€ biometrics synthesis artificial costs โ— key idea : increase the cost to sybil identities o captcha ( turing tests ) o proof - of - work o proof - of - stake o proof - of - space / storage o time delay o threshold validation sybil defenses โ€“ artificial costs โ— proof - of - work first proposed for e - mail anti - spam popularized by bitcoin โ— crypto puzzle, = 000 โ€ฆ โ†’find the proof - of - work threshold doesn โ€™ t prevent an attack, just increases its costs not efficient, not
EPFL CS 438 Moodle
No question: Moodle
environmentally friendly! sybil defenses โ€“ artificial costs โ— proof - of - stake nodes must stake money to participate in consensus randomized validators, likelihood based on stake misbehaviour punished by loss of stake risks : hostile takeover, devolution to plutocracy social / trust network defenses ( 1 / 2 ) โ— pgp โ€œ web of trust โ€ model alternative to pki โ€œ key signing โ€ parties โ€œ alice โ€ โ†’key a โ€œ bob โ€ โ†’key b โ— pki / client - side tls certificates company - managed? email - challenge? not sybil - resistant! social / trust network defenses ( 2 / 2 ) โ— algorithms : generic sybilguard sybillimit sybilrank โ— algorithms : application - specific sumup ( recommendations / vote aggregation ) whanau ( dht ) dsybil social network defenses โ€“ assumptions โ— social graph โ— edges denote โ€œ trust โ€ โ— honest region is well - connected โ— โ€œ sybil region โ€ scenario โ— attack edges are expensive โ— attack edges are rare / few sumup โ— random walk in the graph โ— assign voting rights to end node โ— repeat social network defenses โ€“ weaknesses basics : โ— privacy โ— performance re - thinking the โ€œ movie plot threat โ€ โ— crowd - sourcing โ— sparse infiltration โ— small - scale attacks sybils on facebook let โ€™ s do a thought experiment! we โ€™ re facebook and trying to detect fake accounts how? proof of
EPFL CS 438 Moodle
No question: Moodle
personhood key intuition : can we link identity only to โ€œ being a physical person โ€? goals : โ— inclusion low cost to participation ( permissionless ) โ— equality one person, one vote ( strictly ) โ— security against identity theft / loss and sybils โ— privacy no id, no biometrics, no databases, etc. pseudonym parties principle : real people have only one body each gather in โ€œ lobby โ€ area by a deadline deadline entrances close, no one else gets in attendee gets one token while leaving lobby area 1. 2. lobby area entrances closed proof of personhood โ€“ approaches โ— pseudonym parties โ— encointer co - located physical bodies โ— idena โ€œ flip โ€ tests ( turing tests ) โ— humanity dao dao / curated list โ— many others : upala, brightid, gooddollar, etc. next steps โ†’review paxos, try to implement mandatory reading : โ— โ€œ the sybil attack โ€ optional readings : โ— plenty of papers on sybil detection and resistance 23
EPFL CS 438 Moodle