Skip to content

Commit

Permalink
Proposal 1, clinic js
Browse files Browse the repository at this point in the history
  • Loading branch information
mike dupont committed Sep 16, 2024
1 parent d5063cf commit dc31cac
Show file tree
Hide file tree
Showing 9 changed files with 472 additions and 35 deletions.
37 changes: 2 additions & 35 deletions proposal.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,11 @@ Users will be able to add in urls and secrets to the zkapp and validate the resu

The project will be delivered in steps, each useful features on thier own.

1. Step 1. One week, delivery of clinic js profiling [proposals/grant1/monitoring/clinic-js.md](proposals/grant1/monitoring/clinic-js.md) 5000 MINA

**Budget Requested:**

TBD.
1. Step 1 : 5000 MINA

**Wallet Address:**
B62qqFdiPRuMuQQYYo131saW1fp4f72rKXLVy2KTQEtnJzg5Hz3SqEY
Expand Down Expand Up @@ -252,37 +253,3 @@ B62qqFdiPRuMuQQYYo131saW1fp4f72rKXLVy2KTQEtnJzg5Hz3SqEY
- Regular security audits and updates to the zero-knowledge proof implementation.
- Marketing and outreach efforts to promote the project and engage users.

## Frequently asked questions

- What is the minimum fee for calling a zkapp? What if I set my fee to just 1/billionth of a mina? 1/1e9 of a mina? What are the transaction fees for processing that fee? How can I see that?

The network transaction fee is 0.1 mina, and the app can charge additional fees on top we have seen 0.1 - 2 and more.

## References

### Price

#### ZKapp Fees

https://minascan.io/mainnet/tx/5JvQTouheGHgZMZzHPWS8UowkHcm6zUMV62qitynL63JuYtBnbLb/txInfo

Looking at some existing contracts, the fee is defined in nanomina like this
`const fee = Number(config.fee) * 1e9; // in nanomina (1 billion = 1.0 mina)`
so some have `fee: 1e8,` for 1/10 of a mina.

others define the fee to be 1 mina or more.

### Gpt Defintions

### perf

The Linux `perf` tool is designed as a root-level observability system that provides powerful and efficient sampling of any running program at runtime. It allows users to set up user probes (also known as `uprobes`) to monitor, interrupt, and sample various performance metrics without the need for modifying the source code of the program being observed.

Key features include:
- **Event-driven Sampling**: `perf` captures data based on specific performance events (e.g., CPU cycles, cache misses, page faults) and can provide insights into the behavior of programs.
- **User Probes (Uprobes)**: This feature allows users to monitor user-space applications by dynamically inserting probes at function entry/exit points or arbitrary code locations.
- **Kernel Probes (Kprobes)**: Similar to uprobes, `kprobes` allow for monitoring kernel events.
- **Low Overhead**: Designed for minimal performance impact, enabling efficient data collection and analysis even in production environments.
- **Broad Scope**: It can monitor not only the application-level events but also system-wide events such as scheduler activities, disk I/O, network performance, and more.

With `perf`, developers and administrators gain detailed visibility into how programs interact with hardware, the kernel, and the rest of the system, making it invaluable for performance tuning, debugging, and system optimization.
5 changes: 5 additions & 0 deletions proposals/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Frequently asked questions

- What is the minimum fee for calling a zkapp? What if I set my fee to just 1/billionth of a mina? 1/1e9 of a mina? What are the transaction fees for processing that fee? How can I see that?

The network transaction fee is 0.1 mina, and the app can charge additional fees on top we have seen 0.1 - 2 and more.
93 changes: 93 additions & 0 deletions proposals/grant1/monitoring/chatgpt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
### Title
Augmenting TypeScript pnpm Test Job with Performance Recording and Profiling in Docker

