New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fmg-nitro-adjudicator

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fmg-nitro-adjudicator

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
increased by300%
Maintainers
3
Weekly downloads
 
Created
Source

Nitro contracts

NitroAdjudicator.sol

ConsensusApp.sol

The consensus application (or consensus game) is the unique application that runs in Nitro ledger channels. Its purpose is to allow ledger channel participants to safely update how the funds in the ledger channel are distributed, by way of unanimous consensus. Recall that a ledger channel can allocate to other channels as well as the participants themselves.

The consensus application is compatible with Nitro protocol, and therefore specifies some AppAttributes to be included in each commitment as well as a validTransition function which helps the nitro-adjudicator to settle disputes.

The application specific data are organised thus:

    enum UpdateType { Consensus, Proposal }

    struct AppAttributes {
        uint32 numVotes;
        uint256[] proposedAllocation;
        address[] proposedDestination;
        UpdateType updateType;
    }

and are in addition to (in fact a branch of) the core commitment data:

    struct CommitmentStruct {
        address channelType;
        uint32 nonce;
        address[] participants;
        uint8 commitmentType;
        uint32 turnNum;
        uint32 numVotes;
        address[] destination;
        uint256[] allocation;
        bytes appAttributes;
    }

Valid transitions conform to the following diagram:

graph LR
linkStyle default interpolate basis
0.Consensus -->|Pass| 0.Consensus
0.Consensus -->|Propose| 1.Proposal
1.Proposal -->|Add a vote| 1.Proposal
1.Proposal -->|Propose Alternative| 1.Proposal
1.Proposal -->|New Consensus| 0.Consensus
1.Proposal -->|Veto| 0.Consensus

Note that this state machine is transitioned cyclicly by n players.

2 player example scenarios

New Consensus

  • A1. PreFS; allocation: [5,5]; destination: [0xa,0xb]; proposedAllocation: [5,5]; proposedDestination: [0xa,0xb]; furtherVotesRequired: 0
  • B2. PreFS; allocation: [5,5]; destination: [0xa,0xb]; proposedAllocation: [5,5]; proposedDestination: [0xa,0xb]; furtherVotesRequired: 0
  • A3. PostFS; allocation: [5,5]; destination: [0xa,0xb]; proposedAllocation: [5,5]; proposedDestination: [0xa,0xb]; furtherVotesRequired: 0
  • B4. PostFS; allocation: [5,5]; destination: [0xa,0xb]; proposedAllocation: [5,5]; proposedDestination: [0xa,0xb]; furtherVotesRequired: 0
  • A5. App/Proposal; allocation: [5,5]; destination: [0xa,0xb]; proposedAllocation: [10]; proposedDestination: [0xChannel]; furtherVotesRequired: 1
  • B6. App/Consensus; allocation: [10]; destination: [0xChannel]; proposedAllocation: []; proposedDestination: []; furtherVotesRequired: 0

Veto

  • A1. PreFS; allocation: [5,5]; destination: [0xa,0xb]; proposedAllocation: [5,5]; proposedDestination: [0xa,0xb]; furtherVotesRequired: 0
  • B2. PreFS; allocation: [5,5]; destination: [0xa,0xb]; proposedAllocation: [5,5]; proposedDestination: [0xa,0xb]; furtherVotesRequired: 0
  • A3. PostFS; allocation: [5,5]; destination: [0xa,0xb]; proposedAllocation: [5,5]; proposedDestination: [0xa,0xb]; furtherVotesRequired: 0
  • B4. PostFS; allocation: [5,5]; destination: [0xa,0xb]; proposedAllocation: [5,5]; proposedDestination: [0xa,0xb]; furtherVotesRequired: 0
  • A5. App/Proposal; allocation: [5,5]; destination: [0xa,0xb]; proposedAllocation: [10]; proposedDestination: [0xChannel]; furtherVotesRequired: 1
  • B6. App/Consensus; allocation: [5,5]; destination: [0xa,0xb]; proposedAllocation: []; proposedDestination: []; furtherVotesRequired: 0

3 player example

New Consensus

  • A1. PreFS; allocation: [5,5,5]; destination: [0xa,0xb,0xc]; proposedAllocation: [5,5,5]; proposedDestination: [0xa,0xb,0xc]; furtherVotesRequired: 0
  • B2. PreFS; allocation: [5,5,5]; destination: [0xa,0xb,0xc]; proposedAllocation: [5,5,5]; proposedDestination: [0xa,0xb,0xc]; furtherVotesRequired: 0
  • C3. PreFS; allocation: [5,5,5]; destination: [0xa,0xb,0xc]; proposedAllocation: [5,5,5]; proposedDestination: [0xa,0xb,0xc]; furtherVotesRequired: 0
  • A4. PostFS; allocation: [5,5,5]; destination: [0xa,0xb,0xc]; proposedAllocation: [5,5,5]; proposedDestination: [0xa,0xb,0xc]; furtherVotesRequired: 0
  • B5. PostFS; allocation: [5,5,5]; destination: [0xa,0xb,0xc]; proposedAllocation: [5,5,5]; proposedDestination: [0xa,0xb,0xc]; furtherVotesRequired: 0
  • C6. PostFS; allocation: [5,5,5]; destination: [0xa,0xb,0xc]; proposedAllocation: [5,5,5]; proposedDestination: [0xa,0xb,0xc]; furtherVotesRequired: 0
  • A7. App/Proposal; allocation: [5,5,5]; destination: [0xa,0xb,0xc]; proposedAllocation: [15]; proposedDestination: [0xChannel]; furtherVotesRequired: 2
  • B8. App/Proposal; allocation: [5,5,5]; destination: [0xa,0xb,0xc]; proposedAllocation: [15]; proposedDestination: [0xChannel]; furtherVotesRequired: 1
  • C9. App/Consensus; allocation: [15]; destination: [0xChannel]; proposedAllocation: []; proposedDestination: []; furtherVotesRequired: 0

FAQs

Package last updated on 24 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc