dist_agent_lang 1.0.7

Hybrid programming with library and CLI support for Off/On-chain network integration
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# Contributing to dist_agent_lang

First off, thank you for considering contributing to dist_agent_lang! 🎉

This document provides guidelines and instructions for contributing to the project. Whether you're fixing bugs, adding features, improving documentation, or testing the language, your contributions are valuable.

## Table of Contents

- [Code of Conduct]#code-of-conduct
- [Getting Started]#getting-started
- [How Can I Contribute?]#how-can-i-contribute
- [Development Workflow]#development-workflow
- [Testing Guidelines]#testing-guidelines
- [Code Style]#code-style
- [Submitting Changes]#submitting-changes
- [Areas Needing Help]#areas-needing-help

## Code of Conduct

This project adheres to a code of conduct that all contributors are expected to follow. Please be respectful, inclusive, and constructive in all interactions.

## Getting Started

### Prerequisites

- **Rust 1.70+** ([Install Rust]https://rustup.rs/)
- **Git** for version control
- **Basic familiarity** with programming languages, compilers, or blockchain development (helpful but not required)

### Setting Up Your Development Environment

1. **Fork and Clone the Repository**
   ```bash
   git clone https://github.com/your-username/dist_agent_lang.git
   cd dist_agent_lang
   ```

2. **Build the Project**
   ```bash
   cargo build
   ```

3. **Run Tests**
   ```bash
   # Run all tests
   cargo test
   
   # Run specific test suite
   cargo test --test property_tests
   cargo test --test lexer_tokens_tests
   ```

4. **Verify Everything Works**
   ```bash
   # Run a simple example
   cargo run -- run examples/hello_world_demo.dal
   ```

## How Can I Contribute?

### 🐛 Reporting Bugs

Found a bug? Great! Here's how to report it:

1. **Check Existing Issues**: Search [GitHub Issues]https://github.com/dist_agent_lang/dist_agent_lang/issues to see if it's already reported.

2. **Create a New Issue** with:
   - **Clear title**: Brief description of the issue
   - **Steps to reproduce**: What you did to encounter the bug
   - **Expected behavior**: What should have happened
   - **Actual behavior**: What actually happened
   - **Environment**: OS, Rust version, dist_agent_lang version
   - **Code example**: Minimal code that reproduces the issue (if applicable)

3. **Label appropriately**: Use labels like `bug`, `help-wanted`, `good-first-issue`

### 💡 Suggesting Features

Have an idea? We'd love to hear it!

1. **Check Existing Discussions**: See if it's been discussed in [GitHub Discussions]https://github.com/dist_agent_lang/dist_agent_lang/discussions

2. **Create a Feature Request** with:
   - **Use case**: What problem does this solve?
   - **Proposed solution**: How should it work?
   - **Alternatives considered**: Other approaches you've thought about
   - **Examples**: Code examples showing how it would be used

### 🧪 Testing

**Testing is one of the most valuable contributions!** The language is in beta, and thorough testing helps us reach production readiness.

#### Types of Testing We Need:

1. **Manual Testing**
   - Try the examples in `examples/` directory
   - Write your own programs
   - Test edge cases
   - Report any issues you find

2. **Property-Based Testing**
   - Add tests to `tests/property_tests.rs`
   - Test invariants that should always hold
   - Use `proptest` or `quickcheck` frameworks

3. **Integration Testing**
   - Test real-world scenarios
   - Test multi-chain operations
   - Test AI agent workflows
   - Add tests to `tests/integration/`

4. **Fuzzing**
   - Run fuzzing tests to find edge cases
   - See `docs/testing/fuzzing/` for guides

5. **Mutation Testing**
   - Help improve test quality
   - See `docs/testing/mutation_testing/` for guides

#### Running Tests

```bash
# All tests
cargo test

# Specific test suites
cargo test --test property_tests
cargo test --test lexer_tokens_tests
cargo test --test load_stress_tests

# With output
cargo test -- --nocapture

# Single test
cargo test test_name
```

### 📝 Improving Documentation

Good documentation is crucial! Help us improve:

- **Code comments**: Add or improve inline documentation
- **README files**: Make setup instructions clearer
- **API documentation**: Document functions and modules
- **Tutorials**: Create or improve tutorials
- **Examples**: Add more example programs

To build documentation:
```bash
cargo doc --open
```

### 💻 Writing Code

Ready to write code? Here are some areas that need help:

#### 🔴 High Priority (Security & Core)

1. **Cryptographic Signatures** (`src/stdlib/crypto_signatures.rs`)
   - Implement real ECDSA verification (currently mocked)
   - Implement real ECDSA signing
   - Implement real EdDSA verification
   - **Effort**: 4-6 hours total
   - **Impact**: High - Security critical

2. **JWT Authentication** (`src/http_server_security.rs`)
   - Implement proper JWT validation
   - Replace placeholder implementation
   - **Effort**: 2-3 hours
   - **Impact**: High - Security critical

#### 🟡 Medium Priority (Features)

3. **HTTP Server Route Registration** (`src/http_server.rs`)
   - Dynamic route registration from DAL code
   - Bridge DAL parser/runtime to Axum router
   - **Effort**: 4-6 hours

4. **Parser Improvements** (`src/parser/`)
   - Support `if` statements without parentheses
   - Better error messages
   - **Effort**: 2-3 hours

5. **Security Test Coverage** (`tests/integration/security_tests.rs`)
   - Reentrancy protection tests
   - Safe math operation tests
   - Cross-chain security tests
   - **Effort**: 3-4 hours

#### 🟢 Good First Issues

- Add more example programs
- Improve error messages
- Add unit tests for lexer/parser
- Write documentation
- Fix typos and improve clarity

See [CODEBASE_TODOS.md](../CODEBASE_TODOS.md) for detailed TODO list.

## Development Workflow

### 1. Create a Branch

```bash
git checkout -b feature/your-feature-name
# or
git checkout -b fix/bug-description
```

**Branch naming conventions:**
- `feature/` - New features
- `fix/` - Bug fixes
- `docs/` - Documentation changes
- `test/` - Test additions
- `refactor/` - Code refactoring

### 2. Make Your Changes

- Write clean, readable code
- Follow the code style guidelines
- Add tests for new features
- Update documentation as needed

### 3. Test Your Changes

```bash
# Run all tests
cargo test

# Run specific tests related to your changes
cargo test --test your_test_file

# Check for linting issues
cargo clippy

# Format code
cargo fmt
```

### 4. Commit Your Changes

Write clear, descriptive commit messages:

```bash
git commit -m "Add ECDSA signature verification

- Replace mock implementation with real k256-based verification
- Add test vectors for ECDSA
- Update documentation

Fixes #123"
```

**Commit message format:**
- First line: Brief summary (50 chars or less)
- Blank line
- Detailed explanation (if needed)
- Reference issues: "Fixes #123" or "Closes #456"

### 5. Push and Create Pull Request

```bash
git push origin feature/your-feature-name
```

Then create a Pull Request on GitHub with:
- **Clear title**: What does this PR do?
- **Description**: Why is this change needed? How does it work?
- **Related issues**: Link to any related issues
- **Testing**: How was this tested?
- **Checklist**: Mark items as complete

## Testing Guidelines

### Writing Tests

1. **Unit Tests**: Test individual functions/modules
   - Place in `#[cfg(test)]` modules within source files
   - Or in `tests/` directory

2. **Integration Tests**: Test complete workflows
   - Place in `tests/integration/`
   - Test real-world scenarios

3. **Property Tests**: Test invariants
   - Use `proptest` or `quickcheck`
   - Place in `tests/property_tests.rs`

4. **Performance Tests**: Benchmark critical paths
   - Use `criterion` for benchmarks
   - Place in `benches/` directory

### Test Naming

- Use descriptive names: `test_ecdsa_verification_with_valid_signature`
- Group related tests: `mod ecdsa_tests { ... }`
- Use `#[should_panic]` for tests that should fail

### Example Test

```rust
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_ecdsa_verification_with_valid_signature() {
        let message = b"test message";
        let signature = create_signature(message);
        let public_key = get_public_key();
        
        assert!(verify_signature(message, &signature, &public_key).is_ok());
    }
}
```

## Code Style

### Rust Style

We follow standard Rust conventions:

1. **Format with rustfmt**:
   ```bash
   cargo fmt
   ```

2. **Check with clippy**:
   ```bash
   cargo clippy -- -D warnings
   ```

3. **General guidelines**:
   - Use `snake_case` for functions and variables
   - Use `PascalCase` for types
   - Use `SCREAMING_SNAKE_CASE` for constants
   - Prefer `let` bindings over mutability
   - Use meaningful variable names
   - Add comments for complex logic

### dist_agent_lang Style

For `.dal` files (dist_agent_lang source):

- Use 4 spaces for indentation
- Use descriptive service and function names
- Add `@trust` attributes appropriately
- Include comments for complex logic

## Submitting Changes

### Pull Request Checklist

Before submitting a PR, ensure:

- [ ] Code compiles without errors
- [ ] All tests pass (`cargo test`)
- [ ] Code is formatted (`cargo fmt`)
- [ ] No clippy warnings (`cargo clippy`)
- [ ] Documentation is updated (if needed)
- [ ] Tests are added for new features
- [ ] Commit messages are clear
- [ ] PR description explains the change

### Review Process

1. **Automated Checks**: CI will run tests and linting
2. **Code Review**: Maintainers will review your code
3. **Feedback**: Address any requested changes
4. **Merge**: Once approved, your PR will be merged!

## Areas Needing Help

### 🎯 Most Needed Contributions

1. **Testing** ⭐⭐⭐⭐⭐
   - Test the language with real-world scenarios
   - Write property-based tests
   - Find and report bugs
   - **No coding required** - just use the language!

2. **Cryptographic Implementations** ⭐⭐⭐⭐
   - Replace mock crypto with real implementations
   - See `CODEBASE_TODOS.md` for details
   - **Good for**: Rust developers familiar with crypto

3. **Documentation** ⭐⭐⭐⭐
   - Improve tutorials
   - Add more examples
   - Write API documentation
   - **Good for**: Anyone who can write clearly

4. **Parser Improvements** ⭐⭐⭐
   - Better error messages
   - Syntax improvements
   - **Good for**: Compiler/interpreter enthusiasts

5. **Example Programs** ⭐⭐⭐
   - Create more example programs
   - Show real-world use cases
   - **Good for**: Anyone learning the language

### 🆘 Beginner-Friendly Tasks

- Fix typos in documentation
- Improve error messages
- Add comments to code
- Write example programs
- Test examples and report issues
- Improve README clarity

### 🚀 Advanced Tasks

- Implement cryptographic functions
- Optimize performance
- Add new language features
- Improve compiler optimizations
- Add new standard library modules

## Getting Help

- **GitHub Discussions**: Ask questions, share ideas
- **GitHub Issues**: Report bugs, request features
- **Email**: jason.dinh.developer@gmail.com
- **Documentation**: Check `docs/` directory

## Recognition

Contributors will be:
- Listed in CONTRIBUTORS.md (coming soon)
- Credited in release notes
- Appreciated by the community! 🙏

## License

By contributing, you agree that your contributions will be licensed under the Apache License 2.0.

---

**Thank you for contributing to dist_agent_lang!** 🚀

Every contribution, no matter how small, helps make this language better. Whether you're fixing a typo, writing tests, or implementing features, your help is valuable and appreciated.