npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pbft-typescript

v0.0.48

Published

*Work in progress, do not use in production.*

Downloads

27

Readme

PBFT-Typescript

Work in progress, do not use in production.

This library is a PBFT implementation of the PBFT algorithm (Practical Byzantine Fault Tolerance).

To do

  • [x] Remove node types from the tests
  • [x] PBFT onLeaderChange should count itself
  • [x] Generate new block via a blocks provider?
  • [x] on new-view the new leader is not counting itself (not logging the PP before sending the new-view)
  • [x] implement new-view
  • [x] we should have a timer for each view. new-view shouldn't restart a timer if it's already started.
  • [x] suggest block in new-view (inside PP)
  • [x] Convert getBlock of "BlocksProvider" to async.
  • [x] the onElected will trigger new-view more than once
  • [x] new-view shouldn't restart a timer if it's already started.
  • [x] Unsubscribe gossip on dispose of PBFT
  • [x] Separate the PBFT to a 1-Height-PBFT and a full PBFT.
  • [x] add isMember, and call it from pbft
  • [x] missing protection against byzantine attacks with wrong term/senderId etc.
  • [x] make sure on onReceiveNewView the PP.view === view
  • [x] protect against wrong view in PBFTTerm
  • [x] protect against bad leader messages
  • [x] publish on npm
  • [x] the PP validation should be extracted and used on new view PP
  • [x] onReceiveNewView should match the PP.view with the view
  • [x] onReceiveNewView should validate the given PP
  • [x] use BlockStorage interface
  • [x] publish the public types on the root of the library (import { Config } from 'pbft-typescript')
  • [x] intellisense is not working for pbft-typescript imports
  • [x] BlockStorage interface async compatible.
  • [x] BlockStorage interface remove 'appendBlockToChain'.
  • [x] add the git repo to the npm site
  • [x] Rename OnNewBlock to OnCommitted(Block)
  • [x] BlcokStorage.getTopMostBlock() => convert to BlcokStorage.getLastBlockHash()
  • [x] BlocksProvider.getBlock() change to requestNewBlock(blockHeight: number)
  • [x] BlockStorage: remove getBlockHashOnHeight(), getBlockChainHeight().
  • [x] Convert "registerOnCommitted" to async.
  • [x] Default implementations of: PBFTStorage.
  • [x] Add "restart" to PBFT api
  • [x] term should be taken from the height of the latest block (Use the BlockStorage)
  • [x] Implement "registerOnCommitted" to async.
  • [x] Implement "restart" to PBFT api
  • [x] KeyManager passed in config
  • [x] NetworkCommunication interface: { getMembersPKs(height, seed), sendToMembers([pk]), subscribeToMessages(cb), unsubscribeFromMessages}
  • [x] Remove senderId from Gossip -> Use PK instead
  • [x] Network rename NetworkCommunication
  • [x] Block interface {header}
  • [x] getNetworkMembersPKs(seed: string): string[]; // ordered
  • [x] getHeight should by async
  • [x] BlockUtils.calculateBlockHash(blockHeader) - bytes vs string?
  • [x] Remove BlockStorage, instead cache the last committed block
  • [x] BlockUtils - requestNewBlock and validate => use lastBlockHeader
  • [x] KeyManager implementation.
  • [x] Make BlockUtils external
  • [x] remove blockProvider & blockValidator
  • [x] PBFT.start should work with height
  • [x] TDD trigger once
  • [x] Cache future messages and consume on each new term
  • [x] CommitBlock - commit the matching preprepared block in the pbftstorage - not the temp in state (this.CB)

None Blockers

  • [x] call the clear pbftStorage after commit.
  • [x] set the committee members pks in the PBFTTerm constructor
  • [x] clear the pbftStorage
  • [x] suggest block in new-view (inside PP), with proofs from other nodes.
    • [x] choose the "best" block (Out of view-change proofs) to offer on new-view
    • [x] on new-view verify that the leader offered the "best" block
    • [x] PrePrepare Compare given blockHash with the hash of the given block
    • [x] Storage - store payloads
    • [x] GetLatestPreparedProof from storage
    • [x] Add proof validator that can validate the prepred proof
      • [x] Test for matching view/leader
      • [x] Make sure the preprepare hold a block
      • [x] count null as a valid proof
      • [x] Verify the payloads
      • [x] Test that the pk is in the committee!
      • [x] Make sure that the prepares are not from the leader
      • [x] Prepared proof is valid only if it has 2f+1
    • [x] send the proof on view change
    • [x] validate the proof on view change
    • [x] on generate new-view add the view-change proof.
    • [x] extract ViewChange tests from onReceiveViewChange to a reusable function
    • [x] onReceiveNewView verify the proof
      • [x] not undefined
      • [x] isArray
      • [x] 2f+1 proofs
      • [x] validate using isViewChangePayloadValid
      • [x] all proofs senders a unique
      • [x] all VC terms match the given term
      • [x] all VC views match the given view
  • [ ] validate all signed messages
  • [ ] Check state still holds after async await functions (ex: when returning from requestNewBlock - view has changed)
  • [ ] Think about view-change counting, when to count myself.
  • [ ] add isACommitteeMember to PBFTTerm
  • [ ] Change logging methodology - warning - added metadata
  • [ ] Have a better (Readable) tests solution to await nextTick
  • [ ] documentation
  • [ ] monitoring/debug
  • [ ] Optimizations: IData - Signature only on hash(header).

V1 stuff

  • [ ] PBFT-BC onCommitted - adds header.pbftData.pbftProof
  • [ ] implement verifyBlock