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

Update nuget package versions #3

Merged
merged 2 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
- name: Restore dependencies
run: dotnet restore

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'zulu'
- uses: actions/checkout@v3
with:
Expand All @@ -60,7 +60,7 @@ jobs:
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner

- name: Install Dotnet coverage
shell: powershell
run: |
Expand All @@ -76,7 +76,7 @@ jobs:
dotnet build
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

- name: Build test project
run: dotnet build .\Substrate.NET.Metadata.Tests

Expand Down
4 changes: 2 additions & 2 deletions Substrate.NET.Metadata.Tests/MetadataServiceV10Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public void MetadataV10_V1039_And_V1040_PalletHasChanged_ShouldSucceed()
var metadataSource = readMetadataFromFile("V10\\MetadataV10_Kusama_1039");
var metadataDestination = readMetadataFromFile("V10\\MetadataV10_Kusama_1040");

Assert.IsFalse(_metadataService.HasPalletChangedVersionBetween("Society", metadataSource, metadataDestination));
Assert.IsFalse(_metadataService.HasPalletChangedVersionBetween("Balances", metadataSource, metadataDestination));
Assert.That(_metadataService.HasPalletChangedVersionBetween("Society", metadataSource, metadataDestination), Is.False);
Assert.That(_metadataService.HasPalletChangedVersionBetween("Balances", metadataSource, metadataDestination), Is.False);
}
}
}
4 changes: 2 additions & 2 deletions Substrate.NET.Metadata.Tests/MetadataServiceV11Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ public void MetadataV11_V23_And_V24_PalletHasChanged_ShouldSucceed()
var metadataSource = readMetadataFromFile("V11\\MetadataV11_23");
var metadataDestination = readMetadataFromFile("V11\\MetadataV11_24");

Assert.IsTrue(_metadataService.HasPalletChangedVersionBetween("Multisig", metadataSource, metadataDestination));
Assert.That(_metadataService.HasPalletChangedVersionBetween("Multisig", metadataSource, metadataDestination), Is.True);

// Purschase has been removed, but does not count as changed
Assert.IsFalse(_metadataService.HasPalletChangedVersionBetween("Purchase", metadataSource, metadataDestination));
Assert.That(_metadataService.HasPalletChangedVersionBetween("Purchase", metadataSource, metadataDestination), Is.False);
}
}
}
22 changes: 11 additions & 11 deletions Substrate.NET.Metadata.Tests/MetadataServiceV12Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void MetadataV12_SpecVersionCompare_V27_And_V28_ShouldSucceed()
Assert.That(changedModules[0].ModuleName, Is.EqualTo("Babe"));
Assert.That(changedModules[0].Storage.First().Item2.status, Is.EqualTo(CompareStatus.Added));
Assert.That(changedModules[0].Storage.First().Item2.storage.Name.Value, Is.EqualTo("NextAuthorities"));
Assert.IsTrue(changedModules[0].HasStorageAdded("NextAuthorities"));
Assert.That(changedModules[0].HasStorageAdded("NextAuthorities"), Is.True);

// Now let's test ElectionsPhragmen which changed a lot
var electionPhragmenModule = changedModules[1];
Expand All @@ -53,40 +53,40 @@ public void MetadataV12_SpecVersionCompare_V27_And_V28_ShouldSucceed()
var electionPhragmenCalls = electionPhragmenModule.Calls.ToList();
Assert.That(electionPhragmenCalls[0].Item1, Is.EqualTo(CompareStatus.Added));
Assert.That(electionPhragmenCalls[0].Item2.Name.Value, Is.EqualTo("clean_defunct_voters"));
Assert.IsTrue(electionPhragmenModule.HasCallAdded("clean_defunct_voters"));
Assert.That(electionPhragmenModule.HasCallAdded("clean_defunct_voters"), Is.True);

Assert.That(electionPhragmenCalls[1].Item1, Is.EqualTo(CompareStatus.Removed));
Assert.That(electionPhragmenCalls[1].Item2.Name.Value, Is.EqualTo("report_defunct_voter"));
Assert.IsTrue(electionPhragmenModule.HasCallRemoved("report_defunct_voter"));
Assert.That(electionPhragmenModule.HasCallRemoved("report_defunct_voter"), Is.True);

