Skip to content

Commit

Permalink
channel changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ultd committed May 3, 2024
1 parent a243d80 commit bc54886
Show file tree
Hide file tree
Showing 8 changed files with 2,575 additions and 51 deletions.
43 changes: 43 additions & 0 deletions misc/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Contributing to Sig

Thank you for considering contributing to Syndica's Sig project! We appreciate your interest and support in helping us make this project better. By participating in this project, you are joining a community of developers and contributors working together to create value for the Solana ecosystem.

Before you start contributing, please take a moment to read and understand this Contributing Guidelines document. It will help you get started and ensure a smooth collaboration process.

## Dev Environment Setup

See the [readme](../readme.md#-setup).

## Style Guide

### Optional Values

- optional values should be prepended with `maybe_` and unwrapping should follow the `if (maybe_x) |x| {}` format
- for example:

```zig
fn do_something(maybe_foo: ?Foo) void {
if (maybe_foo) |foo| {
// do something with foo here
}
}
```

### Function Signatures

- if passing an `Allocator` as a parameter, it should be the first parameter of the function
- if the number of possible errors which a function can return is reasonably small (eg, can only fail on memory allocations), then the error types should be explicit (eg, `error{ OutOfMemory }`) instead of using `anyerror` and the `!` operator
- if a parameter is not modified, then it should be `const` (eg, `fn get(*const Self)`)

### Slices

- when converting an array from a slice, the syntax `&buf` should be used instead of `buf[0..]`

### Writing Tests

- when writing tests the naming convention is: `test "{path to file}: {test name}"`
- for example, in `src/gossip/data.zig` a test is defined as `test "gossip.data: test label() and id() methods"`

### Linting

- run `zig fmt src/` in the top-level directory to run the zig linter
Loading

0 comments on commit bc54886

Please sign in to comment.