Commit 853d67d
PoA Leader Lock for Block Production (#3203)
## Linked Issues/PRs
<!-- List of related issues/PRs -->
## Description
<!-- List of detailed changes -->
The goal with this change is to allow multiple authority nodes to be
live without causing contention on who should produce the next block.
Introduced the `LeaderLeasePort`:
```rs
#[async_trait::async_trait]
pub trait LeaderLeasePort: Send + Sync {
async fn can_produce_block(&self, height: BlockHeight) -> anyhow::Result<bool>;
async fn release_lease(&self) -> anyhow::Result<()>;
}
```
Where each block producer can check if the lease is available before
producing a block. On shutdown, it will always release the lease as
well.
The implementation is `RedisLeaderLeaseAdapter`, where we use a lease on
a Redis server. The server can have its own ttl for the lease so if a
block producer dies before releasing the lease, it can still be grabbed
by the other producers :)
## Checklist
- [ ] Breaking changes are clearly marked as such in the PR description
and changelog
- [ ] New behavior is reflected in tests
- [ ] [The specification](https://github.com/FuelLabs/fuel-specs/)
matches the implemented behavior (link update PR if changes are needed)
### Before requesting review
- [ ] I have reviewed the code myself
- [ ] I have created follow-up issues caused by this PR and linked them
here
### After merging, notify other teams
[Add or remove entries as needed]
- [ ] [Rust SDK](https://github.com/FuelLabs/fuels-rs/)
- [ ] [Sway compiler](https://github.com/FuelLabs/sway/)
- [ ] [Platform
documentation](https://github.com/FuelLabs/devrel-requests/issues/new?assignees=&labels=new+request&projects=&template=NEW-REQUEST.yml&title=%5BRequest%5D%3A+)
(for out-of-organization contributors, the person merging the PR will do
this)
- [ ] Someone else?
---------
Co-authored-by: Green Baneling <XgreenX9999@gmail.com>1 parent 697e692 commit 853d67d
File tree
32 files changed
+1459
-127
lines changed- .changes/changed
- .github/workflows
- bin/fuel-core/src/cli
- run
- crates
- fuel-core
- src
- graphql_api/extensions
- service
- adapters/consensus_module
- services
- consensus_module/poa
- src
- p2p
- src/request_response
- relayer
- src/service/syncing
- tx_status_manager
- txpool_v2
- upgradable-executor/wasm-executor/src
- storage/src
- types
- src
- tests
- tests
- version-compatibility/forkless-upgrade
32 files changed
+1459
-127
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
238 | 270 | | |
239 | 271 | | |
240 | 272 | | |
241 | 273 | | |
242 | 274 | | |
| 275 | + | |
243 | 276 | | |
244 | 277 | | |
245 | 278 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments