Skip to content

Commit 38c8749

Browse files
Merge branch '0LNetworkCommunity:main' into change-authkey
2 parents 1ec6c42 + 44f6759 commit 38c8749

File tree

352 files changed

+9372
-29940
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

352 files changed

+9372
-29940
lines changed

.gitattributes

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
*.txt text
1212
*.yml text
1313

14-
# Use Rust syntax highlighter for Move and Move IR code
15-
*.move linguist-language=Rust
16-
*.mvir linguist-language=Rust
14+
# Use Move syntax highlighter for Move IR code
15+
*.mvir linguist-language=Move

.github/workflows/integration.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
- name: MINING
3636
run: RUSTC_WRAPPER=sccache SOURCE_PATH=./ make -f ol/integration-tests/test-mining.mk test
3737

38+
# - name: MINING ACROSS EPOCHS
39+
# run: RUSTC_WRAPPER=sccache SOURCE_PATH=./ make -f ol/integration-tests/test-mining-epochs.mk test
40+
3841
- name: ONBOARD
3942
run: RUSTC_WRAPPER=sccache SOURCE_PATH=./ make -f ol/integration-tests/test-onboard.mk test
4043
- name: File permissions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ key_store.json
6464
*.swp
6565

6666
# prevent mv files from being committed
67-
*.mv
67+
*.mv
68+
language/diem-framework/releases/

Cargo.lock

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 66 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,15 @@ CARGO_ARGS = --release
2828
# testnet automation settings
2929
ifeq (${TEST}, y)
3030
REPO_NAME = dev-genesis
31-
MNEM = $(shell cat ol/
32-
fixtures/mnemonic/${NS}.mnem)
31+
MNEM = $(shell cat ol/fixtures/mnemonic/${NS}.mnem)
3332
CARGO_ARGS = --locked # just keeping this from doing --release mode, while in testnet mode.
3433
GITHUB_USER = OLSF
3534
endif
3635

3736
# Registration params
3837
REMOTE = 'backend=github;repository_owner=${GITHUB_USER};repository=${REPO_NAME};token=${DATA_PATH}/github_token.txt;namespace=${ACC}'
3938

40-
GENESIS_REMOTE = 'backend=github;repository_owner=${REPO_ORG};repository=${REPO_NAME};token=${DATA_PATH}/github_token.txt;namespace=${ACC}'
39+
GENESIS_REMOTE = 'backend=github;repository_owner=${REPO_ORG};repository=${REPO_NAME};token=${DATA_PATH}/github_token.txt;namespace=${ACC};branch=master'
4140

4241
LOCAL = 'backend=disk;path=${DATA_PATH}/key_store.json;namespace=${ACC}'
4342

@@ -93,7 +92,8 @@ bins: stdlib
9392
stdlib:
9493
# cargo run ${CARGO_ARGS} -p diem-framework
9594
cargo run ${CARGO_ARGS} -p diem-framework -- --create-upgrade-payload
96-
sha256sum language/diem-framework/staged/stdlib.mv
95+
# linux uses sha265sum, but not available by default on OS X
96+
bash -c "sha256sum language/diem-framework/staged/stdlib.mv || shasum -a 256 language/diem-framework/staged/stdlib.mv"
9797

9898

9999
install: mv-bin bin-path
@@ -109,7 +109,7 @@ install: mv-bin bin-path
109109
cp -f ${SOURCE}/target/release/onboard ${USER_BIN_PATH}/onboard
110110

111111
bin-path:
112-
@if (cat ~/.bashrc | grep '~/bin:') ; then \
112+
@if (cat ~/.bashrc | grep ${USER_BIN_PATH}) ; then \
113113
echo "OK .bashrc correctly configured with PATH=~/bin" ; \
114114
else \
115115
echo -n "WARN Your .bashrc doesn't seem to have ~/bin as a search path. Append .bashrc with PATH=~/bin:$$PATH ? (y/n) " ; \
@@ -230,8 +230,9 @@ gen-register:
230230
@echo OPER send signed transaction with configurations for *OWNER* account
231231
ACC=${ACC}-oper OWNER=${ACC} IP=${IP} make reg
232232

