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

benchmarks: generated weight functions have compile errors #395

Closed
1 task done
radkomih opened this issue Mar 7, 2024 · 0 comments · Fixed by #397
Closed
1 task done

benchmarks: generated weight functions have compile errors #395

radkomih opened this issue Mar 7, 2024 · 0 comments · Fixed by #397
Assignees

Comments

@radkomih
Copy link
Collaborator

radkomih commented Mar 7, 2024

Is there an existing issue?

  • I have searched the existing issues

Description of bug

  1. For calls, whose weight depends on the input size, sometimes the weight function is generated with and sometimes without an additional parameter in the function signature (size).
func callRemarkWithEventWeight(dbWeight primitives.RuntimeDbWeight, size sc.U64) primitives.Weight {
	return primitives.WeightFromParts(1269787272, 0).
		SaturatingAdd(primitives.WeightFromParts(4547, 0).SaturatingMul(size)).
		SaturatingAdd(dbWeight.Reads(0)).
		SaturatingAdd(dbWeight.Writes(0))
}
  1. For calls whose weights depend on the input size and also affect the database read/writes, the weight function is always generated incorrectly.
  • with a additional line SaturatingAdd(dbWeight.Writes(1, 0).SaturatingMul(size)).
  • dbWeight.Writes(1, 0) with an additional parameter
func callSetStorageWeight(dbWeight primitives.RuntimeDbWeight, size sc.U64) primitives.Weight {
	return primitives.WeightFromParts(0, 0).
			SaturatingAdd(primitives.WeightFromParts(8050380, 0).SaturatingMul(size)).
		SaturatingAdd(dbWeight.Reads(0)).
		SaturatingAdd(dbWeight.Writes(0)).
			SaturatingAdd(dbWeight.Writes(1, 0).SaturatingMul(size)).
}

Steps to reproduce

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
2 participants