GithubHelp home page GithubHelp logo

Comments (2)

jgraef avatar jgraef commented on June 14, 2024

I took a look at block #46720, which showed not enough votes in the Demo. As you can see below, when tried calculating the votes from the slots, the public key of validator 31 is missing from slots.

The following method counts votes:

    pub fn votes(&self, validators: &GroupedList<LazyPublicKey>) -> u16 {
        // sum up votes of signers that signed prepare and commit
        (&self.prepare.signers & &self.commit.signers)
            .iter()
            .map(|s|
                validators.groups().get(s)
                    .map(|Group (count, _)| *count)
                    .unwrap_or(0)
            )
            .sum()
    }

Note the unwrap_or. We should return an AggregateProofError here. I checked that MacroHeader::validators is correct and Blockchain verifies that fact.

Slots is dervied from CompressedList<_> by turning it into an iterator.

Block

{
  "type": "macro",
  "hash": "a1645ad6b696742421494e4b6146c33e6e56101f4072bd2bd03ba5e7b595bf38",
  "blockNumber": 46720,
  "viewNumber": 0,
  "epoch": 365,
  "parentMacroHash": "b805c1024df2a9e5630ea62d2ff1c2aa8b4903ae0d251311460d7b491047aba6",
  "parentHash": "29cac6d1e3fc2d774e4da41b9b758ca4d48b8750a20089f36e6c54e4dbee900a",
  "seed": "84ec9d8d200a23d4c9db4a109a2e7761e98ba04e43f2b358cbc448c0338a8d222e07bba6991778cda134888cb4e414f6",
  "stateRoot": "8e205e7cd8065e241e23877590ecd9e33cc6251a76964677bf13a9af67f00ee0",
  "extrinsicsRoot": "ffa4f40bc65f22180a8fd7ead157857a7a2b8a4014f4dfc360ae9cee7c081d63",
  "timestamp": 1573572053,
  "timestampMillis": 1573572053044,
  "slashFine": 310229,
  "justification": {
    "votes": 319,
    "prepare": {
      "signature": "96bdc11d37094d24e57b4e659dca44fdce34a027785f0e89c0c6e631890b060ca7043f9793380bd7960ef8d6a7fc6ede",
      "signers": [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]
    },
    "commit": {
      "signature": "abf7d350884c7d4888b712676440c1f858ee187f80b41c559ca20a977e895a9721756a6c7ed2b5e2ba94ec12aabe4718",
      "signers": [0, 1, 2, 3, 7, 8, 9, 10, 11, 12, 13, 14, 16, 21, 23, 25, 26, 27, 29, 30, 31]
    }
  }
}

Slot allocation

Found 31 unique validator keys in slots

  • Validator 0 - b84a37ba: 17
  • Validator 1 - b79d17a2: 18
  • Validator 2 - b6a23ab8: 14
  • Validator 3 - b3ea5eae: 17
  • Validator 4 - b21846a4: 18
  • Validator 5 - b19553a4: 18
  • Validator 6 - afbadc8c: 22
  • Validator 7 - ae9b7c4b: 20
  • Validator 8 - ad271d2a: 19
  • Validator 9 - acc6bcd7: 16
  • Validator 10 - ab800b4c: 17
  • Validator 11 - a5ed1821: 14
  • Validator 12 - a4963031: 24
  • Validator 13 - a20b1ce6: 18
  • Validator 14 - a1d9100f: 17
  • Validator 15 - a16c34fe: 14
  • Validator 16 - a0465a40: 13
  • Validator 17 - 94f1e18e: 25
  • Validator 18 - 92e2dfe8: 14
  • Validator 19 - 91188fe5: 17
  • Validator 20 - 8eecc4e7: 22
  • Validator 21 - 8dee007d: 11
  • Validator 22 - 8b4b103b: 14
  • Validator 23 - 8a7e4dc3: 15
  • Validator 24 - 8a77af51: 19
  • Validator 25 - 8961b960: 12
  • Validator 26 - 8820dc9e: 18
  • Validator 27 - 8576fe01: 16
  • Validator 28 - 8502eac8: 10
  • Validator 29 - 835287fc: 15
  • Validator 30 - 811112a5: 8

Votes

ERROR: No public key for: 31
ERROR: No public key for: 31
ERROR: No public key for: 31

  • Prepare: 498
  • Commit: 327
  • Both: 327

from core-rs-albatross.

jgraef avatar jgraef commented on June 14, 2024

Counting the votes over slots returns 327 votes, whereas the value reported by the RPC server is 319. So the RPC server is reporting even 8 less votes than the slots can count. That corresponds to the 30th validators slot amount.

from core-rs-albatross.

Related Issues (20)

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.