Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Sanchonet Cardano network #1384

Merged
merged 13 commits into from
Feb 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ inputs:
cardano_node_version:
description: Cardano node version.
required: true
cardano_node_docker_registry:
description: Cardano node Docker image registry.
required: false
default: "ghcr.io/intersectmbo/cardano-node"
google_region:
description: Google Cloud region name.
required: true
Expand Down Expand Up @@ -60,6 +64,10 @@ inputs:
mithril_genesis_verification_key_url:
description: Mithril genesis verification key location.
required: true
mithril_era_reader_adapter_type:
description: Mithril era reader adapter type.
required: false
default: "cardano-chain"
mithril_era_reader_address_url:
description: Mithril era reader address location.
required: true
Expand Down Expand Up @@ -145,6 +153,7 @@ runs:
environment_prefix = "${{ inputs.environment_prefix }}"
cardano_network = "${{ inputs.cardano_network }}"
cardano_image_id = "${{ inputs.cardano_node_version }}"
cardano_image_registry = "${{ inputs.cardano_node_docker_registry }}"
google_region = "${{ inputs.google_region }}"
google_zone = "${{ inputs.google_zone }}"
google_machine_type = "${{ inputs.google_machine_type }}"
Expand All @@ -158,7 +167,7 @@ runs:
mithril_genesis_secret_key = "${{ inputs.mithril_genesis_secret_key }}"
mithril_protocol_parameters = ${{ fromJSON(inputs.mithril_protocol_parameters) }}
mithril_signers = ${{ fromJSON(inputs.mithril_signers) }}
mithril_era_reader_adapter_type = "cardano-chain"
mithril_era_reader_adapter_type = "${{ inputs.mithril_era_reader_adapter_type }}"
mithril_era_reader_address_url = "${{ inputs.mithril_era_reader_address_url }}"
mithril_era_reader_verification_key_url = "${{ inputs.mithril_era_reader_verification_key_url }}"
mithril_era_reader_secret_key = "${{ inputs.mithril_era_reader_secret_key }}"
Expand Down
27 changes: 26 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ jobs:
strategy:
fail-fast: false
matrix:
environment: [ testing-preview ]
environment: [ testing-preview, testing-sanchonet ]
include:
- environment: testing-preview
environment_prefix: testing
Expand Down Expand Up @@ -601,6 +601,30 @@ jobs:
google_machine_type: e2-standard-8
google_compute_instance_boot_disk_size: 200
google_compute_instance_data_disk_size: 250
- environment: testing-sanchonet
environment_prefix: testing
cardano_network: sanchonet
mithril_use_p2p_network: false
mithril_api_domain: api.mithril.network
mithril_protocol_parameters: |
{
k = 5
m = 100
phi_f = 0.65
}
mithril_signers: |
{
"1" = {
type = "verified",
pool_id = "",
},
}
terraform_backend_bucket: hydra-terraform-admin
google_region: europe-west1
google_zone: europe-west1-b
google_machine_type: e2-highmem-4
google_compute_instance_boot_disk_size: 200
google_compute_instance_data_disk_size: 250
environment: ${{ matrix.environment }}
runs-on: ubuntu-22.04
needs:
Expand All @@ -626,6 +650,7 @@ jobs:
environment: ${{ matrix.environment }}
cardano_network: ${{ matrix.cardano_network }}
cardano_node_version: ${{ vars.CARDANO_NODE_VERSION }}
cardano_node_docker_registry: ${{ vars.CARDANO_NODE_DOCKER_REGISTRY }}
google_region: ${{ matrix.google_region }}
google_zone: ${{ matrix.google_zone }}
google_machine_type: ${{ matrix.google_machine_type }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ jobs:
environment: ${{ matrix.environment }}
cardano_network: ${{ matrix.cardano_network }}
cardano_node_version: ${{ vars.CARDANO_NODE_VERSION }}
cardano_node_docker_registry: ${{ vars.CARDANO_NODE_DOCKER_REGISTRY }}
google_region: ${{ matrix.google_region }}
google_zone: ${{ matrix.google_zone }}
google_machine_type: ${{ matrix.google_machine_type }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ jobs:
environment: ${{ matrix.environment }}
cardano_network: ${{ matrix.cardano_network }}
cardano_node_version: ${{ vars.CARDANO_NODE_VERSION }}
cardano_node_docker_registry: ${{ vars.CARDANO_NODE_DOCKER_REGISTRY }}
google_region: ${{ matrix.google_region }}
google_zone: ${{ matrix.google_zone }}
google_machine_type: ${{ matrix.google_machine_type }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test-deploy-network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
cardano_network: preview
mithril_use_p2p_network: true
mithril_api_domain: api.mithril.network
mithril_era_reader_adapter_type: cardano-chain
mithril_protocol_parameters: |
{
k = 5
Expand Down Expand Up @@ -81,6 +82,7 @@ jobs:
environment: ${{ matrix.environment }}
cardano_network: ${{ matrix.cardano_network }}
cardano_node_version: ${{ vars.CARDANO_NODE_VERSION }}
cardano_node_docker_registry: ${{ vars.CARDANO_NODE_DOCKER_REGISTRY }}
google_region: ${{ matrix.google_region }}
google_zone: ${{ matrix.google_zone }}
google_machine_type: ${{ matrix.google_machine_type }}
Expand All @@ -94,6 +96,7 @@ jobs:
mithril_signers: ${{ toJSON(matrix.mithril_signers) }}
mithril_genesis_secret_key: ${{ secrets.GENESIS_SECRET_KEY }}
mithril_genesis_verification_key_url: ${{ vars.GENESIS_VERIFICATION_KEY_URL }}
mithril_era_reader_adapter_type: ${{ matrix.mithril_era_reader_adapter_type }}
mithril_era_reader_address_url: ${{ vars.ERA_READER_ADDRESS_URL }}
mithril_era_reader_verification_key_url: ${{ vars.ERA_READER_VERIFICATION_KEY_URL }}
mithril_era_reader_secret_key: ${{ secrets.ERA_READER_SECRET_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions docs/runbook/era-markers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ $ export ERA_ACTIVATION_SECRET_KEY=**YOUR_ERA_ACTIVATION_SECRET_KEY**
$ export ASSETS_PATH=**YOUR_ASSETS_PATH**
```

Compute the current Cardano era:
```bash
CARDANO_ERA=$(cardano-cli query tip --testnet-magic $CARDANO_TESTNET_MAGIC | jq -r '.era |= ascii_downcase | .era')
```

Set the transaction amount used when a script transaction is made:
```bash
$ export SCRIPT_TX_VALUE=2000000
Expand Down Expand Up @@ -54,7 +59,7 @@ $ ./mithril-aggregator era generate-tx-datum --current-era-epoch 1 --era-markers

Now create the bootstrap transaction with datum:
```bash
$ cardano-cli transaction build --babbage-era --testnet-magic $CARDANO_TESTNET_MAGIC \
$ cardano-cli $CARDANO_ERA transaction build --testnet-magic $CARDANO_TESTNET_MAGIC \
--tx-in $TX_IN \
--tx-out $(cat $CARDANO_WALLET_PATH/payment.addr)+$SCRIPT_TX_VALUE \
--tx-out-inline-datum-file $ASSETS_PATH/mithril-era-datum-1.json \
Expand All @@ -65,7 +70,7 @@ Estimated transaction fee: Lovelace 168669

Then sign the transaction:
```bash
$ cardano-cli transaction sign \
$ cardano-cli $CARDANO_ERA transaction sign \
--tx-body-file $ASSETS_PATH/tx.raw \
--signing-key-file $CARDANO_WALLET_PATH/payment.skey \
--testnet-magic $CARDANO_TESTNET_MAGIC \
Expand All @@ -74,7 +79,7 @@ $ cardano-cli transaction sign \

And submit it:
```bash
$ cardano-cli transaction submit \
$ cardano-cli $CARDANO_ERA transaction submit \
--testnet-magic $CARDANO_TESTNET_MAGIC \
--tx-file $ASSETS_PATH/tx.signed
Transaction successfully submitted.
Expand Down Expand Up @@ -155,7 +160,7 @@ $ ./mithril-aggregator era generate-tx-datum --current-era-epoch 1 --era-markers

Now create the update transaction with datum:
```bash
$ cardano-cli transaction build --babbage-era --testnet-magic $CARDANO_TESTNET_MAGIC \
$ cardano-cli $CARDANO_ERA transaction build --testnet-magic $CARDANO_TESTNET_MAGIC \
--tx-in $TX_IN_DATUM \
--tx-in $TX_IN_NO_DATUM \
--tx-out $(cat $CARDANO_WALLET_PATH/payment.addr)+$SCRIPT_TX_VALUE \
Expand All @@ -167,7 +172,7 @@ Estimated transaction fee: Lovelace 179889

Then sign the transaction:
```bash
$ cardano-cli transaction sign \
$ cardano-cli $CARDANO_ERA transaction sign \
--tx-body-file $ASSETS_PATH/tx.raw \
--signing-key-file $CARDANO_WALLET_PATH/payment.skey \
--testnet-magic $CARDANO_TESTNET_MAGIC \
Expand All @@ -176,7 +181,7 @@ $ cardano-cli transaction sign \

And submit it:
```bash
$ cardano-cli transaction submit \
$ cardano-cli $CARDANO_ERA transaction submit \
--testnet-magic $CARDANO_TESTNET_MAGIC \
--tx-file $ASSETS_PATH/tx.signed
Transaction successfully submitted.
Expand Down
19 changes: 19 additions & 0 deletions docs/website/root/networks-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,25 @@ Here is an updated list of all **Mithril networks**, including their configurati
| **Era reader adapter type** | `cardano-chain`
| **Era reader address** | `https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-preview/era.addr` [:arrow_upper_right:](https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-preview/era.addr)
| **Era reader verification key** | `https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-preview/era.vkey` [:arrow_upper_right:](https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-preview/era.vkey)
| **Build from** | **Main branch** [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main)

</TabItem>
<TabItem value="sanchonet" label="Sanchonet">
## `testing-sanchonet`
> :warning: For devs only

| Information | -
|------------|------------
| **Mithril network** | `testing-sanchonet` [:mag_right:](https://mithril.network/explorer?aggregator=https%3A%2F%2Faggregator.testing-sanchonet.api.mithril.network%2Faggregator)
| **Cardano network** | `sanchonet`
| **Cardano magic Id** | `4`
| **Supported** | Yes :heavy_check_mark:
| **Status** | Unstable 🔴
| **Aggregator endpoint** | `https://aggregator.testing-sanchonet.api.mithril.network/aggregator` [:arrow_upper_right:](https://aggregator.testing-sanchonet.api.mithril.network/aggregator)
| **Genesis verification key** | `https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-sanchonet/genesis.vkey` [:arrow_upper_right:](https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-sanchonet/genesis.vkey)
| **Era reader adapter type** | `cardano-chain`
| **Era reader address** | `https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-sanchonet/era.addr` [:arrow_upper_right:](https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-sanchonet/era.addr)
| **Era reader verification key** | `https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-sanchonet/era.vkey` [:arrow_upper_right:](https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/testing-sanchonet/era.vkey)
| **Build from** | **Main branch** [:arrow_upper_right:](https://github.com/input-output-hk/mithril/tree/main)

</TabItem>
Expand Down
2 changes: 1 addition & 1 deletion mithril-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-common"
version = "0.2.160"
version = "0.2.161"
description = "Common types, interfaces, and utilities for Mithril nodes."
authors = { workspace = true }
edition = { workspace = true }
Expand Down
11 changes: 11 additions & 0 deletions mithril-common/src/entities/cardano_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const MAINNET_MAGIC_ID: MagicId = 764824073;
const TESTNET_MAGIC_ID: MagicId = 1097911063;
const PREPROD_MAGIC_ID: MagicId = 1;
const PREVIEW_MAGIC_ID: MagicId = 2;
const SANCHONET_MAGIC_ID: MagicId = 4;

#[derive(Error, Debug)]
pub enum CardanoNetworkError {
Expand Down Expand Up @@ -40,6 +41,7 @@ impl CardanoNetwork {
"testnet" => Ok(CardanoNetwork::TestNet(TESTNET_MAGIC_ID)),
"preview" => Ok(CardanoNetwork::TestNet(PREVIEW_MAGIC_ID)),
"preprod" => Ok(CardanoNetwork::TestNet(PREPROD_MAGIC_ID)),
"sanchonet" => Ok(CardanoNetwork::TestNet(SANCHONET_MAGIC_ID)),
"private" => {
if let Some(magic) = network_magic {
Ok(CardanoNetwork::TestNet(magic))
Expand Down Expand Up @@ -83,6 +85,7 @@ impl Display for CardanoNetwork {
TESTNET_MAGIC_ID => write!(f, "testnet"),
PREVIEW_MAGIC_ID => write!(f, "preview"),
PREPROD_MAGIC_ID => write!(f, "preprod"),
SANCHONET_MAGIC_ID => write!(f, "sanchonet"),
_ => write!(f, "private"),
},
}
Expand Down Expand Up @@ -119,6 +122,14 @@ mod tests {
CardanoNetwork::from_code("preprod".to_string(), Some(123)).unwrap(),
CardanoNetwork::TestNet(PREPROD_MAGIC_ID)
);
assert_eq!(
CardanoNetwork::from_code("sanchonet".to_string(), None).unwrap(),
CardanoNetwork::TestNet(SANCHONET_MAGIC_ID)
);
assert_eq!(
CardanoNetwork::from_code("sanchonet".to_string(), Some(123)).unwrap(),
CardanoNetwork::TestNet(SANCHONET_MAGIC_ID)
);
assert_eq!(
CardanoNetwork::from_code("testnet".to_string(), None).unwrap(),
CardanoNetwork::TestNet(TESTNET_MAGIC_ID)
Expand Down
2 changes: 1 addition & 1 deletion mithril-explorer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mithril-explorer",
"version": "0.4.11",
"version": "0.4.12",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
1 change: 1 addition & 0 deletions mithril-explorer/src/aggregators-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const defaultAggregators = [
"https://aggregator.release-preprod.api.mithril.network/aggregator",
"https://aggregator.pre-release-preview.api.mithril.network/aggregator",
"https://aggregator.testing-preview.api.mithril.network/aggregator",
"https://aggregator.testing-sanchonet.api.mithril.network/aggregator",
"http://localhost:8080/aggregator",
];

Expand Down
3 changes: 2 additions & 1 deletion mithril-infra/assets/docker/Dockerfile.cardano
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ARG CARDANO_IMAGE_ID
FROM ghcr.io/intersectmbo/cardano-node:$CARDANO_IMAGE_ID
ARG CARDANO_IMAGE_REGISTRY
FROM $CARDANO_IMAGE_REGISTRY:$CARDANO_IMAGE_ID

# Fix env file rights
# In order to be able to interact with the Cardano node trough its 'node.socket'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
dockerfile: Dockerfile.cardano
args:
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
CARDANO_IMAGE_REGISTRY: ${CARDANO_IMAGE_REGISTRY}
user: ${CURRENT_UID}
profiles:
- cardano
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
dockerfile: Dockerfile.cardano
args:
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
CARDANO_IMAGE_REGISTRY: ${CARDANO_IMAGE_REGISTRY}
user: ${CURRENT_UID}
profiles:
- cardano
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
dockerfile: Dockerfile.cardano
args:
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
CARDANO_IMAGE_REGISTRY: ${CARDANO_IMAGE_REGISTRY}
user: ${CURRENT_UID}
profiles:
- cardano
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
dockerfile: Dockerfile.cardano
args:
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
CARDANO_IMAGE_REGISTRY: ${CARDANO_IMAGE_REGISTRY}
user: ${CURRENT_UID}
profiles:
- cardano
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
dockerfile: Dockerfile.cardano
args:
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
CARDANO_IMAGE_REGISTRY: ${CARDANO_IMAGE_REGISTRY}
user: ${CURRENT_UID}
profiles:
- cardano
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
dockerfile: Dockerfile.cardano
args:
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
CARDANO_IMAGE_REGISTRY: ${CARDANO_IMAGE_REGISTRY}
user: ${CURRENT_UID}
profiles:
- cardano
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
dockerfile: Dockerfile.cardano
args:
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
CARDANO_IMAGE_REGISTRY: ${CARDANO_IMAGE_REGISTRY}
user: ${CURRENT_UID}
profiles:
- cardano
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
dockerfile: Dockerfile.cardano
args:
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
CARDANO_IMAGE_REGISTRY: ${CARDANO_IMAGE_REGISTRY}
user: ${CURRENT_UID}
profiles:
- cardano
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
dockerfile: Dockerfile.cardano
args:
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
CARDANO_IMAGE_REGISTRY: ${CARDANO_IMAGE_REGISTRY}
user: ${CURRENT_UID}
profiles:
- cardano
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
dockerfile: Dockerfile.cardano
args:
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
CARDANO_IMAGE_REGISTRY: ${CARDANO_IMAGE_REGISTRY}
user: ${CURRENT_UID}
profiles:
- cardano
Expand Down
2 changes: 1 addition & 1 deletion mithril-infra/assets/infra.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.7
0.2.8
Loading
Loading