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

feat(benchmark): pallet smart contract - tft bridge - tfgrid #700

Merged
merged 30 commits into from
Jun 16, 2023

Conversation

renauter
Copy link
Collaborator

@renauter renauter commented May 23, 2023

Benchmarking pallets smart contract / tft bridge / tfgrid

Solves part of

@renauter renauter changed the base branch from development to development_benchmark_extrinsics_2 May 23, 2023 00:24
Base automatically changed from development_benchmark_extrinsics_2 to development June 2, 2023 07:13
@renauter renauter marked this pull request as ready for review June 13, 2023 17:56
Copy link
Contributor

@DylanVerstraete DylanVerstraete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just some general remarks. It might be nice if we could have some code that does setup like:

  • create twin / node / farm

Somewhere in a seperate package (crate). Not sure if it will understand the context of the mock or benchmarking though..

Comment on lines 306 to 318
// let cost = 46501499;
// let lock = SmartContractModule::<T>::contract_number_of_cylces_billed(contract_id);
// assert_eq!(lock.amount_locked.saturated_into::<u64>(), cost);
// assert_eq!(
// contract.contract_id, contract_id
// );
// let contract_bill = types::ContractBill {
// contract_id,
// timestamp: <Timestamp<T>>::get().saturated_into::<u64>() / 1000,
// discount_level: types::DiscountLevel::None,
// amount_billed: cost as u128,
// };
// assert_last_event::<T>(Event::ContractBilled(contract_bill).into());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment on lines +591 to +617
fn _create_node<T: Config>(source: T::AccountId) {
let resources = ResourcesInput {
hru: 1024 * GIGABYTE,
sru: 512 * GIGABYTE,
cru: 8,
mru: 16 * GIGABYTE,
};

// random location
let location = LocationInput {
city: get_city_name_input(b"Ghent"),
country: get_country_name_input(b"Belgium"),
latitude: get_latitude_input(b"12.233213231"),
longitude: get_longitude_input(b"32.323112123"),
};

assert_ok!(TfgridModule::<T>::create_node(
RawOrigin::Signed(source.clone()).into(),
1,
resources,
location,
Vec::new().try_into().unwrap(),
false,
false,
None,
));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if we could put this somewhere to be reused in other pallets

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree
but don't see an obvious way for the same reason you mentioned above

@DylanVerstraete DylanVerstraete force-pushed the development_benchmark_extrinsics_3 branch from 9277b4c to 61bbd9a Compare June 14, 2023 09:45
@DylanVerstraete DylanVerstraete changed the title feat(benchmark): pallet smart contract [3/4] feat(benchmark): pallet smart contract - tft bridge - tfgrid Jun 15, 2023
@renauter renauter merged commit 0f1455e into development Jun 16, 2023
@renauter renauter deleted the development_benchmark_extrinsics_3 branch June 16, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants