Skip to content

Commit 99d14df

Browse files
committed
2 parents 0c05c15 + 9086528 commit 99d14df

30 files changed

+496
-478
lines changed

pages/ar/developer/assemblyscript-migration-guide.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ let c: usize = a + (b as usize)
180180
// upcasting on class inheritance
181181
class Bytes extends Uint8Array {}
182182

183-
let bytes = new Bytes(2) < Uint8Array > bytes // same as: bytes as Uint8Array
183+
let bytes = new Bytes(2)
184+
// <Uint8Array>bytes // same as: bytes as Uint8Array
184185
```
185186
186187
هناك سيناريوهين قد ترغب في ال cast ، ولكن استخدام `as`/`<T>var` ** ليس آمنا **:
@@ -192,15 +193,17 @@ let bytes = new Bytes(2) < Uint8Array > bytes // same as: bytes as Uint8Array
192193
// downcasting on class inheritance
193194
class Bytes extends Uint8Array {}
194195
195-
let uint8Array = new Uint8Array(2) < Bytes > uint8Array // breaks in runtime :(
196+
let uint8Array = new Uint8Array(2)
197+
// <Bytes>uint8Array // breaks in runtime :(
196198
```
197199

198200
```typescript
199201
// between two types that share a superclass
200202
class Bytes extends Uint8Array {}
201203
class ByteArray extends Uint8Array {}
202204
203-
let bytes = new Bytes(2) < ByteArray > bytes // breaks in runtime :(
205+
let bytes = new Bytes(2)
206+
// <ByteArray>bytes // breaks in runtime :(
204207
```
205208

206209
في هذه الحالة يمكنك إستخدام دالة `changetype<T>`:
Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
---
2-
title: Quick and easy subgraph debugging using forks
2+
title: تصحيح أخطاء الـ subgraph بسرعة وسهولة باستخدام التفرعات (forks)
33
---
44