var electionPhragmenConstants = electionPhragmenModule.Constants.ToList();
Assert.That(electionPhragmenConstants[0].Item1, Is.EqualTo(CompareStatus.Added));
Assert.That(electionPhragmenConstants[0].Item2.Name.Value, Is.EqualTo("VotingBondBase"));
Assert.IsTrue(electionPhragmenModule.HasConstantAdded("VotingBondBase"));
Assert.That(electionPhragmenModule.HasConstantAdded("VotingBondBase"), Is.True);

Assert.That(electionPhragmenConstants[1].Item1, Is.EqualTo(CompareStatus.Added));
Assert.That(electionPhragmenConstants[1].Item2.Name.Value, Is.EqualTo("VotingBondFactor"));

Assert.That(electionPhragmenConstants[2].Item1, Is.EqualTo(CompareStatus.Removed));
Assert.That(electionPhragmenConstants[2].Item2.Name.Value, Is.EqualTo("VotingBond"));
Assert.IsTrue(electionPhragmenModule.HasConstantRemoved("VotingBond"));
Assert.That(electionPhragmenModule.HasConstantRemoved("VotingBond"), Is.True);

var electionPhragmenEvents = electionPhragmenModule.Events.ToList();
Assert.That(electionPhragmenEvents[0].Item1, Is.EqualTo(CompareStatus.Added));
Assert.That(electionPhragmenEvents[0].Item2.Name.Value, Is.EqualTo("Renounced"));
Assert.IsTrue(electionPhragmenModule.HasEventAdded("Renounced"));
Assert.That(electionPhragmenModule.HasEventAdded("Renounced"), Is.True);

Assert.That(electionPhragmenEvents[1].Item1, Is.EqualTo(CompareStatus.Removed));
Assert.That(electionPhragmenEvents[1].Item2.Name.Value, Is.EqualTo("MemberRenounced"));
Assert.IsTrue(electionPhragmenModule.HasEventRemoved("MemberRenounced"));
Assert.That(electionPhragmenModule.HasEventRemoved("MemberRenounced"), Is.True);

Assert.That(electionPhragmenEvents[2].Item1, Is.EqualTo(CompareStatus.Removed));
Assert.That(electionPhragmenEvents[2].Item2.Name.Value, Is.EqualTo("VoterReported"));

var electionPhragmenErrors = electionPhragmenModule.Errors.ToList();
Assert.That(electionPhragmenErrors[0].Item1, Is.EqualTo(CompareStatus.Added));
Assert.That(electionPhragmenErrors[0].Item2.Name.Value, Is.EqualTo("RunnerUpSubmit"));
Assert.IsTrue(electionPhragmenModule.HasErrorAdded("RunnerUpSubmit"));
Assert.That(electionPhragmenModule.HasErrorAdded("RunnerUpSubmit"), Is.True);

Assert.That(electionPhragmenErrors[1].Item1, Is.EqualTo(CompareStatus.Added));
Assert.That(electionPhragmenErrors[1].Item2.Name.Value, Is.EqualTo("InvalidWitnessData"));
Expand All @@ -96,7 +96,7 @@ public void MetadataV12_SpecVersionCompare_V27_And_V28_ShouldSucceed()

Assert.That(electionPhragmenErrors[3].Item1, Is.EqualTo(CompareStatus.Removed));
Assert.That(electionPhragmenErrors[3].Item2.Name.Value, Is.EqualTo("InvalidCandidateCount"));
Assert.IsTrue(electionPhragmenModule.HasErrorRemoved("InvalidCandidateCount"));
Assert.That(electionPhragmenModule.HasErrorRemoved("InvalidCandidateCount"), Is.True);
}

[Test]
Expand All @@ -105,9 +105,9 @@ public void MetadataV12_V27_And_V28_PalletHasChanged_ShouldSucceed()
var metadataSource = readMetadataFromFile("V12\\MetadataV12_27");
var metadataDestination = readMetadataFromFile("V12\\MetadataV12_28");

Assert.IsTrue(_metadataService.HasPalletChangedVersionBetween("ElectionsPhragmen", metadataSource, metadataDestination));
Assert.That(_metadataService.HasPalletChangedVersionBetween("ElectionsPhragmen", metadataSource, metadataDestination), Is.True);