233-
@echo Making pull request to genesis coordination repo
234-
make gen-make-pull
233+
# TODO: implement the forking workflow for dev genesis?
234+
# @echo Making pull request to genesis coordination repo
235+
# make gen-make-pull
235236

236237
init-test:
237238
echo ${MNEM} | head -c -1 | cargo run -p diem-genesis-tool -- init --path=${DATA_PATH} --namespace=${ACC}
@@ -301,18 +302,14 @@ genesis:
301302
--layout-path ${DATA_PATH}/set_layout.toml \
302303
--val-ip-address ${IP}
303304

304-
305-
sha256sum ${DATA_PATH}/genesis.blob
305+
# linux uses sha265sum, but not available by default on OS X
306+
bash -c "sha256sum ${DATA_PATH}/genesis.blob || shasum -a 256 ${DATA_PATH}/genesis.blob"
306307

307308
#### NODE MANAGEMENT ####
308309
start:
309310
# run in foreground. Only for testing, use a daemon for net.
310311
RUST_LOG=error cargo run -p diem-node -- --config ${DATA_PATH}/validator.node.yaml
311312

312-
# Start a fullnode instead of a validator node
313-
start-full:
314-
cargo run -p diem-node -- --config ${DATA_PATH}/fullnode.node.yaml
315-
316313
daemon:
317314
mkdir -p ~/.config/systemd/user/
318315
cp ./ol/util/diem-node.service ~/.config/systemd/user/
@@ -401,18 +398,16 @@ ifdef TEST
401398
cp ./ol/devnet/set_layout_test.toml ${DATA_PATH}/set_layout.toml
402399
endif
403400

404-
fix-genesis:
405-
cp ./ol/devnet/genesis/${V}/genesis.blob ${DATA_PATH}/
406-
cp ./ol/devnet/genesis/${V}/genesis_waypoint ${DATA_PATH}/
407-
408401

409402
#### HELPERS ####
410403
set-waypoint:
411404
@if test -f ${DATA_PATH}/key_store.json; then \
412405
jq -r '. | with_entries(select(.key|match("-oper/waypoint";"i")))[].value' ${DATA_PATH}/key_store.json > ${DATA_PATH}/client_waypoint; \
413-
jq -r '. | with_entries(select(.key|match("-oper/genesis-waypoint";"i")))[].value' ${DATA_PATH}/key_store.json > ${DATA_PATH}/genesis_waypoint; \
406+
jq -r '. | with_entries(select(.key|match("-oper/genesis-waypoint";"i")))[].value' ${DATA_PATH}/key_store.json > ${DATA_PATH}/genesis_waypoint.txt; \
414407
fi
415408

409+
cargo r -p ol -- init --update-waypoint --waypoint $(shell cat ${DATA_PATH}/client_waypoint)
410+
416411
@echo client_waypoint:
417412
@cat ${DATA_PATH}/client_waypoint
418413

@@ -450,71 +445,65 @@ debug:
450445
make smoke-onboard <<< $$'${MNEM}'
451446

452447

453-
##### DEVNET TESTS #####
448+
#### TESTNET #####
449+
# The testnet is started using the same tools as genesis to have a faithful reproduction of a network from a clean slate.
454450

455-
devnet: clear fix dev-wizard dev-genesis start
456-
# runs a smoke test from fixtures.
457-
# Uses genesis blob from fixtures, assumes 3 validators, and test settings.
458-
# This will work for validator nodes alice, bob, carol, and any fullnodes; 'eve'
451+
# 1. The first thing necessary is initializing testnet genesis validators. All genesis nodes need to set up environment variables for their namespace/personas e.g. NS=alice. Also the TEST=y mode must be set, as well as a chain environment e.g. NODE_ENV=test. These settings must be done manually, preferably in .bashrc
459452

