← Eric Mastro

Process trace · Logos Storage (formerly Codex) · 2024

Slot reservations, end-to-end

One feature, traced from the research question through to the shipped protocol and the specification that documents it. This is what a piece of work looks like when I own it.

01 · Design

Research proposal

Why uncapped competition wastes the network, what capping reservations fixes, and an adversarial analysis of six attacker classes.

research#190 · merged
02 · Plan

Epic breakdown

Six numbered workstreams, each split across the contracts repo and the client repo, with dependencies made explicit and estimates attached.

pm#45 · 12 Jun 2024
03 · Build

Cross-repo delivery

Solidity contract changes and Nim client changes landed in step, each pair kept independently reviewable.

contracts-eth + nim · Sep–Oct 2024
04 · Document

Specification

Filling Slots section of the marketplace spec updated, so the mechanism is described where implementers will look for it.

spec#9 · merged

design → plan → build → document

The feature work breakdown

Broken down by feature, each subtask affects a different repo. Note that some features were not shipped: the expanding window and the dispersal parameter in particular. These were seen as necessary for mainnet, but not showstoppers to deliver the slot reservations functionality for testnet.

1 · Reserve slot
Allow slots to be reserved
Allows reservation of slots, without an implementation of the expanding window.
Wire up reserveSlot and canReserveSlot
Client calls added but not yet invoked, to avoid prevention of slot filling.
shipped
nim#898
2 · Dispersal parameter
Client-tunable dispersal rate
Sets the rate of dispersal, a mechanism to elect what percentage of addresses are eligible in the expanding window at the halfway point to contract expiry.
Add expansionRate parameter to support contract changes
This parameter is part of the StorageRequest and needs to be supported in the Codex client.
3 · Sale state machine
Add SaleReserving state
Add a state, SaleReserving to the sales state machine that reserves a slot before attempting to fill the slot. This should be the first state after SalePreparing
shipped
nim#916
Slot queue seen flag refactor
Split seenNoAvailability from seenNotEligible so only one pauses the queue
on hold
nim
4 · Reservations-full event
Emit SlotReservationsFull event
When the number of reservations for a slot reaches config._MAX_RESERVATIONS, a SlotReservationsFull event is emitted with the RequestId and slotIndex of the slot.
Consume the event client-sideSupports the SlotRervationsFull contract event. Subscribes to the SlotReservationsFull event in the sales module. When emitted, the slot is removed from the slot queue.
shipped
nim#931
5 · Expanding window
Kademlia-distance eligibility, widening over time
Designed and specified; implementation held.
6 · Enforcement
Add expanding window gate logic
Flesh out reserveSlot logic for expanding window
on hold
Require a reservation before filling
Revert if slot is not reserved when attempting to fill it. Check if _reservations contains the sender address for the slot.
Client honours enforcement
Add support for enforcement of slot reservations updates by updating the tests to reserve slots before filling them.
shipped
nim#933
Specification
Update Marketplace spec
Add slots reservations specification to the Marketplace spec.
shipped
spec#9
4Repositories
coordinated
6Workstreams
in the epic
8/11Items shipped,
3 held deliberately
~4moDesign merged
to enforcement live

What this is meant to show

The public design was created first. The mechanisms were discussed and ultimately a final design was distilled from these discussions. It's always easier to modify designs than implementation. Ideas that were rejected were documented alongside the final design.

Clearly planned execution. Implementation was split into workstreams with contract and client work further split into distinct tasks. This type of planning is transparent, easier to delegate and easily planned for, while being able to easily identify features that can be put on hold to make a deadline.

Scope was reduced when needed. Three of eleven items were marked on hold, with the estimate revised once the reservation work was done. The expanding window is a complex feature to implement in a contract, and it solves problems that exist only at scale, so putting it on hold allowed us to ship the testnet first, with work continuing on this feature later.

Documentation, not forgotten. The public marketplace spec was updated with the design details of the slot reservations, so that other contributors and future team members can reference it.

Epic logos-storage-pm-archived#45, opened 12 June 2024 under the Marketplace Productionizing milestone. Design published as research#190. The reservation mechanism is in the protocol; the expanding window is not.

← Back   Recoverability analysis →   Read the design →   Gas analysis →