You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(dkg): implement dkg/disk and dkg/share (#285)
* Initial `dkg/disk` module
- Add `load_definition`
* Add `write_to_keymanager`
- Requires `shares`
* Add `write_keys_to_disk`
- Adjust some pending TODOs.
* Add `write_lock`
* Add `check_clear_data_dir`
* Add `check_writes`
* Test `clear_data_dir_does_not_exist`
* Test `clear_data_dir_is_file`
* Test `clear_data_dir_contains_validator_keys_file`
* Test `clear_data_dir_contains_validator_keys_dir`
* Test `clear_data_dir_contains_validator_keys_dir`
* Test `clear_data_dir_contains_cluster_lock`
* Test `clear_data_dir_contains_deposit_data`
* Test `clear_data_dir_missing_private_key`
* Test `clear_data_dir_contains_private_key`
- Fix required file name
* Formatting
* Fix clippy lints
* Test `load_definition_file_does_not_exist`
* Test `load_definition_invalid_file`
- Fix `load_definition_file_does_not_exist` error
* Add `Generalized Parameter Types` rule
* Replace `todo!` with actual calls
* Make `test_cluster` non test-only
- Workaround to be used by dkg
* Update module docs
* Test `load_definition_valid`
* Use defaults when key is missing
* Test `load_definition_invalid_definition_no_verify`
* Test `load_definition_invalid_definition_verify`
* Add `ShareMsg`
- Impl `From<&Share> for ShareMsg`
* Update `Cargo.lock`
* Allow unwrap in test code
* Adjust visibility and docs
- Make everything public
- Add docs to all exposed symbols
* Fix clippy lints
* Use `File::create` instead of `File::open`
- We need to create the file first.
* Persist readonly permissions
* Resolve TODOs in module docs
* Prefer `AsRef<Path>`
* Fix typo
* Reduce visibility of utility
* Use `PathBuf` for the data_dir
* Simplify error handling
* Add `Debug` and `Clone` to `Share` and `ShareMsg`
* Fix typo & formatting
* feat: make test-cluster be feature based
* feat: update dkg Cargo.toml to split testing and release versions of cluster
* Remove inlined definitions
* Use default argument
* Include payload in error messages
* Inline function
* Use `Zeroizing`
* Add error unused payload lint
---------
Co-authored-by: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
Copy file name to clipboardExpand all lines: AGENTS.md
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,6 +132,7 @@ pub type Result<T> = std::result::Result<T, ModuleError>;
132
132
Rules:
133
133
134
134
-`errors.New("msg")` → enum variant with `#[error("msg")]` (match strings exactly).
135
+
- Every field/payload in an error variant **must** appear in its `#[error("...")]` format string. If a field is not surfaced in the error message, either include it or remove it from the variant. Dead payload (captured but never displayed) is not allowed.
135
136
-`errors.Wrap(err, "...")` → `#[from]` / `#[source]` where appropriate.
136
137
- Always propagate with `?`; avoid silent `filter_map(|x| x.ok())` patterns in production code.
137
138
@@ -145,6 +146,43 @@ Rules:
145
146
- Prefer copying doc comments from Go and adapting to Rust conventions (avoid “Type is a …”).
146
147
- Avoid leaving TODOs in merged code. If a short-lived internal note is necessary, use `// TODO:` and remove before PR merge.
147
148
149
+
## Generalized Parameter Types
150
+
151
+
Prefer generic parameters over concrete types when a function only needs the behavior of a trait. This mirrors the standard library's own conventions and makes functions callable with a wider range of inputs without extra allocations.
- Call `.as_ref()` once at the top of the function and bind it to a local variable when the value is used in multiple places.
183
+
- Do not use `impl AsRef<T>` if the function immediately converts to an owned type anyway — use `impl Into<T>` (or just accept the owned type) in that case.
184
+
- Applies to public and private functions alike; the gain is ergonomics, not just API surface.
185
+
148
186
## Testing
149
187
150
188
- Translate Go tests to Rust where applicable; keep similar test names for cross-reference.
0 commit comments