460-
dev-join: clear fix fix-genesis dev-wizard
461-
# REQUIRES MOCK GIT INFRASTRUCTURE: OLSF/dev-genesis OLSF/dev-epoch-archive
462-
# see `devnet-archive` below
463-
# We want to simulate the onboarding/new validator fetching genesis files from the mock archive: dev-genesis-archive
453+
# 2. Next those validators will register config data to a github repo OLSD/dev-genesis. Note: there could be github http errors, if validators attempt to write the same resource simultaneously
464454

465-
# mock restore backups from dev-epoch-archive
466-
rm -rf ~/.0L/restore
467-
# restore from MOCK archive OLSF/dev-epoch-archive
468-
cargo r -p ol -- restore
469-
# start a node with fullnode.node.yaml configs
470-
make start-full
455+
# THESE STEPS ARE ACHIEVED WITH `make testnet-register`
471456

472-
dev-wizard:
473-
# REQUIRES there is a genesis.blob in the fixtures/genesis/<version> you are testing
474-
MNEM='${MNEM}' cargo run -p onboard -- val --prebuilt-genesis ${DATA_PATH}/genesis.blob --skip-mining --chain-id 1 --genesis-ceremony
457+
# 3. Wait. All genesis nodes need to complete registration. Otherwise buidling a genesis.blob (the first block), will fail.
458+
# 4. Each genesis node builds the genesis file locally, and submits to the github repo. (this remote genesis file is what subsequent non-genesis validators will use to bootstrap their db).
459+
# 5. Genesis validators can start their nodes.
475460

476-
#### DEVNET RESTART ####
477-
# usually do this on Alice, which has the dev-epoch-archive repo, and dev-genesis
461+
# THESE STEPS ARE ACHIEVED WITH `make testnet`
478462

479-
# Do the ceremony: and also save the genesis fixtures, needs to happen before fix.
480-
dev-register: clear fix dev-wizard gen-register
481-
# Do a dev genesis on each node after EVERY NODE COMPLETED registration.
482-
dev-genesis: genesis dev-save-genesis fix-genesis
483463

484-
#### DEVNET INFRA ####
485-
# To make reproducible devnet files.
464+
# 6. Assuming there is progress in the block production, subsequent validators can join.
486465

487-
# Save the files to mock infrastructure i.e. devnet github
488-
dev-infra: dev-backup-archive dev-commit
466+
# THIS IS ACHIEVED WITH: testnet-onboard
489467

490-
dev-save-genesis: set-waypoint
491-
rsync -a ${DATA_PATH}/genesis* ${SOURCE}/ol/devnet/genesis/${V}/
492-
git add ${SOURCE}/ol/devnet/genesis/${V}/
493468

494-
dev-backup-archive:
495-
cd ${HOME}/dev-epoch-archive && make devnet-backup
469+
#### 1. TESTNET SETUP ####
496470

497-
dev-commit:
498-
git commit -a -m "save genesis fixtures to ${V}" | true
499-
git push | true
471+
testnet-init: clear fix
472+
# REQUIRES there is a genesis.blob in the fixtures/genesis/<version> you are testing
473+
MNEM='${MNEM}' cargo run -p onboard -- val --skip-mining --chain-id ${CHAIN_ID} --genesis-ceremony
500474

475+
# Do the genesis ceremony registration, this includes the step testnet-validator-init-wizard
476+
testnet-register: testnet-init gen-register
477+
# Do a dev genesis on each node after EVERY NODE COMPLETED registration.
478+
479+
# Makes the gensis file on each genesis validator, AND SAVES TO GITHUB so that other validators can be onboarded after genesis.
480+
testnet-genesis: genesis set-waypoint
481+
cargo run -p diem-genesis-tool ${CARGO_ARGS} -- create-repo \
482+
--publish-genesis ${DATA_PATH}/genesis.blob \
483+
--shared-backend ${GENESIS_REMOTE}
484+
485+
cargo run -p diem-genesis-tool ${CARGO_ARGS} -- create-repo \
486+
--publish-genesis ${DATA_PATH}/genesis_waypoint.txt \
487+
--shared-backend ${GENESIS_REMOTE}
488+
489+
#### 2. TESTNET START ####
490+
491+
# Do this to restart the network with new code. Assumes a registration has been completed, and the genesis validators are unchanged. If new IP addresses or number of genesis nodes changed, you must RERUN SETUP below.
492+
# - builds stdlib from source
493+
# - clears many of the home files
494+
# - adds fixtures
495+
# - initializes node configs
496+
# - rebuids genesis files and shares to github genesis repo
497+
# - starts node in validator mode
498+
testnet: clear fix testnet-init testnet-genesis start
499+
500+
# For subsequent validators joining the testnet. This will fetch the genesis information saved
501+
testnet-onboard: clear
502+
MNEM='${MNEM}' cargo run -p onboard -- val --github-org OLSF --repo dev-genesis --chain-id ${CHAIN_ID}
503+
# start a node with fullnode.node.yaml configs
504+
cargo r -p diem-node -- -f ~/.0L/fullnode.node.yaml
501505

502-
TAG=$(shell git tag -l "previous")
503-
clean-tags:
504-
git push origin --delete ${TAG}
505-
git tag -d ${TAG}
506-
507-
nuke-testnet:
508-
@echo WIPING EVERYTHING but keeping: github_token.txt, autopay_batch.json, set_layout.toml, /vdf_proofs/proof_0.json
509506

510-
@if test -d ${DATA_PATH}; then \
511-
cd ${DATA_PATH} && cp github_token.txt autopay_batch.json set_layout.toml vdf_proofs/proof_0.json ~/; \
512-
cd ${DATA_PATH} && rm -rf *; \
513-
cd ~ && cp github_token.txt autopay_batch.json set_layout.toml ${DATA_PATH}; \
514-
cd ${DATA_PATH} && mkdir vdf_proofs;\
515-
cd ~ && cp proof_0.json ${DATA_PATH}/vdf_proofs/; \
516-
fi
517-
518507

519508
####### SWARM ########
520509

@@ -566,6 +555,13 @@ fork-config:
566555
cargo run -p onboard -- fork -u http://167.172.248.37 --prebuilt-genesis ${DATA_PATH}/genesis_from_snapshot.blob
567556