Assert.IsFalse(_metadataService.HasPalletChangedVersionBetween("Balances", metadataSource, metadataDestination));
Assert.That(_metadataService.HasPalletChangedVersionBetween("Balances", metadataSource, metadataDestination), Is.False);
}
}
}
18 changes: 9 additions & 9 deletions Substrate.NET.Metadata.Tests/MetadataServiceV13Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ public void MetadataV13_SpecVersionCompare_V9080_And_V9090_ShouldSucceed()
var changedModules = res.ChangedModules.ToList();

Assert.That(changedModules[0].ModuleName, Is.EqualTo("Authorship"));
Assert.IsTrue(changedModules[0].HasConstantAdded("UncleGenerations"));
Assert.That(changedModules[0].HasConstantAdded("UncleGenerations"), Is.True);

Assert.That(changedModules[1].ModuleName, Is.EqualTo("Balances"));
Assert.IsTrue(changedModules[1].HasConstantAdded("MaxLocks"));
Assert.IsTrue(changedModules[1].HasConstantAdded("MaxReserves"));
Assert.That(changedModules[1].HasConstantAdded("MaxLocks"), Is.True);
Assert.That(changedModules[1].HasConstantAdded("MaxReserves"), Is.True);

Assert.That(changedModules[2].ModuleName, Is.EqualTo("Democracy"));
Assert.That(changedModules[2].Constants.Count(), Is.EqualTo(2));
Assert.IsTrue(changedModules[2].HasConstantAdded("InstantAllowed"));
Assert.IsTrue(changedModules[2].HasConstantAdded("MaxProposals"));
Assert.That(changedModules[2].HasConstantAdded("InstantAllowed"), Is.True);
Assert.That(changedModules[2].HasConstantAdded("MaxProposals"), Is.True);
Assert.That(changedModules[2].Errors.Count(), Is.EqualTo(5));
Assert.IsFalse(changedModules[2].HasErrorAdded("test"));
Assert.IsFalse(changedModules[2].HasErrorRemoved("test2"));
Assert.That(changedModules[2].HasErrorAdded("test"), Is.False);
Assert.That(changedModules[2].HasErrorRemoved("test2"), Is.False);
}

[Test]
Expand All @@ -51,8 +51,8 @@ public void MetadataV13_V9080_And_V9090_PalletHasChanged_ShouldSucceed()
var metadataSource = readMetadataFromFile("V13\\MetadataV13_9080");
var metadataDestination = readMetadataFromFile("V13\\MetadataV13_9090");

Assert.IsTrue(_metadataService.HasPalletChangedVersionBetween("Balances", metadataSource, metadataDestination));
Assert.IsFalse(_metadataService.HasPalletChangedVersionBetween("Babe", metadataSource, metadataDestination));
Assert.That(_metadataService.HasPalletChangedVersionBetween("Balances", metadataSource, metadataDestination), Is.True);
Assert.That(_metadataService.HasPalletChangedVersionBetween("Babe", metadataSource, metadataDestination), Is.False);
}
}
}
20 changes: 10 additions & 10 deletions Substrate.NET.Metadata.Tests/MetadataServiceV14Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public void MetadataV14_SpecVersionCompare_V9370_And_V9420_ShouldSucceed()

Assert.That(res, Is.Not.Null);

Assert.IsTrue(res.AddedModules.Any(x => x.ModuleName == "ConvictionVoting"));
Assert.IsTrue(res.AddedModules.Any(x => x.ModuleName == "Referenda"));
Assert.IsTrue(res.AddedModules.Any(x => x.ModuleName == "Whitelist"));
Assert.That(res.AddedModules.Any(x => x.ModuleName == "ConvictionVoting"), Is.True);
Assert.That(res.AddedModules.Any(x => x.ModuleName == "Referenda"), Is.True);
Assert.That(res.AddedModules.Any(x => x.ModuleName == "Whitelist"), Is.True);

// Some basic other assertions on Balance pallet I checked with file compare
var palletBalance = res.ChangedModules.FirstOrDefault(x => x.ModuleName == "Balances");
Expand All @@ -69,12 +69,12 @@ public void MetadataV14_SpecVersionCompare_V9370_And_V9420_ShouldSucceed()
// Some calls has been added and one has been removed
var callsMethodChanged = palletBalance.Calls.LookupDifferentialType.TypeVariant.Elems;
Assert.That(callsMethodChanged.Count(), Is.GreaterThan(1));
Assert.IsTrue(callsMethodChanged.Any(x => x.Item1 == CompareStatus.Added && x.Item2.Name.Value == "set_balance_deprecated"));
Assert.IsTrue(callsMethodChanged.Any(x => x.Item1 == CompareStatus.Removed && x.Item2.Name.Value == "set_balance"));
Assert.That(callsMethodChanged.Any(x => x.Item1 == CompareStatus.Added && x.Item2.Name.Value == "set_balance_deprecated"), Is.True);
Assert.That(callsMethodChanged.Any(x => x.Item1 == CompareStatus.Removed && x.Item2.Name.Value == "set_balance"), Is.True);

