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

[CSDK-198] TransactionRuntime serialization #85

Merged
merged 4 commits into from
Dec 18, 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
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void GetEntityContractTest_v200()
Assert.IsNotNull(result.Entity.Package);
Assert.IsNotNull(result.Entity.MainPurse);
Assert.AreEqual("byte-code-85def61e3ee02e10a1e845cfb8e8b2d9640a18f605333158027a24ed8569d895", result.Entity.ByteCodeHash);
Assert.AreEqual(TransactionRuntime.VmCasperV1, result.Entity.EntityKind.SmartContract);
Assert.AreEqual(TransactionRuntime.VmCasperV1().ToString(), result.Entity.EntityKind.SmartContract.ToString());
Assert.AreEqual(1, result.Entity.ActionThresholds.KeyManagement);
Assert.AreEqual(1, result.Entity.ActionThresholds.Deployment);
Assert.AreEqual(1, result.Entity.ActionThresholds.UpgradeManagement);
Expand Down
13 changes: 4 additions & 9 deletions Casper.Network.SDK.Test/RPCResponses/GetTransactionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public void GetTransactionWithDeployHashTest_v200()
Assert.IsNull(result.Transaction.InitiatorAddr.AccountHash);
Assert.IsTrue(result.Transaction.Invocation is Transaction.NativeTransactionInvocation);
Assert.AreEqual(NativeEntryPoint.Transfer, (result.Transaction.Invocation as Transaction.NativeTransactionInvocation)!.Type);
Assert.AreEqual(TransactionCategory.Mint, result.Transaction.Category);
Assert.IsTrue(result.Transaction.Scheduling is StandardTransactionScheduling);
Assert.AreEqual(deploy.Approvals.Count, result.Transaction.Approvals.Count);
Assert.AreEqual(deploy.Approvals[0].Signature, result.Transaction.Approvals[0].Signature);
Expand Down Expand Up @@ -63,7 +62,6 @@ public void GetDeployWithDeployHashTest_v200()
Assert.IsNull(transaction.InitiatorAddr.AccountHash);
Assert.IsTrue(transaction.Invocation is Transaction.NativeTransactionInvocation);
Assert.AreEqual(NativeEntryPoint.Transfer, (transaction.Invocation as Transaction.NativeTransactionInvocation)!.Type);
Assert.AreEqual(TransactionCategory.Mint, transaction.Category);
Assert.IsTrue(transaction.Scheduling is StandardTransactionScheduling);
Assert.AreEqual(deploy.Approvals.Count, transaction.Approvals.Count);
Assert.AreEqual(deploy.Approvals[0].Signature, transaction.Approvals[0].Signature);
Expand Down Expand Up @@ -96,10 +94,9 @@ public void GetTransactionWithSessionTransactionTest_v200()
Assert.IsNull(transaction.InitiatorAddr.AccountHash);
Assert.IsTrue(transaction.Invocation is Transaction.SessionTransactionInvocation);
Assert.AreEqual("01020304", Hex.ToHexString((transaction.Invocation as Transaction.SessionTransactionInvocation)!.Wasm));
Assert.AreEqual(TransactionCategory.InstallUpgrade, transaction.Category);
Assert.IsTrue(transaction.Scheduling is StandardTransactionScheduling);
Assert.IsTrue(transaction.PricingMode is FixedPricingMode);
Assert.AreEqual(2, ((FixedPricingMode)transaction.PricingMode).GasPriceTolerance);
Assert.IsTrue(transaction.PricingMode is PaymentLimitedPricingMode);
Assert.AreEqual(1, ((PaymentLimitedPricingMode)transaction.PricingMode).GasPriceTolerance);
Assert.AreEqual(transactionV1.Approvals.Count, transaction.Approvals.Count);
Assert.AreEqual(transactionV1.Approvals[0].Signature, transaction.Approvals[0].Signature);

Expand Down Expand Up @@ -128,11 +125,10 @@ public void GetTransactionWithStoredTransactionTest_v200()
Assert.AreEqual(transactionV1.Payload.ChainName, transaction.ChainName);
Assert.AreEqual(transactionV1.Payload.Timestamp, transaction.Timestamp);
Assert.AreEqual(transactionV1.Payload.InitiatorAddr.AccountHash, transaction.InitiatorAddr.AccountHash);
Assert.AreEqual("account-hash-e25f0c3b986aaa1a6c85ee356be99cd320fa1f7ceaf9928a3fbd015db11f240f", transaction.InitiatorAddr.AccountHash.ToString().ToLower());
Assert.IsNull(transaction.InitiatorAddr.PublicKey);
Assert.AreEqual("01a5a5b7328118681638be3e06c8749609280dba4c9daf9aeb3d3464b8839b018a", transaction.InitiatorAddr.PublicKey.ToString().ToLower());
Assert.IsNull(transaction.InitiatorAddr.AccountHash);
Assert.IsTrue(transaction.Invocation is Transaction.StoredTransactionInvocation);
Assert.AreEqual("transfer", (transaction.Invocation as Transaction.StoredTransactionInvocation)!.EntryPoint);
Assert.AreEqual(TransactionCategory.Medium, transaction.Category);
Assert.IsTrue(transaction.Scheduling is StandardTransactionScheduling);
Assert.AreEqual(transactionV1.Approvals.Count, transaction.Approvals.Count);
Assert.AreEqual(transactionV1.Approvals[0].Signature, transaction.Approvals[0].Signature);
Expand Down Expand Up @@ -167,7 +163,6 @@ public void GetTransactionWithStoredDeployTest_v200()
Assert.IsNull(transaction.InitiatorAddr.AccountHash);
Assert.IsTrue(transaction.Invocation is Transaction.StoredTransactionInvocation);
Assert.AreEqual("transfer", (transaction.Invocation as Transaction.StoredTransactionInvocation)!.EntryPoint);
Assert.AreEqual(TransactionCategory.Large, transaction.Category);
Assert.IsTrue(transaction.Scheduling is StandardTransactionScheduling);
Assert.AreEqual(deploy.Approvals.Count, transaction.Approvals.Count);
Assert.AreEqual(deploy.Approvals[0].Signature, transaction.Approvals[0].Signature);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,35 +141,35 @@
"kind": "Identity"
},
{
"key": "message-topic-entity-contract-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1",
"key": "message-topic-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1",
"kind": "Identity"
},
{
"key": "message-entity-contract-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1-1",
"key": "message-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1-1",
"kind": {
"Prune": "message-entity-contract-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1-1"
"Prune": "message-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1-1"
}
},
{
"key": "message-entity-contract-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1-2",
"key": "message-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1-2",
"kind": {
"Prune": "message-entity-contract-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1-2"
"Prune": "message-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1-2"
}
},
{
"key": "block-message-count-00000000000000000000000000000000000000000000000000000000000000",
"kind": "Identity"
},
{
"key": "message-entity-contract-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1-0",
"key": "message-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1-0",
"kind": {
"Write": {
"Message": "message-checksum-4e8fa8422d6022df02a2d41568e25ebfbc9d7d098f8c31f42e4493523627f0f4"
}
}
},
{
"key": "message-topic-entity-contract-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1",
"key": "message-topic-d8850e3227ce97cdb21a3e266fe360a196ec6c97058ee1ea242da0d03aa51c58-5721a6d9d7a9afe5dfdb35276fb823bed0f825350e4d865a5ec0110c380de4e1",
"kind": {
"Write": {
"MessageTopic": {
Expand Down
Loading