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

DO NOT YET ACCEPT - Dynamic TAO #431

Open
wants to merge 353 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
353 commits
Select commit Hold shift + click to select a range
67afb59
feat: v1.0 rebase changes
Apr 10, 2024
55cba98
fix: comment out rpcs tests , fix blockstep tests
Apr 10, 2024
7a82a33
feat: all tests green
Apr 10, 2024
0ac0a80
chore: lints
Apr 10, 2024
44351fc
Allow to also increase take, add tests
gregzaitsev Apr 10, 2024
4f1966d
initial commit
Apr 10, 2024
75e2ea4
fix tests
Apr 10, 2024
9080a94
Rename rate limiting identifiers to match pattern, enforce take bound…
gregzaitsev Apr 11, 2024
ddb3405
Update pallets/subtensor/src/staking.rs
unconst Mar 27, 2024
58d4fad
Update pallets/subtensor/src/lib.rs
unconst Mar 27, 2024
b725dc3
Update pallets/subtensor/src/staking.rs
unconst Mar 27, 2024
44f409a
comment nit
sam0x17 Apr 8, 2024
d2eafc7
fix comment
sam0x17 Apr 8, 2024
0cf36ac
fix comment
sam0x17 Apr 8, 2024
1e66940
fix comment
sam0x17 Apr 8, 2024
b99d478
Allow to also increase take, add tests
gregzaitsev Apr 10, 2024
6d098dc
Rename rate limiting identifiers to match pattern, enforce take bound…
gregzaitsev Apr 11, 2024
2b779ac
Merge branch 'feature/increase_delegate_take' of github.com:opentenso…
gregzaitsev Apr 11, 2024
919066d
Cleanup after rebase to stao branch
gregzaitsev Apr 11, 2024
1601689
dtao
Apr 11, 2024
78466fb
Fix tests after rebasing to stao
gregzaitsev Apr 11, 2024
fadce26
Fix warnings
gregzaitsev Apr 11, 2024
4dbe0e3
feat: use TensorBytes wrapper in place of Vec<u8> for rpc params
Apr 12, 2024
2933fad
Merge branch 'stao' into feature/increase_delegate_take
gregzaitsev Apr 12, 2024
e685338
Fix warning on Vec import
gregzaitsev Apr 12, 2024
840d8d3
Add rate limit test, fix rate limiting
gregzaitsev Apr 12, 2024
619f8e4
Remove ws-port from launch parameters, update rpc-port on both nodes
gregzaitsev Apr 12, 2024
fa00e83
Add tests for delegate take rate limit, fix rate limiting issues
gregzaitsev Apr 12, 2024
fcabd81
Merge pull request #320 from opentensor/feature/fix_localnet_launch
distributedstatemachine Apr 12, 2024
549231e
Merge pull request #319 from opentensor/feature/increase_delegate_take
distributedstatemachine Apr 12, 2024
bbe0324
initial
Apr 14, 2024
77a6013
add fix staking limit
Apr 14, 2024
5b7cd9d
stake limit removed
Apr 14, 2024
a3dc1e3
ddd
Apr 14, 2024
b910aef
feat: get subnet stake info across all subnets for a coldkey
Apr 15, 2024
7d7da63
ddd
Apr 15, 2024
a70c57b
fix
Apr 16, 2024
46b8d4f
Added per-subnet functionality
gregzaitsev Apr 16, 2024
e88033f
Improve efficiency of fn get_delegated
gregzaitsev Apr 16, 2024
39c1004
Introduce DelegatesTake and use Delegates as a global flag indicating…
gregzaitsev Apr 16, 2024
e740c90
fix: adding missing rpc trait implementation
Apr 16, 2024
a82e19b
add weights stake
Apr 17, 2024
ea2b5d8
add TODOs
Apr 17, 2024
16512da
stake via weights
Apr 17, 2024
c8b5744
chore: improve do_add_weighted_stake description
Apr 17, 2024
0452df2
feat: add weighted stakes test
Apr 17, 2024
2f8f9e3
todo
Apr 17, 2024
68942dd
Merge branch 'stao' of https://github.com/opentensor/subtensor into stao
Apr 17, 2024
28784c1
Cleanup per subnet takes
gregzaitsev Apr 17, 2024
2c3528e
subnet staking on by default
Apr 17, 2024
b133bbe
Merge conflicts
gregzaitsev Apr 17, 2024
fd976f0
Merge branch 'stao' of github.com:opentensor/subtensor into stao
gregzaitsev Apr 17, 2024
fb9f7fa
Make block time depend on pow-faucet feature. If used, block time is …
gregzaitsev Apr 17, 2024
0ec611d
add rpc methods
Apr 18, 2024
275910d
Merge branch 'stao' of https://github.com/opentensor/subtensor into stao
Apr 18, 2024
3b8b188
Update get_substake_for_hotkey RPC helper to avoid cloning coldkey
gregzaitsev Apr 18, 2024
bd0b68c
Remove unused import of IterableStorageDoubleMap
gregzaitsev Apr 18, 2024
c06057e
initial
Apr 18, 2024
1de6b77
Merge branch 'stao' into dynamic
gregzaitsev Apr 18, 2024
4354303
Merge branch 'stao' of https://github.com/opentensor/subtensor into d…
Apr 18, 2024
0001593
dynamic
Apr 18, 2024
421ef47
Merge branch 'dynamic' of https://github.com/opentensor/subtensor int…
Apr 18, 2024
6d82ee2
reduce initial min lock to 100
surcyf123 Apr 18, 2024
1c93e3a
Cleanup merge in unit tests
gregzaitsev Apr 18, 2024
f80e21d
Merge branch 'dynamic' of github.com:opentensor/subtensor into dynamic
gregzaitsev Apr 18, 2024
a6d6891
Fix some take tests in staking
gregzaitsev Apr 18, 2024
522618d
Fix broken build in senate tests
gregzaitsev Apr 18, 2024
db1fc8d
fix: partially fix dtao test
Apr 18, 2024
f7e8c32
Fix per-subnet takes in emit_inflation_through_hotkey_account
gregzaitsev Apr 22, 2024
453584d
Merge pull request #352 from opentensor/feature/per-subnet-takes2
distributedstatemachine Apr 22, 2024
a15b387
Add documentation for emit_inflation_through_hotkey_account
gregzaitsev Apr 22, 2024
18d9151
Merge pull request #354 from opentensor/feature/per-subnet-takes2
gztensor Apr 22, 2024
5853d12
Update test for per-subnet take emission
gregzaitsev Apr 22, 2024
c14b470
feat: set delegate takes per subnet + lints
Apr 23, 2024
5a84f4f
gdt
Apr 23, 2024
80ec94f
feat: ensure valid takes are set
Apr 23, 2024
5ece5b4
feat: add call
Apr 23, 2024
e04e3b0
chore: fix tests , pr comments
Apr 23, 2024
9c5df62
Merge pull request #359 from opentensor/feat/set_subnet_takes
gztensor Apr 23, 2024
160937e
feat: dynamic pool info rpcs
Apr 22, 2024
69a3d27
stash
Apr 22, 2024
26183d5
feat: slippage calculation , fixing dtao tests , lints
Apr 22, 2024
265fd49
Separate get_stakes method from fn epoch
gregzaitsev Apr 23, 2024
dd2165f
feat: simple test for dynamic pool info
Apr 23, 2024
26340d6
Merge pull request #351 from opentensor/feat/dynamic_pool_info
gztensor Apr 23, 2024
c0cd7da
Add tests for get_global_stake_weights
gregzaitsev Apr 23, 2024
25d337b
Fix missing alpha outstanding initialization in user_create_network, …
gregzaitsev Apr 23, 2024
3ddde52
feat: get all stakes for subnets
Apr 24, 2024
ccc65f2
Add tests for get_stakes, get_local_stake_weights, and get_global_sta…
gregzaitsev Apr 24, 2024
cc0ca9c
Fix run_coinbase issuing alpha when sum of prices <= 1
gregzaitsev Apr 24, 2024
d2a95b6
Merge synamic into gdt
gregzaitsev Apr 24, 2024
b53df8e
Remove extra definition of get_alpha_outstanding
gregzaitsev Apr 24, 2024
0ccec96
Add tests for get_total_stake_for_each_subnet
gregzaitsev Apr 24, 2024
63f4f0d
Merge pull request #365 from opentensor/feat/return_stakes_across_all…
distributedstatemachine Apr 24, 2024
813db52
Merge branch 'dynamic' into test/test_dtao_emission
gregzaitsev Apr 25, 2024
30cf173
Add tests for per subnet takes in dtao
gregzaitsev Apr 25, 2024
44caaa9
Merge pull request #356 from opentensor/test/test_dtao_emission
distributedstatemachine Apr 26, 2024
5b35e95
add comments to block step
Apr 26, 2024
8229f3d
Merge branch 'dynamic' of https://github.com/opentensor/subtensor int…
Apr 26, 2024
87fe734
Remove changes for nomination limits
gregzaitsev Apr 26, 2024
18aa649
Merge pull request #370 from opentensor/fix/cleanup_nomination_limit
distributedstatemachine Apr 26, 2024
235695a
Fix test_validator_permits test
gregzaitsev Apr 26, 2024
6f9c157
Remove subnet pruning code and tests
gregzaitsev Apr 26, 2024
28e1229
Merge upstream
gregzaitsev Apr 29, 2024
c21467e
s
Apr 29, 2024
ba6761b
Merge branch 'dynamic' of https://github.com/opentensor/subtensor int…
Apr 30, 2024
91c819f
dynamic tempos
Apr 30, 2024
34a319f
stash
Apr 26, 2024
7641fb3
chore: fix typo in bblockstep
May 1, 2024
b6f78bc
Fix senate tests, fix staking tests (in progress)
May 1, 2024
02796e7
Merge branch 'dynamic' into test/fix_dynamic_tests
gztensor May 2, 2024
0f156f2
Fix test_full_with_delegating_some_servers test in staking
gztensor May 2, 2024
af49d0c
Fix test_full_with_delegating test in staking
gztensor May 2, 2024
ad9ccbe
Fix test_full_block_emission_occurs test in staking
gztensor May 2, 2024
f82fc28
Fix test_add_subnet_stake_ok_no_emission and all tests in stake_info
gztensor May 2, 2024
410808f
Remove root checks for penging emission
gztensor May 2, 2024
72affe1
Fix registration tests, neron_info tests in progress
gztensor May 2, 2024
08a0b65
Fix test_get_neuron_stake_based_on_netuid test in neuron_info
gztensor May 2, 2024
815523e
Fix test_get_neuron_subnet_staking_info
gztensor May 3, 2024
b473b90
Fix test_total_issuance_global in migrations tests
gztensor May 3, 2024
1de0328
Fix test_dynamic_pool_info test
gztensor May 3, 2024
28d4f3c
Fix remaining dynamic tests
gztensor May 3, 2024
028566f
Format
gztensor May 3, 2024
386efa5
Allow dynamic tempos in any configuration
gztensor May 7, 2024
fdeae29
Enforce minimum tempo in dynamic tempos calculation
gztensor May 7, 2024
e2929b9
Enforce max value of tempos, reduce min tempo to 1
gztensor May 7, 2024
42965fb
Remove unused stake totals, tests not fixed
gztensor May 8, 2024
e8359a8
Remove get_root_weights
gztensor May 8, 2024
4bbe59f
Fix tests after removing the old stake variables
gztensor May 8, 2024
b2e30aa
Merge branch 'dynamic' into test/fix_dynamic_tests_no_refactoring
gztensor May 8, 2024
a21ee6a
Merge pull request #401 from opentensor/test/fix_dynamic_tests_no_ref…
unconst May 8, 2024
490c3a8
Merge upstream
gztensor May 8, 2024
ab682e0
Fix merge error
gztensor May 8, 2024
1b92a51
Merge dynamic updates into and fix tests
gztensor May 8, 2024
4a58a89
Format
gztensor May 8, 2024
af3447f
Avoid adding zero values from Stake and SubStake maps
gztensor May 8, 2024
93ecc95
Format
gztensor May 8, 2024
5980542
add staoe to detao
May 9, 2024
2c1fb31
Reduce faucet amount to 3000
gztensor May 9, 2024
69b0cbb
Add baedeker scripts
gztensor May 10, 2024
6e71726
Fix keys in baedeker scritps
gztensor May 10, 2024
ef5fbb4
Remove pow faucet feature from dtao testnet launch
gztensor May 10, 2024
f1fb3f9
Merge pull request #402 from opentensor/feat/remove-old-stake-totals
distributedstatemachine May 13, 2024
9cc1dd5
Add migration to remove TotalStake
gztensor May 13, 2024
03883b5
Bump spec version to 200 for dtao
gztensor May 13, 2024
e374ff0
Not returning migration weight from on_runtime_upgrade
gztensor May 13, 2024
2c37d89
Fix dynamic migrations not running
gztensor May 13, 2024
9181f8e
Swap hot and cold keys in SubStake map
gztensor May 14, 2024
137e41b
Format
gztensor May 14, 2024
7405d73
Merge pull request #416 from opentensor/feat/swap-substake-keys
gztensor May 14, 2024
0484d42
Bump nove version
gztensor May 14, 2024
10afbe7
Add RPC API for exposing GDT of hotkey and coldkey
gztensor May 14, 2024
705f3e8
Optimize calculation of coldkey GDT to O(1)
gztensor May 14, 2024
353b9ce
Format
gztensor May 14, 2024
d4c88cf
Merge pull request #420 from opentensor/feat/gdt-rpc-api
distributedstatemachine May 15, 2024
a7157a7
Convert to rust-doc comments in staking.rs
gztensor May 15, 2024
1be5622
Update dynamic to polkadot sdk 1.10
gztensor May 15, 2024
3d3127d
Resolve conflicts from rebasing dynamic to development
gztensor May 16, 2024
7635133
Merge upstream
gztensor May 16, 2024
a8b1e3e
Fix rust-doc comments, cleanup
gztensor May 16, 2024
b0bb230
Format
gztensor May 16, 2024
5fb8319
Cleanup
gztensor May 16, 2024
c635d86
Merge branch 'development' into dynamic
gztensor May 17, 2024
6ff8b8b
Fix unused import warning
gztensor May 17, 2024
2671f9e
add stao
May 17, 2024
de987e3
Add migration to populate SubnetCreator
gztensor May 17, 2024
2bf029a
Merge branch 'development' into dynamic
gztensor May 21, 2024
d348825
Fix runtime panic on faucet
gztensor May 21, 2024
4880610
Fix more development merge issues
gztensor May 21, 2024
571b334
Bump runtime version and node version
gztensor May 21, 2024
2642cb0
Limit dynamic tempos to stay at 360 blocks
gztensor May 22, 2024
0610eca
Remove set_weighted_stake extrtinsic and tests
gztensor May 22, 2024
80cd949
Merge pull request #456 from opentensor/feat/remove-add-weighted-stakes
distributedstatemachine May 23, 2024
9cb5870
Implement co-existing stao and dtao
gztensor May 25, 2024
019052a
Merge development changes into dynamic
gztensor May 28, 2024
82367f8
Fix do_become_delegate after merge
gztensor May 28, 2024
395b352
Fix remaining merge errors in tests
gztensor May 28, 2024
5f816a1
Add TotalSubnetStake, update it for accounting, do not use DynamicTAO…
gztensor May 28, 2024
1de901e
Remove PendingAlphaEmisson and use PendingEmission instead
gztensor May 28, 2024
4f77ffd
Merge branch 'dynamic' of https://github.com/opentensor/subtensor int…
May 29, 2024
6981ffe
remove spurious code
May 29, 2024
0417f86
Run epoch in a separate subnet loop
gztensor May 29, 2024
b32ddac
Remove TotalStake and Stake, add Staker map
gztensor May 30, 2024
98030b0
Fix unit tests after removing Stake, TotalStake, and adding Staker map
gztensor May 31, 2024
1e9e9de
Add dtao tests for prices and subnet block emission
gztensor May 31, 2024
b6ebb89
Fix missing method in tests
gztensor May 31, 2024
eb93e06
Add tests for lock cost, fix test for proportional subnet emissions
gztensor Jun 2, 2024
a680526
Merge development changes into dynamic
gztensor Jun 3, 2024
31d6d93
Merge branch development changes into feat/concurrent-stao-dtao
gztensor Jun 3, 2024
c0ca349
Add stao-dtao transition
gztensor Jun 4, 2024
abc9b04
Fix tests that relied on () db weight in mocks
gztensor Jun 4, 2024
82070bf
Merge pull request #473 from opentensor/feat/concurrent-stao-dtao
gztensor Jun 4, 2024
3c65457
Merge branch 'dynamic' into feat/stao-dtao-transition
gztensor Jun 4, 2024
62b7cd3
Add change_subnet_type extrinsic to admin pallet, remove it from subt…
gztensor Jun 5, 2024
536dd93
Remove pallet subtensor benchmark for change_network_type
gztensor Jun 5, 2024
f40b1ff
Merge pull request #509 from opentensor/feat/stao-dtao-transition
gztensor Jun 5, 2024
89311a2
Halt all staking and block_step operations during stao-dtao transitio…
gztensor Jun 5, 2024
ea35bf7
Add subnet in transition check in user_add_network
gztensor Jun 6, 2024
3eb5ff6
Fix benchmarks build to fix running with localnet.sh
gztensor Jun 6, 2024
ede9e56
In stao-dtao transition, find the next key before deleting the current.
gztensor Jun 6, 2024
c4dfd02
Fix subnet creator lock issue, change global stake weight to 0.5, mak…
gztensor Jun 7, 2024
131745b
Fix tests after changing global stake weight
gztensor Jun 7, 2024
37a1193
Disable migrations
gztensor Jun 7, 2024
6a37a2f
Bump runtime version, fix storage version management in migrations, r…
gztensor Jun 7, 2024
d07875d
Format
gztensor Jun 10, 2024
3c0c5de
Address clippy errors
gztensor Jun 10, 2024
a2791c3
Make stao-dtao transition run on any non-zero owner stake, do not uns…
gztensor Jun 10, 2024
266ea79
Create subnets in STAO mode
gztensor Jun 11, 2024
b4b0699
Bump spec version
gztensor Jun 11, 2024
e9e922c
Add a (ignored) test for total issuance with substaking
gztensor Jun 12, 2024
71ac104
Merge branch 'development' into dynamic
gztensor Jun 12, 2024
6403b03
Fix migration storage version for dao testnet
gztensor Jun 12, 2024
ceb5f38
Remove migration version fix - no longer needed
gztensor Jun 12, 2024
72c58d0
Add admin extrinsic to intiate conversion of all STAO subnets to DTAO
gztensor Jun 14, 2024
2ac2d19
Bump spec version
gztensor Jun 17, 2024
b65359b
Subnet info v2 in progress
gztensor Jun 17, 2024
1a60181
Implement SubnetInfoV2
gztensor Jun 17, 2024
fe15220
Merge pull request #545 from opentensor/feat/subnet-info-v2
gztensor Jun 17, 2024
f5b9322
Fix root pending emission
gztensor Jun 17, 2024
6c3b009
Fix total block emissions and subnet block emissions
gztensor Jun 18, 2024
6cc9748
Implement delegate info light
gztensor Jun 18, 2024
6089ad7
Optimize DelegateInfoLight
gztensor Jun 18, 2024
5a61b36
Add RPC for reading total stake of delegates
gztensor Jun 18, 2024
7cd1afc
Implement new stao-dtao transition: Release SubnetLocked to owner, in…
gztensor Jun 20, 2024
73403bb
Fix zero total tao stake case (no epochs were running)
gztensor Jun 20, 2024
e5a8e71
squash me
gztensor Jun 21, 2024
50cbf60
Fix alpha emissions to be numerically equal to block emission. TAO em…
gztensor Jun 24, 2024
4dd6a88
Make DynamicTAOReserve to be always equal to TotalSubnetTAO for dynam…
gztensor Jun 24, 2024
4073bc5
Merge branch 'dynamic' into feat/everyone-is-a-delegate
gztensor Jun 24, 2024
e08dcc1
Remove Delegates map, implement 'Every hotkey is a delegate' change
gztensor Jun 25, 2024
7e89817
Merge pull request #570 from opentensor/feat/everyone-is-a-delegate
gztensor Jun 25, 2024
4715c1b
Set minimum take to 0% and bump spec version
gztensor Jun 25, 2024
a3abe57
Bring back migration to clear Delegates map
gztensor Jun 25, 2024
8267e60
Add pallet registry migration to populate delegates initially from Gi…
gztensor Jun 25, 2024
928292d
Price threshold change in progress
gztensor Jun 26, 2024
71e552e
initial
Jun 26, 2024
c3758e9
Add tests for emission based on dtao price threshold
gztensor Jun 26, 2024
300f949
thing
Jun 26, 2024
408c867
initial
Jun 26, 2024
4bc0d5c
Fix stake to substrake migration
gztensor Jun 26, 2024
bb25d04
Merge change for delegate info light per subnet ID
gztensor Jun 26, 2024
f40ad3c
Add epoch runtime configuration
gztensor Jun 27, 2024
c0f4ef2
Set owner lock period to 0
gztensor Jun 27, 2024
2ec9655
Cleanup delegate info RPC calls
gztensor Jun 27, 2024
43381e2
Fix fake_epoch, change initial tempo to 360
gztensor Jun 27, 2024
06d4d14
Add migration to fill subnetlocked for subnet 1 from pending emission
gztensor Jun 28, 2024
8749d50
Set StakeWeights in fake_epoch
gztensor Jun 28, 2024
53c3249
Make block time 6 seconds
gztensor Jun 28, 2024
e641e59
Reduce block time to 1 second
gztensor Jun 28, 2024
2b040a5
Revert block time back to 12 secodns
gztensor Jul 1, 2024
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
41 changes: 41 additions & 0 deletions .baedeker/forkless-data.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
local
m = import 'baedeker-library/mixin/spec.libsonnet',
rm = import 'baedeker-library/mixin/raw-spec.libsonnet',
;

function(relay_spec, forked_spec, fork_source)

local relay = {
name: 'subtensor',
bin: 'bin/subtensor',
spec: {Raw:{
local modifyRaw = bdk.mixer([
rm.resetNetworking($),
rm.decodeSpec(),
rm.polkaLaunchPara($),
rm.reencodeSpec(),
]),
raw_spec: modifyRaw({
name: "Unused",
id: "%s_local" % forked_spec,
chainType: "Live",
codeSubstitutes: {},
genesis: {
raw: {
top: cql.chain(fork_source).latest._preloadKeys._raw,
childrenDefault: {},
},
},
}),
}},
nodes: {
[name]: {
bin: $.bin,
wantedKeys: 'standalone',
},
for name in ['alice', 'bob', 'charlie']
},
};

relay + {
}
11 changes: 11 additions & 0 deletions .baedeker/rewrites.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
local dotenv = {
[std.splitLimit(line, "=", 2)[0]]: std.splitLimit(line, "=", 2)[1]
for line in std.split(importstr "../.env", "\n")
if line != ""
if std.member(line, "=")
};

function(prev, repoDir)
(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({
'bin/subtensor':'%s/target/release/subtensor' % repoDir,
})(prev)
6 changes: 6 additions & 0 deletions .baedeker/up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e
BDK_DIR=$(dirname $(readlink -f "$0"))
RUST_LOG=info baedeker --spec=docker -J$BDK_DIR/vendor/ --generator=docker_compose=$BDK_DIR/.bdk-env --generator=docker_compose_discover=$BDK_DIR/.bdk-env/discover.env --secret=file=$BDK_DIR/.bdk-env/secret --tla-str=relay_spec=rococo-local --input-modules='lib:baedeker-library/ops/nginx.libsonnet' --input-modules='lib:baedeker-library/ops/devtools.libsonnet' --tla-str=repoDir=$(realpath $BDK_DIR/..) $@ $BDK_DIR/rewrites.jsonnet
cd $BDK_DIR/.bdk-env
#docker compose up -d --wait --remove-orphans
Empty file.
21 changes: 21 additions & 0 deletions .baedeker/vendor/baedeker-library/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Unique Network

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
54 changes: 54 additions & 0 deletions .baedeker/vendor/baedeker-library/inputs/base.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
local
genesisState = import '../util/genesisState.libsonnet',
{mixinAllChains, ...} = import '../util/mixin.libsonnet',
k = import '../mixin/keys.libsonnet',
;

function(prev, final)

// :code
local WELLKNOWN_CODE = '0x3a636f6465';

local genesisMixin = {
// TODO: Process from wasm once native runtime free world lands.
specJson: cql.description('<build spec for %s>' % self.path, bdk.processSpec(self.bin, self.spec)),
genesisWasm: self.specJson.genesis.raw.top[WELLKNOWN_CODE],
genesisWasmData: cql.runtimeWasm(self.genesisWasm),
genesisStateVersion: self.genesisWasmData.version.state_version,
genesisHead: genesisState(self.specJson, self.genesisStateVersion),

ss58Format: super?.ss58Format ?? 42,
signatureSchema: super?.signatureSchema ?? 'Sr25519',
// FIXME: Try to guess from runtime metadata.
// If null - try to guess the schema.
// I.e use StashOf of pallet_staking, if staking presents in schema, and so on.
validatorIdAssignment: super?.validatorIdAssignment ?? 'none',

addressSeed(seed):: cql.addressSeed(self.signatureSchema, seed, self.ss58Format),
};

local mergedChains = (prev + mixinAllChains(prev, function(chain, path) genesisMixin + {
path: path,
nodes+: {
[nodename]+: local hostname = '%s-node-%s' % [path, nodename]; {
hostname: hostname,
wantedKeys:
if node?.wantedKeys == 'para' then k.paraWantedKeys($)
else if node?.wantedKeys == 'para-ed' then k.paraWantedKeys($, ed = true)
else if node?.wantedKeys == 'para-nimbus' then k.paraWantedKeys($, nimbus = true)
else if node?.wantedKeys == 'relay' then k.relayWantedKeys($)
else if node?.wantedKeys == 'standalone' then k.standaloneWantedKeys($)
else if std.isObject(node?.wantedKeys) then node?.wantedKeys
else if !('wantedKeys' in node) then {}
else error 'Unknown wantedKeys: %s' % node?.wantedKeys,
},
for [nodename, node] in (chain?.nodes ?? {})
},
}));

mergedChains + mixinAllChains(mergedChains, function(chain, path) {
nodes+: {
[nodename]+: bdk.ensureKeys(node.hostname, node.wantedKeys, chain.ss58Format),
for [nodename, node] in (chain?.nodes ?? {})
},
})
55 changes: 55 additions & 0 deletions .baedeker/vendor/baedeker-library/mixin/keys.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
local
needController({validatorIdAssignment, ...}) =
if validatorIdAssignment == 'none' || validatorIdAssignment == 'collatorSelection' then false
else if validatorIdAssignment == 'staking' then true
else error "unknown validatorIdAssignment: %s" % validatorIdAssignment,
;

{
relayWantedKeys(root): {
[if needController(root) then '_controller']: root.signatureSchema,
_stash: root.signatureSchema,

gran: 'Ed25519',
babe: 'Sr25519',
imon: 'Sr25519',
para: 'Sr25519',
asgn: 'Sr25519',
audi: 'Sr25519',
// rococo: beefy is required
beef: 'Ecdsa',

sessionKeys: {
grandpa: 'gran',
babe: 'babe',
im_online: 'imon',
authority_discovery: 'audi',
para_assignment: 'asgn',
para_validator: 'para',
beefy: 'beef',
},
},
paraWantedKeys(root, ed = false, nimbus = false): {
[if needController(root) then '_controller']: root.signatureSchema,
_stash: root.signatureSchema,

// COMPAT: asset-hub on polkadot uses ed25519 instead of sr25519 for session keys.
// https://github.com/paritytech/cumulus/blob/d4bb2215bb28ee05159c4c7df1b3435177b5bf4e/parachains/common/src/lib.rs#L57-L62
[if nimbus then 'nmbs' else 'aura']: if ed then 'Ed25519' else 'Sr25519',
// COMPAT: moonbeam only supports setting nimbus key in genesis, yet rand key is required.
[if nimbus then 'rand']: {alias: 'nmbs'},

sessionKeys: {
aura: 'aura',
},
},
standaloneWantedKeys(root): {
aura: 'Sr25519',
gran: 'Ed25519',

sessionKeys: {
aura: 'aura',
grandpa: 'gran',
},
},
}
Loading
Loading