Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement pre-sharing of proposed block #1426

Closed
2 of 5 tasks
nategraf opened this issue Mar 10, 2021 · 1 comment
Closed
2 of 5 tasks

Implement pre-sharing of proposed block #1426

nategraf opened this issue Mar 10, 2021 · 1 comment

Comments

@nategraf
Copy link
Contributor

nategraf commented Mar 10, 2021

  • Develop a end to end miner test
  • Re-structure the miner to enable this change. (in progress)
  • Develop a prototype implementation of block pre-constructing
  • Develop a prototype implementation of block pre-sharing
  • Deploy a testnet with the change
@nategraf nategraf self-assigned this Mar 10, 2021
@mcortesi mcortesi assigned trianglesphere and unassigned nategraf Apr 28, 2021
mergify bot pushed a commit that referenced this issue May 28, 2021
### Description

This refactors the miner with a couple goals
1. Simplify the block construction logic.
2. Enable pre-construciton / pre-sharing of blocks in the miner
3. Fix the pending state bug

I worked towards these goals by

- Reducing the number of go-routines passing work to each other. There is now 1 main loop goroutine.
- Make the block creation process as linear as possible (and use contexts to cancel instead of global interrupts).
    - Each step in the block production cycle is now done in `miner/block.go`
    - There is no longer a shared "current environment" for the in flight block, but a new environment is made for each request (which is the `blockState` struct).
    - Block production is cancelable with contexts instead of global interrupts
    - I have removed as much blocking as possible from `engine.Prepare`
      - It no longer sleeps until the block time - that is done in the worker
      - It does not wait until the next sequence for nodes that are not validating


### Other changes

- Removes proof of work specific miner interfaces.
- Removes miner/unconfirmed.go
- Includes some upstream changes made to `miner/miner.go` to simplify the start up logic.

### Tested

Unit tests still pass.

Tested end to end on `trianglesphere/miner_refactor_v2`
TODO: test that this fixes the pending bug.

### Related issues

- Fixes #1419
- Partial fix of #1426

### Backwards compatibility

Yes
@trianglesphere trianglesphere removed their assignment Sep 15, 2021
@mcortesi
Copy link
Contributor

streamming block construction superseeds this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants