Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: liberland/liberland_substrate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0e96933c7445f5ba0a621b44c180c82001d0d5ad
Choose a base ref
..
head repository: liberland/liberland_substrate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ae6a86faf4a00ea8aa47d4396ed6b0b8ba4f3127
Choose a head ref
Showing with 6 additions and 19 deletions.
  1. +1 −1 substrate/frame/llm/src/benchmarking.rs
  2. +5 −18 substrate/frame/llm/src/tests.rs
2 changes: 1 addition & 1 deletion substrate/frame/llm/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ benchmarks! {
let origin = RawOrigin::Signed(user.clone());
LLM::<T>::politics_lock(origin.clone().into(), amount.clone()).unwrap();
assert_eq!(LLMPolitics::<T>::get(&user), amount.clone());
}: _(origin, LLMAccount::Locked(user.clone()), LLMAccount::Liquid(user2.clone()), amount.clone())
}: _(origin, LLMAccount::Locked(user.clone()), LLMAccount::Locked(user2.clone()), amount.clone())
verify {
assert_eq!(LLMPolitics::<T>::get(&user), 0u8.into());
}
23 changes: 5 additions & 18 deletions substrate/frame/llm/src/tests.rs
Original file line number Diff line number Diff line change
@@ -704,29 +704,16 @@ fn cant_force_transfer_from_liquid() {
}

#[test]
fn force_updates_balances_correctly_to_liquid() {
fn cant_force_transfer_to_liquid() {
new_test_ext().execute_with(|| {
assert_ok!(LLM::politics_lock(RuntimeOrigin::signed(1), 3));

let court = RuntimeOrigin::signed(1);
let id = LLM::llm_id();
let politipool = LLM::get_llm_politipool_account();
let from = LLMAccount::Locked(1);
let to = LLMAccount::Liquid(2);
let amount = 2;

assert_ok!(LLM::politics_lock(RuntimeOrigin::signed(1), 3));
assert_ok!(LLM::politics_lock(RuntimeOrigin::signed(2), 2));
let politipool_before = Assets::balance(id, politipool);
let from_before = Assets::balance(id, 1);
let to_before = Assets::balance(id, 2);

assert_ok!(LLM::force_transfer(court, from, to, amount));

assert_eq!(Assets::balance(id, politipool), politipool_before - amount);
assert_eq!(Assets::balance(id, 1), from_before);
assert_eq!(Assets::balance(id, 2), to_before + amount);
let amount = 1;

assert_eq!(LLMPolitics::<Test>::get(1), 3 - amount);
assert_eq!(LLMPolitics::<Test>::get(2), 2);
assert_noop!(LLM::force_transfer(court, from, to, amount), Error::<Test>::InvalidAccount);
});
}