Skip to content

Commit 8db63da

Browse files
committed
Update Berkeley Update Section
1 parent 5c79a04 commit 8db63da

16 files changed

+603
-112
lines changed

docs/berkeley-upgrade/archive-migration-installation.mdx renamed to docs/berkeley-upgrade/archive-migration/archive-migration-installation.mdx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ keywords:
77
- Berkeley
88
- upgrade
99
- archive migration
10-
- installing
10+
- installing
1111
- prerequisites
1212
- mina archive node
1313
- archive node
1414
---
1515

1616
The archive node Berkeley migration package is sufficient for satisfying the migration from Devnet/Mainnet to Berkeley.
17-
However, it has some limitations. For example, the migration package does not migrate a non-canonical chain and it skips orphaned blocks that are not part of a canonical chain.
17+
However, it has some limitations. For example, the migration package does not migrate a non-canonical chain and it skips orphaned blocks that are not part of a canonical chain.
1818

1919
To mitigate these limitations, the archive node maintenance package is available for use by archive node operators who want to maintain a copy of their Devnet and Mainnet databases for historical reasons.
2020

@@ -35,23 +35,23 @@ We strongly encourage you to perform the migration on your own data to preserve
3535
1. Download the Devnet/Mainnet archive data using cURL or gsutil:
3636

3737
- cURL:
38-
38+
3939
For Devnet:
4040
```sh
4141
curl https://storage.googleapis.com/mina-archive-dumps/devnet-archive-dump-{date}_0000.sql.tar.gz
4242
```
43-
44-
For Mainnet:
43+
44+
For Mainnet:
4545
```sh
4646
curl https://storage.googleapis.com/mina-archive-dumps/mainnet-archive-dump-{date}_0000.sql.tar.gz
4747
```
48-
48+
4949
To filter the dumps by date, replace `{date}` using the required `yyyy-dd-mm` format. For example, for March 15, 2024, use `2024-03-15`.
50-
50+
5151
:warning: The majority of backups have the `0000` suffix. If a download with that name suffix is not available, try incrementing it. For example, `0001`, `0002`, and so on.
5252

5353
- gsutil:
54-
54+
5555
```sh
5656
gsutil cp gs://mina-archive-dumps/mainnet-archive-dump-2024-01-15* .
5757
```
@@ -65,13 +65,13 @@ We strongly encourage you to perform the migration on your own data to preserve
6565
3. Import the Devnet/Mainnet archive dump into the Berkeley database.
6666

6767
Run this command at the database server:
68-
68+
6969
```sh
7070
psql -U {user} -f {network}-archive-dump-{date}_0000.sql
7171
```
72-
72+
7373
The database in the dump **archive_balances_migrated** is created with the Devnet/Mainnet archive schema.
74-
74+
7575
Note: This database does not have any Berkeley changes.
7676

7777
## Ensure the location of Google Cloud bucket with the Devnet/Mainnet precomputed blocks
@@ -84,17 +84,17 @@ The recommended method is to perform migration on your own data to preserve the
8484

8585
## Validate the Devnet/Mainnet database
8686

87-
The correct Devnet/Mainnet database state is crucial for a successful migration.
87+
The correct Devnet/Mainnet database state is crucial for a successful migration.
8888

89-
[Missing blocks](/berkeley-upgrade/mainnet-database-maintenance#missing-blocks) is one the most frequent issues when dealing with the Devnet/Mainnet archive. Although this step is optional, it is strongly recommended that you verify the archive condition before you start the migration process.
89+
[Missing blocks](/berkeley-upgrade/archive-migration/mainnet-database-maintenance#missing-blocks) is one the most frequent issues when dealing with the Devnet/Mainnet archive. Although this step is optional, it is strongly recommended that you verify the archive condition before you start the migration process.
9090

91-
To learn how to maintain archive data, see [Devnet/Mainnet database maintenance](/berkeley-upgrade/mainnet-database-maintenance).
91+
To learn how to maintain archive data, see [Devnet/Mainnet database maintenance](/berkeley-upgrade/archive-migration/mainnet-database-maintenance).
9292

9393
## Download the migration applications
9494

9595
Migration applications are distributed as part of the archive migration Docker and Debian packages.
9696

97-
Choose the packages that are appropriate for your environment.
97+
Choose the packages that are appropriate for your environment.
9898

9999
### Debian packages
100100

@@ -118,7 +118,7 @@ To get the Docker image:
118118
docker pull gcr.io/o1labs-192920/mina-archive-migration:3.0.1-e848ecb-{codename}
119119
```
120120

121-
Where supported codenames are:
121+
Where supported codenames are:
122122
- bullseye
123123
- focal
124124
- buster
@@ -132,9 +132,9 @@ The Mina Devnet/Mainnet genesis ledger is stored in GitHub in the `mina` reposit
132132

133133
You can get the Berkeley schema files from different locations:
134134

135-
- GitHub repository from the `berkeley` branch.
135+
- GitHub repository from the `berkeley` branch.
136136

137-
Note: The `berkeley` branch can contain new updates regarding schema files, so always get the latest schema files instead of using an already downloaded schema.
137+
Note: The `berkeley` branch can contain new updates regarding schema files, so always get the latest schema files instead of using an already downloaded schema.
138138

139139
- Archive/Rosetta Docker from `berkeley` version
140140

@@ -148,4 +148,4 @@ You can get the Berkeley schema files from different locations:
148148

149149
## Next steps
150150

151-
Congratulations on completing the essential preparation and verification steps. You are now ready to perform the migration steps in [Migrating Devnet/Mainnet Archive to Berkeley Archive](/berkeley-upgrade/migrating-archive-database-to-berkeley).
151+
Congratulations on completing the essential preparation and verification steps. You are now ready to perform the migration steps in [Migrating Devnet/Mainnet Archive to Berkeley Archive](/berkeley-upgrade/archive-migration/migrating-archive-database-to-berkeley).

docs/berkeley-upgrade/worked-archive-example.mdx renamed to docs/berkeley-upgrade/archive-migration/debian-example.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Worked example of Devnet Archive Migration
3-
sidebar_label: Worked example (devnet 2024-03-22)
2+
title: Example of Devnet Archive Migration (Debian)
3+
sidebar_label: Debian example (Devnet)
44
hide_title: true
55
description: A copy-paste example of how to do a Devnet migration.
66
keywords:
@@ -11,9 +11,9 @@ keywords:
1111
- archive node
1212
---
1313

14-
You can follow these steps that can be copy-pasted directly into a fresh Debian 11.
14+
You can follow these steps that can be copy-pasted directly into a fresh Debian 11.
1515

16-
This example uses an altered two-step version of the [full simplified workflow](/berkeley-upgrade/migrating-archive-database-to-berkeley#simplified-approach).
16+
This example uses an altered two-step version of the [full simplified workflow](/berkeley-upgrade/archive-migration/migrating-archive-database-to-berkeley#simplified-approach).
1717

1818
```sh
1919
apt update && apt install lsb-release sudo postgresql curl wget gpg # debian:11 is surprisingly light
@@ -54,7 +54,6 @@ mina-berkeley-migration-script initial \
5454
--blocks-batch-size 100 --blocks-bucket mina_network_block_data \
5555
--network devnet
5656

57-
5857
# now, do a final migration
5958

6059
gsutil cp gs://mina-archive-dumps/devnet-archive-dump-2024-03-22_2050.sql.tar.gz .
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: Example of Mainnet Archive Migration (Docker)
3+
sidebar_label: Docker example (Mainnet)
4+
hide_title: true
5+
description: A copy-paste example of how to do a Mainnet migration.
6+
keywords:
7+
- Berkeley
8+
- upgrade
9+
- archive migration
10+
- mina archive node
11+
- archive node
12+
---
13+
14+
You can follow these steps that can be copy-pasted directly into a OS running Docker.
15+
16+
This example performs a Mainnet initial migration following the [debian-example](/berkeley-upgrade/archive-migration/debian-example)
17+
18+
```sh
19+
20+
# Create a new directory for the migration data
21+
mkdir $(pwd)/mainnet-migration && cd $(pwd)/mainnet-migration
22+
23+
# Create Network
24+
docker network create mainnet
25+
26+
# Launch Local Postgres Database
27+
docker run --name postgres -d -p 5432:5432 --network mainnet -v $(pwd)/mainnet-migration/postgresql/data:/var/lib/postgresql/data -e POSTGRES_USER=mina -e POSTGRES_PASSWORD=minamina -d postgres:13-bullseye
28+
29+
export PGHOST="localhost"
30+
export PGPORT=5432
31+
export PGUSER="mina"
32+
export PGPASSWORD="minamina"
33+
34+
# Drop DBs if they exist
35+
psql -c "DROP DATABASE IF EXISTS mainnet_balances_migrated;"
36+
psql -c "DROP DATABASE IF EXISTS mainnet_really_migrated;"
37+
38+
# Create DBs
39+
psql -c "CREATE DATABASE mainnet_balances_migrated;"
40+
psql -c "CREATE DATABASE mainnet_really_migrated;"
41+
42+
# Retrieve Archive Node Backup
43+
wget https://673156464838-mina-archive-node-backups.s3.us-west-2.amazonaws.com/mainnet/mainnet-archive-dump-2024-04-29_0000.sql.tar.gz
44+
tar -xf mainnet-archive-dump-2024-04-29_0000.sql.tar.gz
45+
46+
# Replace the database name in the dump
47+
sed -i -e s/archive_balances_migrated/mainnet_balances_migrated/g mainnet-archive-dump-2024-04-29_0000.sql
48+
psql mainnet_balances_migrated -f mainnet-archive-dump-2024-04-29_0000.sql
49+
50+
# Prepare target
51+
wget https://raw.githubusercontent.com/MinaProtocol/mina/berkeley/src/app/archive/create_schema.sql
52+
wget https://raw.githubusercontent.com/MinaProtocol/mina/berkeley/src/app/archive/zkapp_tables.sql
53+
psql mainnet_really_migrated -f create_schema.sql
54+
55+
# Start migration
56+
docker create --name mainnet-db-migration \
57+
-v $(pwd)/mainnet-migration:/data \
58+
--network mainnet gcr.io/o1labs-192920/mina-archive-migration:3.0.1-e848ecb-bullseye -- bash -c '
59+
wget http://673156464838-mina-genesis-ledgers.s3-website-us-west-2.amazonaws.com/mainnet/genesis_ledger.json; mina-berkeley-migration-script initial \
60+
--genesis-ledger genesis_ledger.json \
61+
--source-db postgres://mina:minamina@postgres:5432/mainnet_balances_migrated \
62+
--target-db postgres://mina:minamina@postgres:5432/mainnet_really_migrated \
63+
--blocks-batch-size 5000 \
64+
--blocks-bucket mina_network_block_data \
65+
--checkpoint-output-path /data/checkpoints/. \
66+
--precomputed-blocks-local-path /data/precomputed_blocks/. \
67+
--network mainnet'
68+
69+
docker start mainnet-db-migration
70+
71+
docker logs -f mainnet-db-migration
72+
73+
```
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Berkeley Upgrade
3-
sidebar_label: Berkeley Upgrade
2+
title: Archive Migration
3+
sidebar_label: Archive Migration
44
hide_title: true
55
description: Berkeley upgrade is a major upgrade that requires all nodes in a network to upgrade to a newer version. It is not backward compatible.
66
keywords:
@@ -11,26 +11,27 @@ keywords:
1111
- archive node
1212
---
1313

14-
# Berkeley Upgrade
14+
# Archive Migration
1515

16-
The Berkeley upgrade is a major upgrade that requires all nodes in a network to upgrade to a newer version. It is not backward compatible.
16+
The Berkeley upgrade is a major upgrade that requires all nodes in a network to upgrade to a newer version. It is not backward compatible.
1717

1818
A major upgrade occurs when there are major changes to the core protocol that require all nodes on the network to update to the latest software.
1919

2020
## How to prepare for the Berkeley upgrade
2121

22-
The Berkeley upgrade requires upgrading all nodes, including archive nodes. One of the required steps is to migrate archive databases from the current Mainnet format to Berkeley. This migration requires actions and efforts from node operators and exchanges.
22+
The Berkeley upgrade requires upgrading all nodes, including archive nodes. One of the required steps is to migrate archive databases from the current Mainnet format to Berkeley. This migration requires actions and efforts from node operators and exchanges.
2323

2424
Learn about the archive data migration:
2525

26-
- [Understanding the migration process](/berkeley-upgrade/understanding-archive-migration)
27-
- [Prerequisites before migration](/berkeley-upgrade/archive-migration-prerequisites)
28-
- [Suggested installation procedure](/berkeley-upgrade/archive-migration-installation)
29-
- [How to perform archive migration](/berkeley-upgrade/migrating-archive-database-to-berkeley)
26+
- [Understanding the migration process](/berkeley-upgrade/archive-migration/understanding-archive-migration)
27+
- [Prerequisites before migration](/berkeley-upgrade/archive-migration/archive-migration-prerequisites)
28+
- [Suggested installation procedure](/berkeley-upgrade/archive-migration/archive-migration-installation)
29+
- [How to perform archive migration](/berkeley-upgrade/archive-migration/migrating-archive-database-to-berkeley)
3030

3131
Finally, see the shell script example that is compatible with a stock Debian 11 container:
3232

33-
- [Worked example using March 22 data](/berkeley-upgrade/worked-archive-example)
33+
- [Worked Devnet Debian example using March 22 data](/berkeley-upgrade/archive-migration/debian-example)
34+
- [Worked Devnet Docker example using April 29 data](/berkeley-upgrade/archive-migration/docker-example)
3435

3536
## What will happen with original Devnet/Mainnet data
3637

@@ -44,4 +45,4 @@ After the migration, you will have two databases:
4445

4546
There is no requirement to preserve the original Devnet/Mainnet database after migration. However, if for some reason you want to keep the Mainnet orphaned or non-canonical pending blocks, you can download the archive maintenance package for the Devnet/Mainnet database.
4647

47-
To learn about maintaining archive data, see [Devnet/Mainnet database maintenance](/berkeley-upgrade/mainnet-database-maintenance).
48+
To learn about maintaining archive data, see [Devnet/Mainnet database maintenance](/berkeley-upgrade/archive-migration/mainnet-database-maintenance).

docs/berkeley-upgrade/mainnet-database-maintenance.mdx renamed to docs/berkeley-upgrade/archive-migration/mainnet-database-maintenance.mdx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ keywords:
77
- Berkeley
88
- upgrade
99
- archive migration
10-
- planning
10+
- planning
1111
- prerequisites
1212
- mina archive node
1313
- archive node
@@ -18,7 +18,7 @@ keywords:
1818

1919
# Devnet/Mainnet database maintenance
2020

21-
After the Berkeley migration, the original Devnet/Mainnet database is not required unless you are interested in
21+
After the Berkeley migration, the original Devnet/Mainnet database is not required unless you are interested in
2222
preserving some aspect of the database that is lost during the migration process.
2323

2424
Two databases exist after the successful migration:
@@ -31,13 +31,13 @@ Two databases exist after the successful migration:
3131
- Without pending blocks that are not in the canonical chain
3232
- With all pending blocks on the canonical chain converted to canonical blocks
3333

34-
The o1Labs and Mina Foundation teams have consistently prioritized rigorous testing and the delivery of high-quality software products.
34+
The o1Labs and Mina Foundation teams have consistently prioritized rigorous testing and the delivery of high-quality software products.
3535

36-
However, being human entails the possibility of making mistakes.
36+
However, being human entails the possibility of making mistakes.
3737

3838
## Known issues
3939

40-
Recently, a few mistakes were identified while working on a version of Mina used on Mainnet. These issues were promptly addressed; however, within the decentralized environment, archive nodes can retain historical issues despite our best efforts.
40+
Recently, a few mistakes were identified while working on a version of Mina used on Mainnet. These issues were promptly addressed; however, within the decentralized environment, archive nodes can retain historical issues despite our best efforts.
4141

4242
Fixes are available for the following known issues:
4343

@@ -98,7 +98,7 @@ mina-replayer \
9898

9999
where:
100100

101-
- `archive-uri` - connection string to the archive database
101+
- `archive-uri` - connection string to the archive database
102102
- `input-file` - JSON file that holds the archive database
103103
- `output-file` - JSON file that will hold the ledger with auxiliary information, like global slot and blockchain height, which will be dumped on the last block
104104
- `checkpoint-interval` - frequency of checkpoints expressed in blocks count
@@ -131,12 +131,12 @@ mina-replayer --archive-uri {db_connection_string} --input-file reference_replay
131131

132132
where:
133133

134-
- `archive-uri` - connection string to the archive database
134+
- `archive-uri` - connection string to the archive database
135135
- `input-file` - JSON file that holds the archive database
136136
- `output-file` - JSON file that will hold the ledger with auxiliary information, like global slot and blockchain height, which will be dumped on the last block
137137
- `checkpoint-interval` - frequency of checkpoints expressed in blocks count
138138
- `replayer_input_file.json` - JSON file constructed from the Devnet/Mainnet genesis ledger:
139-
139+
140140
```
141141
jq '.ledger.accounts' genesis_ledger.json | jq '{genesis_ledger: {accounts: .}}' > replayer_input_config.json
142142
```
@@ -149,9 +149,9 @@ where:
149149

150150
The daemon node unavailability can cause the archive node to miss some of the blocks. This recurring missing blocks issue consistently poses challenges. To address this issue, you can reapply missing blocks.
151151

152-
If you uploaded the missing blocks to Google Cloud, the missing blocks can be reapplied from precomputed blocks to preserve chain continuity.
152+
If you uploaded the missing blocks to Google Cloud, the missing blocks can be reapplied from precomputed blocks to preserve chain continuity.
153153

154-
1. To automatically verify and patch missing blocks, use the [download_missing_blocks.sh](https://raw.githubusercontent.com/MinaProtocol/mina/2.0.0berkeley_rc1/src/app/rosetta/download-missing-blocks.sh) script.
154+
1. To automatically verify and patch missing blocks, use the [download_missing_blocks.sh](https://raw.githubusercontent.com/MinaProtocol/mina/2.0.0berkeley_rc1/src/app/rosetta/download-missing-blocks.sh) script.
155155

156156
The `download-missing-blocks` script uses `localhost` as the database host so the script assumes that psql is running on localhost on port 5432. Modify `PG_CONN` in `download_missing_block.sh` for your environment.
157157

@@ -164,15 +164,15 @@ If you uploaded the missing blocks to Google Cloud, the missing blocks can be re
164164
```
165165

166166
1. Run the `mina-missing-blocks-auditor` script from the database host:
167-
167+
168168
For Devnet:
169-
169+
170170
```sh
171171
download-missing-blocks.sh devnet {db_user} {db_password}
172172
```
173173

174174
For Mainnet:
175-
175+
176176
```sh
177177
download-missing-blocks.sh mainnet {db_user} {db_password}
178178
```
@@ -193,4 +193,4 @@ Note: It's important to highlight that precomputed blocks for **Devnet** between
193193

194194
## Next steps
195195

196-
Now that you have completed the steps to properly maintain the correctness of the archive database, you are ready to perform the archive [migration process](/berkeley-upgrade/migrating-archive-database-to-berkeley).
196+
Now that you have completed the steps to properly maintain the correctness of the archive database, you are ready to perform the archive [migration process](/berkeley-upgrade/archive-migration/migrating-archive-database-to-berkeley).

0 commit comments

Comments
 (0)