Assert.IsTrue(callsMethodChanged.Any(x => x.Item1 == CompareStatus.Added && x.Item2.Name.Value == "transfer_allow_death"));
Assert.IsTrue(callsMethodChanged.Any(x => x.Item1 == CompareStatus.Added && x.Item2.Name.Value == "set_balance_deprecated"));
Assert.IsTrue(callsMethodChanged.Any(x => x.Item1 == CompareStatus.Added && x.Item2.Name.Value == "force_set_balance"));
Assert.That(callsMethodChanged.Any(x => x.Item1 == CompareStatus.Added && x.Item2.Name.Value == "transfer_allow_death"), Is.True);
Assert.That(callsMethodChanged.Any(x => x.Item1 == CompareStatus.Added && x.Item2.Name.Value == "set_balance_deprecated"), Is.True);
Assert.That(callsMethodChanged.Any(x => x.Item1 == CompareStatus.Added && x.Item2.Name.Value == "force_set_balance"), Is.True);

var upgradeAccounts = callsMethodChanged.FirstOrDefault(x => x.Item1 == CompareStatus.Added && x.Item2.Name.Value == "upgrade_accounts");
Assert.That(upgradeAccounts.Item2.VariantFields.Value.Count(), Is.EqualTo(1));
Expand Down Expand Up @@ -105,9 +105,9 @@ public void MetadataV14_V9270_And_V9280_PalletHasChanged_ShouldSucceed()
var metadataSource = readMetadataFromFile("V14\\MetadataV14_9270");
var metadataDestination = readMetadataFromFile("V14\\MetadataV14_9280");

Assert.IsTrue(_metadataService.HasPalletChangedVersionBetween("Auctions", metadataSource, metadataDestination));
Assert.That(_metadataService.HasPalletChangedVersionBetween("Auctions", metadataSource, metadataDestination), Is.True);

Assert.IsFalse(_metadataService.HasPalletChangedVersionBetween("AuthorityDiscovery", metadataSource, metadataDestination));
Assert.That(_metadataService.HasPalletChangedVersionBetween("AuthorityDiscovery", metadataSource, metadataDestination), Is.False);
}
}
}
4 changes: 2 additions & 2 deletions Substrate.NET.Metadata.Tests/MetadataServiceV9Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public void MetadataV9_V1020_And_V1022_PalletHasChanged_ShouldSucceed()
var metadataSource = readMetadataFromFile("V9\\MetadataV9_Kusama_1020");
var metadataDestination = readMetadataFromFile("V9\\MetadataV9_Kusama_1022");

Assert.IsTrue(_metadataService.HasPalletChangedVersionBetween("Democracy", metadataSource, metadataDestination));
Assert.IsFalse(_metadataService.HasPalletChangedVersionBetween("Balances", metadataSource, metadataDestination));
Assert.That(_metadataService.HasPalletChangedVersionBetween("Democracy", metadataSource, metadataDestination), Is.True);
Assert.That(_metadataService.HasPalletChangedVersionBetween("Balances", metadataSource, metadataDestination), Is.False);
}
}
}
18 changes: 12 additions & 6 deletions Substrate.NET.Metadata.Tests/Substrate.NET.Metadata.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.5.0" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
<PackageReference Include="Substrate.NET.API" Version="0.9.7" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Substrate.NET.API" Version="0.9.20" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Substrate.NET.Metadata/Substrate.NET.Metadata.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Ardalis.GuardClauses" Version="4.0.1" />
<PackageReference Include="Substrate.NET.API" Version="0.9.7" />
<PackageReference Include="Ardalis.GuardClauses" Version="4.5.0" />
<PackageReference Include="Substrate.NET.API" Version="0.9.20" />

<None Include="../README.md" Pack="true" PackagePath="\" />
<None Include="../LICENSE" Pack="true" PackagePath="\" />
Expand Down
Loading