forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gql][indexer] index chain identifier into its own table (MystenLabs#…
…18825) This PR puts chain identifier into its own table so that queries of chain identifier does not depend on the existence of checkpoint 0 in the db, which may be pruned away. Tested against devnet locally and added a gql e2e test. --- Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [x] GraphQL: Added a way to always have `chainIdentifier` query return the correct chain ID even when pruning is enabled. - [ ] CLI: - [ ] Rust SDK: - [ ] REST API: --------- Co-authored-by: stefan-mysten <135084671+stefan-mysten@users.noreply.github.com> Co-authored-by: Ashok Menon <ashok@mystenlabs.com>
- Loading branch information
1 parent
f4cef69
commit 16c31d6
Showing
8 changed files
with
78 additions
and
13 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
crates/sui-graphql-e2e-tests/tests/epoch/chain_identifier.exp
This file contains 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,16 @@ | ||
processed 3 tasks | ||
|
||
init: | ||
C: object(0,0) | ||
|
||
task 1, line 7: | ||
//# create-checkpoint | ||
Checkpoint created: 1 | ||
|
||
task 2, lines 9-12: | ||
//# run-graphql | ||
Response: { | ||
"data": { | ||
"chainIdentifier": "8f58ad28" | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
crates/sui-graphql-e2e-tests/tests/epoch/chain_identifier.move
This file contains 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,12 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//# init --protocol-version 48 --simulator --accounts C | ||
|
||
|
||
//# create-checkpoint | ||
|
||
//# run-graphql | ||
{ | ||
chainIdentifier | ||
} |
This file contains 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
2 changes: 2 additions & 0 deletions
2
crates/sui-indexer/migrations/pg/2024-07-13-003534_chain_identifier/down.sql
This file contains 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,2 @@ | ||
-- This file should undo anything in `up.sql` | ||
DROP TABLE IF EXISTS chain_identifier; |
6 changes: 6 additions & 0 deletions
6
crates/sui-indexer/migrations/pg/2024-07-13-003534_chain_identifier/up.sql
This file contains 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,6 @@ | ||
-- Your SQL goes here | ||
CREATE TABLE chain_identifier | ||
( | ||
checkpoint_digest BYTEA NOT NULL, | ||
PRIMARY KEY(checkpoint_digest) | ||
); |
This file contains 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 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 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