Skip to content

Commit

Permalink
makefile streamline
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Nov 8, 2023
1 parent 1434cd9 commit 2c97988
Showing 1 changed file with 41 additions and 28 deletions.
69 changes: 41 additions & 28 deletions tools/genesis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,81 @@ FUTURE_USES = 0.70
endif

ifndef RECOVERY_FILE
# RECOVERY_FILE = v5_recovery
RECOVERY_FILE = sample_export_recovery

# RECOVERY_FILE =
RECOVERY_FILE = ./tests/fixtures/v5_recovery.json
endif

ifndef YEARS
YEARS = 7
endif

ifndef CHAIN
CHAIN = testnet
CHAIN = mainnet
endif

ifndef GIT_ORG
GIT_ORG = 0LNetworkCommunity
endif

ifndef GIT_REPO
GIT_REPO = genesis-smoke
GIT_REPO = release-v6.9.0-rc.0-genesis-7
endif

install:
cargo build --release -p libra -p libra-genesis-tools -p libra-framework
cp ./target/release/libra* ~/.cargo/bin/

register:
libra-genesis-tools register --org-github ${GIT_ORG} --name-github ${GIT_REPO}
# have cli tools use localhost
libra config fix --force-url http://localhost:8080

legacy:
### Fetch Ancestry Data, Snapshot, and Use v5.2 codebase and snapshot to generate recovery.json for seeding v6.9.x state
sudo rm -Rf ~/libra-recovery && mkdir -p ~/libra-recovery
wget https://github.com/0LNetworkCommunity/epoch-archive/raw/main/670.tar.gz -O ~/libra-recovery/670.tar.gz
cd ~/libra-recovery && tar -xvzf 670.tar.gz
wget https://raw.githubusercontent.com/sirouk/ol-data-extraction/v-6.9.x-ready/assets/data.json -O ~/libra-recovery/v5_ancestry.json

sudo rm -Rf ~/libra-legacy-v6
cd ~ && git clone -b v6 https://github.com/0LNetworkCommunity/libra-legacy-v6
cd ~/libra-legacy-v6/ol/genesis-tools
cargo r -p ol-genesis-tools -- --export-json ~/libra-recovery/v5_recovery.json --snapshot-path ~/libra-recovery/670/state_ver* --ancestry-file ~/libra-recovery/v5_ancestry.json
cp -f ~/libra-recovery/v5_recovery.json ~/libra-framework/tools/genesis/tests/fixtures/v5_recovery.json
md5sum ~/libra-framework/tools/genesis/tests/fixtures/v5_recovery.json"

genesis: stdlib
cargo r -- \
libra-genesis-tools -- \
-c ${CHAIN} \
genesis --org-github ${GIT_ORG} \
--name-github ${GIT_REPO} \
--local-framework \
--json-legacy ./tests/fixtures/${RECOVERY_FILE}.json \
--json-legacy ${RECOVERY_FILE} \
--target-supply ${TARGET_SUPPLY} \
--target-future-uses ${FUTURE_USES} \
--years-escrow ${YEARS} \
--map-dd-to-slow 3A6C51A0B786D644590E8A21591FA8E2 \
--map-dd-to-slow 2B0E8325DEA5BE93D856CFDE2D0CBA12


wizard:
cargo r -- -c ${CHAIN} \
wizard --org-github ${GIT_ORG} \
--name-github ${GIT_REPO} \
--local-framework \
--json-legacy ./tests/fixtures/${RECOVERY_FILE}.json \
--target-supply ${TARGET_SUPPLY} \
--target-future-uses ${FUTURE_USES} \
--years-escrow ${YEARS} \
--map-dd-to-slow 3A6C51A0B786D644590E8A21591FA8E2 \
--map-dd-to-slow 2B0E8325DEA5BE93D856CFDE2D0CBA12

stdlib:
cargo r -p libra-framework -- release
libra-framework release

############ TESTNET HELPERS ################


git-fetch:
testnet: testnet-git-fetch testnet-stdlib testnet-genesis testnet-node

testnet-git-fetch:
@echo WILL RESET GIT AND PULL LATEST COMMIT
git reset --hard && git pull -f

testnet: git-fetch stdlib test-genesis node

test-node:
cargo r -p libra -- node
testnet-stdlib:
cargo r -p libra-framework -- release

node:
diem-node -f ~/.libra/validator.yaml
testnet-node:
# assumes you have done `install` above
libra node

ifndef ALICE_IP
ALICE_IP = 134.209.32.159
Expand All @@ -84,7 +97,7 @@ ifndef CAROL_IP
CAROL_IP = 165.22.34.98
endif

test-genesis:
testnet-genesis:
LIBRA_CI=1 cargo r -- \
-c ${CHAIN} testnet \
-m ${PERSONA} \
Expand Down

0 comments on commit 2c97988

Please sign in to comment.