Skip to content

Remove Build Warnings#3283

Merged
shargon merged 1 commit intoneo-project:masterfrom
cschuchardt88:fixes/gas-001
May 30, 2024
Merged

Remove Build Warnings#3283
shargon merged 1 commit intoneo-project:masterfrom
cschuchardt88:fixes/gas-001

Conversation

@cschuchardt88
Copy link
Member

@cschuchardt88 cschuchardt88 commented May 28, 2024

ChangeLog

  • Removed Build Warnings

Note: this updates the GasConsumed to FeeConsumed for oracle and other services.

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

json["state"] = engine.Execute();
// Gas consumed in the unit of datoshi, 1 GAS = 1e8 datoshi
json["gasconsumed"] = engine.GasConsumed.ToString();
json["gasconsumed"] = engine.FeeConsumed.ToString();
Copy link
Member Author

Choose a reason for hiding this comment

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

Do you want me to change the json property as well. @roman-khimov @shargon

Copy link
Contributor

Choose a reason for hiding this comment

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

no existing rpc should be updated.

Copy link
Member

Choose a reason for hiding this comment

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

we should add both, and remove gas in the future

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd leave it as is, this API is used a lot, transitioning to feeconsumed would just bring a lot of pain for no real gain.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with roman, we should avoid change the rpc interface, its wildly used, should avoid any type of change. But maybe we can have a version 2 rpc.

Copy link
Member

Choose a reason for hiding this comment

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

Vote up for keeping it as is. And do we really need v2? I doubt, at least until we have a set of significant changes to be made in the API

Copy link
Contributor

Choose a reason for hiding this comment

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

A set of v2? Why not only those that are needed?

/// <param name="datoshi">The amount of GAS, in the unit of datoshi, 1 datoshi = 1e-8 GAS, to be added.</param>
protected internal void AddFee(long datoshi)
{
#pragma warning disable CS0618 // Type or member is obsolete
Copy link
Contributor

Choose a reason for hiding this comment

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

Wont this disable the warning on user side as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

No

@Jim8y Jim8y requested a review from a team May 28, 2024 22:51
private string GetDirectoryPath(uint network, uint blockIndex)
{
uint folder = (blockIndex / Settings.Default.StoragePerFolder) * Settings.Default.StoragePerFolder;
uint folder = (blockIndex / Settings.Default!.StoragePerFolder) * Settings.Default.StoragePerFolder;
Copy link
Member

Choose a reason for hiding this comment

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

Setttings.Default is not nullable, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, its nullable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Setttings.Default is not nullable, isn't it?

The default is very weird, cause its initialized when the load is called, no real default value for it.

json["state"] = engine.Execute();
// Gas consumed in the unit of datoshi, 1 GAS = 1e8 datoshi
json["gasconsumed"] = engine.GasConsumed.ToString();
json["gasconsumed"] = engine.FeeConsumed.ToString();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd leave it as is, this API is used a lot, transitioning to feeconsumed would just bring a lot of pain for no real gain.

protected internal void AddFee(long datoshi)
{
#pragma warning disable CS0618 // Type or member is obsolete
FeeConsumed = GasConsumed = checked(FeeConsumed + datoshi);
Copy link
Contributor

Choose a reason for hiding this comment

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

Frankly, I don't understand why we have FeeConsumed here. It's perfectly fine to count GasConsumed in sdatoshis, that's what you use in VM/contract anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know. I'm just fixing the warning. @Jim8y any comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

Frankly, I don't understand why we have FeeConsumed here. It's perfectly fine to count GasConsumed in sdatoshis, that's what you use in VM/contract anyway.

@roman-khimov No, its not necessarily to use FeeConsumed here, problem is the same as anywhere else, gas is gas, datoshi is datoshi, miss using it cause ambiguous. So i tried to correct gas as much as possible. But if the team thinks we should keep using GasConsumed, it can be corrected.

@Jim8y Jim8y requested a review from a team May 30, 2024 01:55
@shargon shargon merged commit 5bcfc45 into neo-project:master May 30, 2024
@shargon shargon deleted the fixes/gas-001 branch May 30, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants