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

final fix of hotfixes #891

Closed
wants to merge 69 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
3fedd89
Update to polkadot SDK release-polkadot-v1.11.0
gztensor Aug 28, 2024
4886e96
Add EVM pallets, rpc, and precompiles
gztensor Aug 29, 2024
dee91c0
Format
gztensor Aug 29, 2024
8dd904e
Fix clippy issues
gztensor Aug 29, 2024
86167cb
Format
gztensor Aug 29, 2024
ca953f4
Fix try-runtime build
gztensor Aug 29, 2024
fa7d30f
Fix runtime-benchmarks build
gztensor Aug 29, 2024
069bea4
Format
gztensor Aug 29, 2024
f0dde3c
Fix configuration of pallet_transaction_payment, reduce linear fees t…
gztensor Aug 29, 2024
3f3b546
Format
gztensor Aug 29, 2024
8c1de0d
Fix zepter check
gztensor Aug 29, 2024
072bdea
Fix zepter check
gztensor Aug 29, 2024
0d571b4
Cleanup and fix gas to weight to fees conversion
gztensor Aug 30, 2024
020fb2a
Format
gztensor Aug 30, 2024
9609bd2
Change chain ID to 945 for testnet
gztensor Aug 30, 2024
e88f428
Add staking precompile implementation notes
gztensor Sep 3, 2024
8285c39
add add staking logic
soring323 Sep 4, 2024
609005b
refactor execute function
soring323 Sep 4, 2024
231e586
add remove staking function
soring323 Sep 4, 2024
074c9b6
fix lint issue
soring323 Sep 4, 2024
fad6d17
add refund logic to caller
soring323 Sep 5, 2024
7e047fa
fix lint issue
soring323 Sep 5, 2024
9d0391c
Merge pull request #777 from DedicatedDev/mz/feat/staking-precompile
gztensor Sep 5, 2024
600e6d1
fix clippy lint issues
soring323 Sep 5, 2024
27797ae
fix clippy lint issues
soring323 Sep 5, 2024
74fe08d
Merge pull request #784 from DedicatedDev/mz/feat/fix-clippy-issue
gztensor Sep 5, 2024
1c2c12f
Address code review comments: Separate RPC merging into helper functions
gztensor Sep 5, 2024
89c8910
Use TryFrom for converting bytes to AccountId32 with error
gztensor Sep 5, 2024
767ed55
Bump runtime version to 197
gztensor Sep 6, 2024
bc65af2
Merge branch 'devnet-ready' into feat/evm-devnet-ready
gztensor Sep 6, 2024
56a9809
Re-add staking precompile implementation notes
gztensor Sep 6, 2024
f8632e3
Format
gztensor Sep 6, 2024
0478b8d
Fix removing stake in staking precompile
gztensor Sep 17, 2024
4cdfeb5
Remove payable modifier from removeStake precompile method
gztensor Sep 17, 2024
517fabf
bump spec above mainnet (#829)
camfairchild Sep 23, 2024
453a7af
Update EVM to polkadot dsk 1.16
gztensor Sep 26, 2024
5372f5e
Format
gztensor Sep 26, 2024
f706122
Make linter happy again
gztensor Sep 26, 2024
a2b8bb6
Format
gztensor Sep 26, 2024
3f147b8
Remove unused manifest key: dependencies.scale-codec.package (linter)
gztensor Sep 26, 2024
1c72c6f
Fix benchmarks
gztensor Sep 26, 2024
bb9ee35
Format
gztensor Sep 26, 2024
4966c2c
Cleanup RPC create_full bounds
gztensor Sep 27, 2024
7064b52
Add ed25519 verify precompile
gztensor Sep 30, 2024
c587301
Implement ed25519 verification precompile
gztensor Oct 1, 2024
129d3d9
Propagate features for ed25519-dalek
gztensor Oct 2, 2024
ac24a8f
Add ed25519-dalek to std feature in runtime
gztensor Oct 2, 2024
6ead778
Implement subtensor evm balance converter, use in balance transfer pr…
gztensor Oct 4, 2024
bdd85cd
Use evm balance converter in staking precompile
gztensor Oct 4, 2024
638f521
Merge devnet-ready into feat/evm-devnet-ready
gztensor Oct 4, 2024
40fff23
Recalculate decimals for gas price
gztensor Oct 4, 2024
4ea9663
Fix decimals in gas fees (max_fee_per_gas and max_priority_fee_per_gas)
gztensor Oct 15, 2024
f39520c
Format
gztensor Oct 15, 2024
d3f7013
Merge main into feat/evm-devnet-ready
gztensor Oct 15, 2024
6622905
add ability to skip cargo audit
sam0x17 Oct 16, 2024
70e86e2
Cargo update after updating frontier version of sqlx
gztensor Oct 16, 2024
3c17e7c
fix
sam0x17 Oct 16, 2024
7c4126f
Fix decimals in gas price rpc
gztensor Oct 16, 2024
042d5d7
Update frontier fork to master branch
gztensor Oct 29, 2024
a85e207
fix: whitelist
orriin Oct 30, 2024
dbb3ad3
Reapply hotkey swap fix for childkey's parents
gztensor Oct 30, 2024
d16929a
Merge pull request #890 from opentensor/fix/reapply-hotkey-swap-fix-c…
sam0x17 Oct 30, 2024
2ad1381
separate out cargo-audit so it can be canceled via label
sam0x17 Oct 30, 2024
f58977b
pin frontier version
orriin Oct 31, 2024
29cd71e
Merge branch 'devnet-ready' into feat/evm-devnet-ready
orriin Oct 31, 2024
8d084b1
fix merge
orriin Oct 31, 2024
6513d46
update cargo.lock
orriin Oct 31, 2024
d8eadf3
fix feature propagation
orriin Oct 31, 2024
3fb89ec
Merge pull request #772 from opentensor/feat/evm-devnet-ready
unconst Oct 31, 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
42 changes: 42 additions & 0 deletions .github/workflows/cargo-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: cargo audit
on:
pull_request:
types:
- labeled
- unlabeled
- synchronize
concurrency:
group: cargo-audit-${{ github.ref }}
cancel-in-progress: true

jobs:
cargo-audit:
name: cargo audit
runs-on: SubtensorCI
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-cargo-audit') }}
steps:
- name: Check-out repositoroy under $GITHUB_WORKSPACE
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update &&
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler

- name: Install Rust Stable
uses: actions-rs/[email protected]
with:
toolchain: stable
components: rustfmt, clippy
profile: minimal

- name: Utilize Shared Rust Cache
uses: Swatinem/[email protected]
with:
key: ubuntu-latest-${{ env.RUST_BIN_DIR }}

- name: Install cargo-audit
run: cargo install cargo-audit

- name: cargo audit
run: cargo audit --ignore RUSTSEC-2024-0336 # rustls issue; wait for upstream to resolve this
31 changes: 0 additions & 31 deletions .github/workflows/check-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,37 +208,6 @@ jobs:

- name: cargo clippy --workspace --all-targets --all-features -- -D warnings
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
# runs cargo audit
cargo-audit:
name: cargo audit
runs-on: SubtensorCI
if: ${{ github.event_name != 'push' && !contains(github.event.pull_request.labels.*.name, 'skip-cargo-audit') }}
steps:
- name: Check-out repositoroy under $GITHUB_WORKSPACE
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update &&
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler

- name: Install Rust Stable
uses: actions-rs/[email protected]
with:
toolchain: stable
components: rustfmt, clippy
profile: minimal

- name: Utilize Shared Rust Cache
uses: Swatinem/[email protected]
with:
key: ubuntu-latest-${{ env.RUST_BIN_DIR }}

- name: Install cargo-audit
run: cargo install cargo-audit

- name: cargo audit
run: cargo audit --ignore RUSTSEC-2024-0336 # rustls issue; wait for upstream to resolve this

# runs cargo test --workspace
cargo-test:
Expand Down
15 changes: 14 additions & 1 deletion pallets/subtensor/src/swap/swap_hotkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,20 @@ impl<T: Config> Pallet<T> {
// Remove the old hotkey's child entries
ChildKeys::<T>::remove(old_hotkey, netuid);
// Insert the same child entries for the new hotkey
ChildKeys::<T>::insert(new_hotkey, netuid, my_children);
ChildKeys::<T>::insert(new_hotkey, netuid, my_children.clone());
for (_, child_key_i) in my_children {
// For each child, update their parent list
let mut child_parents: Vec<(u64, T::AccountId)> =
ParentKeys::<T>::get(child_key_i.clone(), netuid);
for parent in child_parents.iter_mut() {
// If the parent is the old hotkey, replace it with the new hotkey
if parent.1 == *old_hotkey {
parent.1 = new_hotkey.clone();
}
}
// Update the child's parent list
ParentKeys::<T>::insert(child_key_i, netuid, child_parents);
}
}

// 13. Swap ParentKeys.
Expand Down
97 changes: 97 additions & 0 deletions pallets/subtensor/tests/swap_hotkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,3 +1148,100 @@ fn test_swap_complex_parent_child_structure() {
);
});
}

#[test]
fn test_swap_parent_hotkey_childkey_maps() {
new_test_ext(1).execute_with(|| {
let netuid: u16 = 1;
let parent_old = U256::from(1);
let coldkey = U256::from(2);
let child = U256::from(3);
let parent_new = U256::from(4);
add_network(netuid, 0, 0);
SubtensorModule::create_account_if_non_existent(&coldkey, &parent_old);

// Set child and verify state maps
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),
parent_old,
netuid,
vec![(u64::MAX, child)]
));
assert_eq!(
ParentKeys::<Test>::get(child, netuid),
vec![(u64::MAX, parent_old)]
);
assert_eq!(
ChildKeys::<Test>::get(parent_old, netuid),
vec![(u64::MAX, child)]
);

// Swap
let mut weight = Weight::zero();
assert_ok!(SubtensorModule::perform_hotkey_swap(
&parent_old,
&parent_new,
&coldkey,
&mut weight
));

// Verify parent and child keys updates
assert_eq!(
ParentKeys::<Test>::get(child, netuid),
vec![(u64::MAX, parent_new)]
);
assert_eq!(
ChildKeys::<Test>::get(parent_new, netuid),
vec![(u64::MAX, child)]
);
})
}

#[test]
fn test_swap_child_hotkey_childkey_maps() {
new_test_ext(1).execute_with(|| {
let netuid: u16 = 1;
let parent = U256::from(1);
let coldkey = U256::from(2);
let child_old = U256::from(3);
let child_new = U256::from(4);
add_network(netuid, 0, 0);
SubtensorModule::create_account_if_non_existent(&coldkey, &child_old);
SubtensorModule::create_account_if_non_existent(&coldkey, &parent);

// Set child and verify state maps
assert_ok!(SubtensorModule::do_set_children(
RuntimeOrigin::signed(coldkey),
parent,
netuid,
vec![(u64::MAX, child_old)]
));
assert_eq!(
ParentKeys::<Test>::get(child_old, netuid),
vec![(u64::MAX, parent)]
);
assert_eq!(
ChildKeys::<Test>::get(parent, netuid),
vec![(u64::MAX, child_old)]
);

// Swap
let mut weight = Weight::zero();
assert_ok!(SubtensorModule::perform_hotkey_swap(
&child_old,
&child_new,
&coldkey,
&mut weight
));

// Verify parent and child keys updates
assert_eq!(
ParentKeys::<Test>::get(child_new, netuid),
vec![(u64::MAX, parent)]
);
assert_eq!(
ChildKeys::<Test>::get(parent, netuid),
vec![(u64::MAX, child_new)]
);
})
}
Loading