From 52a54e985f2a8694dfff0e219b943c3047a5cec9 Mon Sep 17 00:00:00 2001 From: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com> Date: Sat, 18 Jan 2025 17:18:41 -0500 Subject: [PATCH] include epoch in state snapshot (#8) * must include epoch in state snapshot * example fixtures --------- Co-authored-by: Franci McPianissimo Co-authored-by: Isa Sforzando --- src/schema_account_state.rs | 5 +- tests/fixtures/definite.json | 101 +++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/definite.json diff --git a/src/schema_account_state.rs b/src/schema_account_state.rs index a44fc3d..d7961c9 100644 --- a/src/schema_account_state.rs +++ b/src/schema_account_state.rs @@ -60,10 +60,11 @@ impl WarehouseAccState { /// Note original data was in an RFC rfc3339 with Z for UTC, Cypher seems to prefer with offsets +00000 pub fn to_cypher_object_template(&self) -> String { format!( - r#"{{address: "{}", balance: {}, version: {}, sequence_num: {}, slow_locked: {}, slow_transfer: {}, framework_version: "{}", donor_voice: {} }}"#, + r#"{{address: "{}", balance: {}, version: {}, epoch: {}, sequence_num: {}, slow_locked: {}, slow_transfer: {}, framework_version: "{}", donor_voice: {} }}"#, self.address.to_hex_literal(), self.balance, self.time.version, + self.time.epoch, self.sequence_num, self.slow_wallet_locked, self.slow_wallet_transferred, @@ -91,7 +92,7 @@ impl WarehouseAccState { UNWIND tx_data AS tx MERGE (addr:Account {{address: tx.address}}) - MERGE (snap:Snapshot {{address: tx.address, balance: tx.balance, framework_version: tx.framework_version, version: tx.version, sequence_num: tx.sequence_num, slow_locked: tx.slow_locked, slow_transfer: tx.slow_transfer, donor_voice: tx.donor_voice }}) + MERGE (snap:Snapshot {{address: tx.address, balance: tx.balance, framework_version: tx.framework_version, epoch: tx.epoch, version: tx.version, sequence_num: tx.sequence_num, slow_locked: tx.slow_locked, slow_transfer: tx.slow_transfer, donor_voice: tx.donor_voice }}) MERGE (addr)-[rel:State {{version: tx.version}} ]->(snap) RETURN diff --git a/tests/fixtures/definite.json b/tests/fixtures/definite.json new file mode 100644 index 0000000..7d34079 --- /dev/null +++ b/tests/fixtures/definite.json @@ -0,0 +1,101 @@ +{ + "9": "84b0d0c028667f8a9a839d428643aa7596dc3bf0a563afd2ecf3320e5148907a", + "10": "e8a45ac08f61476be347c8aee30d86fb421212be320d80d672b6cdf7c46cf45e", + "15": "09f4a92df3d64a369061223330f087db907dd38b5c462ed734db6142e7d4aa8f", + "17": "9f43f56aa54a7e96b2336872cf0c6de4a9c8aa2c46402863d741a9b4b0a731c7", + "21": "2193bce9dac68ce99bd21e5d676da01b301d99e4daa051795aabc9067e765930", + "23": "3b6972bd84c757f0ca44ed86616023a0e6abe69902006a4505d8a4558655625f", + "25": "3ea4b37bde07479913b84aaec776531220870952db1ea840ce11e9bb418301c3", + "45": "0ba6dfbd1b2a2677a8a9455f78714baae6010aea78340239236d13137b294a86", + "67": "808e4288a6dc5fee6e4f42491c17d955c2c4b7f01bdb467d69e0eb05b1548c2e", + "77": "e700697129a9bf36db97673fa064b17e31daeb236c4b769820aed2d85d34cfdc", + "133": "94f572954bbd5709c8d36f0f073fb69fe16ebe604684ea3232c848200d8863b1", + "136": "caa9faebe82c01e8b5f33d26f985797b6f406a2ffabf50afd7cbb30278c6d3d2", + "138": "297336e8511fef50f15bf0061cd7217a1d9c5bbd3b770995354c4dd2af1099ce", + "141": "8b430f6b4116897c9c92aefd294996ee0e025c5d92a42e8d15d13ee33c278ca9", + "155": "48a1382e7241a2d4be3ad9d1ae37208a53ca358660bd5c0e3b51fb4d74b5f0be", + "169": "8eddb9e180f30c6d66c5c97922929a30dca0e9b3c088e3000a85df97aec8a4f4", + "232": "4c94263fd36db66caf4962fe4e679dc66516413f85be65ebd3471ba1077baa93", + "237": "9d375c03d3b0af03938228ff0bd11c3ebdc4c958584695aefeb66faf15016a6b", + "240": "111ad22a0c110a4fa62eac1c3851e086130d84c96813fb080c0aace856de5091", + "244": "5962c24c91c20d5673ce2376b213ebaae86ffe33a130370cb5049d8b5eb7c497", + "261": "397b4a9a3d5762b627fe8524821e15cc893389a8b2d25bbe49281080a69f3d87", + "310": "c0695bdda0ea9357831dfbd3e2747d311ff8ef32ad32eb836010c3db1cde6bcc", + "316": "9536baa126cd2040895446d0d01d8172182fcc29ec8cf896c6427e2c7c13a2b0", + "345": "e700697129a9bf36db97673fa064b17e31daeb236c4b769820aed2d85d34cfdc", + "352": "918b0a463a07ec449e6d4977138798baec47e08350944a7df89af252ded7c273", + "360": "4db2c246f600802171710f0d6b2115afa5c380498ab1f48de87b7d690062100f", + "361": "640a3f429f5e7189bdfe21eb9e34d72b638827ce6ed9cfc6c2144424d0ace6e7", + "369": "367b8d06c70bd7ac677a0ed7b5f727413adcc6486a4da519ae73286d00276f64", + "375": "6568530690bd448ec91a826bbfb67c4d3202643ccdfc2a07ba6b6052e1c390c3", + "437": "9ed9c6b8f33e19b518b4ab5874b05105a55f0adb88d2f5ea3e99af27af5bab45", + "483": "866d4b7bf0e729af32da19fa1c1ceecd45b6ab41fa186511f8b97b13d107f54e", + "487": "da7d074176650221b840eb45fc9689570406ce75f613e19e048d5e8bf7f14198", + "496": "ea2f021f53191a426f413a935bd40d739b32bf21a7c66dcf751c07146dcbbb07", + "556": "e5bccc44b3b84b332921df07b7ed0c80919b5a6fab3b646e36d678fbe81ac2f4", + "575": "139c3fdf3ed84e34e3b7a059ee5423408eed1dd6ba8d88953008a8ffade47fa9", + "580": "e700697129a9bf36db97673fa064b17e31daeb236c4b769820aed2d85d34cfdc", + "604": "1a9554268c45fab120433c8b37fb42a41f09a66c863a5538e278e71a6e5cfc8f", + "618": "cea2dfbbcf996640fca84813e2d3a3b077c740a322484c5b8300a5fee5ad3b8b", + "638": "ad71c1c76676542c4ead95b21f312d8d0bbc75d97b8263320824cef1aa18608d", + "663": "99d28737d1ac290ed32ac8b629a228d191ae15d72ca99fa23a222bd26008b6a9", + "691": "6c5de05d91c2fb5a81cb46ff69fc45092fe60df19be3bf705f48523c2e7515b7", + "727": "16c7c19566b411775f01a1bfc6670b3ab838b01b4c6cb4bf0bb68631ab700447", + "736": "f3b93551e4e88d1215619c67a4c31ba006eed9ac94cf33155f7b9b2acfd7a87d", + "771": "297336e8511fef50f15bf0061cd7217a1d9c5bbd3b770995354c4dd2af1099ce", + "856": "a49417f7153213e75816ff9a993ea546a3759b7842b90c4b11301692ccedbfbe", + "902": "1fb574264b60135af9e52ae2695b4440a1d56f672d10521673ddde3960cf8698", + "970": "3f2a1134b2307870453eaacf0e00129d4da37e8ccb91102325c6528dfe722cc3", + "971": "474ba540e8f638a0276903f8e4ccf1db8dceadc73e6b8cfbc952144a782bd1a7", + "1032": "918b0a463a07ec449e6d4977138798baec47e08350944a7df89af252ded7c273", + "1108": "20bc5f2eb0baf17df5cc57df8645e7568f06f6cfcb713f84b8be4a30f55f44bd", + "1160": "2f77eda271a4c38a3191039744c99f0441129b2f6383bcd058f113cd3a4320b3", + "1168": "93519a02b9fd3f900460ae91176e4f6021bbeb5dcb272213a9aafb726b8811fd", + "1241": "1fb574264b60135af9e52ae2695b4440a1d56f672d10521673ddde3960cf8698", + "1249": "32aa8e07688a245279a4b60d2f9b25070c2aae77ff35d3d2a39174202dcc62b8", + "1287": "3ea4b37bde07479913b84aaec776531220870952db1ea840ce11e9bb418301c3", + "1306": "ab8186f9dad86872fcfa692d8e4e9c62a0dc608787fb1b5f3279500a312941b8", + "1307": "4ff40db84c9ef58f8182075bc5ada7b32786a203e96774307dab7aab1d5b9885", + "1382": "f280b9ea5e4124cea0bef0d894bd182ee0302c24b936251ee6af1064288cdd0e", + "1383": "18981c0ecc7aec7ed83692f50fbc42ed3bbdca4b3192d285319c38b37a402d37", + "1390": "04e1d399e56ffa0a07fc7070d1e4060471f06dfadccfe1f62e8fa192e5ee855d", + "1408": "04e1d399e56ffa0a07fc7070d1e4060471f06dfadccfe1f62e8fa192e5ee855d", + "1472": "a20c1b58418519a6db762f37eab922a92c26dac516f647709452abdceda9ed53", + "1559": "ea889ecc60731db730f57a58b389b4e203a0e2616c83b89fdd8fa1eff6a33ae3", + "1601": "e99ac5405b0f7bc278eab7f98d015d57fec782da9ac8ba9c2d71e8f0268da029", + "1637": "9ed9c6b8f33e19b518b4ab5874b05105a55f0adb88d2f5ea3e99af27af5bab45", + "1650": "9daf22caa0b307540038541efb2de3564afd3f2f09ff3e56f70857bc7ee041b3", + "1791": "6568530690bd448ec91a826bbfb67c4d3202643ccdfc2a07ba6b6052e1c390c3", + "1863": "e068f4ec2c03c1051e090d213c20b62dbd3c719f82b6b564df8c65636742e67a", + "1878": "49bcb03a4bc18d8ccac12c8db99345448c301d91bd0c030f49b060cc393b2dfc", + "1882": "a10b111501d8e93ad1089f9fe6ba8c0f10c75eb12038d15489e114fc6e23abec", + "1902": "ff3d2eae8d4886ecd930ca56eb31cfdf90f70c15bb21c6bb49471f20cf398e74", + "1957": "89b3c1825012fe031f056a72c01ce52dd6bda28fbb25e8b899f44e7bdcb6bcfa", + "2034": "6b93f4af4ff2af847f42ea69d4128e37fbdb636474faeba4cbe87ffbda960bf3", + "2111": "6b93f4af4ff2af847f42ea69d4128e37fbdb636474faeba4cbe87ffbda960bf3", + "2208": "068c84cf73ba6e808040688ae6d45ed92f4648027db16fa22835d55fa92b2579", + "2266": "f8ff7ffebcd8cd3fadaff2705882c038ba4817d86f42f8ba4b0e202b23c5a5d0", + "2287": "6683fc4abec5eec579cea3b5c580f76c026b574205cf67fa5a597ccf422986c3", + "2437": "431838702c804252173e9706bc1116b99ec73cdbaa13793fc8144fadee442d76", + "2479": "3a12970de0527c72c088f145d71cfede7ba9041b9f9e3e7eb9b69ba8181489bf", + "2600": "cf86cd244a695b36570cb67ce1d78af4905a354d0240a6db1a97c70cc65f22fa", + "2647": "fb373db841db9306124f0472833451aae272a110d89b63426cfce0088111f94d", + "2672": "9ed9c6b8f33e19b518b4ab5874b05105a55f0adb88d2f5ea3e99af27af5bab45", + "2722": "1c0c4b90de598f948555546ab6c06a6d140d267f46a9fd140e5bf012e6eceaf2", + "2833": "1333d9dbced717b9bc1e23cd72a018a7821f28affab81e2848eae5af6935295f", + "2976": "dc658e08b81706726c7dbffb744e51c0217f8b80dfea1d89c85d6905b9dc2de6", + "3044": "7be1b703b9faa0bafb03226778bcd8c7b5bab85fb12dd8a11e864fbdc83dada4", + "3068": "c1b67f857f11d24dac31bdf2440deaccc0640caf174b3116a6940dc96b2f36ba", + "3105": "2a601d3c32db611d914b818118fa1967a3dcdd104d0b5536f6f36684a44b4581", + "3431": "936fa5773bc09a14a594f7038289ad3015472b1b0376f55620e21852badb5a19", + "3460": "b4a10553a3a5465a1015bc0ccddfe1613ed259831fdcdb4a120d4e5edfaef215", + "3670": "2857d388d2012b20dba06b236f4c49f8ed127aac51f52c262a87a1180ab624c0", + "3736": "c0535227e30c77e25e784e24d50ce0140ba3ae6519bd720c9d6ff4b6a27188e3", + "3737": "8437fc4d875137521f821ac502786b32f78b7941d8099912a30ebf1316810e00", + "3749": "9d3e65c4cccf78ef50b2ed255914b4e2b42dab89a6397e700e679ef4d3c1f19f", + "3772": "4491374b1a0a412944094494909f5f46c5739aa6775556350fed546e57b45042", + "3873": "eb150e266906ae38efe1c8beb3e24bbc85ad23f6e8db2eb577f15d9537c7e485", + "3884": "25beae7270b612be46cd57f94e452536ebed6d01bdb22303b971786f2a24593a", + "3933": "9ed9c6b8f33e19b518b4ab5874b05105a55f0adb88d2f5ea3e99af27af5bab45", + "3959": "139c3fdf3ed84e34e3b7a059ee5423408eed1dd6ba8d88953008a8ffade47fa9" +} \ No newline at end of file