Skip to content

Commit abd7210

Browse files
authored
switch from asdf to mise
switch from `asdf` to `mise`
2 parents da76add + e7e0a91 commit abd7210

4 files changed

Lines changed: 65 additions & 64 deletions

File tree

.tool-versions

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,53 @@
22

33
River's Proof of Reserves implementation in Elixir. This implementation is based on BitMEX's Proof of Reserves Python implementation, found [here](https://github.com/BitMEX/proof-of-reserves-liabilities).
44

5-
This library is used by River to generate its Proof of Liabilities tree and to allow users to download and verify the Proof of Liabilities.
5+
This library is used by River to generate its Proof of Liabilities tree and to allow users to download and verify the Proof of Liabilities.
66

77
See River's [Proof of Reserves page](https://river.com/reserves) for more information.
88

9-
## Verifying River's Proof of Reserves
9+
## Verifying River's Proof of Reserves
1010

1111
This library comes with a `verify_liabilities.exs` script that will verify River's Proof of Reserves and the balances of any accounts you provide. The following steps will walk you through the process of verifying River's Proof of Reserves.
1212

1313
### 1. Fetch the Proof of Reserves Data
1414

15-
Go to River's [Proof of Reserves](https://river.com/reserves) page. Log in with the email address you used to sign up for River.
15+
Go to River's [Proof of Reserves](https://river.com/reserves) page. Log in with the email address you used to sign up for River.
1616

17-
Click "Verify Liabilities" and select the "Verify on your computer" option. This will allow you to download the Proof of Liabilities CSV file. Note the path to this CSV file, as you will need to provide it to the command in the next step.
17+
Click "Verify Liabilities" and select the "Verify on your computer" option. This will allow you to download the Proof of Liabilities CSV file. Note the path to this CSV file, as you will need to provide it to the command in the next step.
1818

1919
Click "Continue" and you will be prompted to run the setup script also seen in the next step.
2020

2121
### 2. Setup the Project
2222

23-
In your terminal, run this command to clone the repository and install the dependencies. This step will install [asdf](https://asdf-vm.com/) and the Erlang/Elixir SDK.
23+
In your terminal, run this command to clone the repository and install the dependencies. This step will install [mise](https://mise.run/) and the Erlang/Elixir SDK.
2424

25-
If you already have Erlang and Elixir installed or have already verified River's Proof of Reserves before, you can skip this step. If you have asdf installed but not Erlang/Elixir, you can install the SDK with asdf by running `asdf install` from this directory and skip this step.
25+
If you already have Erlang and Elixir installed or have already verified River's Proof of Reserves before, you can skip this step. If you have mise installed but not Erlang/Elixir, you can install the SDK with mise by running `mise install` from this directory and skip this step.
2626

2727
```bash
2828
git clone https://github.com/RiverFinancial/proof-of-reserves.git
2929
cd proof-of-reserves
3030
./scripts/setup.sh
31-
source $HOME/.asdf/asdf.sh
3231
```
3332

34-
This script will install Erlang/Elixir and the project dependencies. It will then compile the library.
33+
This script will install Erlang/Elixir and the project dependencies. It will then compile the library.
3534

36-
Back in River's Proof of Reserves flow, click "Continue" and you will see the verification command, also shown in the step below.
35+
Back in River's Proof of Reserves flow, click "Continue" and you will see the verification command, also shown in the step below.
3736

3837
### 2. Run the Verification Script
3938

40-
You will need to replace a few variables in the command below to run the script successfully. These values can be found in the River Proof of Reserves flow. If you followed the steps above, you will now see the command in the final screen. The command on the River page will already have your email and account string(s) filled in. You will need to fill in the `<CSV_PATH>` with the path to the CSV file you downloaded in Step 1.
39+
You will need to replace a few variables in the command below to run the script successfully. These values can be found in the River Proof of Reserves flow. If you followed the steps above, you will now see the command in the final screen. The command on the River page will already have your email and account string(s) filled in. You will need to fill in the `<CSV_PATH>` with the path to the CSV file you downloaded in Step 1.
4140

4241
- `<EMAIL>` with the email address you used to sign up for River.
4342
- `<ACCOUNT_STRING>` in the format `<ACCOUNT_ID>:<ACCOUNT_KEY>`. If you have multiple accounts, you can provide this flag multiple times, like so: `--account <ACCOUNT_STRING_1> --account <ACCOUNT_STRING_2>`. You can find your account ID and key in the Proof of Reserves flow.
44-
- `<CSV_PATH>` with the path to the CSV file you downloaded in Step 1. The downloaded file will initially be zipped, so you will need to unzip it before providing the path to the CSV file.
43+
- `<CSV_PATH>` with the path to the CSV file you downloaded in Step 1. The downloaded file will initially be zipped, so you will need to unzip it before providing the path to the CSV file.
4544

4645
```bash
4746
mix run verify_liabilities.exs --email <EMAIL> --account <ACCOUNT_STRING> --file <CSV_PATH>
4847
```
4948

50-
If the verification is successful, it will output your balance and a summary of the verification.
49+
If the verification is successful, it will output your balance and a summary of the verification.
5150

52-
If you click continue on the River page, you can check that these balances are correct.
51+
If you click continue on the River page, you can check that these balances are correct.
5352

5453
## Installation as a Library
5554

mise.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[tools]
2+
elixir = "1.18.4-otp-27"
3+
erlang = "27.2.4"

scripts/setup.sh

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ set -euo pipefail
33
# This script is used to setup the project, install erlang, elixir, and mix dependencies.
44
# NOTE: it currently assumes you are using MacOS or a Linux distribution derived from Debian or RedHat
55

6-
# Install dependencies for asdf (curl, git, etc.)
7-
function install_asdf_deps() {
6+
# Install dependencies for mise (curl, git, etc.)
7+
function install_mise_deps() {
88
case $(uname -s) in
99
# MacOS
1010
Darwin*)
@@ -42,73 +42,73 @@ function install_asdf_deps() {
4242
esac
4343
}
4444

45-
function install_asdf() {
46-
echo "Installing asdf (version manager for erlang and elixir)..."
47-
ASDF_DIR="$HOME/.asdf"
48-
49-
# Avoid reinstalling if asdf directory exists.
50-
if [ -d "$ASDF_DIR" ]
51-
then
52-
echo "Existing asdf directory found, skipping installation..."
45+
function install_mise() {
46+
echo "Installing mise (version manager for erlang and elixir)..."
47+
48+
# Check if mise is already installed
49+
if command -v mise &> /dev/null; then
50+
echo "mise is already installed, skipping installation..."
5351
return
5452
fi
5553

56-
git clone https://github.com/asdf-vm/asdf.git "$ASDF_DIR"
54+
# Install mise using the official installer
55+
curl https://mise.run | sh
5756

58-
ASDF_ENV="$ASDF_DIR/asdf.sh"
57+
# Add mise to PATH for the current session
58+
export PATH="$HOME/.local/bin:$PATH"
5959

60-
# Add asdf to your shell and source RC file to include ASDF path additions.
60+
# Add mise to shell configuration
6161
if [ -z "${SHELL+X}" ]; then
6262
SHELL=$(echo $0)
6363
fi
6464

6565
case $SHELL in
6666
*/bash)
67-
echo "\nsource $ASDF_ENV" >> ~/.bashrc
68-
source "$ASDF_ENV"
69-
70-
echo "Sourcing asdf $ASDF_ENV"
67+
if ! grep -q 'eval "$(~/.local/bin/mise activate bash)"' ~/.bashrc 2>/dev/null; then
68+
echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
69+
fi
70+
eval "$(~/.local/bin/mise activate bash)"
71+
echo "Sourcing mise for bash"
7172
;;
7273
*/zsh)
73-
echo "\nsource $ASDF_ENV" >> ~/.zshrc
74-
source "$ASDF_ENV"
75-
76-
echo "Sourcing asdf $ASDF_ENV"
74+
if ! grep -q 'eval "$(~/.local/bin/mise activate zsh)"' ~/.zshrc 2>/dev/null; then
75+
echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrc
76+
fi
77+
eval "$(~/.local/bin/mise activate zsh)"
78+
echo "Sourcing mise for zsh"
7779
;;
7880
*/fish)
79-
echo "\nsource $HOME/.asdf/asdf.fish" >> ~/.config/fish/config.fish
80-
# TODO: Reload to adjust path?
81-
82-
echo "Sourcing asdf $ASDF_ENV"
81+
if ! grep -q '~/.local/bin/mise activate fish' ~/.config/fish/config.fish 2>/dev/null; then
82+
echo '~/.local/bin/mise activate fish | source' >> ~/.config/fish/config.fish
83+
fi
84+
~/.local/bin/mise activate fish | source
85+
echo "Sourcing mise for fish"
8386
;;
8487
*)
8588
>&2 echo "Unsupported shell: $SHELL"
86-
>&2 echo "Please add the following line to your shell configuration file:"
87-
>&2 echo ". $HOME/.asdf/asdf.sh"
89+
>&2 echo "Please add mise to your PATH and run: mise activate"
8890
exit +3
8991
;;
9092
esac
9193
}
9294

9395
function install_erlang_elixir() {
9496
echo "Installing erlang and elixir..."
95-
# Install erlang & elixir using asdf.
96-
# The plugins will be added to asdf and the versions will be installed according to the .tool-versions file.
97-
ASDF=$(which asdf)
98-
if [ -f "$HOME/.asdf/asdf.sh" ]; then
99-
echo "Sourcing asdf"
100-
source "$HOME/.asdf/asdf.sh"
101-
fi
102-
103-
if [ -z "${ASDF+X}" ]; then
104-
echo "asdf not found, please install asdf first"
97+
# Install erlang & elixir using mise.
98+
# The versions will be installed according to the mise.toml file.
99+
100+
# Ensure mise is in PATH
101+
export PATH="$HOME/.local/bin:$PATH"
102+
103+
MISE=$(which mise || echo "$HOME/.local/bin/mise")
104+
105+
if [ ! -x "$MISE" ]; then
106+
echo "mise not found, please install mise first"
105107
exit +4
106108
fi
107109

108-
echo "Adding asdf plugins: $ASDF"
109-
$ASDF plugin add erlang || true
110-
$ASDF plugin add elixir || true
111-
$ASDF install
110+
echo "Installing tools with mise: $MISE"
111+
$MISE install
112112
}
113113

114114
function install_mix_deps() {
@@ -128,16 +128,17 @@ function compile_project() {
128128
# It installs the dependencies, sets up the project, and compiles the project.
129129
function setup_project() {
130130
echo "Installing dependencies (elixir, erlang, etc.)..."
131-
# Install dependencies for asdf and Elixir.
131+
# Install dependencies for mise and Elixir.
132132
# Openssl is required for elixir's crypto library.
133-
install_asdf_deps
133+
install_mise_deps
134134
if ! command -v elixir &> /dev/null; then
135-
echo "Elixir is not installed, searching for asdf to install elixir..."
136-
if ! command -v asdf &> /dev/null; then
137-
echo "asdf not found, installing dependencies for asdf..."
138-
install_asdf
135+
echo "Elixir is not installed, searching for mise to install elixir..."
136+
export PATH="$HOME/.local/bin:$PATH"
137+
if ! command -v mise &> /dev/null; then
138+
echo "mise not found, installing mise..."
139+
install_mise
139140
else
140-
echo "asdf found, installing elixir..."
141+
echo "mise found, installing elixir..."
141142
fi
142143
install_erlang_elixir
143144
else
@@ -150,4 +151,4 @@ function setup_project() {
150151
echo "Setup complete! You are ready to run the verification script."
151152
}
152153

153-
setup_project
154+
setup_project

0 commit comments

Comments
 (0)