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

Calculate CPU usage outside of the player's isolate. #36

Closed
wants to merge 1 commit into from

Conversation

deft-code
Copy link

This moves cpu usage tracking outside of the player's isolate. Within the isolate it's possible for a player to alter the calculation in their favor.

@artch
Copy link
Contributor

artch commented Sep 8, 2019

I would argue that calculating it outside the isolate would be far less precise since it's not an immediate calculation of userspace code execution, it will always charge the player some additional amount of CPU. Do you have any particular exploit in mind regarding this?


run.dispose();
dataRef.dispose();

let intentCount = countIntents(runResult.intents);
runResult.intentsCpu = intentCount / 0.2;

Choose a reason for hiding this comment

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

This is equal to a multiply with 5 (intentCount * 5) which doesn't seem intended.

Suggested change
runResult.intentsCpu = intentCount / 0.2;
runResult.intentsCpu = intentCount * 0.2;

@deft-code deft-code closed this Jul 1, 2024
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.

3 participants