Skip to content

Commit 5a3dd16

Browse files
superboyiiiWi1l-B0tshargon
authored
V3.8.1 to master (#3941)
* [`Optimize`]: show native contract is active or not (#3922) * optimize: show native contract net active yet * Update src/Neo.CLI/CLI/MainService.Native.cs * style: move BigInteger extensions from Utility to BigIntegerExtensions (#3916) --------- Co-authored-by: Shargon <[email protected]> * Avoid empty snupkg in release (#3925) * v3.8.1 (#3930) * Revert workflow branch --------- Co-authored-by: Will <[email protected]> Co-authored-by: Shargon <[email protected]>
1 parent bd75829 commit 5a3dd16

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

.github/workflows/nuget.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
--output ${{ env.NEO_NUGET_DIR }} \
3939
--verbosity normal \
4040
-p:VersionPrefix=${{ env.APP_VERSION }} \
41+
-p:IncludeSymbols=false \
4142
-p:DebugSymbols=false \
4243
-p:DebugType=none \
4344
-p:ServerGarbageCollection=true \

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2424
<Company>The Neo Project</Company>
2525
<GenerateDocumentationFile>true</GenerateDocumentationFile>
26-
<VersionPrefix>3.8.0</VersionPrefix>
26+
<VersionPrefix>3.8.1</VersionPrefix>
2727
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2828
<WarningLevel>4</WarningLevel>
2929
<AnalysisLevel>latest</AnalysisLevel>

src/Neo.CLI/CLI/MainService.Blockchain.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,20 +208,27 @@ public void OnShowContractCommand(string nameOrHash)
208208
lock (syncRoot)
209209
{
210210
ContractState? contract = null;
211-
212-
if (UInt160.TryParse(nameOrHash, out var scriptHash))
211+
NativeContract? nativeContract = null;
212+
var isHash = UInt160.TryParse(nameOrHash, out var scriptHash);
213+
if (isHash)
214+
{
213215
contract = NativeContract.ContractManagement.GetContract(NeoSystem.StoreView, scriptHash);
216+
if (contract is null)
217+
nativeContract = NativeContract.Contracts.SingleOrDefault(s => s.Hash == scriptHash);
218+
}
214219
else
215220
{
216-
var nativeContract = NativeContract.Contracts.SingleOrDefault(s => s.Name.Equals(nameOrHash, StringComparison.InvariantCultureIgnoreCase));
217-
221+
nativeContract = NativeContract.Contracts.SingleOrDefault(s => s.Name.Equals(nameOrHash, StringComparison.InvariantCultureIgnoreCase));
218222
if (nativeContract != null)
219223
contract = NativeContract.ContractManagement.GetContract(NeoSystem.StoreView, nativeContract.Hash);
220224
}
221225

222226
if (contract is null)
223227
{
224-
ConsoleHelper.Error($"Contract {nameOrHash} doesn't exist.");
228+
var state = nativeContract is null
229+
? "doesn't exist"
230+
: isHash ? $"({nativeContract.Name}) not active yet" : "not active yet";
231+
ConsoleHelper.Error($"Contract {nameOrHash} {state}.");
225232
return;
226233
}
227234

src/Neo.CLI/CLI/MainService.Native.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ partial class MainService
2323
[ConsoleCommand("list nativecontract", Category = "Native Contract")]
2424
private void OnListNativeContract()
2525
{
26-
NativeContract.Contracts.ToList().ForEach(p => ConsoleHelper.Info($"\t{p.Name,-20}", $"{p.Hash}"));
26+
var currentIndex = NativeContract.Ledger.CurrentIndex(NeoSystem.StoreView);
27+
NativeContract.Contracts.ToList().ForEach(contract =>
28+
{
29+
var active = contract.IsActive(NeoSystem.Settings, currentIndex) ? "" : " not active yet";
30+
ConsoleHelper.Info($"\t{contract.Name,-20}", $"{contract.Hash}{active}");
31+
});
2732
}
2833
}
2934
}

src/Neo/SmartContract/Native/NativeContract.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ internal bool IsInitializeBlock(ProtocolSettings settings, uint index, [NotNullW
330330
/// <param name="settings">The <see cref="ProtocolSettings"/> where the HardForks are configured.</param>
331331
/// <param name="blockHeight">Block height</param>
332332
/// <returns>True if the native contract is active</returns>
333-
internal bool IsActive(ProtocolSettings settings, uint blockHeight)
333+
public bool IsActive(ProtocolSettings settings, uint blockHeight)
334334
{
335335
if (ActiveIn is null) return true;
336336

0 commit comments

Comments
 (0)