Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2647634
:construction_worker: Adding CU measurement
notdanilo Aug 13, 2025
90cb409
:white_check_mark: Adding CU measurement in tests
notdanilo Aug 21, 2025
c06c062
:white_check_mark: Making entities/components unique in the tests
notdanilo Aug 21, 2025
e51e18c
:white_check_mark: Profiling system with 1 to 10 components
notdanilo Aug 29, 2025
dcd64c8
:rotating_light: Fixing linter warnings
notdanilo Sep 8, 2025
f07cb91
:construction_worker: Adding CU measurement
notdanilo Aug 13, 2025
958c4d8
:construction: WIP - System directly updates components
notdanilo Aug 6, 2025
e24e8fd
:construction: on-chain component serialization
notdanilo Aug 7, 2025
211e9e6
:recycle: Authority & Session checks
notdanilo Aug 13, 2025
28c85ff
:recycle: Updating C# client
notdanilo Aug 13, 2025
a24e970
:fire: Removing unnecessary test
notdanilo Aug 13, 2025
9545726
:bug: Fixing authority account mutability
notdanilo Aug 13, 2025
fcb15c9
:fire: Removing CU test for whitelisting
notdanilo Aug 13, 2025
04db04f
:recycle: Hardcoding known CPI Auth PDA
notdanilo Aug 14, 2025
bc815be
:recycle: Small optimizations
notdanilo Aug 14, 2025
6efa277
:rotating_light: Fixing linter warnings
notdanilo Aug 14, 2025
2503df1
:fire: Removing debug print
notdanilo Aug 14, 2025
5da16b8
:memo: Adding docs about CPI Auth PDA seeds
notdanilo Aug 18, 2025
4723611
:bug: Fixed case where the same component is used more than once in t…
notdanilo Aug 21, 2025
32506aa
:recycle: Optimizing apply_impl with less Vecs
notdanilo Aug 28, 2025
229db62
:white_check_mark: Fixing systems and report function
notdanilo Aug 29, 2025
699061e
:construction: Buffer & Component delegation
notdanilo Sep 8, 2025
466b0b2
:construction: Unifying Buffer & Component delegation instruction
notdanilo Sep 8, 2025
bf0cf12
:recycle: TS&C# Unified Buffer & Component delegation instruction
notdanilo Sep 8, 2025
b0d65fa
:rotating_light: Fixing linter warnings
notdanilo Sep 8, 2025
ef6d123
:recycle: Getting rid of Anchor's CPI
notdanilo Sep 10, 2025
ab1f59b
:rotating_light: Fixing linter
notdanilo Sep 10, 2025
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
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ which = "^7"
tokio = { version = "^1", features = ["full"] }
sysinfo = "^0"
bytemuck_derive = "^1"
sha2 = { version = "^0.10" }

[profile.release]
overflow-checks = true
Expand Down
13 changes: 9 additions & 4 deletions clients/csharp/Solana.Unity.Bolt.Test/AccelerationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ await Profiler.Run("InitializePositionComponentOnAccelerationEntity", async () =
await Profiler.Run("DelegateComponent", async () => {
await DelegateComponent(framework);
});
// TODO: Re-enable this test when ephemeral-validator is properly installed on the CI.
// await Profiler.Run("ApplySimpleMovementSystemOnAccelerator 10", async () => {
// await ApplySimpleMovementSystemOnAccelerator(framework);
// });
await Profiler.Run("ApplySimpleMovementSystemOnAccelerator 10", async () => {
if (Environment.GetEnvironmentVariable("GITHUB_ACTIONS") != null) {
return;
}
await ApplySimpleMovementSystemOnAccelerator(framework);
});
}

