Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# If your on windows use wsl / git bash / cygwin / msys2 with direnv

# This repo only accepts signed commits:
# This repository only accepts signed commits:
# point out to users at commit time that commits need to be signed,
# not once they've done many commits and are trying to push a PR:
git config --local commit.gpgSign true
git config --local tag.gpgSign true

# docker on mac expects linux/arm64/v8 but currently we don't publish that build
if [[ "$(uname -s)" == "Darwin" ]] && [[ "$(uname -m)" == "arm64" ]]; then
export DOCKER_DEFAULT_PLATFORM=linux/arm64
fi

export MIDNIGHT_NODE_IMAGE="midnightnetwork/midnight-node:0.8.0"

export POSTGRES_HOST="postgres" # TODO: replace with IP or host to postgres connection if not connecting to the docker one.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assignees: ""

### Context & versions:

<!-- Explain your setup and what versions have been used. -->
<!-- Explain your setup and what versions have been used. -->

### Steps to reproduce:

Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/documentation-improvement.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ assignees: ""

Documentation Improvement: Clearly describe the improvement requested for existing content and/or raise missing areas of documentation and provide details for what should be included.

### Documentation url:
### Documentation URL:
<!-- Specify the exact location of the documentation you are referencing. -->

### Description of Improvement:
### Description of Improvement:
<!-- Provide a detailed description of the requested improvement. -->

### Proposed Solution (Optional):
Expand Down
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ assignees: ""

Feature Request: Clearly describe your feature, its benefits, and most important the expected outcome. This helps us analyze the proposed solution and develop alternatives

### Describe the proposed feature.
## Describe the proposed feature:

### User Need:
## User Need:
<!-- What user need does this feature address? Include use cases and user stories. -->

### Expected Benefit:
## Expected Benefit:
<!--What benefits does this feature provide to users and the platform? -->

### Details:
## Details:
<!--Proposed implementation ideas, alternatives considered, dependencies, and any additional information.-->
6 changes: 3 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Overview
# Overview

<!-- Describe your changes briefly here, with some context as to why this is needed. -->

Expand All @@ -12,9 +12,9 @@
- [ ] All check jobs of the CI have succeeded
- [ ] Self-reviewed the diff
- [ ] Reviewer requested
- [ ] Update README file (if relevant)
- [ ] Update README.md file (if relevant)
- [ ] Update documentation (if relevant)
- [ ] No new TODOs introduced
- [ ] No new todos introduced

## Links

Expand Down
3 changes: 3 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MD013: false # line length 80
MD026: false
MD034: false
6 changes: 6 additions & 0 deletions .github/workflows/checkmarx.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Checkmarx One Scan

# ↓ lock down top‐level permissions to only what we use
permissions:
contents: read # we only need to checkout code
actions: read # to query workflows/runs
pull-requests: write # to comment on or label PRs

on:
pull_request:
branches: [ '**' ]
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

# ↓ lock down top‐level permissions to only what we use
permissions:
contents: read # we only need to checkout code
actions: read # to query workflows/runs
statuses: write

# Run on pushes to any branch and pull requests
on:
push:
branches: ['main']
pull_request:
branches: ['**']

jobs:
# Lint all YAML, JSON & Shell
lint:
name: Lint code & configs
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check compose files
run: |
source ./.envrc
docker compose -f compose.yml config -q
docker compose -f compose-partner-chains.yml config -q
docker compose -f proof-server.yml config -q

- name: Run Super-linter
uses: github/super-linter@v7
env:
# only lint the file types you care about
VALIDATE_YAML: true
VALIDATE_JSON: true
VALIDATE_SHELL: true
VALIDATE_BASH: true
VALIDATE_BASH_EXEC: true
VALIDATE_CHECOV: true
VALIDATE_GITHUB_ACTIONS: true
VALIDATE_GITLEAKS: true
VALIDATE_NATURAL_LANGUAGE: true
VALIDATE_MARKDOWN: true
VALIDATE_DOCKERFILE: true
FILTER_REGEX_EXCLUDE: (^cardano-config/|LICENSE\.md)
# tell it your default branch so it can diff
DEFAULT_BRANCH: origin/main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 🚀 Features

### 🚀 Features