568557
# start node from files
569-
fork-start:
558+
fork-start:
570559
rm -rf ~/.0L/db
571560
cargo run -p libra-node -- --config ~/.0L/validator.node.yaml
561+
562+
##### UTIL #####
563+
TAG=$(shell git tag -l "previous")
564+
clean-tags:
565+
git push origin --delete ${TAG}
566+
git tag -d ${TAG}
567+

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ We live 24/7 on Discord [join us there](https://discord.gg/AzCp63pggW).
1919

2020
Read our documentation [here](ol/documentation/README.md).
2121

22-
Skip straight to [toubleshooting onboarding a node to network.](ol/documentation/node-ops/validators/troubleshoting_onboarding.md)
22+
Skip straight to [troubleshooting onboarding a node to network.](ol/documentation/node-ops/validators/troubleshoting_onboarding.md)
2323

2424
Contribute to [issues](https://github.com/OLSF/libra/issues).
2525

@@ -43,7 +43,7 @@ This is a non-exhaustive summary of the key features of the Diem architecture th
4343
The smart-contract language of the platform is called Move. It is the most unique breakthrough of the team. This is a language that is designed to be extremely safe in adversarial environments, and for hurried, less experienced developers. It's a very ergonomic language, it's easy to approach it if you have even entry-level coding experience. In terms of safety it incorporates much from the Rust language concepts of "borrowing" memory. The compiler is pretty obnoxious, which is something you want when designing autonomous financial systems. One standout feature of the Move language is built-in Formal Verification. Adjacent to the code you can write specs for invariants which your code must preserve (i.e. this function should never be called by this type of account), and it can be checked during the development and build process. This is unique and powerful.
4444

4545
### Programming model
46-
The execution of the smart contract and scripts has some subtle but important safety features. By design what are referred to in other platforms as smart-contracts are in fact "modules" here. Users can publish modules, which any other module or transaction can import. This is important. The transactions are scripts. So compared to Ethereum, much of what happens in a smart contract, can actually be split into long lived code in a module, and transaction-scripts which can import from the module (and other modules). This decoupling allows for powerful composability and reliability. The developer can evolve the application without necessarily needing to upgrade modules every time a new transaction use-case emerges.
46+
The execution of the smart contract and scripts has some subtle but important safety features. By design what are referred to in other platforms as smart contracts are in fact "modules" here. Users can publish modules, which any other module or transaction can import. This is important. The transactions are scripts. So compared to Ethereum, much of what happens in a smart contract, can actually be split into long-lived code in a module, and transaction-scripts which can import from the module (and other modules). This decoupling allows for powerful composability and reliability. The developer can evolve the application without necessarily needing to upgrade modules every time a new transaction use case emerges.
4747

4848
Modules can have "resources" bound to them. A resource can be thought of as an object in memory, but with restrictions: they can only be modified by the module that instantiated them, and are restricted in how they get created and transferred. Writing a non-fungible token is basically just instantiating one such structure, and something like a fungible token, can be done in a handful of lines of code.
4949

@@ -75,7 +75,7 @@ The technology we are inheriting is a spaceship. It is also purely infrastructur
7575

7676
But most importantly, the architecture is designed as a private, consortium chain.
7777

78-
For system administration, there is on omnipresent Diem Association account. Yes, a private key that controls many functions including: Freezing accounts (!), selecting validators for inclusion, paying transaction fees to validators, upgrading the system code. This is obviously a non-starter. So a lot of work had to go into making system policies execute in a permissionless environment.
78+
For system administration, there is an omnipresent Diem Association account. Yes, a private key that controls many functions including: Freezing accounts (!), selecting validators for inclusion, paying transaction fees to validators, upgrading the system code. This is obviously a non-starter. So a lot of work had to go into making system policies execute in a permissionless environment.
7979

8080
We also had to add Sybil resistance mechanisms. Typically communities have been choosing Proof-of-Stake as the Sybil resistance method for BFT networks. This is not the route we chose given community growth considerations (as well as regulatory). Elsewhere we've talked in detail about our Delay Towers complement to consensus.
8181

@@ -134,10 +134,10 @@ We've made some additions to the MoveVM that were necessary for us to implement
134134

135135
- Decimal - we needed a number type that could be used for financial math that could lead into polynomial curves etc. So we added the Rust Decimal library and some initial APIs and their corresponding native instructions.
136136

137-
- VDF verification - to verify the Delay Towers proofs we added the ChiaVDF verifier to the VM. The prover is not needed in the VM. The VDF prover can accept a number of parameters (not hardcoded for 0L's use-case). So application builders could leverage it in their own games.
137+
- VDF verification - to verify the Delay Towers proofs we added the ChiaVDF verifier to the VM. The prover is not needed in the VM. The VDF prover can accept a number of parameters (not hardcoded for 0L's use case). So application builders could leverage it in their own games.
138138

139139
### Auto Pay
140-
The ability to create payments in the future, and regular payments as a percent of account balance or of new income. This was a feature requested early by the community. It powers a number of use-cases important at the start of a network.
140+
The ability to create payments in the future, and regular payments as a percent of account balance or of new income. This was a feature requested early by the community. It powers a number of use cases important at the start of a network.
141141
Namely it is useful for anyone that wants to run a community program. In this case an entity or a person is seeking to accomplish a goal or a project, and is asking for donations. Autopay allows for set-it-and-forget-it donations to programs. Most people in 0L use this to send a portion of their mining rewards to programs automatically.
142142

143143
Autopay can be programmed for:

config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "diem-config"
3-
version = "5.1.1"
3+
version = "5.2.0"
44
authors = ["Diem Association <[email protected]>"]
55
description = "Diem diem-config"
66
repository = "https://github.com/diem/diem"

0 commit comments

Comments
 (0)