Commit graph

19598 commits

Author SHA1 Message Date
Eric Eastwood fb8e2814f1 Fix direction of fake edges
- batch -> insertion fake edge
 - Connecting insertion events' `prev_events` successors -> insertion event

---

 - batch -> insertion fake edge
 - Connecting insertion events' `prev_events` successors -> insertion event

```
backfill sorted_events=[
  "event_id=$RQU5oBY9oHveDdx1X4FZs6BWzBqrGnbxQCZfNF4OEmw,depth=11,body=Message 1 (eventIDsAfter),prevs=['$44dIgrZ6WEBaxnCxiulvFQmLRlgIF2c2LHxwVZ39BhY']",
  "event_id=$44dIgrZ6WEBaxnCxiulvFQmLRlgIF2c2LHxwVZ39BhY,depth=10,body=Message 0 (eventIDsAfter),prevs=['$G00qI6L-Jem6u0rM73WAgtl3e27WFREG_IqXBK3rBVY']",
  "event_id=$Bb7NKUT_EJEIYJucAJvsm3IGWOHPV5HjT9sFBH4cgJ0,depth=10,body=org.matrix.msc2716.insertion,prevs=['$G00qI6L-Jem6u0rM73WAgtl3e27WFREG_IqXBK3rBVY']",
  "event_id=$DD2ibvlCDuylHLA5XHpzbWgplgANwmvy_qRGIz6obgU,depth=10,body=org.matrix.msc2716.batch,prevs=['$JfIXG5RA3SubwPx3qekrP7p7TL84M-EMXyrWUPGEJqE']",
  "event_id=$JfIXG5RA3SubwPx3qekrP7p7TL84M-EMXyrWUPGEJqE,depth=10,body=Historical 99 (batch=0),prevs=['$JMMtj_q0q-o3sgMjGtUDot_vjIBS1fu7pMFIVIKW8XU']",
  "event_id=$JMMtj_q0q-o3sgMjGtUDot_vjIBS1fu7pMFIVIKW8XU,depth=10,body=Historical 98 (batch=0),prevs=['$lCpKjiG2aZzjSvL4mu3BijwjsuGADKfP6CmB6S_9TeI']",
  "event_id=$lCpKjiG2aZzjSvL4mu3BijwjsuGADKfP6CmB6S_9TeI,depth=10,body=Historical 97 (batch=0),prevs=['$2e-t0QWqLfVJz2fdwbwAuT7HpT2awCyFhtR35VPUx0Q']",
  "event_id=$2e-t0QWqLfVJz2fdwbwAuT7HpT2awCyFhtR35VPUx0Q,depth=10,body=Historical 96 (batch=0),prevs=['$3tMaM3-QgXlRaGWzkcKg8VOooUETwADMmvC8LgPHi3k']",
  "event_id=$3tMaM3-QgXlRaGWzkcKg8VOooUETwADMmvC8LgPHi3k,depth=10,body=Historical 95 (batch=0),prevs=['$sWNiiKCpV6jaMOBrJPKSnmhfm1HvzQX5reT9cNGTgkk']",
  "event_id=$sWNiiKCpV6jaMOBrJPKSnmhfm1HvzQX5reT9cNGTgkk,depth=10,body=Historical 94 (batch=0),prevs=['$b23cNluaxei15QPBanvua5F690RJdnL4yCq-3MAbKyc']",
  "event_id=$b23cNluaxei15QPBanvua5F690RJdnL4yCq-3MAbKyc,depth=10,body=Historical 93 (batch=0),prevs=['$mlWvqR2MWITXVBZfeVLcujmVAzBvkkDdP6oSz3eSwUg']",
  "event_id=$mlWvqR2MWITXVBZfeVLcujmVAzBvkkDdP6oSz3eSwUg,depth=10,body=Historical 92 (batch=0),prevs=['$wlVdFpoXlPWoajb33gizlhlft5k-tVwGUpmMsmcoHPU']",
  "event_id=$wlVdFpoXlPWoajb33gizlhlft5k-tVwGUpmMsmcoHPU,depth=10,body=Historical 91 (batch=0),prevs=['$v6VMFCnyQkl16tZCVu7J_-Nst_NRXXaQd2efn2TUpEE']",
  "event_id=$v6VMFCnyQkl16tZCVu7J_-Nst_NRXXaQd2efn2TUpEE,depth=10,body=Historical 90 (batch=0),prevs=['$ooH_Jq5JLVIkIB9TpsltyHtqtn7KNxDIc_xYUcBUsAA']",
  "event_id=$ooH_Jq5JLVIkIB9TpsltyHtqtn7KNxDIc_xYUcBUsAA,depth=10,body=Historical 89 (batch=0),prevs=['$iK_6DSB9OgXzFNQ1qEZo_42ifWrX1xwUKs_qFKZT8Uo']",
  "event_id=$iK_6DSB9OgXzFNQ1qEZo_42ifWrX1xwUKs_qFKZT8Uo,depth=10,body=Historical 88 (batch=0),prevs=['$LKnAV4et1stXQRkd_dg0XOK5kNXFyFYQOgx5wdSQB34']",
  "event_id=$LKnAV4et1stXQRkd_dg0XOK5kNXFyFYQOgx5wdSQB34,depth=10,body=Historical 87 (batch=0),prevs=['$vvtLzYBovfNjm-aU5o5JF6TumBAzrBbzrMVrqA43cmE']",
  "event_id=$vvtLzYBovfNjm-aU5o5JF6TumBAzrBbzrMVrqA43cmE,depth=10,body=Historical 86 (batch=0),prevs=['$yYyBW-D_3XN6aYyXeRJKQYN1hJyswh9kUe2Q3kk_auA']",
  "event_id=$yYyBW-D_3XN6aYyXeRJKQYN1hJyswh9kUe2Q3kk_auA,depth=10,body=Historical 85 (batch=0),prevs=['$_1yK-Gzkabr_ZKMRFHlJMat943MjCznY2YN2WPExrtY']",
  "event_id=$_1yK-Gzkabr_ZKMRFHlJMat943MjCznY2YN2WPExrtY,depth=10,body=Historical 84 (batch=0),prevs=['$CZSLI1NUX9gWptZT_i52oyCfQpH5rOlPFSgmSjD4a-Q']",
  "event_id=$CZSLI1NUX9gWptZT_i52oyCfQpH5rOlPFSgmSjD4a-Q,depth=10,body=Historical 83 (batch=0),prevs=['$093Wua4ZaJLX4uRYuL89y3t47jntwceo0ReVGM-_WNE']",
  "event_id=$093Wua4ZaJLX4uRYuL89y3t47jntwceo0ReVGM-_WNE,depth=10,body=Historical 82 (batch=0),prevs=['$wA7OKTWe6BMbXustd4WBLTJ2fBIY4RLeOstoKaaiIwg']",
  "event_id=$wA7OKTWe6BMbXustd4WBLTJ2fBIY4RLeOstoKaaiIwg,depth=10,body=Historical 81 (batch=0),prevs=['$ZUVoXb9Or3HAeZVM5nKYUp1-mcizUyGuQHuUaRTEf8s']",
  "event_id=$ZUVoXb9Or3HAeZVM5nKYUp1-mcizUyGuQHuUaRTEf8s,depth=10,body=Historical 80 (batch=0),prevs=['$ul_NFiXrTv6S-YseztgF5fpKx-_gXeQ7C9XF_TdcCqM']",
  "event_id=$ul_NFiXrTv6S-YseztgF5fpKx-_gXeQ7C9XF_TdcCqM,depth=10,body=Historical 79 (batch=0),prevs=['$9zzm0Mr6wn2W5EKl7t0AmGqJntslGV9Telo6rP9DeZg']",
  "event_id=$9zzm0Mr6wn2W5EKl7t0AmGqJntslGV9Telo6rP9DeZg,depth=10,body=Historical 78 (batch=0),prevs=['$LsfJ_IpS4y1mWjdLFsod16JBS2B2j0XO3BCMEtXaigk']",
  "event_id=$LsfJ_IpS4y1mWjdLFsod16JBS2B2j0XO3BCMEtXaigk,depth=10,body=Historical 77 (batch=0),prevs=['$hfdqS5ARU7roPsWgGS8RXsog_m0P7vOc1UMdmKju0aw']",
  "event_id=$hfdqS5ARU7roPsWgGS8RXsog_m0P7vOc1UMdmKju0aw,depth=10,body=Historical 76 (batch=0),prevs=['$h4ZA91X45b8aNuMjz_xC1457mw2h6_MTSqvv6MVH8tU']",
  "event_id=$h4ZA91X45b8aNuMjz_xC1457mw2h6_MTSqvv6MVH8tU,depth=10,body=Historical 75 (batch=0),prevs=['$qvxKJlvqC0gaRP7mRjO-yMD4Zzt42dkd7dqZSs-v-Fk']",
  "event_id=$qvxKJlvqC0gaRP7mRjO-yMD4Zzt42dkd7dqZSs-v-Fk,depth=10,body=Historical 74 (batch=0),prevs=['$kgMcrid7-aqUIzDzjouB3HQKIGh2h-6Iop6WK08KCkc']",
  "event_id=$kgMcrid7-aqUIzDzjouB3HQKIGh2h-6Iop6WK08KCkc,depth=10,body=Historical 73 (batch=0),prevs=['$_ssYYwoWm7OOjhYwkZxQKOMq7maygenjjLJBypuA3N8']",
  "event_id=$_ssYYwoWm7OOjhYwkZxQKOMq7maygenjjLJBypuA3N8,depth=10,body=Historical 72 (batch=0),prevs=['$1OAjmvRdC67suR_wlrgbQDzOFJZxAnE4RZyKt4Khq9M']",
  "event_id=$1OAjmvRdC67suR_wlrgbQDzOFJZxAnE4RZyKt4Khq9M,depth=10,body=Historical 71 (batch=0),prevs=['$1cpjOXZwqsZzZ643qAkcnEc3Mjgl1n_WPfeVaovxE0g']",
  "event_id=$1cpjOXZwqsZzZ643qAkcnEc3Mjgl1n_WPfeVaovxE0g,depth=10,body=Historical 70 (batch=0),prevs=['$qYsfdlkVwJDtvjGHQtJATjglCIUzj11Cu7Kt70Qpa00']",
  "event_id=$qYsfdlkVwJDtvjGHQtJATjglCIUzj11Cu7Kt70Qpa00,depth=10,body=Historical 69 (batch=0),prevs=['$xwkLzZQX2w1rS9IbSburCCNy9g_3GA5cxR2Dd1AiDEo']",
  "event_id=$xwkLzZQX2w1rS9IbSburCCNy9g_3GA5cxR2Dd1AiDEo,depth=10,body=Historical 68 (batch=0),prevs=['$RUjVghSfYx0Rz-HMW7pFUjVL7gjnDh5FhrzmizwRSg4']",
  "event_id=$RUjVghSfYx0Rz-HMW7pFUjVL7gjnDh5FhrzmizwRSg4,depth=10,body=Historical 67 (batch=0),prevs=['$xFM3GD0jHQ2sV_w-m996lYIj6bBy3e4zoo4zba7KK94']",
  "event_id=$xFM3GD0jHQ2sV_w-m996lYIj6bBy3e4zoo4zba7KK94,depth=10,body=Historical 66 (batch=0),prevs=['$P9rG_KsdrP29_nrUhVNwDXxEj6TtcAHYMiEPjTECuyI']",
  "event_id=$P9rG_KsdrP29_nrUhVNwDXxEj6TtcAHYMiEPjTECuyI,depth=10,body=Historical 65 (batch=0),prevs=['$fG9vXCIp3ymBUSQGfxuQyHjXvwfaz0i-Al5PZER5q6Y']",
  "event_id=$fG9vXCIp3ymBUSQGfxuQyHjXvwfaz0i-Al5PZER5q6Y,depth=10,body=Historical 64 (batch=0),prevs=['$ZppkvSCfh7zKOSOIaAzzOM13xzO3c46HlvAt1ogqxSI']",
  "event_id=$ZppkvSCfh7zKOSOIaAzzOM13xzO3c46HlvAt1ogqxSI,depth=10,body=Historical 63 (batch=0),prevs=['$XJgjPkRjlTh04CAXr_7doyRn9uP6Q2BRBS5ogIxxgq4']",
  "event_id=$XJgjPkRjlTh04CAXr_7doyRn9uP6Q2BRBS5ogIxxgq4,depth=10,body=Historical 62 (batch=0),prevs=['$iiC9E-Xbw8DqYLkca_3SYXKP0fyjAO3Rulzl_UMlg_U']",
  "event_id=$iiC9E-Xbw8DqYLkca_3SYXKP0fyjAO3Rulzl_UMlg_U,depth=10,body=Historical 61 (batch=0),prevs=['$JQrY-1YX4u1WLM8pf-YV45wOig2GZmXyLRzQd16lNRY']",
  "event_id=$JQrY-1YX4u1WLM8pf-YV45wOig2GZmXyLRzQd16lNRY,depth=10,body=Historical 60 (batch=0),prevs=['$EZwD8zE9aSg6UYGfT93gAB22vf1EbG2m4rXNWYtDoMM']",
  "event_id=$EZwD8zE9aSg6UYGfT93gAB22vf1EbG2m4rXNWYtDoMM,depth=10,body=Historical 59 (batch=0),prevs=['$MXdmxSkN7gpzy28Rg6Ond0DyVu4a6_NA2PAEh2RGhWE']",
  "event_id=$MXdmxSkN7gpzy28Rg6Ond0DyVu4a6_NA2PAEh2RGhWE,depth=10,body=Historical 58 (batch=0),prevs=['$3qKPpnyChlt2O24cqwF2zHORIvm4zbVwugRtKxkAQAo']",
  "event_id=$3qKPpnyChlt2O24cqwF2zHORIvm4zbVwugRtKxkAQAo,depth=10,body=Historical 57 (batch=0),prevs=['$fZwZ3KIY2HpkBh_-GX762uJlvSDjKx_jkKBmO4XMXbU']",
  "event_id=$fZwZ3KIY2HpkBh_-GX762uJlvSDjKx_jkKBmO4XMXbU,depth=10,body=Historical 56 (batch=0),prevs=['$6S5Ni1dMs9cIWmlGAToAXq9HD19IC3VzPsA6Mpv-99k']",
  "event_id=$6S5Ni1dMs9cIWmlGAToAXq9HD19IC3VzPsA6Mpv-99k,depth=10,body=Historical 55 (batch=0),prevs=['$H_iqXiAxOxF6cEFG8uBIOA4daNZRS-n5BkyIO2TJB1M']",
  "event_id=$H_iqXiAxOxF6cEFG8uBIOA4daNZRS-n5BkyIO2TJB1M,depth=10,body=Historical 54 (batch=0),prevs=['$M_jaKYkmwpIOh5WbYKo7OABADOIde2GL_UpYgy5DKJE']",
  "event_id=$M_jaKYkmwpIOh5WbYKo7OABADOIde2GL_UpYgy5DKJE,depth=10,body=Historical 53 (batch=0),prevs=['$_tY_1OYdYB2e4mX0psdoZXQqbr_nJvdxNErra3vIRHw']",
  "event_id=$_tY_1OYdYB2e4mX0psdoZXQqbr_nJvdxNErra3vIRHw,depth=10,body=Historical 52 (batch=0),prevs=['$8x0ZzHjqduS1SlqKk1F6x1G71bKCFPWbx0nYU90GS8g']",
  "event_id=$8x0ZzHjqduS1SlqKk1F6x1G71bKCFPWbx0nYU90GS8g,depth=10,body=Historical 51 (batch=0),prevs=['$hYNHRnZ2AktMkxjbiPP_yofAOMmRJLy4nN5K-81-yj8']",
  "event_id=$hYNHRnZ2AktMkxjbiPP_yofAOMmRJLy4nN5K-81-yj8,depth=10,body=Historical 50 (batch=0),prevs=['$Aje2Qa0CHNWiAw1HiK-1djoycAhh4UliroN1vAdKIU4']",
  "event_id=$Aje2Qa0CHNWiAw1HiK-1djoycAhh4UliroN1vAdKIU4,depth=10,body=Historical 49 (batch=0),prevs=['$hbkSA7qbBPpEQH77YE2h-XKVgS3qhI3xse3Yg08smuc']",
  "event_id=$hbkSA7qbBPpEQH77YE2h-XKVgS3qhI3xse3Yg08smuc,depth=10,body=Historical 48 (batch=0),prevs=['$N80_1es0l8LAcvslhrbTOddyQ76W3_VLPnXnG5IBEn4']",
  "event_id=$N80_1es0l8LAcvslhrbTOddyQ76W3_VLPnXnG5IBEn4,depth=10,body=Historical 47 (batch=0),prevs=['$rvz1DpQx9HZLbHgZj5Jq3TVoH1WComOP6AWbytDKClQ']",
  "event_id=$rvz1DpQx9HZLbHgZj5Jq3TVoH1WComOP6AWbytDKClQ,depth=10,body=Historical 46 (batch=0),prevs=['$a6ifNO0AizTsP4HnVPD3Zkuqvo-8PnarenXKDUJZvGE']",
  "event_id=$a6ifNO0AizTsP4HnVPD3Zkuqvo-8PnarenXKDUJZvGE,depth=10,body=Historical 45 (batch=0),prevs=['$1WL7whQmdncf8CJ5l38dn_J8PVztPTNNMNS82gltKhw']",
  "event_id=$1WL7whQmdncf8CJ5l38dn_J8PVztPTNNMNS82gltKhw,depth=10,body=Historical 44 (batch=0),prevs=['$yCLNJyVjv2ti71ORpJI1wuyiWWOCG857If5M24eK2c4']",
  "event_id=$yCLNJyVjv2ti71ORpJI1wuyiWWOCG857If5M24eK2c4,depth=10,body=Historical 43 (batch=0),prevs=['$LV_gqx1bl9NHYdifp_v5JA1QE79nwblPe9dY_MKWuFo']",
  "event_id=$LV_gqx1bl9NHYdifp_v5JA1QE79nwblPe9dY_MKWuFo,depth=10,body=Historical 42 (batch=0),prevs=['$TT41-KXnRahtw3bBlgFkaLEvnGtC7BPispoy9LVoSTE']",
  "event_id=$TT41-KXnRahtw3bBlgFkaLEvnGtC7BPispoy9LVoSTE,depth=10,body=Historical 41 (batch=0),prevs=['$X0wtHayfehEhB59jCSI2NSX5LSdgQfMYBy5D5IXerrg']",
  "event_id=$X0wtHayfehEhB59jCSI2NSX5LSdgQfMYBy5D5IXerrg,depth=10,body=Historical 40 (batch=0),prevs=['$ERk1O6FQFNndKxopemlDrzWV_SZ9zvPaK-7cDWc9hOo']",
  "event_id=$ERk1O6FQFNndKxopemlDrzWV_SZ9zvPaK-7cDWc9hOo,depth=10,body=Historical 39 (batch=0),prevs=['$8EltMIaFXj0HYOUsfGwDXs6--yrfI5NvQHbv8okNMbI']",
  "event_id=$8EltMIaFXj0HYOUsfGwDXs6--yrfI5NvQHbv8okNMbI,depth=10,body=Historical 38 (batch=0),prevs=['$8S8FjedOebUYwPFtb7vb-ZzMeYDp7vJRk-OUzau1RlY']",
  "event_id=$8S8FjedOebUYwPFtb7vb-ZzMeYDp7vJRk-OUzau1RlY,depth=10,body=Historical 37 (batch=0),prevs=['$s06MJYSVrGYW73z6hpTeCPDxnuFLkJXWvyym-4RqTXg']",
  "event_id=$s06MJYSVrGYW73z6hpTeCPDxnuFLkJXWvyym-4RqTXg,depth=10,body=Historical 36 (batch=0),prevs=['$fXsHFdVTchw-xmD41v9KC2ZxC5j6-VYRHGdRTw4AxRQ']",
  "event_id=$fXsHFdVTchw-xmD41v9KC2ZxC5j6-VYRHGdRTw4AxRQ,depth=10,body=Historical 35 (batch=0),prevs=['$ETgS3ZdUq57PzCK0ki-oV21XqFBs1nSgv6CHVl1nddw']",
  "event_id=$ETgS3ZdUq57PzCK0ki-oV21XqFBs1nSgv6CHVl1nddw,depth=10,body=Historical 34 (batch=0),prevs=['$GyrVy70TxEH3ARdy1tf-ZuxyWTqY8M4GeD-e0O4bXTs']",
  "event_id=$GyrVy70TxEH3ARdy1tf-ZuxyWTqY8M4GeD-e0O4bXTs,depth=10,body=Historical 33 (batch=0),prevs=['$etOVbOEtwqS-iLZfOWwAWeaf7Nq4h6B0aLTcsL3Fqb4']",
  "event_id=$etOVbOEtwqS-iLZfOWwAWeaf7Nq4h6B0aLTcsL3Fqb4,depth=10,body=Historical 32 (batch=0),prevs=['$jkugW9wPO5-ZTu3pulbPyYUs7MT08q24rSit47W2aiE']",
  "event_id=$jkugW9wPO5-ZTu3pulbPyYUs7MT08q24rSit47W2aiE,depth=10,body=Historical 31 (batch=0),prevs=['$xl5SAerMsKP7xYH7e9B0QyjNGVu1zYN037WcMl6eM7I']",
  "event_id=$xl5SAerMsKP7xYH7e9B0QyjNGVu1zYN037WcMl6eM7I,depth=10,body=Historical 30 (batch=0),prevs=['$epCIEu5hsIrjVfAQ8xwG_w7l2L_GVswFGlOgvKuBOv4']",
  "event_id=$epCIEu5hsIrjVfAQ8xwG_w7l2L_GVswFGlOgvKuBOv4,depth=10,body=Historical 29 (batch=0),prevs=['$W-r7mxy0Yaj7M33JPu3WwCGHZ4zy-r_UsuuSiSbaBNI']",
  "event_id=$W-r7mxy0Yaj7M33JPu3WwCGHZ4zy-r_UsuuSiSbaBNI,depth=10,body=Historical 28 (batch=0),prevs=['$j4NztVmkOMiN4_drb1Hm0EOEh5kDM1r7Vo1jKPlz5iY']",
  "event_id=$j4NztVmkOMiN4_drb1Hm0EOEh5kDM1r7Vo1jKPlz5iY,depth=10,body=Historical 27 (batch=0),prevs=['$QhtQWlhor0qS81fOCmF2UmYSZXrCY2YabQ3Ysk1pvQ8']",
  "event_id=$QhtQWlhor0qS81fOCmF2UmYSZXrCY2YabQ3Ysk1pvQ8,depth=10,body=Historical 26 (batch=0),prevs=['$ICyGlEHUQ2VNNkGL8KfN5v9rbuLZzYQ_LmH-XpKXi-w']",
  "event_id=$ICyGlEHUQ2VNNkGL8KfN5v9rbuLZzYQ_LmH-XpKXi-w,depth=10,body=Historical 25 (batch=0),prevs=['$4WvejXMuOtnrR_npONQHcEptKDb7oeAdzlguCFafXw8']",
  "event_id=$4WvejXMuOtnrR_npONQHcEptKDb7oeAdzlguCFafXw8,depth=10,body=Historical 24 (batch=0),prevs=['$1dQvQ9CXC8jvDir8Qv_qWD1P6669n5Dt2e9MQzWMmus']",
  "event_id=$1dQvQ9CXC8jvDir8Qv_qWD1P6669n5Dt2e9MQzWMmus,depth=10,body=Historical 23 (batch=0),prevs=['$VqYi4klnvQoQapuwcRhVOGpnd8b5JZbhpr0J8bIVq6s']",
  "event_id=$VqYi4klnvQoQapuwcRhVOGpnd8b5JZbhpr0J8bIVq6s,depth=10,body=Historical 22 (batch=0),prevs=['$caikDgtNzU_-uPQvliFV0LaXeD5KxfT42bbYT-tBuz4']",
  "event_id=$caikDgtNzU_-uPQvliFV0LaXeD5KxfT42bbYT-tBuz4,depth=10,body=Historical 21 (batch=0),prevs=['$tAmrVFwIE67VdJdTELUy9dCLX7UnwEQWJQ0szLMLj1I']",
  "event_id=$tAmrVFwIE67VdJdTELUy9dCLX7UnwEQWJQ0szLMLj1I,depth=10,body=Historical 20 (batch=0),prevs=['$moO383nMlO3xQcIcBJRa1ob23aKG_3BboL0VzaEuV9M']",
  "event_id=$moO383nMlO3xQcIcBJRa1ob23aKG_3BboL0VzaEuV9M,depth=10,body=Historical 19 (batch=0),prevs=['$1ZC20pJmFEnjdsp1WeF3Vb786YGxRUN7lVgBuGtbTh0']",
  "event_id=$1ZC20pJmFEnjdsp1WeF3Vb786YGxRUN7lVgBuGtbTh0,depth=10,body=Historical 18 (batch=0),prevs=['$CR5eEOqcjN4M-V4z4pmcGuj4DDZvIXsXJuCGKFCL2bo']",
  "event_id=$CR5eEOqcjN4M-V4z4pmcGuj4DDZvIXsXJuCGKFCL2bo,depth=10,body=Historical 17 (batch=0),prevs=['$5Nt4QouUaxCemiakDvgSau0Awaq2eLiuf_zAotPHrEk']",
  "event_id=$5Nt4QouUaxCemiakDvgSau0Awaq2eLiuf_zAotPHrEk,depth=10,body=Historical 16 (batch=0),prevs=['$bQGGb7wF69JaRvAgcy8YXA--vZxVwIFoQwBxz1JNcc0']",
  "event_id=$bQGGb7wF69JaRvAgcy8YXA--vZxVwIFoQwBxz1JNcc0,depth=10,body=Historical 15 (batch=0),prevs=['$5NTrpJdUTplsV5Pv0h81f10Od7r8b7MByhNP-Hgo5XI']",
  "event_id=$5NTrpJdUTplsV5Pv0h81f10Od7r8b7MByhNP-Hgo5XI,depth=10,body=Historical 14 (batch=0),prevs=['$RlE8jSspaoHviQ64oGYupPalY6iiEOfm6SVKxCFcj5Q']",
  "event_id=$RlE8jSspaoHviQ64oGYupPalY6iiEOfm6SVKxCFcj5Q,depth=10,body=Historical 13 (batch=0),prevs=['$fAjxrhPzB4YdRFSVUrY4dyUX2rs_Og61PlIxutf4cPw']",
  "event_id=$fAjxrhPzB4YdRFSVUrY4dyUX2rs_Og61PlIxutf4cPw,depth=10,body=Historical 12 (batch=0),prevs=['$AiIInms6FQzl0GHYZw38stEFC72Bl9uoW5r7sLBOdiw']",
  "event_id=$AiIInms6FQzl0GHYZw38stEFC72Bl9uoW5r7sLBOdiw,depth=10,body=Historical 11 (batch=0),prevs=['$l5uuVWnK1HYmBpL-X8XGLG-0FzXmrAVDAdFojpD_BnY']",
  "event_id=$l5uuVWnK1HYmBpL-X8XGLG-0FzXmrAVDAdFojpD_BnY,depth=10,body=Historical 10 (batch=0),prevs=['$bq2Cmy1rMLmJRWRek0azb5SE-CBPj-QJ1GB2F6X6pos']",
  "event_id=$bq2Cmy1rMLmJRWRek0azb5SE-CBPj-QJ1GB2F6X6pos,depth=10,body=Historical 9 (batch=0),prevs=['$fNL5PyiTg-FuQaq3rBdqAzVLev7MPo89u5nUGdP5CdY']",
  "event_id=$fNL5PyiTg-FuQaq3rBdqAzVLev7MPo89u5nUGdP5CdY,depth=10,body=Historical 8 (batch=0),prevs=['$FZvdy85_rIB-TgSq2irIGp8TPz3vt3DdEsTlmklxHfE']",
  "event_id=$FZvdy85_rIB-TgSq2irIGp8TPz3vt3DdEsTlmklxHfE,depth=10,body=Historical 7 (batch=0),prevs=['$gibUQn3wnIHPf2CzXr4rVaDd0ozucmpZLTXi69kT4v0']",
  "event_id=$gibUQn3wnIHPf2CzXr4rVaDd0ozucmpZLTXi69kT4v0,depth=10,body=Historical 6 (batch=0),prevs=['$EtLYRN3xJoYCG2f6l3ZNzeFDBVgT0sJSO-5_CWfk62E']",
  "event_id=$G00qI6L-Jem6u0rM73WAgtl3e27WFREG_IqXBK3rBVY,depth=9,body=Message 1 (eventIDsBefore),prevs=['$E9W0RVZ5jf054fUIQPlls4AXPlFcS5sF6iSwdsgpEZ0']",
  "event_id=$EtLYRN3xJoYCG2f6l3ZNzeFDBVgT0sJSO-5_CWfk62E,depth=10,body=Historical 5 (batch=0),prevs=['$6f7SVRgiDAaiqWanvIsjBfJieMdK8fP_t8qalpWDTKo']"
]
```

When only connecting batch -> insertion event:

 - batch -> insertion fake edge

```
backfill sorted_events=[
  "event_id=$vDdCr0f90ey6Pjpw8Ugl2HQf09Rww5x_M8LanATK8VM,depth=10,body=org.matrix.msc2716.insertion,prevs=['$n9kq5qDGfNxKw7_Cb8kIC-9BrQ0Kg_sTWn9_nLwovA4']",
  "event_id=$h9x6BgpQVHF8Jr33ovBjTxDvXYuR6aNyxw2sKWKqu5U,depth=10,body=org.matrix.msc2716.batch,prevs=['$KU7hS3FmvoQaZkOjdWqyuBqBwFvcWdqJEbKvsXAxWgg']",
  "event_id=$KU7hS3FmvoQaZkOjdWqyuBqBwFvcWdqJEbKvsXAxWgg,depth=10,body=Historical 99 (batch=0),prevs=['$N0bxYWNt4qrh3B4ns78nzD_BRSFzMHt1KTynmuIjztQ']",
  "event_id=$N0bxYWNt4qrh3B4ns78nzD_BRSFzMHt1KTynmuIjztQ,depth=10,body=Historical 98 (batch=0),prevs=['$D9gUbM3vrg7KAVDrXowcP0jmzjX_VM2OHArxGZy6wc8']",
  "event_id=$D9gUbM3vrg7KAVDrXowcP0jmzjX_VM2OHArxGZy6wc8,depth=10,body=Historical 97 (batch=0),prevs=['$fUs553QBZQ-3MqELA3X6pmCL6F9HsEGc0eAyIQ5w-KQ']",
  "event_id=$fUs553QBZQ-3MqELA3X6pmCL6F9HsEGc0eAyIQ5w-KQ,depth=10,body=Historical 96 (batch=0),prevs=['$Txz5IQUjGCf1ewtLvxmPKS0MrGD2LYoh6JwoQcXPYYI']",
  "event_id=$Txz5IQUjGCf1ewtLvxmPKS0MrGD2LYoh6JwoQcXPYYI,depth=10,body=Historical 95 (batch=0),prevs=['$kC7jJEVaeGxRbaGAECrje-j_rUWodeKtXT5TByOR3_0']",
  "event_id=$kC7jJEVaeGxRbaGAECrje-j_rUWodeKtXT5TByOR3_0,depth=10,body=Historical 94 (batch=0),prevs=['$qQ_Qw4R3XJ65ftHFvt7WyUg1-TrJ5ubgw4ln93O3qSE']",
  "event_id=$qQ_Qw4R3XJ65ftHFvt7WyUg1-TrJ5ubgw4ln93O3qSE,depth=10,body=Historical 93 (batch=0),prevs=['$z6Sohu4b39SVOiprB26Ke9XNo1EWuzZysQ-jyc80oXs']",
  "event_id=$z6Sohu4b39SVOiprB26Ke9XNo1EWuzZysQ-jyc80oXs,depth=10,body=Historical 92 (batch=0),prevs=['$CP4JNyEaRikkHIC-1OpoXhw3y3s_0_s-rqnKu_63aFg']",
  "event_id=$CP4JNyEaRikkHIC-1OpoXhw3y3s_0_s-rqnKu_63aFg,depth=10,body=Historical 91 (batch=0),prevs=['$nCjxeXj_OF05JtxM8YUdUlx_moibUUy6QrosWt8R_Us']",
  "event_id=$nCjxeXj_OF05JtxM8YUdUlx_moibUUy6QrosWt8R_Us,depth=10,body=Historical 90 (batch=0),prevs=['$8sFfCVGCb97FXd1etQLR70vmJDjk6RNsgbo5ughLXl8']",
  "event_id=$8sFfCVGCb97FXd1etQLR70vmJDjk6RNsgbo5ughLXl8,depth=10,body=Historical 89 (batch=0),prevs=['$45AU3xVc6xF4qfrdJMh68kZIc-PF9hqkFmuOoxA_j08']",
  "event_id=$45AU3xVc6xF4qfrdJMh68kZIc-PF9hqkFmuOoxA_j08,depth=10,body=Historical 88 (batch=0),prevs=['$9JhvBwk32ygq52H9mKPryUxX3ildrK47p8bAECnMkcI']",
  "event_id=$9JhvBwk32ygq52H9mKPryUxX3ildrK47p8bAECnMkcI,depth=10,body=Historical 87 (batch=0),prevs=['$rXBGwIxCzRUCCQpNvMNiePqrKk6daAOb5nN2AuACDcg']",
  "event_id=$rXBGwIxCzRUCCQpNvMNiePqrKk6daAOb5nN2AuACDcg,depth=10,body=Historical 86 (batch=0),prevs=['$Iebf12p8JQRuVHfWIgVwyc8cqDkPwTvod2HJIAfaaXY']",
  "event_id=$Iebf12p8JQRuVHfWIgVwyc8cqDkPwTvod2HJIAfaaXY,depth=10,body=Historical 85 (batch=0),prevs=['$8CV6t9Yg5RrYzy1-t72ez47xVAgc45iM_nBcEr0r5u8']",
  "event_id=$8CV6t9Yg5RrYzy1-t72ez47xVAgc45iM_nBcEr0r5u8,depth=10,body=Historical 84 (batch=0),prevs=['$jF0yFS-VkCntnui9esPytzncMQ4vbpoI4dEtbnqm2zM']",
  "event_id=$jF0yFS-VkCntnui9esPytzncMQ4vbpoI4dEtbnqm2zM,depth=10,body=Historical 83 (batch=0),prevs=['$rEfXGwUAl6BfF0t_PtOoqnyiC02ACeOKB9zrWaB2k9w']",
  "event_id=$rEfXGwUAl6BfF0t_PtOoqnyiC02ACeOKB9zrWaB2k9w,depth=10,body=Historical 82 (batch=0),prevs=['$7sjkdcEQOMDA7bXvNadBsscUPsvgwHgF7lHq6qT5SCQ']",
  "event_id=$7sjkdcEQOMDA7bXvNadBsscUPsvgwHgF7lHq6qT5SCQ,depth=10,body=Historical 81 (batch=0),prevs=['$Ee4Zn_bD2_qgutvjVpmTLduivzstgTmaXoG4QYsk9kI']",
  "event_id=$Ee4Zn_bD2_qgutvjVpmTLduivzstgTmaXoG4QYsk9kI,depth=10,body=Historical 80 (batch=0),prevs=['$O1NfL_xO7qhf9XtZfwYPQJHRTgcP9UJZ_CU6UfnyTmI']",
  "event_id=$O1NfL_xO7qhf9XtZfwYPQJHRTgcP9UJZ_CU6UfnyTmI,depth=10,body=Historical 79 (batch=0),prevs=['$lSviYdCQKQye2QgoDaj7Ax1uKSp55bvUlS_Ax7vocPA']",
  "event_id=$lSviYdCQKQye2QgoDaj7Ax1uKSp55bvUlS_Ax7vocPA,depth=10,body=Historical 78 (batch=0),prevs=['$ES3Mz4RnN5yj2mv6HIloRnAQlryyAToscQP_74X0R3E']",
  "event_id=$ES3Mz4RnN5yj2mv6HIloRnAQlryyAToscQP_74X0R3E,depth=10,body=Historical 77 (batch=0),prevs=['$G6S-j3AT0tMMHoTXDRYJYGHmVSpy3I7qMPJp71PvqsE']",
  "event_id=$G6S-j3AT0tMMHoTXDRYJYGHmVSpy3I7qMPJp71PvqsE,depth=10,body=Historical 76 (batch=0),prevs=['$n2IZJ9fG-t9cVol8slIDErGnNdbPeacvAWCDlTGYpJk']",
  "event_id=$n2IZJ9fG-t9cVol8slIDErGnNdbPeacvAWCDlTGYpJk,depth=10,body=Historical 75 (batch=0),prevs=['$WxYHgWQRH2CKo5fXTiwH5zMrc7xuI3nsiBgDDSFFBbY']",
  "event_id=$WxYHgWQRH2CKo5fXTiwH5zMrc7xuI3nsiBgDDSFFBbY,depth=10,body=Historical 74 (batch=0),prevs=['$4SxomALNe4fQrzh990LW2MVe2hAh41hefUN96WklLwA']",
  "event_id=$4SxomALNe4fQrzh990LW2MVe2hAh41hefUN96WklLwA,depth=10,body=Historical 73 (batch=0),prevs=['$7jcugB1rv_Jp4wntQhdW_LrwAHjV4flw_uZ3A0rrKVY']",
  "event_id=$7jcugB1rv_Jp4wntQhdW_LrwAHjV4flw_uZ3A0rrKVY,depth=10,body=Historical 72 (batch=0),prevs=['$0JOxrvf7ZArMCYzB1qSz76-akAdDtf0B-ferG4uI3vo']",
  "event_id=$0JOxrvf7ZArMCYzB1qSz76-akAdDtf0B-ferG4uI3vo,depth=10,body=Historical 71 (batch=0),prevs=['$Vd0nksOUDQ92s-Kkn37Zhhj204cAUynybHuHrgtROTs']",
  "event_id=$Vd0nksOUDQ92s-Kkn37Zhhj204cAUynybHuHrgtROTs,depth=10,body=Historical 70 (batch=0),prevs=['$CCDHZGKctXGPB5bAoEbrNk7cXCUiDtIL7PJ1VQGwIS0']",
  "event_id=$CCDHZGKctXGPB5bAoEbrNk7cXCUiDtIL7PJ1VQGwIS0,depth=10,body=Historical 69 (batch=0),prevs=['$3w0P2g8VdVb1ar52A_9XXeON3vmWb6sr_Lctjcyp11A']",
  "event_id=$3w0P2g8VdVb1ar52A_9XXeON3vmWb6sr_Lctjcyp11A,depth=10,body=Historical 68 (batch=0),prevs=['$-fRkdzIZbqczQ85DLuNk9l9DlYgtroT3Sj2hY4PjK3Y']",
  "event_id=$-fRkdzIZbqczQ85DLuNk9l9DlYgtroT3Sj2hY4PjK3Y,depth=10,body=Historical 67 (batch=0),prevs=['$jX0KrPhWbDIHoxsFZCKm8VJLiRaz7zbFLRpcPmXrNLU']",
  "event_id=$jX0KrPhWbDIHoxsFZCKm8VJLiRaz7zbFLRpcPmXrNLU,depth=10,body=Historical 66 (batch=0),prevs=['$RZaiBaIb5pXeFu21n3o8agvfPOzYPHZW2pg-NYnK2Wo']",
  "event_id=$RZaiBaIb5pXeFu21n3o8agvfPOzYPHZW2pg-NYnK2Wo,depth=10,body=Historical 65 (batch=0),prevs=['$Ayy7g5q4SVDDI2n4AjMKEhF7JKYekYoezs42uVlqKQo']",
  "event_id=$Ayy7g5q4SVDDI2n4AjMKEhF7JKYekYoezs42uVlqKQo,depth=10,body=Historical 64 (batch=0),prevs=['$Qrtts5rHLUrB3SH__uKCz9M_IzT8dwLEi5cZbL5XSrI']",
  "event_id=$Qrtts5rHLUrB3SH__uKCz9M_IzT8dwLEi5cZbL5XSrI,depth=10,body=Historical 63 (batch=0),prevs=['$GzpO60z90GafGhNpczoL9-_9sA4X9KAIx-oOp3Ak5fs']",
  "event_id=$GzpO60z90GafGhNpczoL9-_9sA4X9KAIx-oOp3Ak5fs,depth=10,body=Historical 62 (batch=0),prevs=['$FoDpnYsHjsEPKpk1aBTznOupi2Nq0pDcwgPup3EuwHY']",
  "event_id=$FoDpnYsHjsEPKpk1aBTznOupi2Nq0pDcwgPup3EuwHY,depth=10,body=Historical 61 (batch=0),prevs=['$x22YRSOcrA__Jj1jlAjUQj7_aDJxmzgXfn03nDgNuAs']",
  "event_id=$x22YRSOcrA__Jj1jlAjUQj7_aDJxmzgXfn03nDgNuAs,depth=10,body=Historical 60 (batch=0),prevs=['$3abKTbz8gCJ7WVGCAX4gdKKjctfq2UBwAq_kZAiMb6o']",
  "event_id=$3abKTbz8gCJ7WVGCAX4gdKKjctfq2UBwAq_kZAiMb6o,depth=10,body=Historical 59 (batch=0),prevs=['$6JgNxTembrNVYP3Ko6VgpHJNILIqIvTXwPpIsds63BA']",
  "event_id=$6JgNxTembrNVYP3Ko6VgpHJNILIqIvTXwPpIsds63BA,depth=10,body=Historical 58 (batch=0),prevs=['$NUENCAs9SSA4UUHind2mtrX_-5_H-GTXJ4DjQ8o0hVo']",
  "event_id=$NUENCAs9SSA4UUHind2mtrX_-5_H-GTXJ4DjQ8o0hVo,depth=10,body=Historical 57 (batch=0),prevs=['$c12ynew3nRtCewk7IvWy1EurV2XHgRh1sRbj9x5OwJA']",
  "event_id=$c12ynew3nRtCewk7IvWy1EurV2XHgRh1sRbj9x5OwJA,depth=10,body=Historical 56 (batch=0),prevs=['$xcqepPdOhubqAJ2xzBBZg0kuoPnfW4DcTJcj0UiRnDU']",
  "event_id=$xcqepPdOhubqAJ2xzBBZg0kuoPnfW4DcTJcj0UiRnDU,depth=10,body=Historical 55 (batch=0),prevs=['$BPlbbeAqGAzwTsSA-B0qOOYkZyovhvESdtcANOsobdk']",
  "event_id=$BPlbbeAqGAzwTsSA-B0qOOYkZyovhvESdtcANOsobdk,depth=10,body=Historical 54 (batch=0),prevs=['$Z40RGtNNkb54tu_EjNyCc3TG3JAzDn2VNFKcogEpquo']",
  "event_id=$Z40RGtNNkb54tu_EjNyCc3TG3JAzDn2VNFKcogEpquo,depth=10,body=Historical 53 (batch=0),prevs=['$K-50fqiUNw5NkQeGMkg3fgaJCwA9bm5WtTM7AWmfbvw']",
  "event_id=$K-50fqiUNw5NkQeGMkg3fgaJCwA9bm5WtTM7AWmfbvw,depth=10,body=Historical 52 (batch=0),prevs=['$71c4Wa_ks9TcN4nwj0403YQGRRVj-6rhJkQlwoIiJf4']",
  "event_id=$71c4Wa_ks9TcN4nwj0403YQGRRVj-6rhJkQlwoIiJf4,depth=10,body=Historical 51 (batch=0),prevs=['$o16ueMl2wNS6UfeDDt1JJDP5GeHDAo3G-mZnc5kFVA8']",
  "event_id=$o16ueMl2wNS6UfeDDt1JJDP5GeHDAo3G-mZnc5kFVA8,depth=10,body=Historical 50 (batch=0),prevs=['$Tf7hucPlbAIsJSJC_SZTerIDhA601DVXdktkmuR5Kw8']",
  "event_id=$Tf7hucPlbAIsJSJC_SZTerIDhA601DVXdktkmuR5Kw8,depth=10,body=Historical 49 (batch=0),prevs=['$sCpJSEbWzgIZaVxLlGb_JkxhYFj2s16ZloJPiafivVs']",
  "event_id=$sCpJSEbWzgIZaVxLlGb_JkxhYFj2s16ZloJPiafivVs,depth=10,body=Historical 48 (batch=0),prevs=['$UrxtBrZ2WrXFjInPAO2dwVtoPwDQxDDQ49GoqT5v6mI']",
  "event_id=$UrxtBrZ2WrXFjInPAO2dwVtoPwDQxDDQ49GoqT5v6mI,depth=10,body=Historical 47 (batch=0),prevs=['$7PoOmq5lSm_3qEm2B5ggpuEqev14pFjMD-T_4BYqZYo']",
  "event_id=$7PoOmq5lSm_3qEm2B5ggpuEqev14pFjMD-T_4BYqZYo,depth=10,body=Historical 46 (batch=0),prevs=['$2DhrL57VVj1KJuWeIP1_UZHrD7VQq2AUksvMDiTPD-4']",
  "event_id=$2DhrL57VVj1KJuWeIP1_UZHrD7VQq2AUksvMDiTPD-4,depth=10,body=Historical 45 (batch=0),prevs=['$8JexHkPI8s_95LGsa-xS7IUA6pPAzl1Wu6HOkezX4hk']",
  "event_id=$8JexHkPI8s_95LGsa-xS7IUA6pPAzl1Wu6HOkezX4hk,depth=10,body=Historical 44 (batch=0),prevs=['$D1BSCRk1kps83i5-Tm34uZGwTCCxNlmPt-QrVzJ3gKQ']",
  "event_id=$D1BSCRk1kps83i5-Tm34uZGwTCCxNlmPt-QrVzJ3gKQ,depth=10,body=Historical 43 (batch=0),prevs=['$2sdel6OjRf9AArfA-Lp-6AxAXMEGvus5j9CupJmPfpk']",
  "event_id=$2sdel6OjRf9AArfA-Lp-6AxAXMEGvus5j9CupJmPfpk,depth=10,body=Historical 42 (batch=0),prevs=['$ts6IiQMG8YyMwDYVUdRplhzpJLQPuzZXE8TIjTm5Qtw']",
  "event_id=$ts6IiQMG8YyMwDYVUdRplhzpJLQPuzZXE8TIjTm5Qtw,depth=10,body=Historical 41 (batch=0),prevs=['$SxPDbdJ_VYhfcIkJe4sUCvZG71gnhDjgne-WM-gOncQ']",
  "event_id=$SxPDbdJ_VYhfcIkJe4sUCvZG71gnhDjgne-WM-gOncQ,depth=10,body=Historical 40 (batch=0),prevs=['$AOpiIZHC5mhpwV1RPzQd_29KHsY-niX0uuL3ofWoTyY']",
  "event_id=$AOpiIZHC5mhpwV1RPzQd_29KHsY-niX0uuL3ofWoTyY,depth=10,body=Historical 39 (batch=0),prevs=['$8vAjOM6qlvKS9JJAXQx4CCOqRSzMP6C9YlNi0ft1Y68']",
  "event_id=$8vAjOM6qlvKS9JJAXQx4CCOqRSzMP6C9YlNi0ft1Y68,depth=10,body=Historical 38 (batch=0),prevs=['$EUgYbcq2DMNLgzY7SaPtpNQAOKKYLKYIoGfNYQb8Y2A']",
  "event_id=$EUgYbcq2DMNLgzY7SaPtpNQAOKKYLKYIoGfNYQb8Y2A,depth=10,body=Historical 37 (batch=0),prevs=['$ibThSro6ruPZeNqjf_9UGXfo1kErnQUcRZTDAunDM-4']",
  "event_id=$ibThSro6ruPZeNqjf_9UGXfo1kErnQUcRZTDAunDM-4,depth=10,body=Historical 36 (batch=0),prevs=['$YcrZi3aSgm17cZUkGZf-MaR8EWzl-RdDf5qYctmnZ1k']",
  "event_id=$YcrZi3aSgm17cZUkGZf-MaR8EWzl-RdDf5qYctmnZ1k,depth=10,body=Historical 35 (batch=0),prevs=['$0BhcUb0o0wtIE4hwVqAs0AC591TPOx54idyv6TCTiEo']",
  "event_id=$0BhcUb0o0wtIE4hwVqAs0AC591TPOx54idyv6TCTiEo,depth=10,body=Historical 34 (batch=0),prevs=['$umgo6IT00-E22uIRr_e4AsclGtanloy1Aw5GzNpBNfc']",
  "event_id=$umgo6IT00-E22uIRr_e4AsclGtanloy1Aw5GzNpBNfc,depth=10,body=Historical 33 (batch=0),prevs=['$aka96B_0Yx9AljoQKr4QitStKb0RkcPucvFKusGdySc']",
  "event_id=$aka96B_0Yx9AljoQKr4QitStKb0RkcPucvFKusGdySc,depth=10,body=Historical 32 (batch=0),prevs=['$OJJa17fRud2uJLkJ0-mF8iQFsAvimrY_efopy6ctqTg']",
  "event_id=$OJJa17fRud2uJLkJ0-mF8iQFsAvimrY_efopy6ctqTg,depth=10,body=Historical 31 (batch=0),prevs=['$pLWU_gcJnZGRmruRUcPIqWcjBJ9zmh1lb2jv39RDipc']",
  "event_id=$pLWU_gcJnZGRmruRUcPIqWcjBJ9zmh1lb2jv39RDipc,depth=10,body=Historical 30 (batch=0),prevs=['$G-kuDTfZY1V23CzLgSXfgdctIvbxmnT0Nx-qUuUhGbw']",
  "event_id=$G-kuDTfZY1V23CzLgSXfgdctIvbxmnT0Nx-qUuUhGbw,depth=10,body=Historical 29 (batch=0),prevs=['$b5NQ52jYrGKU7-5lJojXF3xAyWcANt3P6CJ1_Mpw9hA']",
  "event_id=$b5NQ52jYrGKU7-5lJojXF3xAyWcANt3P6CJ1_Mpw9hA,depth=10,body=Historical 28 (batch=0),prevs=['$4oJCt-e8AZYL8WJuY_uV2COvrCzbTvC7RB8xAvxGvEA']",
  "event_id=$4oJCt-e8AZYL8WJuY_uV2COvrCzbTvC7RB8xAvxGvEA,depth=10,body=Historical 27 (batch=0),prevs=['$lP0kCgxZMRAQL6_zg0JLNvdn1lRf1dLWXaWMa4ZT5Iw']",
  "event_id=$lP0kCgxZMRAQL6_zg0JLNvdn1lRf1dLWXaWMa4ZT5Iw,depth=10,body=Historical 26 (batch=0),prevs=['$b46KcYyRVIQJ2Mf6lc7UC56ViSxV9h43SVeQ5gYQ0MU']",
  "event_id=$b46KcYyRVIQJ2Mf6lc7UC56ViSxV9h43SVeQ5gYQ0MU,depth=10,body=Historical 25 (batch=0),prevs=['$b35VNurzabrSP0KvVCXRB1i-FjbDS8Ly-UZcU5m9RC0']",
  "event_id=$b35VNurzabrSP0KvVCXRB1i-FjbDS8Ly-UZcU5m9RC0,depth=10,body=Historical 24 (batch=0),prevs=['$8b1w7cxe5bdMj9mKrZTD32szDIVDZutWo1iXUsEQBSM']",
  "event_id=$8b1w7cxe5bdMj9mKrZTD32szDIVDZutWo1iXUsEQBSM,depth=10,body=Historical 23 (batch=0),prevs=['$vqlAlL8FDxucbRlZISrTtvtP4G1tSHNzbZwWEzAMbRM']",
  "event_id=$vqlAlL8FDxucbRlZISrTtvtP4G1tSHNzbZwWEzAMbRM,depth=10,body=Historical 22 (batch=0),prevs=['$ACWiMQWRjseJTFI_4yFLcrr-U7qzeHeSJpOlWOm7H2c']",
  "event_id=$ACWiMQWRjseJTFI_4yFLcrr-U7qzeHeSJpOlWOm7H2c,depth=10,body=Historical 21 (batch=0),prevs=['$mkKg3O1vyzZXCJoN0xEDuZYcm-mra3neT8peKSaI-fQ']",
  "event_id=$mkKg3O1vyzZXCJoN0xEDuZYcm-mra3neT8peKSaI-fQ,depth=10,body=Historical 20 (batch=0),prevs=['$Aro7lP7i_onbj9g5-tgTxKR7Xwo2u6H9xMKVb0Q4OQo']",
  "event_id=$Aro7lP7i_onbj9g5-tgTxKR7Xwo2u6H9xMKVb0Q4OQo,depth=10,body=Historical 19 (batch=0),prevs=['$ZT0davtwy-6ltpLlA7xCRDoZTbBKrFEm0xywwBqmI74']",
  "event_id=$ZT0davtwy-6ltpLlA7xCRDoZTbBKrFEm0xywwBqmI74,depth=10,body=Historical 18 (batch=0),prevs=['$LYfu_QQSdd9Murplu_qT56yJXtXNF0PIfJ-4-zj_OK4']",
  "event_id=$LYfu_QQSdd9Murplu_qT56yJXtXNF0PIfJ-4-zj_OK4,depth=10,body=Historical 17 (batch=0),prevs=['$sCjd4Lz7kNCDqKnV4NpyEbxufPa5ygfhMIXD5tvZIVE']",
  "event_id=$sCjd4Lz7kNCDqKnV4NpyEbxufPa5ygfhMIXD5tvZIVE,depth=10,body=Historical 16 (batch=0),prevs=['$7b8cgWaAtDefi5UR74eFaIq-OCAozn1z-095TfJYYWc']",
  "event_id=$7b8cgWaAtDefi5UR74eFaIq-OCAozn1z-095TfJYYWc,depth=10,body=Historical 15 (batch=0),prevs=['$DJ4LuxKnd1pjfsvyqbx5lWFucWgHi-ouH1GoS_8MQXs']",
  "event_id=$DJ4LuxKnd1pjfsvyqbx5lWFucWgHi-ouH1GoS_8MQXs,depth=10,body=Historical 14 (batch=0),prevs=['$GeABTSXvlqx9Ul4j4vQHQ0xHiZqKjRvZbXQQjPpBQZA']",
  "event_id=$GeABTSXvlqx9Ul4j4vQHQ0xHiZqKjRvZbXQQjPpBQZA,depth=10,body=Historical 13 (batch=0),prevs=['$KoqVyBic8-LUcPwfk3cN-xgwPvcHmPL8kUrVCVXl6Q8']",
  "event_id=$KoqVyBic8-LUcPwfk3cN-xgwPvcHmPL8kUrVCVXl6Q8,depth=10,body=Historical 12 (batch=0),prevs=['$Rn3edaeQ2P7DiyOh5y2_dtPK_sg_97neVHHDXCaga0g']",
  "event_id=$Rn3edaeQ2P7DiyOh5y2_dtPK_sg_97neVHHDXCaga0g,depth=10,body=Historical 11 (batch=0),prevs=['$rRXAVfkswED2m4zGvzd3E3msFjbN1RjP08DblJb9kbY']",
  "event_id=$rRXAVfkswED2m4zGvzd3E3msFjbN1RjP08DblJb9kbY,depth=10,body=Historical 10 (batch=0),prevs=['$7NE5L9LaMSqUj2gwxB46vZrCIDKklNRJNEnYhhluC3I']",
  "event_id=$7NE5L9LaMSqUj2gwxB46vZrCIDKklNRJNEnYhhluC3I,depth=10,body=Historical 9 (batch=0),prevs=['$Legp3Fec3qa5Matct10VzlsNU-cCYSfOMpEC1wWRCSw']",
  "event_id=$Legp3Fec3qa5Matct10VzlsNU-cCYSfOMpEC1wWRCSw,depth=10,body=Historical 8 (batch=0),prevs=['$Ot4kjqVOhGVkEWIshCwP9AmsHX9Dw_OG_rAfzF2YYgk']",
  "event_id=$Ot4kjqVOhGVkEWIshCwP9AmsHX9Dw_OG_rAfzF2YYgk,depth=10,body=Historical 7 (batch=0),prevs=['$_NgCYX2d-zby256Pt84Aw4WOtYtH5kaG9Qq5nrSISFo']",
  "event_id=$_NgCYX2d-zby256Pt84Aw4WOtYtH5kaG9Qq5nrSISFo,depth=10,body=Historical 6 (batch=0),prevs=['$wm5gnTie-UwOxwYVM6YYI6qbOO9g_n-IZ900ouJf4yI']",
  "event_id=$wm5gnTie-UwOxwYVM6YYI6qbOO9g_n-IZ900ouJf4yI,depth=10,body=Historical 5 (batch=0),prevs=['$d8O1CwNO3PfEYgODGj_6eHdxs-8H0Nk3UaoBnrJ8QBs']",
  "event_id=$rFNqVLF37MMcg7Dy8DjxnpUIyo8q-GBEs35AHKJRe8c,depth=11,body=Message 1 (eventIDsAfter),prevs=['$-VN0Wx6nnEzZLwFeON19jL9hW07xo1rGS08HsmBtA2g']",
  "event_id=$-VN0Wx6nnEzZLwFeON19jL9hW07xo1rGS08HsmBtA2g,depth=10,body=Message 0 (eventIDsAfter),prevs=['$n9kq5qDGfNxKw7_Cb8kIC-9BrQ0Kg_sTWn9_nLwovA4']",
  "event_id=$n9kq5qDGfNxKw7_Cb8kIC-9BrQ0Kg_sTWn9_nLwovA4,depth=9,body=Message 1 (eventIDsBefore),prevs=['$JdciLNIztkJyL8kE0GAs_JNRKx00ZYkfkT0Hw9bZmTY']"
]
```
2021-10-29 14:10:43 -05:00
Eric Eastwood 3d387f94fc WIP: Sort events topologically when we receive them over backfill 2021-10-29 11:02:09 -05:00
Eric Eastwood 6ea263b73b Revert "WIP: Sort events topologically when we receive them over backfill"
This reverts commit 5afc264dd5.
2021-10-29 02:43:17 -05:00
Eric Eastwood 5afc264dd5 WIP: Sort events topologically when we receive them over backfill 2021-10-29 02:43:08 -05:00
Eric Eastwood 3e09d49000 Revert "WIP: Don't include the event we branch from"
This reverts commit 9a6d8faafe.
2021-10-28 20:40:57 -05:00
Eric Eastwood 9a6d8faafe WIP: Don't include the event we branch from
We want to backfill all of the history before adding the base event.