- Port from prior repo (#3)
- Port from prior repository (#3)
- If direnv isn't working give an appropriate error message.
- /data dir should be .gitignored
- Automatically create a random node key.
- Only randomise the postgres password once.
- Parametise cardano network

### 💼 Other
## 💼 Other

- *(deps)* Bump checkmarx/ast-github-action from 2.3.18 to 2.3.19 (#9)
- Be explicit about image
11 changes: 9 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
Expand All @@ -12,25 +14,30 @@ Examples of behavior that contributes to creating a positive environment include

Examples of unacceptable behavior by participants include:

-The use of sexualized language or imagery and unwelcome sexual attention or advances
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others’ private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope
This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at legal@midnight.foundation. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.

## Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ We welcome your contributions to the Midnight network! By contributing, you'll p
## Getting Started

* **Review Existing Contributions and Issues:** Before submitting, please check if a similar issue or feature request already exists by searching our issue tracker.
* **Understand the Project:** Familiarize yourself with Midnight's architecture, technology, and coding standards. You can find relevant information in our litepaper.
* **Set up Your Development Environment:** Ensure you have the necessary tools and dependencies installed. See our developer [documentation](https://docs.midnight.network/) for detailed instructions.
* **Understand the Project:** Familiarize yourself with Midnight's architecture, technology, and coding standards. You can find relevant information in our litepaper.
* **Set up Your Development Environment:** Ensure you have the necessary tools and dependencies installed. See our developer [documentation](https://docs.midnight.network/) for detailed instructions.

## Submitting Issues

Expand All @@ -16,7 +16,7 @@ Ensure the title is a clear summary of the requirement and provides enough conte
**Issue Types:**

* **Bug Report:** Provide detailed information about the issue, including steps to reproduce it, expected behavior, and actual behavior, screenshots, or any other relevant information.
* **Documentation Improvement:** Clearly describe the improvement requested for existing content and/or raise missing areas of documentation and provide details for what should be included.
* **Documentation Improvement:** Clearly describe the improvement requested for existing content and/or raise missing areas of documentation and provide details for what should be included.
* **Feature Request:** Clearly describe your feature, its benefits, and most importantly, the expected outcome. This helps us analyze the proposed solution and develop alternatives.
* **Enhancement:** (WIP)

Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This allows for easy orchestration of the Midnight Node service.

## Usage

1. Clone repo
1. Clone repository

2. run `direnv allow` to load the environment variables

Expand All @@ -19,23 +19,27 @@ This allows for easy orchestration of the Midnight Node service.
The `.envrc` file will automatically create a random private key and save it as `midnight-node.privatekey`.

Choose which compose files to use:
- `compose.yml` for Midnight Node
- `compose-partner-chains.yml` for Cardano + DB Sync
- `proof-server.yml` for Local Proof Server

- `compose.yml` for Midnight Node
- `compose-partner-chains.yml` for Cardano + DB Sync
- `proof-server.yml` for Local Proof Server

One can use one or multiple compose files at once.

For example, to run the Midnight Node, you can do:

```shell
docker compose up -d
```

or to run the Midnight Node and Cardano DB Sync, you can do:

```shell
docker compose -f ./compose-partner-chains.yml -f ./compose.yml up -d
```

or to run the Midnight Node, Cardano DB Sync and a local Proof Server, you can do:

```shell
docker compose -f ./compose-partner-chains.yml -f ./compose.yml -f ./proof-server.yml up -d
```
Expand All @@ -59,7 +63,8 @@ rm -R ./cardano-data
#### Env vars not setup

If you get warnings like this then likely `direnv` is not setup or `direnv allow` has not been run:
```

```text
WARN[0000] The "HOME_IPC" variable is not set. Defaulting to a blank string.
```

Expand All @@ -73,7 +78,7 @@ socket file: `rm ~/ipc/node.socket` and restart.
If you encounter this message on the midnight node it's likely that the
cardano-node is still syncing and it will go away once it's fully synced:

```
```text
Unable to author block in slot. Failure creating inherent data provider:
'No latest block on chain.' not found.
Possible causes: main chain follower configuration error, db-sync not synced fully,
Expand Down
9 changes: 4 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ for Linux Foundation projects.

## Disclosing a security issue

The Midnight foundation takes all security issues seriously, which includes all source code repositories managed
through our [GitHub organization](https://github.com/midnightntwrk). If you believe you have found a security vulnerability in any Midnight Foundation
owned repository, <B>please report it using GitHub's private vulnerability reporting</B> and not through public GitHub issues. To learn more about GitHub's
The Midnight foundation takes all security issues seriously, which includes all source code repositories managed
through our [GitHub organization](https://github.com/midnightntwrk). If you believe you have found a security vulnerability in any Midnight Foundation
owned repository, *please report it using GitHub's private vulnerability reporting* and not through public GitHub issues. To learn more about GitHub's
private vulnerability reporting and how to submit a vulnerability report, please review [GitHub's documentation on private reporting](https://docs.github.com/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
Expand All @@ -40,10 +40,9 @@ After the initial reply to your report, the maintainers will endeavor to keep
you informed of the progress towards a fix and full announcement, and may ask
for additional information or guidance.

Thank you for improving the security of Midnight. We appreciate your dedication to responsible disclosure and will
Thank you for improving the security of Midnight. We appreciate your dedication to responsible disclosure and will
make every effort to acknowledge your contributions.


## Vulnerability management

When the maintainers receive a disclosure report, they will assign it to a
Expand Down
6 changes: 3 additions & 3 deletions cardano-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fi
DOCKER_DEFAULT_PLATFORM=linux/amd64 docker run --rm \
--network container:cardano-node \
-e CARDANO_NODE_SOCKET_PATH="/ipc/node.socket" \
-e CARDANO_NODE_NETWORK_ID=${CARDANO_NODE_NETWORK_ID} \
-e CARDANO_NODE_NETWORK_ID="${CARDANO_NODE_NETWORK_ID}" \
-v ~/ipc:/ipc \
${CARDANO_IMAGE} \
cli $*
"${CARDANO_IMAGE}" \
cli "$@"
10 changes: 5 additions & 5 deletions midnight-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

if [ -z "$MIDNIGHT_NODE_IMAGE" ]; then
echo "Error: Env var MIDNIGHT_NODE_IMAGE is not set or is empty"
echo "Please install direnv and run `direnv allow` to activate it."
echo "Please install direnv and run 'direnv allow' to activate it."
exit 1
fi

docker run -it \
-e CFG_PRESET=${CFG_PRESET} \
-e DB_SYNC_POSTGRES_CONNECTION_STRING=${DB_SYNC_POSTGRES_CONNECTION_STRING} \
-v ./data:/data ${MIDNIGHT_NODE_IMAGE} \
$*
-e CFG_PRESET="${CFG_PRESET}" \
-e DB_SYNC_POSTGRES_CONNECTION_STRING="${DB_SYNC_POSTGRES_CONNECTION_STRING}" \
-v ./data:/data "${MIDNIGHT_NODE_IMAGE}" \
"$@"