### Project Background
The current project involves optimizing and enhancing the testing environment for a TypeScript application using `pnpm` in a Docker container. The focus is on integrating performance recording and function-level profiling to identify and address performance bottlenecks. More information on the Docker and pnpm setup can be found [here](https://docs.docker.com/compose/) and [here](https://pnpm.io/).

### Proposal Overview

#### Problem
Existing TypeScript testing environments often lack detailed performance analysis tools, leading to difficulties in identifying performance issues and inefficiencies. This gap impedes the optimization of applications and slows down the development process.

#### Solution
This proposal aims to enhance the TypeScript testing job by integrating performance recording and function-level profiling tools within a Docker container managed by Docker Compose. The approach includes modifying Docker configurations, installing profiling tools, updating test scripts, and analyzing the profiling results to improve performance.

#### Impact
By implementing this proposal, the Mina ecosystem will benefit from improved tools for performance analysis, fostering better code quality and optimization practices. This will attract more developers and users interested in high-performance TypeScript applications, contributing to the overall adoption and innovation within the ecosystem.

#### Audience
The primary audience includes developers and teams using TypeScript with `pnpm` in Docker containers. This also extends to those interested in performance optimization and profiling in development environments.

### Architecture & Design

#### Detailed Design/Architecture
The proposal involves updating the Docker Compose configuration to support profiling tools and modifying the Dockerfile to include these tools. Profiling utilities such as Clinic or Node.js's built-in profilers will be installed. Test scripts will be updated to enable profiling during test runs. Profiling results will be analyzed to identify performance bottlenecks.

1. **Docker Compose Configuration**: Update `docker-compose.yml` to support profiling commands and environment variables.
2. **Dockerfile Modifications**: Install profiling tools and set up the environment for performance testing.
3. **Test Script Updates**: Modify `package.json` scripts to include profiling options and commands.

#### Vision
The long-term vision is to establish a robust performance profiling framework for TypeScript applications, making it a standard practice in development environments. This will lead to higher performance standards and more efficient development processes within the Mina ecosystem.

#### Existing Work
The current project setup is available [here](https://github.com/example/repository). This repository contains the existing Docker and pnpm configuration.

#### Production Timeline
The project is expected to be in production within 1-2 months of funding, including time for configuration, implementation, and testing.

### Budget & Milestones

#### Deliverables
1. Enhanced Docker Compose and Dockerfile configurations.
2. Integration of performance recording and profiling tools.
3. Updated test scripts with profiling support.
4. Analysis and documentation of profiling results.

#### Mid-Point Milestones
1. Docker and profiling tools setup complete.
2. Test scripts updated with profiling commands.
3. Initial performance data collected and analyzed.

#### Project Timeline
- **Month 1**: Configuration updates, installation of tools, initial setup.
- **Month 2**: Integration with test scripts, performance profiling, and initial analysis.
- **Month 3**: Final testing, documentation, and delivery of results.

#### Budget Requested
Up to 100,000 MINA

#### Budget Breakdown
1. **Development and Implementation**: 60,000 MINA
2. **Tool Licenses and Dependencies**: 20,000 MINA
3. **Testing and Analysis**: 10,000 MINA
4. **Documentation and Reporting**: 10,000 MINA

#### Wallet Address
[Your MINA Wallet Address]

### Team Info

#### Proposer Github
- [Proposer GitHub Profile](https://github.com/proposer)

#### Proposer Experience
The proposer has experience in building and optimizing dApps with a focus on performance profiling. Relevant projects and contributions can be viewed [here](https://github.com/proposer/portfolio).

#### Team Members
1. **[Team Member 1](https://github.com/team-member-1)**: Role - Lead Developer. Experience - Expert in Docker and performance profiling.
2. **[Team Member 2](https://github.com/team-member-2)**: Role - DevOps Specialist. Experience - Proficient in Docker Compose and CI/CD pipelines.

#### Achievements
- Successfully optimized performance for several TypeScript applications.
- Developed and integrated profiling tools in production environments.

### Risks & Mitigations

#### Risks
1. **Tool Compatibility Issues**: Profiling tools may not integrate seamlessly with the existing setup.
2. **Performance Overhead**: Profiling might introduce performance overhead, affecting test results.

#### Mitigations
1. **Compatibility Testing**: Conduct thorough testing to ensure compatibility and smooth integration of profiling tools.
2. **Performance Monitoring**: Monitor the impact of profiling on performance and adjust configurations to minimize overhead.
97 changes: 97 additions & 0 deletions proposals/grant1/monitoring/clinic-js.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
### Navigators Season 2: Starter Grants Proposal

#### Title
**Proposal Title: Augmenting O1JS TypeScript npm Test Job with Performance Recording and Function-Level Profiling**

#### Project Background
The project aims to enhance the testing infrastructure of a TypeScript application by integrating performance recording and function-level profiling within a Docker container started by Docker Compose in github actions. This will enable developers to identify performance bottlenecks and optimize their code more effectively with no setup costs. The current setup involves running tests using npm, but lacks detailed performance insights. This proposal seeks to address this gap by leveraging profiling tools like `clinic` for javascript level profiling.

#### Proposal Overview
**Problem:** The current testing setup lacks detailed performance insights, making it difficult to identify and address performance bottlenecks.

**Solution:** Integrate performance recording and function-level profiling using `clinic` within the Docker container started by Docker Compose in a github action.

**Impact:** This proposal will significantly enhance the Mina ecosystem by providing developers with improved tools for performance analysis, encouraging adoption, and attracting more users and developers. It will enable novel applications by facilitating better performance optimization.

**Audience:** The target audience for this project includes developers and teams working on TypeScript applications within the Mina ecosystem.

#### Architecture & Design
**Detailed Design/Architecture:**
The proposed solution involves updating the Dockerfile to install necessary profiling tools, modifying the Docker Compose configuration to include profiling commands, and updating test scripts to run with profiling.

1. **Dockerfile and compose update:**
We have already created a dockerfile for o1js and demonstrated that we can collect strace.
The docker compose runs in a github action.

2. **Test Script Update:**

We will use the https://github.com/dfloresc/clinicjs-pipeline to augument the mina o1js code in the first step.
The following steps can expand with more detailed performance monitoring.


**Vision:** The long-term vision for this project is to create a robust testing framework that provides detailed performance insights, enabling developers to build highly optimized applications within the Mina ecosystem.
It also will help extract knowledge from the o1js codebase for the following step, providing valuable intermediates.

**Existing Work:**

https://github.com/meta-introspector/o1js/actions/runs/10874552509 This run demonstrates
the running of part of the o1js test framework in github and collecting performance traces with strace as a simple
example.

**Production Timeline:**

The project is expected to be in production within 1 week.

#### Budget & Milestones
**Deliverables:**
- Updated Dockerfile with profiling tools installed.
- Modified Docker Compose configuration to include profiling commands.
- Updated test scripts to run with profiling.
- Documentation on how to use the profiling tools.

**Mid-Point Milestones:**
- Completion of Dockerfile and Docker Compose updates.
- Initial testing of profiling setup.
- Preliminary documentation.

**Project Timeline:** 1W

**Budget Requested:**

40 Hours * 100 MINA = 4000 MINA + 1000 MINA Contingency

**Budget Breakdown:**
- Development: 3,000 MINA
- Testing and QA: 1,000 MINA
- Documentation: 1,000 MINA
- Contingency: 1,000 MINA

**Wallet Address:**
Coinbase Wallet B62qqFdiPRuMuQQYYo131saW1fp4f72rKXLVy2KTQEtnJzg5Hz3SqEY


#### Team Info
**Proposer Github:** https://github.com/jmikedupont2

**Proposer Experience:** The proposer has experience building github pipelines and performance tuning.

**Team Members:**
- **Member 1:** Role - Lead Developer, Experience - [Relevant Experience], GitHub - https://github.com/jmikedupont2
- **Member 2:** Role - QA Engineer, TBD

**Achievements:**
- Successfully developed and deployed docker build already.
- Studied the ocaml of mina, the parts of the rust of pasta
- Studied the o1js of mina

#### Risks & Mitigations
**Risks:**
- Integration issues with profiling tools.
- Performance overhead introduced by profiling.
- Delivery of the results

**Mitigations:**
- Thorough testing and validation of profiling tools.
- Optimization of profiling setup to minimize performance impact.
- Regular communication with the community for feedback and support.
- Usage of accepted and standard tools for profiling nodejs
127 changes: 127 additions & 0 deletions proposals/grant1/monitoring/letchat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
### Navigators Season 2: Growth Grants Proposal

#### Title
**Proposal Title: Augmenting O1JS TypeScript npm Test Job with Performance Recording and Function-Level Profiling**

#### Project Background
The project aims to enhance the testing infrastructure of a TypeScript application by integrating performance recording and function-level profiling within a Docker container started by Docker Compose. This will enable developers to identify performance bottlenecks and optimize their code more effectively. The current setup involves running tests using pnpm, but lacks detailed performance insights. This proposal seeks to address this gap by leveraging profiling tools like `clinic`.

For more information, you can refer to the project documentation [here](#).

#### Proposal Overview
**Problem:** The current testing setup lacks detailed performance insights, making it difficult to identify and address performance bottlenecks.

**Solution:** Integrate performance recording and function-level profiling using `clinic` within the Docker container started by Docker Compose.

**Impact:** This proposal will significantly enhance the Mina ecosystem by providing developers with improved tools for performance analysis, encouraging adoption, and attracting more users and developers. It will enable novel applications by facilitating better performance optimization.

**Audience:** The target audience for this project includes developers and teams working on TypeScript applications within the Mina ecosystem.

#### Architecture & Design
**Detailed Design/Architecture:**
The proposed solution involves updating the Dockerfile to install necessary profiling tools, modifying the Docker Compose configuration to include profiling commands, and updating test scripts to run with profiling.

1. **Dockerfile Update:**
```Dockerfile
FROM node:14
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install -g pnpm
RUN pnpm install
RUN npm install -g clinic
COPY . .
EXPOSE 3000
CMD ["pnpm", "start"]
```

2. **Docker Compose Update:**
```yaml
version: '3.8'
services:
app:
build: .
command: pnpm test
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
- ./profiling-data:/usr/src/app/profiling-data
environment:
- NODE_ENV=development
ports:
- "3000:3000"
depends_on:
- db

db:
image: postgres:13
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: mydatabase
ports:
- "5432:5432"
```

3. **Test Script Update:**
```json
{
"scripts": {
"test": "pnpm run test:profile",
"test:profile": "clinic doctor -- pnpm run test:original",
"test:original": "mocha"
}
}
```

**Vision:** The long-term vision for this project is to create a robust testing framework that provides detailed performance insights, enabling developers to build highly optimized applications within the Mina ecosystem.

**Existing Work:** If applicable, please provide a link to the GitHub repository.

**Production Timeline:** The project is expected to be in production within 2 months.

#### Budget & Milestones
**Deliverables:**
- Updated Dockerfile with profiling tools installed.
- Modified Docker Compose configuration to include profiling commands.
- Updated test scripts to run with profiling.
- Documentation on how to use the profiling tools.

**Mid-Point Milestones:**
- Completion of Dockerfile and Docker Compose updates.
- Initial testing of profiling setup.
- Preliminary documentation.

**Project Timeline:** 1M - 3M

**Budget Requested:** Up to 100,000 MINA

**Budget Breakdown:**
- Development: 60,000 MINA
- Testing and QA: 20,000 MINA
- Documentation: 10,000 MINA
- Contingency: 10,000 MINA

**Wallet Address:** [MINA Wallet address for funding. Please ensure to use the same wallet used during the KYC process.]

#### Team Info
**Proposer Github:** [GitHub Profile Link]

**Proposer Experience:** The proposer has experience building zkApps and other dApps. Relevant projects include [Project 1](#), [Project 2](#).

**Team Members:**
- **Member 1:** Role - Lead Developer, Experience - [Relevant Experience], GitHub - [GitHub Profile Link]
- **Member 2:** Role - QA Engineer, Experience - [Relevant Experience], GitHub - [GitHub Profile Link]

**Achievements:**
- Successfully developed and deployed [Project 1].
- Contributed to the open-source community with [Project 2].

#### Risks & Mitigations
**Risks:**
- Integration issues with profiling tools.
- Performance overhead introduced by profiling.

**Mitigations:**
- Thorough testing and validation of profiling tools.
- Optimization of profiling setup to minimize performance impact.
- Regular communication with the community for feedback and support.
Loading

0 comments on commit dc31cac

Please sign in to comment.