Skip to content

Commit 43d417f

Browse files
authored
Add AGPL LICENSE + CONTRIBUTING + Code of conduct (#40)
1 parent c06de3e commit 43d417f

File tree

3 files changed

+993
-0
lines changed

3 files changed

+993
-0
lines changed

CODE_OF_CONDUCT.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement on [Telegram](t.me/openzeppelin_tg/2).
63+
All complaints will be reviewed and investigated promptly and fairly.
64+
65+
All community leaders are obligated to respect the privacy and security of the
66+
reporter of any incident.
67+
68+
## Enforcement Guidelines
69+
70+
Community leaders will follow these Community Impact Guidelines in determining
71+
the consequences for any action they deem in violation of this Code of Conduct:
72+
73+
### 1. Correction
74+
75+
**Community Impact**: Use of inappropriate language or other behavior deemed
76+
unprofessional or unwelcome in the community.
77+
78+
**Consequence**: A private, written warning from community leaders, providing
79+
clarity around the nature of the violation and an explanation of why the
80+
behavior was inappropriate. A public apology may be requested.
81+
82+
### 2. Warning
83+
84+
**Community Impact**: A violation through a single incident or series
85+
of actions.
86+
87+
**Consequence**: A warning with consequences for continued behavior. No
88+
interaction with the people involved, including unsolicited interaction with
89+
those enforcing the Code of Conduct, for a specified period of time. This
90+
includes avoiding interactions in community spaces as well as external channels
91+
like social media. Violating these terms may lead to a temporary or
92+
permanent ban.
93+
94+
### 3. Temporary Ban
95+
96+
**Community Impact**: A serious violation of community standards, including
97+
sustained inappropriate behavior.
98+
99+
**Consequence**: A temporary ban from any sort of interaction or public
100+
communication with the community for a specified period of time. No public or
101+
private interaction with the people involved, including unsolicited interaction
102+
with those enforcing the Code of Conduct, is allowed during this period.
103+
Violating these terms may lead to a permanent ban.
104+
105+
### 4. Permanent Ban
106+
107+
**Community Impact**: Demonstrating a pattern of violation of community
108+
standards, including sustained inappropriate behavior, harassment of an
109+
individual, or aggression toward or disparagement of classes of individuals.
110+
111+
**Consequence**: A permanent ban from any sort of public interaction within
112+
the community.
113+
114+
## Attribution
115+
116+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117+
version 2.0, available at
118+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
119+
120+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
121+
enforcement ladder](https://github.com/mozilla/diversity).
122+
123+
[homepage]: https://www.contributor-covenant.org
124+
125+
For answers to common questions about this code of conduct, see the FAQ at
126+
https://www.contributor-covenant.org/faq. Translations are available at
127+
https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# Contributing
2+
3+
Thanks for your interest in contributing! This guide explains how to set up your environment, make changes, run checks locally, and submit high‑quality pull requests that pass CI.
4+
5+
---
6+
7+
## Project Overview
8+
9+
`event-scanner` is a Rust library for monitoring EVM-based smart contract events. It is built on the `alloy` ecosystem and provides in-memory scanning with retry-aware callback execution. See `README.md` for features, usage, examples, and testing notes.
10+
11+
- Workspace manifest: `Cargo.toml`
12+
- Library code: `src/`
13+
- Examples: `examples/simple_counter`, `examples/historical_scanning`
14+
- Integration tests: `tests/`
15+
- Formatting: `rustfmt.toml`
16+
- Toolchain pin: `rust-toolchain.toml`
17+
- CI: `.github/workflows/check.yml` and `.github/workflows/test.yml`
18+
19+
---
20+
21+
## Prerequisites
22+
23+
- Rust toolchains via `rustup`
24+
- Minimum supported Rust version (MSRV): 1.89 (see `rust-toolchain.toml`)
25+
- Formatting uses nightly `rustfmt` in CI
26+
- Recommended tooling
27+
- `cargo-nextest` for fast, reliable test runs: `cargo install cargo-nextest`
28+
- `typos` for spell checking: `cargo install typos-cli` (or `brew install typos`)
29+
- A recent `rust-analyzer` for IDE support
30+
- Runtime/dev tools
31+
- For examples and some tests, you’ll need an Ethereum dev node such as Foundry’s `anvil`
32+
33+
---
34+
35+
## Repository Layout
36+
37+
- `src/` – core library
38+
- `examples/` – runnable examples that deploy a demo contract and scan events
39+
- `tests/` – integration tests covering live, historical and hybrid flows
40+
- `.github/workflows/` – CI configuration (build, fmt, clippy, typos, tests)
41+
42+
---
43+
44+
## Getting Started
45+
46+
1. Fork the repository and clone your fork.
47+
2. Ensure toolchains are installed:
48+
- `rustup toolchain install 1.89` (MSRV)
49+
- `rustup toolchain install nightly` (for rustfmt parity with CI)
50+
3. Optional helpers:
51+
- `cargo install cargo-nextest`
52+
- `cargo install typos-cli`
53+
54+
Build the workspace:
55+
56+
```bash
57+
cargo build --locked --all-targets --all-features
58+
```
59+
60+
Run the test suite (we recommend nextest):
61+
62+
```bash
63+
cargo nextest run
64+
# or
65+
cargo test
66+
```
67+
68+
Run examples:
69+
70+
```bash
71+
RUST_LOG=info cargo run -p simple_counter
72+
# or
73+
RUST_LOG=info cargo run -p historical_scanning
74+
```
75+
76+
Note: Examples start a local `anvil` instance and deploy a demo contract.
77+
78+
---
79+
80+
## Code Style & Linting
81+
82+
- Formatting is enforced by `rustfmt` with the settings in `rustfmt.toml`.
83+
- CI runs formatting on nightly. To match CI locally:
84+
```bash
85+
cargo +nightly fmt --all --check
86+
```
87+
- To apply formatting locally:
88+
```bash
89+
cargo +nightly fmt --all
90+
```
91+
- Linting is enforced with `clippy` and pedantic lints are denied.
92+
- To check locally (matches CI):
93+
```bash
94+
cargo clippy --all-targets --all-features -- -D warnings -D clippy::pedantic
95+
```
96+
- To apply automatic fixes where possible:
97+
```bash
98+
cargo clippy --all-targets --all-features --fix --allow-dirty --allow-staged -- -D warnings -D clippy::pedantic
99+
```
100+
- Spelling/typos:
101+
- CI uses `typos`. Locally:
102+
```bash
103+
typos
104+
```
105+
106+
---
107+
108+
## Local CI Parity Checklist
109+
110+
Before opening a PR, please ensure the following commands succeed locally:
111+
112+
```bash
113+
# Build (all targets & features)
114+
cargo build --locked --all-targets --all-features
115+
116+
# Format (nightly to match CI)
117+
cargo +nightly fmt --all --check
118+
119+
# Lint (deny warnings, pedantic)
120+
cargo clippy --all-targets --all-features -- -D warnings -D clippy::pedantic
121+
122+
# Spelling
123+
typos
124+
125+
# Tests (prefer nextest)
126+
cargo nextest run
127+
```
128+
129+
---
130+
131+
## Branching, Commits, and PRs
132+
133+
- Branch from `main` with a descriptive name, e.g. `feat/reorg-handling`, `fix/rpc-retries`, `docs/contributing`.
134+
- Keep PRs focused and reasonably small; large changes are harder to review.
135+
- Write clear commit messages that explain the why and the what. Conventional Commits are welcome but not required.
136+
- Include tests for new functionality or bug fixes where applicable.
137+
- Update documentation and examples as needed.
138+
- Ensure CI passes. Required checks include:
139+
- Build: cargo build
140+
- Format: rustfmt (nightly)
141+
- Lint: clippy (pedantic, warnings denied)
142+
- Typos: typos
143+
- Tests: see `.github/workflows/test.yml`
144+
- CODEOWNERS: reviewers may be auto-assigned based on `CODEOWNERS`.
145+
146+
PR description template (suggested):
147+
148+
```markdown
149+
## Summary
150+
Short summary of the change and context.
151+
152+
## Motivation
153+
Why is this change needed?
154+
155+
## Approach
156+
Key implementation details, trade-offs, and alternatives considered.
157+
158+
## Checklist
159+
- [ ] Builds locally with `--all-targets --all-features`
160+
- [ ] `cargo +nightly fmt --all --check`
161+
- [ ] `cargo clippy --all-targets --all-features -- -D warnings -D clippy::pedantic`
162+
- [ ] `typos`
163+
- [ ] Tests pass (`cargo nextest run`)
164+
- [ ] Docs/README/examples updated (if applicable)
165+
```
166+
167+
---
168+
169+
## Testing Notes
170+
171+
- Integration tests live under `tests/` and cover live, historical, and hybrid flows.
172+
- Prefer `cargo-nextest` for speed and improved output.
173+
- Where practical, add regression tests when fixing bugs.
174+
175+
---
176+
177+
## Design & Architecture
178+
179+
- High-level architecture and core traits/components are described in `README.md`.
180+
- For non-trivial changes (new abstractions, public API changes), please open an issue first to discuss design direction before implementation.
181+
182+
---
183+
184+
## Filing Issues
185+
186+
- Use GitHub Issues for bug reports and feature requests.
187+
- Include reproduction steps, expected vs actual behavior, logs, and environment details.
188+
- Security-related reports: please follow `SECURITY.md`.
189+
190+
---
191+
192+
## Release & Versioning
193+
194+
- Public crates follow semver. Breaking changes to the public API should be noted clearly in PRs and release notes.
195+
- New features and fixes may be released in pre-releases before a stable cut.
196+
197+
---
198+
199+
## Community Standards
200+
201+
- Be respectful and constructive.
202+
- Prefer clear, actionable feedback.
203+
- Assume good intent and collaborate to reach the best solution.
204+
205+
Thanks again for contributing to Event Scanner!

0 commit comments

Comments
 (0)