5-
> Note: this is only available from this `graph-node` [commit](https://github.com/graphprotocol/graph-node/commit/f4e6992d7949b18f990045c8babdcd205a060ef6) or this [docker tag](https://hub.docker.com/layers/graphprotocol/graph-node/f4e6992/images/sha256-51ad494a2ecc387bef2359d863b596ad5bd44436808964cf221e60365a7c00c8?context=explore) onwards, it hasn't been yet released in a minor release (eg: 0.26.0)
5+
> ملاحظة: هذا متاح فقط من هذا `graph-node` [commit](https://github.com/graphprotocol/graph-node/commit/f4e6992d7949b18f990045c8babdcd205a060ef6) أو هذا [docker tag](https://hub.docker.com/layers/graphprotocol/graph-node/f4e6992/images/sha256-51ad494a2ecc387bef2359d863b596ad5bd44436808964cf221e60365a7c00c8?context=explore) وصاعدا ولم يتم إصدارها بعد في إصدار ثانوي (على سبيل المثال: 0.26.0)
66
7-
As with many systems processing large amounts of data, The Graph's Indexers (Graph nodes) may take quite some time to sync-up your subgraph with the target blockchain. The discrepancy between quick changes with the purpose of debugging and long wait times needed for indexing is extremely counterproductive and we are well aware of that. This is why we are introducing **subgraph forking**, developed by [LimeChain](https://limechain.tech/), and in this article I will show you how this feature can be used to substantially speed-up subgraph debugging!
7+
كما هو الحال مع العديد من الأنظمة التي تعالج كميات كبيرة من البيانات ، قد يستغرق مفهرسو The Graph أو (Graph nodes) بعض الوقت لمزامنة الـ subgraph الخاص بك مع blockchain المستهدف. التناقض بين التغييرات السريعة بغرض تصحيح الأخطاء وأوقات الانتظار الطويلة اللازمة للفهرسة يؤدي إلى نتائج عكسية للغاية ونحن ندرك ذلك جيدًا. ولهذا السبب نقدم **subgraph forking ** ، الذي تم تطويره بواسطة [ LimeChain ](https://limechain.tech/) ، وفي هذه المقالة سنوضح لكم كيف يمكن استخدام هذه الميزة لتسريع تصحيح أخطاء الـ subgraph بشكل كبير!
88

9-
## Ok, what is it?
9+
## حسنا، ما هو؟
1010

11-
**Subgraph forking** is the process of lazily fetching entities from _another_ subgraph's store (usually a remote one).
11+
**Subgraph forking** هي عملية جلب الكيانات بشكل lazily من مخزن subgraph _آخر_ (عادةً ما يكون بعيدًا).
1212

13-
In the context of debugging, **subgraph forking** allows you to debug your failed subgraph at block _X_ without needing to wait to sync-up to block _X_.
13+
يسمح لك **subgraph forking** بتصحيح أخطاء الـ subgraph الفاشل في الكتلة(block) _ X _ دون الحاجة للانتظار للمزامنة للكتلة _ X _.
1414

15-
## What?! How?
15+
## ماذا؟! كيف؟
1616

17-
When you deploy a subgraph to a remote Graph node for indexing and it fails at block _X_, the good news is that the Graph node will still serve GraphQL queries using its store, which is synced-up to block _X_. That's great! This means we can take advantage of this "up-to-date" store to fix the bugs arising when indexing block _X_.
17+
عندما تنشر subgraph إلى Graph node بعيدة للقيام بالفهرسة ويفشل عند الكتلة _ X _ ، فإن الخبر الجيد هو أن Graph node ستظل تقدم استعلامات GraphQL باستخدام مخزنها(store)، والذي تمت مزامنته للكتلة(block) _ X _. هذا عظيم! هذا يعني أنه يمكننا الاستفادة من هذا المخزن "المحدث" لإصلاح الأخطاء التي تظهر عند فهرسة الكتلة _ X _.
1818

19-
In a nutshell, we are going to _fork the failing subgraph_ from a remote Graph node that is guaranteed to have the subgraph indexed up to block _X_ in order to provide the locally deployed subgraph being debugged at block _X_ an up-to-date view of the indexing state.
19+
باختصار ، سنقوم _ بتفريع (fork) الـ subgraph الفاشل _ من Graph node بعيدة والتي تضمن فهرسة الـ subgraph للكتلة _ X _ وذلك من أجل توفير الـ subgraph المنشور محليًا والذي يتم تصحيحه عندالكتلة*X* مع عرض محدث لحالة الفهرسة.
2020

21-
## Please, show me some code!
21+
## من فضلك ، أرني بعض الأكواد!
2222

23-
To stay focused on subgraph debugging, let's keep things simple and run along with the [example-subgraph](https://github.com/graphprotocol/example-subgraph) indexing the Ethereum Gravity smart contract.
23+
للاستمرار في التركيز على تصحيح أخطاء الـ subgraph ، دعنا نجعل الأمور بسيطة ونعمل مع [example-subgraph](https://github.com/graphprotocol/example-subgraph) الذي يفهرس عقد Ethereum Gravity الذكي.
2424

25-
Here are the handlers defined for indexing `Gravatar`s, with no bugs whatsoever:
25+
فيما يلي المعالجات (handlers) المعرفة لفهرسة `Gravatar` ، بدون أخطاء على الإطلاق:
2626

2727
```tsx
2828
export function handleNewGravatar(event: NewGravatar): void {
@@ -46,43 +46,43 @@ export function handleUpdatedGravatar(event: UpdatedGravatar): void {
4646
}
4747
```
4848

49-
Oops, how unfortunate, when I deploy my perfect looking subgraph to the [HostedService](https://thegraph.com/hosted-service/) it fails with the _"Gravatar not found!"_ error.
49+
للأسف ، يفشل نشر هذا الـ subgraph ذو المظهر المثالي على [ HostedService ](https://thegraph.com/hosted-service/)مع ظهور الخطأ _"Gravatar not found!"_.
5050

51-
The usual way to attempt a fix is:
51+
الطريقة المعتادة لمحاولة الإصلاح هي:
5252

53-
1. Make a change in the mappings source, which you believe will solve the issue (while I know it won't).
54-
2. Re-deploy the subgraph to the [HostedService](https://thegraph.com/hosted-service/) (or another remote Graph node).
55-
3. Wait for it to sync-up.
56-
4. If it breaks again go back to 1, otherwise: Hooray!
53+
1. إجراء تغيير في مصدر الـ mappings ، والذي تعتقد أنه سيحل المشكلة (وأنا أعلم أنه لن يحلها).
54+
2. إعادة نشر الـ subgraph على [ HostedService ](https://thegraph.com/hosted-service/) (أو Graph node أخرى بعيدة).
55+
3. الانتظار حتى تتم المزامنة.
56+
4. إذا حدثت المشكلة مرة أخرى ، فارجع إلى 1!
5757

58-
It is indeed pretty familiar to an ordinary debug process, but there is one step that horribly slows down the process: _3. Wait for it to sync-up._
58+
كما ترى ، فهده الطريقة تشبه عملية تصحيح الأخطاء العادية ، ولكن هناك خطوة واحدة تؤدي إلى إبطاء العملية بشكل رهيب: _ 3. الانتظار حتى تتم المزامنة. _
5959

60-
Using **subgraph forking** we can essentially eliminate this step. Here is how it looks:
60+
باستخدام **subgraph forking** يمكننا التخلص من تلك الخطوة. إليك كيف يبدو:
6161

62-
0. Spin-up a local Graph node with the **_appropriate fork-base_** set.
63-
1. Make a change in the mappings source, which you believe will solve the issue.
64-
2. Deploy to the local Graph node, **_forking the failing subgraph_** and **_starting from the problematic block_**.
65-
3. If it breaks again, go back to 1, otherwise: Hooray!
62+
0. قم بتجهيز Graph node محلية بمجموعة **_fork-base_** مناسبة.
63+
1. قم بإجراء تغيير في مصدر الـ mappings ، والذي تعتقد أنه سيحل المشكلة.
64+
2. قم بالنشر إلى Graph node محلية ، **_وقم بتفريع الـ subgraph الفاشل_**و**_ البدء من الكتلة التي بها المشكلة_**.
65+
3. إذا حدثت المشكلة مرة أخرى ، فارجع إلى 1!
6666

67-
Now, you may have 2 questions:
67+
الآن ، قد يكون لديك سؤالان:
6868

69-
1. fork-base what??? 2) Forking who?!
70-
2. Forking who?!
69+
1. ماهو fork-base؟؟؟
70+
2. ما الذي نقوم بتفريعه (Forking)؟!
7171

72-
And I answer:
72+
وأنا أجيب:
7373

74-
1. `fork-base` is the "base" URL, such that when the _subgraph id_ is appended the resulting URL (`<fork-base>/<subgraph-id>`) is a valid GraphQL endpoint for the subgraph's store. 2) Forking is easy, no need to sweat:
75-
2. Forking is easy, no need to sweat:
74+
1. `fork-base` هو عنوان URL "الأساسي" ،فمثلا عند إلحاق _subgraph id_ ، يكون عنوان URL الناتج (`<fork-base>/<subgraph-id>`) هو GraphQL endpoint صالح لمخزن الـ subgraph.
75+
2. الـتفريع سهل ، فلا داعي للقلق:
7676

7777
```bash
7878
$ graph deploy <subgraph-name> --debug-fork <subgraph-id> --ipfs http://localhost:5001 --node http://localhost:8020
7979
```
8080

81-
Also, don't forget to set the `dataSources.source.startBlock` field in the subgraph manifest to the number of the problematic block, so you can skip indexing unnecessary blocks and take advantage of the fork!
81+
أيضًا ، لا تنس تعيين حقل `dataSources.source.startBlock` في subgraph manifest لرقم الكتلة(block) التي بها المشكلة، حتى تتمكن من تخطي فهرسة الكتل الغير ضرورية والاستفادة من التفريع!
8282

83-
So, here is what I do:
83+
لذلك ، هذا ما أفعله:
8484

85-
0. I spin-up a local graph node ([here is how to do it](https://github.com/graphprotocol/graph-node#running-a-local-graph-node)) with the `fork-base` option set to: `https://api.thegraph.com/subgraphs/id/`, since I will fork a subgraph, the buggy one I deployed earlier, from the [HostedService](https://thegraph.com/hosted-service/).
85+
0. أقوم بتجهيز Graph Node محلية ([هنا كيف تقوم به](https://github.com/graphprotocol/graph-node#running-a-local-graph-node)) مع تعيين خيار `fork-base` إلى `https://api.thegraph.com/subgraphs/id/` ، نظرا لأنني سأقوم بتفريع(fork) الـ subgraph الذي به أخطاء والذي نشرته سابقا من الـ [HostedService](https://thegraph.com/hosted-service/).
8686

8787
```
8888
$ cargo run -p graph-node --release -- \
@@ -92,13 +92,13 @@ $ cargo run -p graph-node --release -- \
9292
--fork-base https://api.thegraph.com/subgraphs/id/
9393
```
9494

95-
1. After careful inspection I notice that there is a mismatch in the `id` representations used when indexing `Gravatar`s in my two handlers. While `handleNewGravatar` converts it to a hex (`event.params.id.toHex()`), `handleUpdatedGravatar` uses an int32 (`event.params.id.toI32()`) which causes the `handleUpdatedGravatar` to panic with "Gravatar not found!". I make them both convert the `id` to a hex.
96-
2. After I made the changes I deploy my subgraph to the local Graph node, **_forking the failing subgraph_** and setting `dataSources.source.startBlock` to `6190343` in `subgraph.yaml`:
95+
1. بعد فحص دقيق ، لاحظت أن هناك عدم تطابق في تمثيلات الـ `id` المستخدمة عند فهرسة `Gravatar` في المعالجين الخاصين بي. بينما `handleNewGravatar` يحول (`event.params.id.toHex()`) إلى سداسي ، `handleUpdatedGravatar` يستخدم int32 (`event.params.id.toI32()`) مما يجعل `handleUpdatedGravatar` قلقا من "Gravatar not found!". أنا أجعلهم كلاهما يحولان `id` إلى سداسي.
96+
2. بعد إجراء التغييرات ، قمت بنشر الـ subgraph الخاص بي على Graph node المحلية **_وتفريع الـsubgraph الفاشل_** وضبط `dataSources.source.startBlock` إلى `6190343` في `subgraph.yaml`:
9797

9898
```bash
9999
$ graph deploy gravity --debug-fork QmNp169tKvomnH3cPXTfGg4ZEhAHA6kEq5oy1XDqAxqHmW --ipfs http://localhost:5001 --node http://localhost:8020
100100
```
101101

102-
3. I inspect the logs produced by the local Graph node and, Hooray!, everything seems to be working.
103-
4. I deploy my now bug-free subgraph to a remote Graph node and live happily ever after! (no potatoes tho)
104-
5. The end...
102+
3. لقد قمت بفحص السجلات التي تنتجها Graph node المحلية ، ويبدو أن كل شيء يعمل بشكل جيد.
103+
4. أقوم بنشر الـ subgraph الخاص بي الخالي من الأخطاء لـ Graph node بعيدة وأعيش في سعادة دائمة
104+
5. النهاية...

pages/ar/hosted-service/migrating-subgraph.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ _بينما تتم هذه الآلية حاليا على الشبكة ، ينا
137137

138138
على الرغم من أن هذه ليست ميزة موجودة في واجهة مستخدم المنتج ، إلا أنه يمكنك تعيين الحد الأقصى لميزانيتك لكل استعلام وذلك عن طريق أخذ المبلغ الذي ترغب في دفعه شهريًا وتقسيمه على حجم الاستعلام المتوقع.
139139

140-
While you get to decide on your query budget, there is no guarantee that an Indexer will be willing to serve queries at that price. If a Gateway can match you to an Indexer willing to serve a query at, or lower than, the price you are willing to pay, you will pay the delta/difference of your budget **and** their price. As a consequence, a lower query price reduces the pool of Indexers available to you, which may affect the quality of service you receive. It's beneficial to have high query fees, as that may attract curation and big-name Indexers to your subgraph.
140+
أثناء اتخاذ قرار بشأن ميزانية الاستعلام الخاصة بك ، ليس هناك ما يضمن أن المفهرس سيكون على استعداد لتقديم الاستعلامات بهذا السعر. إذا تمكن الـ Gateway من مطابقتك مع مفهرس يرغب في تقديم استعلام بالسعر الذي ترغب في دفعه أو أقل ، فستدفع الفرق بين ميزانيتك **و** سعرهم. ونتيجة لذلك ، فإن سعر الاستعلام المنخفض يقلل من عدد المفهرسين المتاحين لك ، مما قد يؤثر على جودة الخدمة التي تتلقاها. من المفيد أن يكون لديك رسوم استعلام مرتفع ، لأن ذلك قد يجذب التنسيق وأسماء كبيرة من المفهرسين إلى الـ subgraph الخاص بك.
141141

142142
تذكر أنه سوق ديناميكي ومتنامي ، ولكن كيفية تفاعلك معه هو تحت سيطرتك. لا يوجد حد أقصى أو أدنى للسعر في البروتوكول أو البوابات(Gateways). على سبيل المثال ، يمكنك إلقاء نظرة أدناه على السعر الذي دفعه عدد قليل من الـ dapps على الشبكة (على أساس أسبوعي). انظر للعمود الأخير ، والذي يعرض رسوم الاستعلام كـ GRT. على سبيل المثال ، [Pickle Finance](https://www.pickle.finance/) لديه 8 طلبات في الثانية ودفع 2.4 GRT لأسبوع واحد.
143143

0 commit comments

Comments
 (0)