Skip to content

Commit 5bcfc45

Browse files
Remove Wanring (#3283)
1 parent df06791 commit 5bcfc45

7 files changed

Lines changed: 17 additions & 14 deletions

File tree

src/Neo.GUI/Neo.GUI.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<UseWindowsForms>true</UseWindowsForms>
1111
<Product>Neo.GUI</Product>
1212
<ApplicationIcon>neo.ico</ApplicationIcon>
13+
<GenerateResourceWarnOnBinaryFormatterUse>false</GenerateResourceWarnOnBinaryFormatterUse>
1314
</PropertyGroup>
1415

1516
<ItemGroup>

src/Neo/SmartContract/ApplicationEngine.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ protected static void OnSysCall(ExecutionEngine engine, Instruction instruction)
253253
/// <param name="datoshi">The amount of GAS, in the unit of datoshi, 1 datoshi = 1e-8 GAS, to be added.</param>
254254
protected internal void AddFee(long datoshi)
255255
{
256+
#pragma warning disable CS0618 // Type or member is obsolete
256257
FeeConsumed = GasConsumed = checked(FeeConsumed + datoshi);
258+
#pragma warning restore CS0618 // Type or member is obsolete
257259
if (FeeConsumed > _feeAmount)
258260
throw new InvalidOperationException("Insufficient GAS.");
259261
}

src/Plugins/OracleService/OracleService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public static Transaction CreateResponseTx(DataCache snapshot, OracleRequest req
430430
ContractMethodDescriptor md = oracleContract.Manifest.Abi.GetMethod("verify", -1);
431431
engine.LoadContract(oracleContract, md, CallFlags.None);
432432
if (engine.Execute() != VMState.HALT) return null;
433-
tx.NetworkFee += engine.GasConsumed;
433+
tx.NetworkFee += engine.FeeConsumed;
434434

435435
var executionFactor = NativeContract.Policy.GetExecFeeFactor(snapshot);
436436
var networkFee = executionFactor * SmartContract.Helper.MultiSignatureContractCost(m, n);

src/Plugins/RpcServer/RpcServer.SmartContract.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private JObject GetInvokeResult(byte[] script, Signer[] signers = null, Witness[
7676
json["script"] = Convert.ToBase64String(script);
7777
json["state"] = session.Engine.State;
7878
// Gas consumed in the unit of datoshi, 1 GAS = 10^8 datoshi
79-
json["gasconsumed"] = session.Engine.GasConsumed.ToString();
79+
json["gasconsumed"] = session.Engine.FeeConsumed.ToString();
8080
json["exception"] = GetExceptionMessage(session.Engine.FaultException);
8181
json["notifications"] = new JArray(session.Engine.Notifications.Select(n =>
8282
{

src/Plugins/RpcServer/RpcServer.Wallet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ private JObject GetVerificationResult(UInt160 scriptHash, ContractParameter[] ar
383383
json["script"] = Convert.ToBase64String(invocationScript);
384384
json["state"] = engine.Execute();
385385
// Gas consumed in the unit of datoshi, 1 GAS = 1e8 datoshi
386-
json["gasconsumed"] = engine.GasConsumed.ToString();
386+
json["gasconsumed"] = engine.FeeConsumed.ToString();
387387
json["exception"] = GetExceptionMessage(engine.FaultException);
388388
try
389389
{

src/Plugins/StorageDumper/Settings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ internal class Settings
3434

3535
private Settings(IConfigurationSection section)
3636
{
37-
/// Geting settings for storage changes state dumper
37+
// Geting settings for storage changes state dumper
3838
BlockCacheSize = section.GetValue("BlockCacheSize", 1000u);
3939
HeightToBegin = section.GetValue("HeightToBegin", 0u);
4040
StoragePerFolder = section.GetValue("StoragePerFolder", 100000u);
4141
Exclude = section.GetSection("Exclude").Exists()
42-
? section.GetSection("Exclude").GetChildren().Select(p => int.Parse(p.Value)).ToArray()
42+
? section.GetSection("Exclude").GetChildren().Select(p => int.Parse(p.Value!)).ToArray()
4343
: new[] { NativeContract.Ledger.Id };
4444
}
4545

src/Plugins/StorageDumper/StorageDumper.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ public class StorageDumper : Plugin
2323
{
2424
private readonly Dictionary<uint, NeoSystem> systems = new Dictionary<uint, NeoSystem>();
2525

26-
private StreamWriter _writer;
26+
private StreamWriter? _writer;
2727
/// <summary>
2828
/// _currentBlock stores the last cached item
2929
/// </summary>
30-
private JObject _currentBlock;
31-
private string _lastCreateDirectory;
30+
private JObject? _currentBlock;
31+
private string? _lastCreateDirectory;
3232

3333

3434
public override string Description => "Exports Neo-CLI status data";
@@ -73,7 +73,7 @@ private void OnDumpStorage(uint network, UInt160? contractHash = null)
7373
prefix = BitConverter.GetBytes(contract.Id);
7474
}
7575
var states = systems[network].StoreView.Find(prefix);
76-
JArray array = new JArray(states.Where(p => !Settings.Default.Exclude.Contains(p.Key.Id)).Select(p => new JObject
76+
JArray array = new JArray(states.Where(p => !Settings.Default!.Exclude.Contains(p.Key.Id)).Select(p => new JObject
7777
{
7878
["key"] = Convert.ToBase64String(p.Key.ToArray()),
7979
["value"] = Convert.ToBase64String(p.Value.ToArray())
@@ -94,7 +94,7 @@ private void OnCommitting(NeoSystem system, Block block, DataCache snapshot, IRe
9494
private void OnPersistStorage(uint network, DataCache snapshot)
9595
{
9696
uint blockIndex = NativeContract.Ledger.CurrentIndex(snapshot);
97-
if (blockIndex >= Settings.Default.HeightToBegin)
97+
if (blockIndex >= Settings.Default!.HeightToBegin)
9898
{
9999
JArray stateChangeArray = new JArray();
100100

@@ -139,7 +139,7 @@ private void OnCommitted(NeoSystem system, Block block)
139139

140140
void OnCommitStorage(uint network, DataCache snapshot)
141141
{
142-
if (_currentBlock != null)
142+
if (_currentBlock != null && _writer != null)
143143
{
144144
_writer.WriteLine(_currentBlock.ToString());
145145
_writer.Flush();
@@ -150,10 +150,10 @@ private void InitFileWriter(uint network, DataCache snapshot)
150150
{
151151
uint blockIndex = NativeContract.Ledger.CurrentIndex(snapshot);
152152
if (_writer == null
153-
|| blockIndex % Settings.Default.BlockCacheSize == 0)
153+
|| blockIndex % Settings.Default!.BlockCacheSize == 0)
154154
{
155155
string path = GetOrCreateDirectory(network, blockIndex);
156-
var filepart = (blockIndex / Settings.Default.BlockCacheSize) * Settings.Default.BlockCacheSize;
156+
var filepart = (blockIndex / Settings.Default!.BlockCacheSize) * Settings.Default.BlockCacheSize;
157157
path = $"{path}/dump-block-{filepart}.dump";
158158
if (_writer != null)
159159
{
@@ -176,7 +176,7 @@ private string GetOrCreateDirectory(uint network, uint blockIndex)
176176

177177
private string GetDirectoryPath(uint network, uint blockIndex)
178178
{
179-
uint folder = (blockIndex / Settings.Default.StoragePerFolder) * Settings.Default.StoragePerFolder;
179+
uint folder = (blockIndex / Settings.Default!.StoragePerFolder) * Settings.Default.StoragePerFolder;
180180
return $"./StorageDumper_{network}/BlockStorage_{folder}";
181181
}
182182

0 commit comments

Comments
 (0)