A part of LotusPoSt has been changed from the campaign PoSt to two new PoSt, one is winningPoSt and the other is windowPoSt . Let's talk about winningPoSt first. As the name suggests, winningPoSt is the PoSt when winning. The so-called winning means obtaining the block right. Simply put, winningPoSt is a randomly checked sector in which 66 randomly selected Merkle paths can be correct. Then let's talk about the code logic. From the Lotus code. It all starts with the block of the mineOne function of the Miner structure of lotus/miner/miner.go. func (m *Miner) mineOne(ctx context.Context, addr address.Address, base *MiningBase) (*types.BlockMsg, error) {mbi, err := m.api.MinerGetBaseInfo(ctx, addr, round, base.TipSet.Key())rand, err := m.api.ChainGetRandomness(ctx, base.TipSet.Key(), crypto.DomainSeparationTag_WinningPoStChallengeSeed, base.TipSet.Height()+base.NullRounds, nil) Among them, the MinerGetBaseInfo function is used to obtain some basic information, including the sector information that needs to be extracted. The ComputeProof function is used to calculate the winningPoSt proof. Because the specific implementation of these logics is implemented in rust-fil-proofs (ie rust language). From rust to rust, many interfaces are crossed: Only the two API functions provided by rust-fil-proofs are introduced, and the intermediate interface will not be introduced. The number of sectors and total number of leaves to challenge are defined in rust-fil-proofs/filecoin-proofs/src/constant.rs: pub const WINNING_POST_CHALLENGE_COUNT: usize = 66; That is, a sector is extracted from the valid sectors and 66 leaf nodes to be challenged are selected on the sector. The generate_winning_post_sector_challenge function implements the challenge logic of the department. How does the core logic check the department? The specific logic is: In the fallback::generate_sector_challenges function: let mut hasher = Sha256::new(); In short, it uses the random_information of the random_provider_id and the random number of the sector to calculate the hash value of sha256. The calculation result and the current limited number of sectors are modulo. That is, sector_index is the sector ID of the final query. generate_winning_post checks the leaf node on the Merkle tree (replica_r_last) composed of the selected sectors. The calculation logic of the challenge leaf node is implemented by the fallback::generate_leaf_challenge function : let mut hasher = Sha256::new(); Hash random information, sector ID and challenge leaf number. Calculate the result modulo the total number of leaves. 32G sector has 1G leaf number. The computational part of the zero-knowledge proof can be viewed in the rust-fil-proofs/post/fallback directory. The sector structure is discussed in rust/background/fallback/circuit.rs. This structure is a challenge. As can be seen from the synthesize function: // 1. Verify comm_r comm_r as public input and other comm_r_last and comm_c as private inputs. // 1. Verify H(Comm_C || comm_r_last) == comm_r Verify that comm_r is calculated from comm_c and comm_r_last. // 2. Verify Inclusion Paths for(i,(leaf,path))in leafs.iter().zip(paths.iter()).enumerate() { Verify that the leaf node can correctly calculate the root of the Merkle tree. Lotus PoSt consists of two parts: winningPoSt and windowPoSt . WinningPoSt is the PoSt certificate that needs to be provided when obtaining block authority. Extract a sector from all valid sectors and challenge the 66 leaves on the sector. ——End—— |
>>: [100 Questions and Answers about Filecoin in Pictures] Question 27: What is Tipset?
NextBank, the world’s first international Bitcoin...
People with these palmistry features are more ble...
Some people are more thoughtful when doing things...
If we are destined to meet, we will meet even if ...
Finger fortune telling: low finger roots reveal p...
For a woman, marrying a man is the most important ...
1. See your parents 1. Look at the corners of the...
The debate over Bitcoin block expansion has becom...
Ethereum’s exchange volume has decreased by 30% i...
Generally speaking, moles in different locations ...
Reporter: Pencil lead Matrix Financial, a startup...
Do women with high cheekbones really bring bad lu...
After experiencing the worst Spring Festival in h...
Everyone hopes to have good fortune, but in fact ...
A person's character affects his fortune and d...