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 configuring payments pallet kreivo #328

Merged
merged 3 commits into from
Jan 16, 2024

Conversation

darkforest0202
Copy link
Contributor

This PR is configuring the Payments pallet into the Kreivo runtime and also it generates the weights for each extrinsic.

Something interesting is that a test weights() was added where we can have how much each extrinsic occupies in the block and some interesting statistics like how many max tx we could have in a block.

Below the tests results:

running 8 tests
max block weight: Weight(ref_time: 500000000000, proof_size: 5242880)
max total extrinsics weight: Weight(ref_time: 375000000000, proof_size: 3932160)
max extrinsic weight: Weight(ref_time: 349875000000, proof_size: 3670016)

pay (20): Weight { ref_time: 77756220, proof_size: 8524 }
	percentage of max extrinsic weight: 0.02% (ref_time), 0.23% (proof_size)
	max tx per block: 4499 (ref_time), 430 (proof_size)
release: Weight { ref_time: 137000000, proof_size: 8817 }
	percentage of max extrinsic weight: 0.04% (ref_time), 0.24% (proof_size)
	max tx per block: 2553 (ref_time), 416 (proof_size)
cancel: Weight { ref_time: 101000000, proof_size: 8524 }
	percentage of max extrinsic weight: 0.03% (ref_time), 0.23% (proof_size)
	max tx per block: 3464 (ref_time), 430 (proof_size)
request_refund: Weight { ref_time: 31000000, proof_size: 159279 }
	percentage of max extrinsic weight: 0.01% (ref_time), 4.34% (proof_size)
	max tx per block: 11286 (ref_time), 23 (proof_size)
dispute_refund: Weight { ref_time: 70000000, proof_size: 159279 }
	percentage of max extrinsic weight: 0.02% (ref_time), 4.34% (proof_size)
	max tx per block: 4998 (ref_time), 23 (proof_size)
resolve_dispute: Weight { ref_time: 196000000, proof_size: 8817 }
	percentage of max extrinsic weight: 0.06% (ref_time), 0.24% (proof_size)
	max tx per block: 1785 (ref_time), 416 (proof_size)
request_payment: Weight { ref_time: 15000000, proof_size: 8524 }
	percentage of max extrinsic weight: 0.00% (ref_time), 0.23% (proof_size)
	max tx per block: 23325 (ref_time), 430 (proof_size)
accept_and_pay: Weight { ref_time: 121000000, proof_size: 8817 }
	percentage of max extrinsic weight: 0.03% (ref_time), 0.24% (proof_size)
	max tx per block: 2891 (ref_time), 416 (proof_size)

total weight: Weight { ref_time: 748756220, proof_size: 370581 }

The command line used to generate the weights is the following:

Executed Command:
 ./target/release/virto-node benchmark pallet \
 --chain kreivo \
 --wasm-execution=compiled \
 --pallet pallet_payments \
 --extrinsic "*" \
 --steps 50 \
 --repeat 20 \
 --template=./templates/frame-weight-template.hbs \
--output pallets/payments/src/weights.rs \

Important: It worths considering that these benchmarks were calculated using a Macbook M1 Pro with 32GB of ram. Depending on the hardware used to run the collators all the numbers and statistics might change. This should be properly done in #179

Closes #327 #309

Copy link
Member

@olanod olanod left a comment

Choose a reason for hiding this comment

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

Awesome job! a minor change though :)

runtime/kreivo/src/payments.rs Outdated Show resolved Hide resolved
@darkforest0202 darkforest0202 changed the base branch from master to feat-polkadot-release-v1.5.0-migration January 3, 2024 15:09
@darkforest0202 darkforest0202 requested a review from olanod January 3, 2024 15:09
@darkforest0202
Copy link
Contributor Author

@olanod i have back ported the changes of this PR to the polkadot virto release 1.5. Also i addressed your comment about the RootAccount.

As you might see i changed the target branch to feat-polkadot-release-v1.5.0-migration. So in case there are warnings in this PR i would just merge it and solve it on the target release.

Base automatically changed from feat-polkadot-release-v1.5.0-migration to master January 12, 2024 15:17
@olanod olanod force-pushed the feat-configuring-payments-pallet-kreivo branch from f1954fb to d3fb1c7 Compare January 16, 2024 14:22
@olanod olanod force-pushed the feat-configuring-payments-pallet-kreivo branch from d3fb1c7 to 48a26da Compare January 16, 2024 14:24
@olanod olanod merged commit 7676815 into master Jan 16, 2024
2 checks passed
@olanod olanod deleted the feat-configuring-payments-pallet-kreivo branch January 16, 2024 15:06
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.

[Payments] - Generate weights.rs file from benchmarking.
3 participants