But then there is a problem of how do we add the base event after
exhausting all of the historical messages. Backfill will give
us that extremity again but the current code will always
choose the historical branch over and over and never move past it.

I wish we could ask the federated homeserver if it already
has the insertion event locally but we can't make any requests
in the store code here :/
2021-10-28 20:24:00 -05:00
Eric Eastwood 4a12304cf7 Put empty prev_events behind new room version
See https://github.com/matrix-org/synapse/pull/11114#discussion_r733475645
2021-10-28 01:42:48 -05:00
Eric Eastwood 1d3f417046 Revert back to string interpolation for SQL boolean value
Maybe fixes the `sqlite3.OperationalError: no such column: FALSE,` problem in CI,
https://github.com/matrix-org/synapse/runs/3962382283#step:4:11038
2021-10-21 18:49:30 -05:00
Eric Eastwood 2fbe3f13ae Merge branch 'develop' into madlittlemods/return-historical-events-in-order-from-backfill 2021-10-21 05:26:04 -05:00
Eric Eastwood 5bfde7bd33 Merge branch 'master' into madlittlemods/return-historical-events-in-order-from-backfill 2021-10-21 04:51:57 -05:00
Eric Eastwood ee47878439 Fix mypy lints 2021-10-21 04:49:28 -05:00
Eric Eastwood 1263c7e2a9 Remove unused import 2021-10-21 04:39:34 -05:00
Eric Eastwood 83474d9158 Put MSC2716 backfill logic behind experimental feature flag 2021-10-21 04:31:10 -05:00
Eric Eastwood 69dfa16dcb Move to sorting the backfill events in the existing sorted 2021-10-21 04:19:36 -05:00
Eric Eastwood 7da8012f31 Remove extra event info 2021-10-21 04:06:03 -05:00
Eric Eastwood f39c1da083 Remove debug logging 2021-10-21 04:05:24 -05:00
Dirk Klimpel ef7fe09778
Fix setting a user's external_id via the admin API returns 500 and deletes users existing external mappings if that external ID is already mapped (#11051)
Fixes #10846
2021-10-21 09:52:32 +01:00
Eric Eastwood 4191f5615f Remove fake prev events from historical state chain
Fix https://github.com/matrix-org/synapse/issues/11091

