Skip to content

Commit

Permalink
Update transaction serialization RC5 (#121)
Browse files Browse the repository at this point in the history
Update serialization logic for RC5
  • Loading branch information
ZhmakAS authored Nov 28, 2024
1 parent a317a99 commit 2c8395e
Show file tree
Hide file tree
Showing 37 changed files with 2,439 additions and 945 deletions.
69 changes: 33 additions & 36 deletions casper/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,39 @@ import (
)

type (
AuctionState = types.AuctionState
Args = types.Args
ValidatorBid = types.ValidatorBid
Bid = types.Bid
Block = types.Block
BlockV1 = types.BlockV1
BlockHeaderV1 = types.BlockHeaderV1
BlockBodyV1 = types.BlockBodyV1
BlockV2 = types.BlockV2
BlockHeaderV2 = types.BlockHeaderV2
BlockBodyV2 = types.BlockBodyV2
ContractPackage = types.ContractPackage
ContractVersion = types.ContractVersion
Contract = types.Contract
Transaction = types.Transaction
TransactionV1 = types.TransactionV1
TransactionHeader = types.TransactionHeader
TransactionV1Header = types.TransactionV1Header
TransactionBody = types.TransactionBody
TransactionV1Body = types.TransactionV1Body
Deploy = types.Deploy
DeployHeader = types.DeployHeader
DeployApproval = types.Approval
EntryPointV1 = types.EntryPointV1
EntryPointV2 = types.EntryPointV2
ExecutionResult = types.ExecutionResult
NamedKeys = types.NamedKeys
NamedKey = types.NamedKey
TransformKey = types.TransformKey
Transform = types.Transform
Argument = types.Argument
Account = types.Account
PublicKeyAndBid = types.PublicKeyAndBid
Reward = types.EraReward
WriteTransfer = types.WriteTransfer
UnbondingPurse = types.UnbondingPurse
AuctionState = types.AuctionState
Args = types.Args
ValidatorBid = types.ValidatorBid
Bid = types.Bid
Block = types.Block
BlockV1 = types.BlockV1
BlockHeaderV1 = types.BlockHeaderV1
BlockBodyV1 = types.BlockBodyV1
BlockV2 = types.BlockV2
BlockHeaderV2 = types.BlockHeaderV2
BlockBodyV2 = types.BlockBodyV2
ContractPackage = types.ContractPackage
ContractVersion = types.ContractVersion
Contract = types.Contract
Transaction = types.Transaction
TransactionV1 = types.TransactionV1
TransactionV1Payload = types.TransactionV1Payload
Deploy = types.Deploy
DeployHeader = types.DeployHeader
DeployApproval = types.Approval
EntryPointV1 = types.EntryPointV1
EntryPointV2 = types.EntryPointV2
ExecutionResult = types.ExecutionResult
NamedKeys = types.NamedKeys
NamedKey = types.NamedKey
TransformKey = types.TransformKey
Transform = types.Transform
Argument = types.Argument
Account = types.Account
PublicKeyAndBid = types.PublicKeyAndBid
Reward = types.EraReward
WriteTransfer = types.WriteTransfer
UnbondingPurse = types.UnbondingPurse
)

type (
Expand Down
67 changes: 67 additions & 0 deletions tests/data/era/era_summary_v2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"jsonrpc": "2.0",
"id": "1",
"result": {
"api_version": "2.0.0",
"era_summary": {
"block_hash": "34f7c0246c6dd3b4ae7161a59c6834a9aaa12f74b8d2c4d16ec347a9b8a90407",
"era_id": 15383,
"stored_value": {
"EraInfo": {
"seigniorage_allocations": [
{
"Validator": {
"validator_public_key": "01032146b0b9de01e26aaec7b0d1769920de94681dbd432c3530bfe591752ded6c",
"amount": "100542274855185"
}
},
{
"Validator": {
"validator_public_key": "01032146b0b9de01e26aaec7b0d1769920de94681dbd432c3530bfe591752ded6c",
"amount": "84485499521"
}
},
{
"Validator": {
"validator_public_key": "0126d4637eb0c0769274f03a696df1112383fa621c9f73f57af4c5c0fbadafa8cf",
"amount": "88379190136305"
}
},
{
"Validator": {
"validator_public_key": "0126d4637eb0c0769274f03a696df1112383fa621c9f73f57af4c5c0fbadafa8cf",
"amount": "84493160372"
}
},
{
"Validator": {
"validator_public_key": "0140afe8f752e5ff100e0189c080bc207e8805b3e5e82f792ec608de2f11f39f6c",
"amount": "99527758907914"
}
},
{
"Validator": {
"validator_public_key": "0140afe8f752e5ff100e0189c080bc207e8805b3e5e82f792ec608de2f11f39f6c",
"amount": "84483913675"
}
},
{
"Validator": {
"validator_public_key": "017536433a73f7562526f3e9fcb8d720428ae2d28788a9909f3c6f637a9d848a4b",
"amount": "83817182779548"
}
},
{
"Validator": {
"validator_public_key": "017536433a73f7562526f3e9fcb8d720428ae2d28788a9909f3c6f637a9d848a4b",
"amount": "84494615864"
}
}
]
}
},
"state_root_hash": "6e8ed1a812f9518ee39277f77f707955a3f73b2c775df7424b2da175625b8f2e",
"merkle_proof": "010000000b000000000000000000000000000000000000000000000000000000000000000007080000000001032146b0b9de01e26aaec7b0d1769920de94681dbd432c3530bfe591752ded6c0611e19352715b0001032146b0b9de01e26aaec7b0d1769920de94681dbd432c3530bfe591752ded6c05816abaab13000126d4637eb0c0769274f03a696df1112383fa621c9f73f57af4c5c0fbadafa8cf06f1cd3b626150000126d4637eb0c0769274f03a696df1112383fa621c9f73f57af4c5c0fbadafa8cf05b44f2fac13000140afe8f752e5ff100e0189c080bc207e8805b3e5e82f792ec608de2f11f39f6c060a0ab71c855a000140afe8f752e5ff100e0189c080bc207e8805b3e5e82f792ec608de2f11f39f6c05cb37a2ab1300017536433a73f7562526f3e9fcb8d720428ae2d28788a9909f3c6f637a9d848a4b069cd867353b4c00017536433a73f7562526f3e9fcb8d720428ae2d28788a9909f3c6f637a9d848a4b05388545ac1301000000000b140000000001510e5f331b1a84b14252fe3913d3afb152f287462714c108b2cd03c29164207801018eb48c820fb106611a9dc65b5516c76267c7a546c8b0f7f87ccad67dc1afa1f50201d39dc1d39d36b8c59e9355cdd55adf4d769cc6d63db915fe69ea94a24e8454840301a86c2de6d91155a59adda00169c1372f409b8e71aca5ecc95888e75ab4df366e0401744d6727bd6c08d70a1d49fa3fcb0397230595e628ed0c52f5a78d3d59c6cdbb06014bcefe3ed7eb0d929ffb1b06975df2caf7476f9beb3b0828be78fd766730668d0801732d8be21ba8d9d166007384999a8f4887b01534151e5d22a1f388be99412fc409018b587e1127177e34a3e470c3bc536da9f89345f0bcfdeb6b548be732d984d82c0a00aa359968ebc13aeb0ec170d86c230e35d478037aa4cc1441b186501323f5d9c90d00d133641314a03c3da85597bc23aaa10b56ecc43efc1035c69d76463cecb633a00e0043d39741a6e7b395eace3b1fbbbd5bbf288f7a788e80745a2e2bb0f2173a8b4f0f018e1ee0db6abadb25182adb757ee0fb68645c62892c43bdb5f66f04ddd49c26db1001d515393ea4ba786b0a887b03406e563b8bb6eec7130c2b74af11c301edb19242110177049afcfe3f07f8fb1ff429073573fd537ec93a14c0aaad71141afaac088093120176706b834e9776d305d9d5face0a7c273a646827ffc02c4f0fdf92192767ca3b1301b86fb4cf28dec81b269a278ed437302f10921d86fe16a4de0e0240f735ee8f5d1401e127033e641533f0ee99f0612c9e20c86e9c1974aada7e03af57ae81ef58c09b1501d789c8bba61eab50b62479a596b99f4268f8ae0a4c770e71ab75ed870b6ecda1160109ee69158b030e49dd6f79b65ea0dea62cca0df0163c7b08dc7379ac2e5265a91701ccc91d447ba4fa1d39e26b2e4c45cee12291790d0e54d95ce0c71ce798cc02de"
}
}
}
79 changes: 36 additions & 43 deletions tests/data/sse/transaction_accepted_event.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,52 @@
{
"TransactionAccepted": {
"Version1": {
"hash": "35ae20f399194f469d74acebe7fae333b59a8b63868f24648e7ce62d3e6ea930",
"header": {
"chain_name": "dev-net",
"timestamp": "2024-07-12T10:08:27.782Z",
"hash": "446f9511258112c6e5150ee13d57c421da2bc30e0058db6165855a9d1ba4b868",
"payload": {
"initiator_addr": {
"PublicKey": "0184f6d260f4ee6869ddb36affe15456de6ae045278fa2f467bb677561ce0dad55"
},
"timestamp": "2024-11-27T17:24:10.516Z",
"ttl": "30m",
"body_hash": "08f9a371124b26f8038fba6b6bc72851139d861fcb77e1823fd71e8ae438c5e3",
"chain_name": "casper-net-1",
"pricing_mode": {
"Fixed": {
"gas_price_tolerance": 3
"additional_computation_factor": 0,
"gas_price_tolerance": 1
}
},
"initiator_addr": {
"PublicKey": "0202c57b8226aadc7bd004860b9d34b0c7bb9652698c508d1c01368cbb5f198d5d32"
"fields": {
"args": {
"Named": [
[
"target",
{
"cl_type": "PublicKey",
"bytes": "0106ed45915392c02b37136618372ac8dde8e0e3b8ee6190b2ca6db539b354ede4",
"parsed": "0106ed45915392c02b37136618372ac8dde8e0e3b8ee6190b2ca6db539b354ede4"
}
],
[
"amount",
{
"cl_type": "U512",
"bytes": "0400f90295",
"parsed": "2500000000"
}
]
]
},
"entry_point": "Transfer",
"scheduling": "Standard",
"target": "Native"
}
},
"body": {
"args": [
[
"validator",
{
"cl_type": "PublicKey",
"bytes": "017536433a73f7562526f3e9fcb8d720428ae2d28788a9909f3c6f637a9d848a4b",
"parsed": "017536433a73f7562526f3e9fcb8d720428ae2d28788a9909f3c6f637a9d848a4b"
}
],
[
"amount",
{
"cl_type": "U512",
"bytes": "050052eda574",
"parsed": "501000000000"
}
],
[
"delegator",
{
"cl_type": "PublicKey",
"bytes": "0202c57b8226aadc7bd004860b9d34b0c7bb9652698c508d1c01368cbb5f198d5d32",
"parsed": "0202c57b8226aadc7bd004860b9d34b0c7bb9652698c508d1c01368cbb5f198d5d32"
}
]
],
"target": "Native",
"entry_point": "Delegate",
"transaction_category": 1,
"scheduling": "Standard"
},
"approvals": [
{
"signer": "0202c57b8226aadc7bd004860b9d34b0c7bb9652698c508d1c01368cbb5f198d5d32",
"signature": "02bae820a71f24b503921a7d2fac93cf454ffd39cee932f70cc82686c57793f8a3222b599243fa9db275a97e299033a7836f7b5dc33534147989887b2fb506b644"
"signer": "0184f6d260f4ee6869ddb36affe15456de6ae045278fa2f467bb677561ce0dad55",
"signature": "016bfe70925847f5bedd2cd031b0316d73b8c9b3573b31ed8ba9ead069eb69800a6ef66136e10571b327866b2e03e1369e2982b20428628641bbdd4d641475ea05"
}
]
}
}
}
}
Loading

0 comments on commit 2c8395e

Please sign in to comment.