-
Couldn't load subscription status.
- Fork 7
Feat/hashi executor #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mani99brar
wants to merge
12
commits into
dev
Choose a base branch
from
feat/hashi-executor
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat/hashi executor #434
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9afd65c
chore: add from field
9bf7c9a
chore: update tests for added field
a16ccf9
fix: node hash decoding for msg sender
b740080
Merge branch 'dev' into chore/updated-relayer-encoding-fix
mani99brar 938eb3d
Merge branch 'dev' into chore/updated-relayer-encoding-fix
mani99brar 966dd6a
feat: hashi executor
f0ce06f
feat: hashi executor
9c8c6b4
feat: hashi helpers
e1bbda4
chore: refactor gql queries
1f52086
chore: add chiado hashi support
0568965
chore: bot review fixes
0e4ca91
fix: typo
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import request from "graphql-request"; | ||
| import { VeaOutboxArbToEth, VeaOutboxArbToGnosis } from "@kleros/vea-contracts/typechain-types"; | ||
|
|
||
| async function getVeaMsgTrnx(nonce: number, inboxAddress: string) { | ||
| console.log(`Fetching transaction hashes for nonce ${nonce} from inbox ${inboxAddress}`); | ||
| try { | ||
| const subgraph = process.env.RELAYER_SUBGRAPH; | ||
| const query = `{messageSents(first: 1, where: {nonce: ${nonce}, inbox: "${inboxAddress}"}) { | ||
| id | ||
| transactionHash | ||
| }}`; | ||
| const result = (await request(`https://api.studio.thegraph.com/query/${subgraph}`, query)) as { | ||
| messageSents: { id: string; transactionHash: string }[]; | ||
| }; | ||
| return result.messageSents.map((trnx) => trnx.transactionHash); | ||
mani99brar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } catch (e) { | ||
| console.log(e); | ||
| return []; | ||
| } | ||
| } | ||
|
|
||
| interface SnapshotResponse { | ||
| snapshotSaveds: Array<{ count: string }>; | ||
| } | ||
| /** | ||
| * Get the count of the veaOutbox | ||
| * @param veaOutbox The veaOutbox contract instance | ||
| * @param chainId The chain id of the veaOutbox chain | ||
| * @returns The count of the veaOutbox | ||
| */ | ||
| const getCount = async (veaOutbox: VeaOutboxArbToEth | VeaOutboxArbToGnosis, chainId: number): Promise<number> => { | ||
| const subgraph = process.env.RELAYER_SUBGRAPH; | ||
| const stateRoot = await veaOutbox.stateRoot(); | ||
|
|
||
| const result = (await request( | ||
| `https://api.studio.thegraph.com/query/${subgraph}`, | ||
| `{ | ||
| snapshotSaveds(first: 1, where: { stateRoot: "${stateRoot}" }) { | ||
| count | ||
| } | ||
| }` | ||
| )) as SnapshotResponse; | ||
|
|
||
| if (result["snapshotSaveds"].length == 0) return 0; | ||
|
|
||
| return Number(result["snapshotSaveds"][0].count); | ||
| }; | ||
|
|
||
| interface MessageSent { | ||
| nonce: number; | ||
| } | ||
|
|
||
| interface MessageSentsResponse { | ||
| messageSents: MessageSent[]; | ||
| } | ||
|
|
||
| /** | ||
| * Get the nonces of messages sent by a given sender | ||
| * @param chainId The chain id of the veaOutbox chain | ||
| * @param nonce The nonce of the first message to relay | ||
| * @param msgSender The address of the sender | ||
| * @returns The nonces of the messages sent by the sender | ||
| */ | ||
| const getNonceFrom = async (chainId: number, inbox: string, nonce: number, msgSender: string) => { | ||
| const subgraph = process.env.RELAYER_SUBGRAPH; | ||
|
|
||
| const result = (await request( | ||
| `https://api.studio.thegraph.com/query/${subgraph}`, | ||
| `{ | ||
| messageSents( | ||
| first: 1000, | ||
| where: { | ||
| inbox: "${inbox}", | ||
| nonce_gte: ${nonce}, | ||
| msgSender_: {id: "${msgSender.toLowerCase()}"} | ||
| }, | ||
| orderBy: nonce, | ||
| orderDirection: asc | ||
| ) { | ||
| nonce | ||
| } | ||
| }` | ||
| )) as MessageSentsResponse; | ||
|
|
||
| return result[`messageSents`].map((a: { nonce: string | number }) => Number(a.nonce)); | ||
| }; | ||
|
|
||
| export { getVeaMsgTrnx, getCount, getNonceFrom }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.