public static async Task AddAccelerationEntity(Framework framework) {
Expand All @@ -47,10 +49,13 @@ public static async Task DelegateComponent(Framework framework) {
public static async Task ApplySimpleMovementSystemOnAccelerator(Framework framework) {
for (int i = 0; i < 10; i++) {
var apply = new ApplyAccounts() {
CpiAuth = WorldProgram.FindCpiAuthPda(),
Authority = framework.Wallet.Account.PublicKey,
BoltSystem = framework.SystemSimpleMovement,
World = framework.WorldPda,
Buffer = WorldProgram.FindBufferPda(framework.AccelerationComponentPositionPda)
};

var instruction = WorldProgram.Apply(apply, Bolt.World.SerializeArgs(new { direction = "Up" }));
instruction.Keys.Add(AccountMeta.ReadOnly(framework.ExampleComponentPosition, false));
instruction.Keys.Add(AccountMeta.Writable(framework.AccelerationComponentPositionPda, false));
Expand Down
2 changes: 2 additions & 0 deletions clients/csharp/Solana.Unity.Bolt.Test/ECSTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ public static async Task CheckPositionOnEntity1IsDefault(Framework framework) {

public static async Task ApplySimpleMovementSystemUpOnEntity1(Framework framework) {
var apply = new ApplyAccounts() {
CpiAuth = WorldProgram.FindCpiAuthPda(),
Authority = framework.Wallet.Account.PublicKey,
BoltSystem = framework.SystemSimpleMovement,
World = framework.WorldPda,
Buffer = WorldProgram.FindBufferPda(framework.ComponentPositionEntity1Pda),
};
var instruction = WorldProgram.Apply(apply, Bolt.World.SerializeArgs(new { direction = "Up" }));
instruction.Keys.Add(AccountMeta.ReadOnly(framework.ExampleComponentPosition, false));
Expand Down
3 changes: 2 additions & 1 deletion clients/csharp/Solana.Unity.Bolt.Test/Framework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public async Task<string> SendAndConfirmInstruction(IRpcClient client, Transacti
.AddInstruction(instruction)
.Build(signers);

var signature = await client.SendTransactionAsync(transaction, true, Commitment.Processed);
var signature = await client.SendTransactionAsync(transaction, false, Commitment.Processed);
var confirmed = await client.ConfirmTransaction(signature.Result, Commitment.Processed);
if (signature.WasSuccessful && confirmed)
{
Expand All @@ -107,6 +107,7 @@ public async Task<string> SendAndConfirmInstruction(IRpcClient client, Transacti
if (signature.ErrorData != null) {
errorMessage += "\n" + string.Join("\n", signature.ErrorData.Logs);
}
Console.WriteLine(errorMessage);
throw new Exception(errorMessage);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ public class DelegateComponentInstruction {
}

public static async Task<DelegateComponentInstruction> DelegateComponent(PublicKey payer, PublicKey entity, PublicKey componentId, string seed = "") {
var account = WorldProgram.FindComponentPda(componentId, entity, seed);
var bufferPda = WorldProgram.FindBufferPda(account, componentId);
var delegationRecord = WorldProgram.FindDelegationProgramPda("delegation", account);
var delegationMetadata = WorldProgram.FindDelegationProgramPda("delegation-metadata", account);
var componentPda = WorldProgram.FindComponentPda(componentId, entity, seed);
var componentBuffer = WorldProgram.FindBufferPda(componentPda);

byte[] discriminator = new byte[] { 90, 147, 75, 178, 85, 88, 4, 137 };
var componentDelegationRecord = WorldProgram.FindDelegationProgramPda("delegation", componentPda);
var componentDelegationMetadata = WorldProgram.FindDelegationProgramPda("delegation-metadata", componentPda);

var worldProgram = new PublicKey(WorldProgram.ID);
var bufferDelegationRecord = WorldProgram.FindDelegationProgramPda("delegation", componentBuffer);
var bufferDelegationMetadata = WorldProgram.FindDelegationProgramPda("delegation-metadata", componentBuffer);
var bufferBuffer = WorldProgram.FindBufferPda(componentBuffer, worldProgram);

byte[] discriminator = new byte[] { 191, 212, 179, 193, 178, 94, 119, 93 };
uint commitFrequencyMs = 0;
byte[] commitFrequencyBytes = BitConverter.GetBytes(commitFrequencyMs);
if (!BitConverter.IsLittleEndian) Array.Reverse(commitFrequencyBytes);
Expand All @@ -38,22 +44,27 @@ public static async Task<DelegateComponentInstruction> DelegateComponent(PublicK
Array.Copy(validator, 0, data, discriminator.Length + commitFrequencyBytes.Length, validator.Length);

TransactionInstruction instruction = new TransactionInstruction() {
ProgramId = componentId,
ProgramId = new PublicKey(WorldProgram.ID),
Keys = new List<AccountMeta>() {
AccountMeta.ReadOnly(payer, true),
AccountMeta.ReadOnly(entity, false),
AccountMeta.Writable(account, false),
AccountMeta.Writable(payer, true),
AccountMeta.Writable(componentPda, false),
AccountMeta.Writable(componentBuffer, false),
AccountMeta.ReadOnly(componentId, false),
AccountMeta.Writable(bufferPda, false),
AccountMeta.Writable(delegationRecord, false),
AccountMeta.Writable(delegationMetadata, false),
AccountMeta.Writable(WorldProgram.FindBufferPda(componentPda, componentId), false),
AccountMeta.Writable(componentDelegationRecord, false),
AccountMeta.Writable(componentDelegationMetadata, false),
AccountMeta.ReadOnly(WorldProgram.DelegationProgram, false),
AccountMeta.ReadOnly(SystemProgram.ProgramIdKey, false),
AccountMeta.ReadOnly(entity, false),
AccountMeta.ReadOnly(worldProgram, false),
AccountMeta.Writable(bufferBuffer, false),
AccountMeta.Writable(bufferDelegationRecord, false),
AccountMeta.Writable(bufferDelegationMetadata, false),
},
Data = data,
};
return new DelegateComponentInstruction() {
Pda = WorldProgram.FindDelegationProgramPda(seed, entity),
Pda = componentPda,
Instruction = instruction,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static async Task<DestroyComponentInstruction> DestroyComponent(PublicKey
public static async Task<DestroyComponentInstruction> DestroyComponent(PublicKey authority, PublicKey receiver, PublicKey entity, PublicKey componentProgram, PublicKey componentPda) {
var componentProgramData = WorldProgram.FindComponentProgramDataPda(componentProgram);
var destroyComponent = new DestroyComponentAccounts() {
CpiAuth = WorldProgram.FindCpiAuthPda(),
Authority = authority,
Receiver = receiver,
Entity = entity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ public static async Task<InitializeComponentInstruction> InitializeComponent(Pub

public static async Task<InitializeComponentInstruction> InitializeComponent(PublicKey payer, PublicKey entity, PublicKey componentId, PublicKey componentPda, PublicKey authority = null) {
var initializeComponent = new InitializeComponentAccounts() {
CpiAuth = WorldProgram.FindCpiAuthPda(),
Payer = payer,
Entity = entity,
Data = componentPda,
ComponentProgram = componentId,
Authority = authority ?? new PublicKey(WorldProgram.ID)
Authority = authority ?? new PublicKey(WorldProgram.ID),
Buffer = WorldProgram.FindBufferPda(componentPda)
};
var instruction = WorldProgram.InitializeComponent(initializeComponent);
return new InitializeComponentInstruction() {
Expand Down
Loading