Explorar el Código

:white_check_mark: Making C# test faster (#150)

Danilo Guanabara hace 7 meses
padre
commit
62996e880c

+ 4 - 4
Anchor.toml

@@ -37,11 +37,11 @@ members = [
 
 [scripts]
 test = """
-echo "Waiting for 2 seconds..."
-sleep 2
+echo "Waiting for 5 seconds..."
+sleep 5
 yarn run ts-mocha -p ./tsconfig.json -t 1000000 clients/typescript/test/main.ts
-cd clients/csharp
-dotnet test
+cd clients/csharp/Solana.Unity.Bolt.Test
+dotnet run --configuration Release
 """
 
 [test]

+ 0 - 2
clients/csharp/Solana.Unity.Bolt.Test/.gitignore

@@ -1,2 +0,0 @@
-bin
-obj

+ 52 - 29
clients/csharp/Solana.Unity.Bolt.Test/ECSTest.cs

@@ -1,5 +1,3 @@
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Solana.Unity.Bolt.Test;
 using Solana.Unity.Rpc.Models;
 using Solana.Unity.Wallet;
@@ -9,43 +7,68 @@ using System;
 using System.Threading.Tasks;
 using Solana.Unity.Wallet.Bip39;
 using World.Program;
-
+using System.Diagnostics;
+using Solana.Unity.Rpc.Types;
 namespace ECSTest {
     public class Test {
         public static async Task Run(Framework framework) {
-            await AddEntity1(framework);
-            await AddEntity2(framework);
-            await AddEntity3(framework);
-            await AddEntity4WithSeed(framework);
-            await InitializeVelocityComponentOnEntity1WithSeed(framework);
-            await InitializePositionComponentOnEntity1(framework);
-            await InitializePositionComponentOnEntity2(framework);
-            await InitializePositionComponentOnEntity4(framework);
-            await CheckPositionOnEntity1IsDefault(framework);
-            await ApplySimpleMovementSystemUpOnEntity1(framework);
-            await ApplySimpleMovementSystemRightOnEntity1(framework);
-            await DestroyVelocityComponentOnEntity1(framework);
+            await Profiler.Run("AddEntity1", async () => {
+                await AddEntity1(framework);
+            });
+            await Profiler.Run("AddEntity2", async () => {
+                await AddEntity2(framework);
+            });
+            await Profiler.Run("AddEntity3", async () => {
+                await AddEntity3(framework);
+            });
+            await Profiler.Run("AddEntity4WithSeed", async () => {
+                await AddEntity4WithSeed(framework);
+            });
+            await Profiler.Run("InitializeVelocityComponentOnEntity1WithSeed", async () => {
+                await InitializeVelocityComponentOnEntity1WithSeed(framework);
+            });
+            await Profiler.Run("InitializePositionComponentOnEntity1", async () => {
+                await InitializePositionComponentOnEntity1(framework);
+            });
+            await Profiler.Run("InitializePositionComponentOnEntity2", async () => {
+                await InitializePositionComponentOnEntity2(framework);
+            });
+            await Profiler.Run("InitializePositionComponentOnEntity4", async () => {
+                await InitializePositionComponentOnEntity4(framework);
+            });
+            await Profiler.Run("CheckPositionOnEntity1IsDefault", async () => {
+                await CheckPositionOnEntity1IsDefault(framework);
+            });
+            await Profiler.Run("ApplySimpleMovementSystemUpOnEntity1", async () => {
+                await ApplySimpleMovementSystemUpOnEntity1(framework);
+            });
+            await Profiler.Run("ApplySimpleMovementSystemRightOnEntity1", async () => {
+                await ApplySimpleMovementSystemRightOnEntity1(framework);
+            });
+            await Profiler.Run("DestroyVelocityComponentOnEntity1", async () => {
+                await DestroyVelocityComponentOnEntity1(framework);
+            });
         }
 
         public static async Task AddEntity1(Framework framework) {
-            var addEntity = await Bolt.World.AddEntity(framework.Client, framework.WorldPda, framework.Wallet.Account.PublicKey);
+            var addEntity = await Bolt.World.AddEntity(framework.Client, framework.WorldPda, framework.Wallet.Account.PublicKey, Commitment.Processed);
             framework.Entity1Pda = addEntity.Pda;
             await framework.SendAndConfirmInstruction(addEntity.Instruction);
         }
         
         public static async Task AddEntity2(Framework framework) {
-            var addEntity = await Bolt.World.AddEntity(framework.Client, framework.WorldPda, framework.Wallet.Account.PublicKey);
+            var addEntity = await Bolt.World.AddEntity(framework.Client, framework.WorldPda, framework.Wallet.Account.PublicKey, Commitment.Processed);
             framework.Entity2Pda = addEntity.Pda;
             await framework.SendAndConfirmInstruction(addEntity.Instruction);
         }
 
         public static async Task AddEntity3(Framework framework) {
-            var addEntity = await Bolt.World.AddEntity(framework.Client, framework.WorldPda, framework.Wallet.Account.PublicKey);
+            var addEntity = await Bolt.World.AddEntity(framework.Client, framework.WorldPda, framework.Wallet.Account.PublicKey, Commitment.Processed);
             await framework.SendAndConfirmInstruction(addEntity.Instruction);
         }
 
         public static async Task AddEntity4WithSeed(Framework framework) {
-            var addEntity = await Bolt.World.AddEntity(framework.Client, framework.WorldPda, framework.Wallet.Account.PublicKey, "custom-seed");
+            var addEntity = await Bolt.World.AddEntity(framework.Client, framework.WorldPda, framework.Wallet.Account.PublicKey, "custom-seed", Commitment.Processed);
             framework.Entity4Pda = addEntity.Pda;
             await framework.SendAndConfirmInstruction(addEntity.Instruction);
         }
@@ -78,9 +101,9 @@ namespace ECSTest {
             var accountInfo = await framework.GetAccountInfo(framework.ComponentPositionEntity1Pda);
             var data = Convert.FromBase64String(accountInfo.Data[0]);
             var position = Position.Accounts.Position.Deserialize(data);
-            Assert.AreEqual(0, position.X);
-            Assert.AreEqual(0, position.Y);
-            Assert.AreEqual(0, position.Z);
+            Debug.Assert(0 == position.X, "X is not equal to 0");
+            Debug.Assert(0 == position.Y, "Y is not equal to 0");
+            Debug.Assert(0 == position.Z, "Z is not equal to 0");
         }
 
         public static async Task ApplySimpleMovementSystemUpOnEntity1(Framework framework) {
@@ -97,9 +120,9 @@ namespace ECSTest {
             var accountInfo = await framework.GetAccountInfo(framework.ComponentPositionEntity1Pda);
             var data = Convert.FromBase64String(accountInfo.Data[0]);
             var position = Position.Accounts.Position.Deserialize(data);
-            Assert.AreEqual(0, position.X);
-            Assert.AreEqual(1, position.Y);
-            Assert.AreEqual(0, position.Z);
+            Debug.Assert(0 == position.X, "X is not equal to 0");
+            Debug.Assert(1 == position.Y, "Y is not equal to 1");
+            Debug.Assert(0 == position.Z, "Z is not equal to 0");
         }
 
         public static async Task ApplySimpleMovementSystemRightOnEntity1(Framework framework) {
@@ -117,9 +140,9 @@ namespace ECSTest {
             var accountInfo = await framework.GetAccountInfo(framework.ComponentPositionEntity1Pda);
             var data = Convert.FromBase64String(accountInfo.Data[0]);
             var position = Position.Accounts.Position.Deserialize(data);
-            Assert.AreEqual(1, position.X);
-            Assert.AreEqual(1, position.Y);
-            Assert.AreEqual(0, position.Z);
+            Debug.Assert(1 == position.X, "X is not equal to 1");
+            Debug.Assert(1 == position.Y, "Y is not equal to 1");
+            Debug.Assert(0 == position.Z, "Z is not equal to 0");
         }
 
         public static async Task DestroyVelocityComponentOnEntity1(Framework framework) {
@@ -131,7 +154,7 @@ namespace ECSTest {
             await framework.SendAndConfirmInstruction(destroyComponent.Instruction);
 
             var receiverBalance = await framework.Client.GetBalanceAsync(receiver.Account.PublicKey);
-            Assert.AreEqual(componentBalance.Result.Value, receiverBalance.Result.Value);
+            Debug.Assert(componentBalance.Result.Value == receiverBalance.Result.Value, "Component balance is not equal to receiver balance");
         }
    }
 }

+ 22 - 14
clients/csharp/Solana.Unity.Bolt.Test/Framework.cs

@@ -1,4 +1,9 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+#pragma warning disable CS8600
+#pragma warning disable CS8604
+#pragma warning disable CS8618
+#pragma warning disable CS8603
+#pragma warning disable CS8625
+
 using Solana.Unity.Wallet;
 using Solana.Unity.Bolt;
 using Solana.Unity.Rpc;
@@ -11,6 +16,8 @@ using Solana.Unity.Programs;
 using Solana.Unity.Rpc.Builders;
 using System.Threading.Tasks.Dataflow;
 using System.Collections.Generic;
+using System.Diagnostics;
+using Solana.Unity.Rpc.Types;
 
 namespace Solana.Unity.Bolt.Test
 {
@@ -36,14 +43,12 @@ namespace Solana.Unity.Bolt.Test
         public PublicKey Entity1Pda { get; set; }
         public PublicKey Entity2Pda { get; set; }
         public PublicKey Entity4Pda { get; set; }
-
         public PublicKey ExampleComponentPosition { get; set; }
         public PublicKey ExampleComponentVelocity { get; set; }
         public PublicKey ComponentPositionEntity1Pda { get; set; }
         public PublicKey ComponentVelocityEntity1Pda { get; set; }
         public PublicKey ComponentPositionEntity2Pda { get; set; }
         public PublicKey ComponentPositionEntity4Pda { get; set; }
-
         public PublicKey SystemSimpleMovement { get; set; }
 
         public PublicKey SessionToken { get; set; }
@@ -63,20 +68,22 @@ namespace Solana.Unity.Bolt.Test
 
         public async Task Initialize()
         {
-            var result = await Client.RequestAirdropAsync(Wallet.Account.PublicKey, 2000000000);
-            if (!result.WasSuccessful)
-            {
-                throw new Exception(result.Reason);
-            }
-            await Client.ConfirmTransaction(result.Result);
+            await Profiler.Run("RequestAirdrop", async () => {
+                var result = await Client.RequestAirdropAsync(Wallet.Account.PublicKey, 2000000000);
+                if (!result.WasSuccessful)
+                {
+                    throw new Exception(result.Reason);
+                }
+                await Client.ConfirmTransaction(result.Result, Commitment.Processed);
+            });
         }
 
-        public async Task<string> SendAndConfirmInstruction(TransactionInstruction instruction, List<Account> signers = null, PublicKey payer = null)
+        public async Task<string> SendAndConfirmInstruction(TransactionInstruction instruction, List<Account>? signers = null, PublicKey? payer = null)
         {
             if (signers == null) {
                 signers = new List<Account> { Wallet.Account };
             }
-            var blockHashResponse = await Client.GetLatestBlockHashAsync();
+            var blockHashResponse = await Client.GetLatestBlockHashAsync(Commitment.Processed);
             if (!blockHashResponse.WasSuccessful || blockHashResponse.Result?.Value?.Blockhash == null)
                 throw new Exception("Failed to get latest blockhash");
             var blockhash = blockHashResponse.Result.Value.Blockhash;
@@ -86,8 +93,9 @@ namespace Solana.Unity.Bolt.Test
                 .AddInstruction(instruction)
                 .Build(signers);
 
-            var signature = await Client.SendAndConfirmTransactionAsync(transaction);
-            if (signature.WasSuccessful)
+            var signature = await Client.SendTransactionAsync(transaction, true, Commitment.Processed);
+            var confirmed = await Client.ConfirmTransaction(signature.Result, Commitment.Processed);
+            if (signature.WasSuccessful && confirmed)
             {
                 return signature.Result;
             }
@@ -101,7 +109,7 @@ namespace Solana.Unity.Bolt.Test
 
         public async Task<AccountInfo> GetAccountInfo(PublicKey publicKey)
         {
-            var accountInfo = await Client.GetAccountInfoAsync(publicKey);
+            var accountInfo = await Client.GetAccountInfoAsync(publicKey, Commitment.Processed);
             if (accountInfo.WasSuccessful)
             {
                 return accountInfo.Result.Value;

+ 7 - 0
clients/csharp/Solana.Unity.Bolt.Test/Position.cs

@@ -1,3 +1,10 @@
+#pragma warning disable CS8600
+#pragma warning disable CS8604
+#pragma warning disable CS8618
+#pragma warning disable CS8603
+#pragma warning disable CS8625
+
+
 using System;
 using System.Collections.Generic;
 using System.Linq;

+ 12 - 0
clients/csharp/Solana.Unity.Bolt.Test/Profiler.cs

@@ -0,0 +1,12 @@
+using System.Diagnostics;
+
+public class Profiler {
+    public static async Task Run(string name, Func<Task> action) {
+        Console.Write(name);
+        var stopwatch = new Stopwatch();
+        stopwatch.Start();
+        await action();
+        stopwatch.Stop();
+        Console.WriteLine(" (" + stopwatch.ElapsedMilliseconds + "ms)");
+    }
+}

+ 6 - 10
clients/csharp/Solana.Unity.Bolt.Test/Main.cs → clients/csharp/Solana.Unity.Bolt.Test/Program.cs

@@ -1,18 +1,14 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+using System;
 using System.Threading.Tasks;
 
 namespace Solana.Unity.Bolt.Test
 {
-    
-
-    [TestClass]
-    [DoNotParallelize]
-    public class WorldClientTests
+    class Program
     {
-
-        [TestMethod]
-        public async Task Main()
+        static async Task Main(string[] args)
         {
+            Console.WriteLine("Running C# tests...");
             var framework = new Framework();
             await framework.Initialize();
             await WorldTest.Test.Run(framework);
@@ -20,4 +16,4 @@ namespace Solana.Unity.Bolt.Test
             await SessionTest.Test.Run(framework);
         }
     }
-}
+}

+ 6 - 5
clients/csharp/Solana.Unity.Bolt.Test/SessionTest.cs

@@ -1,5 +1,4 @@
 using GplSession.Program;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Solana.Unity.Bolt.Test;
 using Solana.Unity.Programs;
 using Solana.Unity.Wallet;
@@ -7,6 +6,8 @@ using System;
 using System.Collections.Generic;
 using System.Threading.Tasks;
 using World.Program;
+using System.Diagnostics;
+using Solana.Unity.Rpc.Types;
 
 namespace SessionTest {
     public class Test {
@@ -30,7 +31,7 @@ namespace SessionTest {
         }
         
         public static async Task AddEntity(Framework framework) {
-            var addEntity = await Bolt.World.AddEntity(framework.Client, framework.WorldPda, framework.SessionSigner.Account.PublicKey);
+            var addEntity = await Bolt.World.AddEntity(framework.Client, framework.WorldPda, framework.SessionSigner.Account.PublicKey, Commitment.Processed);
             framework.SessionEntityPda = addEntity.Pda;
             await framework.SendAndConfirmInstruction(addEntity.Instruction, new List<Account> { framework.SessionSigner.Account }, framework.SessionSigner.Account.PublicKey);
         }
@@ -55,9 +56,9 @@ namespace SessionTest {
             var accountInfo = await framework.GetAccountInfo(framework.SessionComponentPositionPda);
             var data = Convert.FromBase64String(accountInfo.Data[0]);
             var position = Position.Accounts.Position.Deserialize(data);
-            Assert.AreEqual(1, position.X);
-            Assert.AreEqual(0, position.Y);
-            Assert.AreEqual(0, position.Z);
+            Debug.Assert(1 == position.X, "X is not equal to 1");
+            Debug.Assert(0 == position.Y, "Y is not equal to 0");
+            Debug.Assert(0 == position.Z, "Z is not equal to 0");
         }
    }
 }

+ 14 - 31
clients/csharp/Solana.Unity.Bolt.Test/Solana.Unity.Bolt.Test.csproj

@@ -1,35 +1,18 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
 
-    <PropertyGroup>
-        <TargetFramework>net8.0</TargetFramework>
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
 
-        <IsPackable>false</IsPackable>
-    </PropertyGroup>
+  <ItemGroup>
+    <PackageReference Include="Solana.Unity.Programs" Version="2.6.1.3" />
+    <PackageReference Include="Solana.Unity.Rpc" Version="2.6.1.3" />
+    <PackageReference Include="Solana.Unity.Wallet" Version="2.6.1.3" />
+    <ProjectReference Include="..\Solana.Unity.Bolt\Solana.Unity.Bolt.csproj" />
+    
+  </ItemGroup>
 
-    <ItemGroup>
-        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
-        <PackageReference Include="Moq" Version="4.16.1" />
-        <PackageReference Include="MSTest.TestAdapter" Version="2.1.1" />
-        <PackageReference Include="MSTest.TestFramework" Version="2.1.1" />
-        <PackageReference Include="coverlet.collector" Version="1.3.0" />
-        <PackageReference Include="coverlet.msbuild" Version="3.0.3">
-            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
-            <PrivateAssets>all</PrivateAssets>
-        </PackageReference>
-        <PackageReference Include="Solana.Unity.Programs" Version="2.6.1.3" />
-        <PackageReference Include="Solana.Unity.Rpc" Version="2.6.1.3" />
-        <PackageReference Include="Solana.Unity.Wallet" Version="2.6.1.3" />
-        <PackageReference Include="System.Text.Json" Version="9.0.1" />
-    </ItemGroup>
-
-    <ItemGroup>
-        <ProjectReference Include="..\Solana.Unity.Bolt\Solana.Unity.Bolt.csproj" />
-    </ItemGroup>
-
-    <ItemGroup>
-      <None Remove="TestResults\" />
-    </ItemGroup>
-    <ItemGroup>
-      <Folder Include="TestResults\" />
-    </ItemGroup>
 </Project>

+ 6 - 0
clients/csharp/Solana.Unity.Bolt.Test/Velocity.cs

@@ -1,3 +1,9 @@
+#pragma warning disable CS8600
+#pragma warning disable CS8604
+#pragma warning disable CS8618
+#pragma warning disable CS8603
+#pragma warning disable CS8625
+
 using System;
 using System.Collections.Generic;
 using System.Linq;

+ 9 - 3
clients/csharp/Solana.Unity.Bolt.Test/WorldTest.cs

@@ -10,9 +10,15 @@ using World.Program;
 namespace WorldTest {
     public class Test {
         public static async Task Run(Framework framework) {
-            await InitializeRegistry(framework);
-            await InitializeWorld(framework);
-            await InitializeSecondWorld(framework);
+            await Profiler.Run("InitializeRegistry", async () => {
+                await InitializeRegistry(framework);
+            });
+            await Profiler.Run("InitializeWorld", async () => {
+                await InitializeWorld(framework);
+            });
+            await Profiler.Run("InitializeSecondWorld", async () => {
+                await InitializeSecondWorld(framework);
+            });
         }
 
         public static async Task InitializeRegistry(Framework framework) {

+ 26 - 2
clients/csharp/Solana.Unity.Bolt.sln

@@ -1,10 +1,10 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
+Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio Version 17
 VisualStudioVersion = 17.1.32328.378
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Solana.Unity.Bolt", "Solana.Unity.Bolt\Solana.Unity.Bolt.csproj", "{71A4300E-545E-4754-99FD-BB1CBAD40CCA}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Solana.Unity.Bolt.Test", "Solana.Unity.Bolt.Test\Solana.Unity.Bolt.Test.csproj", "{AF0C0559-8E84-48A8-98A7-F3BF5B25C659}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Solana.Unity.Bolt.Test", "Solana.Unity.Bolt.Test\Solana.Unity.Bolt.Test.csproj", "{5C707987-EBC6-43BD-854A-04CD8D81ADD8}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -52,6 +52,30 @@ Global
 		{AF0C0559-8E84-48A8-98A7-F3BF5B25C659}.Release|x64.Build.0 = Release|Any CPU
 		{AF0C0559-8E84-48A8-98A7-F3BF5B25C659}.Release|x86.ActiveCfg = Release|Any CPU
 		{AF0C0559-8E84-48A8-98A7-F3BF5B25C659}.Release|x86.Build.0 = Release|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Debug|x64.Build.0 = Debug|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Debug|x86.Build.0 = Debug|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Release|x64.ActiveCfg = Release|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Release|x64.Build.0 = Release|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Release|x86.ActiveCfg = Release|Any CPU
+		{C38D0DA5-FBB4-47C7-ADD5-4EB9C23BCF9E}.Release|x86.Build.0 = Release|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Debug|x64.Build.0 = Debug|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Debug|x86.Build.0 = Debug|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Release|Any CPU.Build.0 = Release|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Release|x64.ActiveCfg = Release|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Release|x64.Build.0 = Release|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Release|x86.ActiveCfg = Release|Any CPU
+		{5C707987-EBC6-43BD-854A-04CD8D81ADD8}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 3 - 2
clients/csharp/Solana.Unity.Bolt/WorldProgram/Bolt.cs

@@ -1,6 +1,7 @@
 #pragma warning disable CS1591
 
 using Solana.Unity.Rpc;
+using Solana.Unity.Rpc.Types;
 using Solana.Unity.Wallet;
 using System;
 using System.Threading.Tasks;
@@ -8,8 +9,8 @@ using WorldNamespace = World;
 
 namespace Bolt {
     public partial class World {
-        public static async Task<WorldNamespace.Accounts.World> GetWorld(IRpcClient client, PublicKey world) {
-            var Response = await client.GetAccountInfoAsync(world.ToString());
+        public static async Task<WorldNamespace.Accounts.World> GetWorld(IRpcClient client, PublicKey world, Commitment commitment = Commitment.Finalized) {
+            var Response = await client.GetAccountInfoAsync(world.ToString(), commitment);
             if (!Response.WasSuccessful)
             {
                 throw new Exception(string.Join("\n", Response.ErrorData.Logs));

+ 5 - 4
clients/csharp/Solana.Unity.Bolt/WorldProgram/Bolt/AddEntity.cs

@@ -2,6 +2,7 @@
 
 using Solana.Unity.Rpc;
 using Solana.Unity.Rpc.Models;
+using Solana.Unity.Rpc.Types;
 using Solana.Unity.Wallet;
 using System.Text;
 using System.Threading.Tasks;
@@ -31,8 +32,8 @@ namespace Bolt {
             };
         }
 
-        public static async Task<AddEntityInstruction> AddEntity(IRpcClient client, PublicKey world, PublicKey payer, string seed) {
-            var worldData = await GetWorld(client, world);
+        public static async Task<AddEntityInstruction> AddEntity(IRpcClient client, PublicKey world, PublicKey payer, string seed, Commitment commitment = Commitment.Finalized) {
+            var worldData = await GetWorld(client, world, commitment);
             return await AddEntity(world, payer, seed, worldData.Id);
         }
 
@@ -45,8 +46,8 @@ namespace Bolt {
             return await AddEntity(world, payer, entityPda, seed);
         }
 
-        public static async Task<AddEntityInstruction> AddEntity(IRpcClient client, PublicKey world, PublicKey payer) {
-            var worldData = await GetWorld(client, world);
+        public static async Task<AddEntityInstruction> AddEntity(IRpcClient client, PublicKey world, PublicKey payer, Commitment commitment = Commitment.Finalized) {
+            var worldData = await GetWorld(client, world, commitment);
             var entityPda = WorldProgram.FindEntityPda(worldData.Id, worldData.Entities);
             return await AddEntity(world, payer, entityPda);
         }