Skip to content

Commit

Permalink
improve argobj (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc authored Jan 14, 2024
1 parent 88e89cc commit 520cf64
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ exports[`run-block > should work 1`] = `
"section": "system",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x4f73b976422902a23b5e92560fde0c13d50b884c857955b81132eae5a16dd786",
Expand All @@ -55,7 +55,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x9fad2d531dd4b66543bd2059facb0f75f5918a1c11b8e87b59eb12fe24f3c600",
Expand All @@ -80,7 +80,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x29fd5131e22e84526f205a94f7f65fefeaf2322804f2df83d83e230e8df81873",
Expand All @@ -105,7 +105,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x442225f7616374af8b2500502da468dd6560625cf14329f80ed64cdd90d08fec",
Expand All @@ -130,7 +130,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xd72bbbf8e4e4a489fb3d047ef49c556177435771d7f2c11605a565d991a2a92f",
Expand All @@ -155,7 +155,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xb421a1a3df726074841597c870501ec1517de9871433c2e6cdb50a274427e899",
Expand All @@ -180,7 +180,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x06ca3cffb9d763c3d634e3851c7a288d08cb75f341858881317ca4ba5e063c31",
Expand All @@ -205,7 +205,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x296e450cc898642031e7b08055a6a7b85a1ce8c60dca2be5eefcb23354032e5b",
Expand Down Expand Up @@ -243,7 +243,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x781f442c055547163f4619f93035976e8d8c1fb3aad794c1bd63e09ea9151221",
Expand All @@ -268,7 +268,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x5ffb69a70059e109fd02fbd1953cf7ec174781f9b91bda658981069c6a333de3",
Expand All @@ -293,7 +293,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xaea68d39bede2bb9273c4739c70fcb9921eb9087562fea9e6dada7aa7391f4b9",
Expand All @@ -318,7 +318,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xeed2494dfa28f8e35b86783222c8a67af3432a3d88dfb44a000c935a35054282",
Expand All @@ -343,7 +343,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x66a1f3e932b57ba5add086029f163a5e9f9317dfb9850dbd7aeb611c7ea494ee",
Expand All @@ -368,7 +368,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xaa970f33ad559ba201339c4c3c2192b8ac2b1f8289b5835a6fac6d8a2dd50842",
Expand All @@ -393,7 +393,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x51b42ac6b319803ba3d50a262ba8a932882c6f7f7ee5b454de4cd9c1542b9d02",
Expand All @@ -418,7 +418,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xf78fd15d06240d156b0049e7a9504262c6e1355498e28b2d5cc0a2ce0690a3be",
Expand All @@ -443,7 +443,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x781e9b6c0170135cd44b5d956297b36e7683367a491a06c138614a23f031749f",
Expand All @@ -468,7 +468,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xe25fb3380e9bbaa6f06333d1567d1885d936879f2438b9e2ee6e9688689e991e",
Expand All @@ -493,7 +493,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xa67d0728f1be05799457ce503331ff87381688d016f4979dce5573a497891e61",
Expand All @@ -518,7 +518,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xa408e9591b8e02fce556055b6ad5044e01591c4d20434cd5822993b162c86205",
Expand All @@ -543,7 +543,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xfc6fd710944df1ae7cff9c4668b01058149e35b9c891c607dc1f8e6680a2877a",
Expand All @@ -568,7 +568,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x0162fb1a6da15341be4dd3924f45a1e11e4a21e9378f3e8125ef30b04b9aa7b0",
Expand All @@ -593,7 +593,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xfa619706e98d0671b655aa17a87c2c8740625d89c4417333ca4c033f60783ddd",
Expand All @@ -618,7 +618,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x863c28f29edcc101829cda57afec7d48e13146d408463367a505d8155b7d0301",
Expand All @@ -643,7 +643,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x0ef8e4f7e72b6c18dce2f03af29e492e23c62546f4d8c42be367b66eafce7bea",
Expand All @@ -668,7 +668,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xd6e77ede0b1645cd40bd41187c8128dcee09117d91192adba3ae10f36dec6c91",
Expand All @@ -693,7 +693,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x4c5c0610af43f9c8ceccc1adde122654a40c170f3e36e1677f62cf5ea6ce17e3",
Expand All @@ -718,7 +718,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x770bd7fbe1bc176c77d7ceb2020d88ff467a1fe9a8696b7de3fdfede6f9c98f9",
Expand All @@ -743,7 +743,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x9846000f8e4d134768cfd77404123c80d00258d811dfb98bc222bfc74a14857c",
Expand All @@ -768,7 +768,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x09db17dd18fb2bed0b4e76a4a27a4673057aa380069cd5fbf8c0dc8caf91f98b",
Expand All @@ -793,7 +793,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x7f43d714cdd3a6fe4194e6a0b66613b6df662965e16379e14bf541c0fff91211",
Expand All @@ -818,7 +818,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x5e05cf9945ba47a30984e695efb85b1725341ac43bee01aa9c1f6294b4f036d5",
Expand All @@ -843,7 +843,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x306d19a2fc9882b37eeff572b905f9f44ca77950a5ba68101ca98bc2e8b19934",
Expand All @@ -868,7 +868,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xb54b4a1b0711ce54595e16d7c37d9bf21084efb2f65b3c77f3cc5b7ae4523d91",
Expand All @@ -893,7 +893,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x1429ed2970fec88fd74b9c5da15e0379e740c02c21bc56eca7a488324f209b23",
Expand All @@ -918,7 +918,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x85e5d92042ae4ef1330e693763102d5536d350df2ea96ab8f131a190726981cd",
Expand All @@ -943,7 +943,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0x0fa3f49239794538893917fba500a9bca651174ce82137aac4bc197624c7cb70",
Expand All @@ -968,7 +968,7 @@ exports[`run-block > should work 1`] = `
"section": "paraInclusion",
},
{
"argObj": {},
"argObj": undefined,
"args": [
{
"commitmentsHash": "0xb2898d0172220505adb7a461831be76bf55a96e6a15f4d217c9791916db0d587",
Expand Down
10 changes: 7 additions & 3 deletions packages/chopsticks/src/plugins/run-block/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,15 @@ export const rpc = async ({ chain }: Context, [params]: [RunBlockParams]): Promi
const timestamp = await newBlock.read('u64', meta.query.timestamp.now)
const events = await newBlock.read('Vec<EventRecord>', meta.query.system.events)
const parsedEvents = events?.map((event) => {
const argObj = {}
let argObj: any = undefined
const len = event.event.data.names?.length ?? 0
for (let i = 0; i < len; i++) {
argObj[event.event.data.names![i]] = event.event.data[i].toJSON()
if (len > 0) {
argObj = {}
for (let i = 0; i < len; i++) {
argObj[event.event.data.names![i]] = event.event.data[i].toJSON()
}
}

return {
phase: event.phase.isApplyExtrinsic
? event.phase.asApplyExtrinsic.toNumber()
Expand Down

0 comments on commit 520cf64

Please sign in to comment.