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

Change the way to obtain units per second #1902

Merged
merged 1 commit into from Nov 3, 2022

Conversation

girazoki
Copy link
Collaborator

What does it do?

Simplifies the way to obtain units per second in the precompile xcm-utils. It should make errors in test that run in debug mode dissapear

What important points reviewers should know?

Is there something left for follow-up PRs?

What alternative implementations were considered?

Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?

What value does it bring to the blockchain users?

@girazoki girazoki added the D3-trivial PR contains trivial changes in a runtime directory that do not require an audit label Oct 26, 2022
@nanocryk nanocryk added A0-pleasereview Pull request needs code review. B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes labels Oct 28, 2022
@nanocryk
Copy link
Contributor

Can you explain how this work? buy_weight doesn't spend users funds? Why substract from u128::MAX?

@girazoki
Copy link
Collaborator Author

girazoki commented Oct 28, 2022

this is a view function, so no worries. It does not spend any user funds. We just spawn a local trader context, initialize it with u128::MAX (simulating that someone bought that amount), try to buy 1 second of execution, and then check how much is left. I used u128::MAX because I need to make sure the trader will have enough tokens to buy the 1 second of execution.

@girazoki girazoki merged commit 94d7150 into master Nov 3, 2022
@girazoki girazoki deleted the girazoki-modify-units-per-second-precomp branch November 3, 2022 08:56
imstar15 pushed a commit to OAK-Foundation/moonbeam that referenced this pull request May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-pleasereview Pull request needs code review. B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D3-trivial PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants