-
Notifications
You must be signed in to change notification settings - Fork 1k
Remove Build Warnings #3283
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
Remove Build Warnings #3283
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -253,7 +253,9 @@ protected static void OnSysCall(ExecutionEngine engine, Instruction instruction) | |
| /// <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 | ||
| FeeConsumed = GasConsumed = checked(FeeConsumed + datoshi); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Frankly, I don't understand why we have
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@roman-khimov No, its not |
||
| #pragma warning restore CS0618 // Type or member is obsolete | ||
| if (FeeConsumed > _feeAmount) | ||
| throw new InvalidOperationException("Insufficient GAS."); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -383,7 +383,7 @@ private JObject GetVerificationResult(UInt160 scriptHash, ContractParameter[] ar | |
| json["script"] = Convert.ToBase64String(invocationScript); | ||
| 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(); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you want me to change the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no existing rpc should be updated.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should add both, and remove gas in the future
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A set of v2? Why not only those that are needed? |
||
| json["exception"] = GetExceptionMessage(engine.FaultException); | ||
| try | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,12 +23,12 @@ public class StorageDumper : Plugin | |
| { | ||
| private readonly Dictionary<uint, NeoSystem> systems = new Dictionary<uint, NeoSystem>(); | ||
|
|
||
| private StreamWriter _writer; | ||
| private StreamWriter? _writer; | ||
| /// <summary> | ||
| /// _currentBlock stores the last cached item | ||
| /// </summary> | ||
| private JObject _currentBlock; | ||
| private string _lastCreateDirectory; | ||
| private JObject? _currentBlock; | ||
| private string? _lastCreateDirectory; | ||
|
|
||
|
|
||
| public override string Description => "Exports Neo-CLI status data"; | ||
|
|
@@ -73,7 +73,7 @@ private void OnDumpStorage(uint network, UInt160? contractHash = null) | |
| prefix = BitConverter.GetBytes(contract.Id); | ||
| } | ||
| var states = systems[network].StoreView.Find(prefix); | ||
| JArray array = new JArray(states.Where(p => !Settings.Default.Exclude.Contains(p.Key.Id)).Select(p => new JObject | ||
| JArray array = new JArray(states.Where(p => !Settings.Default!.Exclude.Contains(p.Key.Id)).Select(p => new JObject | ||
| { | ||
| ["key"] = Convert.ToBase64String(p.Key.ToArray()), | ||
| ["value"] = Convert.ToBase64String(p.Value.ToArray()) | ||
|
|
@@ -94,7 +94,7 @@ private void OnCommitting(NeoSystem system, Block block, DataCache snapshot, IRe | |
| private void OnPersistStorage(uint network, DataCache snapshot) | ||
| { | ||
| uint blockIndex = NativeContract.Ledger.CurrentIndex(snapshot); | ||
| if (blockIndex >= Settings.Default.HeightToBegin) | ||
| if (blockIndex >= Settings.Default!.HeightToBegin) | ||
| { | ||
| JArray stateChangeArray = new JArray(); | ||
|
|
||
|
|
@@ -139,7 +139,7 @@ private void OnCommitted(NeoSystem system, Block block) | |
|
|
||
| void OnCommitStorage(uint network, DataCache snapshot) | ||
| { | ||
| if (_currentBlock != null) | ||
| if (_currentBlock != null && _writer != null) | ||
| { | ||
| _writer.WriteLine(_currentBlock.ToString()); | ||
| _writer.Flush(); | ||
|
|
@@ -150,10 +150,10 @@ private void InitFileWriter(uint network, DataCache snapshot) | |
| { | ||
| uint blockIndex = NativeContract.Ledger.CurrentIndex(snapshot); | ||
| if (_writer == null | ||
| || blockIndex % Settings.Default.BlockCacheSize == 0) | ||
| || blockIndex % Settings.Default!.BlockCacheSize == 0) | ||
| { | ||
| string path = GetOrCreateDirectory(network, blockIndex); | ||
| var filepart = (blockIndex / Settings.Default.BlockCacheSize) * Settings.Default.BlockCacheSize; | ||
| var filepart = (blockIndex / Settings.Default!.BlockCacheSize) * Settings.Default.BlockCacheSize; | ||
| path = $"{path}/dump-block-{filepart}.dump"; | ||
| if (_writer != null) | ||
| { | ||
|
|
@@ -176,7 +176,7 @@ private string GetOrCreateDirectory(uint network, uint blockIndex) | |
|
|
||
| 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; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, its
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The default is very weird, cause its initialized when the load is called, no real default value for it. |
||
| return $"./StorageDumper_{network}/BlockStorage_{folder}"; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No