Giter Club home page Giter Club logo

bft-rs's People

Contributors

kaoimin avatar rev-chaos avatar u2 avatar yejiayu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bft-rs's Issues

The height of BftActuator and Bft are not ensure consistency.

pub fn send_status(&mut self, status: BftMsg) -> Result<()>{ match status { BftMsg::Status(s) => Ok(s), _ => Err(BftError::MsgTypeErr), } .and_then(|s| { if s.height >= self.height { self.height = s.height + 1; } self.sender .send(BftMsg::Status(s)) .map_err(|_| BftError::SendMsgErr) }) }

If the sender occurs an error, the height of BftActuator may different from Bft. Why not straightly expose Bft's height?

vote type

Here

bft-rs/src/lib.rs

Lines 88 to 99 in ce10282

pub struct Vote {
/// Prevote vote or precommit vote
pub vote_type: Step,
/// The height of vote
pub height: usize,
/// The round of vote
pub round: usize,
/// The vote proposal
pub proposal: Target,
/// The address of voter
pub voter: Address,
}

why does the vote_type not use prevote and precommit.

@rev-chaos @KaoImin

The API is too hard to use.

Why should I learn how to use the channel?

Recommend the API to be changed to the following.

pub trait BFT {
    fn set_proposal(p: Proposal) -> BFTResult<bool, Error>;
    fn set_vote(v: Vote) -> BFTResult<bool, Error>;

    fn start();
}

pub trait BFTProvider: Send + Sync {
    fn package_proposal(height: u64) -> BFTResult<Proposal, Error>;
    fn validate_proposal(p: Prposal) -> BFTResult<bool, Error>;
    fn commit(cm: CommitBlock) -> BFTResult<(), Error>;
    fn udpate_validate(height: u64) -> BFTResult<Vec<Validate>, Error>;
    // Broadcast blocks or votes can be split into two function.
    fn broadcast() -> BFTResult<(), Error>;
}

let provider = BFTProvider::new();

let bft = BFT::new(provider, signer);
bft.start();

ref go-cita-tendermint

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.