We have to allow creation of events with no prev_events
but do have auth_events.

And since the historical member events are outliers
with no prev_events to resolve them, we want to avoid
putting them as backward extremeties.
2021-10-21 03:44:27 -05:00
Eric Eastwood 477c15df72 Some more debug logging 2021-10-20 22:11:12 -05:00
Eric Eastwood 886071b66b Fix backfill not picking up batch events connected to non-base insertion events
Previously, we would only look for a batch event if the insertion event
was connected to something else by prev_event. This is only the case
for the base insertion event. And instead, we need to look for
a batch event whenever we come across an insertion event.
2021-10-20 16:48:28 -05:00
Richard van der Hoff 57501d9194
Update sign_json to support inline key config (#11139)
It's been possible to configure a key inline in the homeserver.yaml since
13bc1e0746. Update `sign_json` to work with this.
2021-10-20 18:49:20 +01:00
Robert Edström 62db603fa0
Consider IP whitelist for identity server resolution (#11120)
Signed-off-by: Robert Edström <github@legogris.se>
2021-10-20 18:43:49 +01:00
Richard van der Hoff 0930e9ae12
Clean up _update_auth_events_and_context_for_auth (#11122)
Remove some redundant code, and generally simplify.
2021-10-20 18:22:40 +01:00
Aaron R 2c61a318cc
Show error when timestamp in seconds is provided to the /purge_media_cache API (#11101) 2021-10-20 14:41:48 +00:00
Sean Quah ee2cee5f52 Merge branch 'master' into develop 2021-10-20 13:43:02 +01:00
Travis Ralston 106d99b8cd
Remove false warning about copying the log config to a homeserver.yaml (#11092)
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2021-10-20 11:48:15 +00:00
Brendan Abolivier 78d5896d19
Document the version of Synapse each module callback was introduced in (#11132)
* Mention callbacks introduced in v1.37.0

According to the documentation introduced in https://github.com/matrix-org/synapse/pull/10062

* Mention callbacks introduced in v1.39.0

According to https://github.com/matrix-org/synapse/pull/10386 and https://github.com/matrix-org/synapse/pull/9884

* Mention callbacks introduced in v1.42.0

According to https://github.com/matrix-org/synapse/pull/10524

* Mention callbacks introduced in v1.44.0 and v1.45.0

As per https://github.com/matrix-org/synapse/pull/10898, https://github.com/matrix-org/synapse/pull/10910 and https://github.com/matrix-org/synapse/pull/10894

* Mention callbacks introduced in v1.46.0

According to https://github.com/matrix-org/synapse/pull/10548
2021-10-20 11:04:27 +00:00
Sean Quah 9b016a0fb4 Remove link to #10947 from changelog 2021-10-20 12:04:20 +01:00
Sean Quah 522489fbcd 1.45.1 2021-10-20 12:00:03 +01:00
Sean Quah df95d3aec2
Revert change to counting of deactivated users towards the monthly active users limit (#11127)
Temporarily revert "Add functionality to remove deactivated users from the monthly_active_users table (#10947)".

This reverts commit eda8c88b84.
2021-10-20 11:05:29 +01:00
Patrick Cloke 0dd0c40329
Add missing type hints to event fetching. (#11121)
Updates the event rows returned from the database to be
attrs classes instead of dictionaries.
2021-10-19 14:29:03 +00:00
Andrew Morgan 5e0e683541
Fix instances of [example]{.title-ref} in the upgrade notes (#11118) 2021-10-19 14:13:56 +01:00
David Robertson a6c318735d
Merge branch 'master' into develop 2021-10-19 12:44:33 +01:00
David Robertson 95813ff43c
Be less inconsistent about v1.2.3 versus 1.2.3 2021-10-19 11:30:16 +01:00
David Robertson a21f8c4b41
Duplicate known issues under 1.45 release 2021-10-19 11:21:21 +01:00
David Robertson 8b1185347a
1.45.0 2021-10-19 11:19:55 +01:00
Dan Callahan 191396f4ba
Reword changelog regarding a suspected regression (#11117)
Signed-off-by: Dan Callahan <danc@element.io>
2021-10-19 11:16:52 +01:00
Richard van der Hoff f3efa0036b
Move _persist_auth_tree into FederationEventHandler (#11115)
This is just a lift-and-shift, because it fits more naturally here. We do
rename it to `process_remote_join` at the same time though.
2021-10-19 10:24:09 +01:00
Richard van der Hoff 0170774b19
Rename _auth_and_persist_fetched_events (#11116)
... to `_auth_and_persist_outliers`, since that reflects its purpose better.
2021-10-19 10:23:55 +01:00
Richard van der Hoff d85bc9a4a7
Include rejected status when we log events. (#11008)
If we find ourselves dealing with rejected events, we proably want to know
about it. Let's include it in the stringification of the event so that it gets
logged.
2021-10-19 10:21:50 +01:00
Eric Eastwood 260ca06f0f Some more trials of trying to get many many events to backfill in order on remote 2021-10-19 01:55:40 -05:00
Eric Eastwood a64bb2e811 Add changelog 2021-10-18 19:30:43 -05:00
Eric Eastwood 4983739156 Avoid constant missing prev_event fetching while backfilling
Persist backfilled event response from oldest -> newest to avoid
having to go fetch missing prev_events which de-outliers every
other event and screws up the stream_ordering. Missing prev_events
aren't fetched as "backfilled" so the stream_ordering was incrementing.

This helps us in MSC2716 land where we can more easily copy a similar
stream_ordering that the originating homeserver has.
2021-10-18 19:27:27 -05:00
Eric Eastwood 438e2226cc Use OrderedDict to gurantee order returned is the same as we were building the list
We are using a Dict over a list to gurantee we don't duplicate the event if it's already in there.
I assume this is why we were using a Set before.
2021-10-18 16:40:04 -05:00
Eric Eastwood f30302db58 Scratch debugging why events appear out of order on remote homeservers 2021-10-18 15:24:19 -05:00
Patrick Cloke 3ab55d43bd
Add missing type hints to synapse.api. (#11109)
* Convert UserPresenceState to attrs.
* Remove args/kwargs from error classes and explicitly pass msg/errorcode.
2021-10-18 15:01:10 -04:00
Richard van der Hoff cc33d9eee2
Check auth on received events' auth_events (#11001)
Currently, when we receive an event whose auth_events differ from those we expect, we state-resolve between the two state sets, and check that the event passes auth based on the resolved state.

This means that it's possible for us to accept events which don't pass auth at their declared auth_events (or where the auth events themselves were rejected), leading to problems down the line like #10083.

This change means we will:

 * ignore any events where we cannot find the auth events
 * reject any events whose auth events were rejected
 * reject any events which do not pass auth at their declared auth_events.

Together with a whole raft of previous work, this is a partial fix to #9595.

Fixes #6643.

Based on #11009.
2021-10-18 18:29:37 +01:00
Richard van der Hoff a5d2ea3d08
Check *all* auth events for room id and rejection (#11009)
This fixes a bug where we would accept an event whose `auth_events` include
rejected events, if the rejected event was shadowed by another `auth_event`
with same `(type, state_key)`.

The approach is to pass a list of auth events into
`check_auth_rules_for_event` instead of a dict, which of course means updating
the call sites.

This is an extension of #10956.
2021-10-18 18:28:30 +01:00
Brendan Abolivier 73743b8ad1
Document Synapse's behaviour when dealing with multiple modules (#11096)
Document Synapse's behaviour when multiple modules register the same
callback/web resource/etc.

Co-authored-by: reivilibre <oliverw@matrix.org>
2021-10-18 18:26:52 +02:00
Richard van der Hoff e8f24b6c35
_run_push_actions_and_persist_event: handle no min_depth (#11014)
Make sure that we correctly handle rooms where we do not yet have a
`min_depth`, and also add some comments and logging.
2021-10-18 17:17:15 +01:00