Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@gavofyork
Copy link
Member

@gavofyork gavofyork commented Mar 14, 2018

Uses the recursive-triplet-majority method on the last 81 blocks. Also removes the need for with-env stuff (though let it be known, this makes serialisation/deserialisation more likely to become a performance bottleneck).

http://www.cs.huji.ac.il/~nati/PAPERS/coll_coin_fl.pdf

Goes in after #98

@gavofyork gavofyork added the A3-in_progress Pull request is in progress. No review needed at this stage. label Mar 14, 2018
@gavofyork gavofyork added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Mar 16, 2018
@rphmeier
Copy link
Contributor

Could you link to the relevant paper?

{
type Item = T;
fn mixed(self) -> Self::Item {
let mut accum = [[T::default(); 3]; 13];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

13 is pretty arbitrary. 3^13 is pretty big but not unreasonably.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now a named constant.

Ok(seeds.iter().cloned().mixed())
}

/// The mixed trait for mixing a ssequence.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo. and why use a trait if it's supposed to be an implementation of a single algorithm? why not fn mix<I, T> instead of impl<I, T> Mixed for I?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not? is this not idiomatic?

}
}
}
accum[max_depth][0]
Copy link
Contributor

@rphmeier rphmeier Mar 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth noting in the docs that the amount of items is effectively truncated to the lowest power of three below it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

fn calculate_random() -> Hash {
let c = block_number() - 1;
(0..81)
.map(|i| if c >= i { block_hash(c - i) } else { Default::default() })
Copy link
Contributor

@rphmeier rphmeier Mar 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so for the first 81 blocks the random seed won't be random at all -- I wonder if it's better to use a filter_map so that the early randomness is much more manipulable but not dominated by zero hashes. In polkadot we should have an initial epoch shuffle which ends after randomness is well-seeded.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'll still be a bit random. but sure, lower security. thankfully it doesn't really matter.

@gavofyork gavofyork merged commit 58cc695 into master Mar 20, 2018
@gavofyork gavofyork deleted the gav-random-beacon branch March 20, 2018 02:48
lamafab pushed a commit to lamafab/substrate that referenced this pull request Jun 16, 2020
* read head-data directly out of WASM memory

* implement ext_post_message for parachain WASM

* further refactoring of the parachain module

* add externalities error type

* accumulate posted messages when validating parachain candidate

* define Extrinsic type in primitives

* availability-store: store extrinsic data

* compute extrinsic and check against candidate

* add some egress queue tests

* grumbles & substrate update

* ensure everything builds
JoshOrndorff pushed a commit to moonbeam-foundation/substrate that referenced this pull request Apr 21, 2021
* added polkadot-js types

* lint

* turn lint on save on

* remove parachain types and comments
liuchengxu pushed a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
* Add verify_btc_address function
* Format code
liuchengxu added a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
* Fix ci GA

* Add wasm workflow

* Pin to some nightly version for wasm

* Install wasm-gc

* Add --git

* Add wasm badge

* Add stale workflow
liuchengxu pushed a commit to autonomys/substrate that referenced this pull request Jun 3, 2022
…dator

Do not submit unsigned root block extrinsic on nodes that do not produce blocks themselves
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants