Skip to content

Commit

Permalink
Add bcs field to Checkpoint (#20340)
Browse files Browse the repository at this point in the history
## Description 

This PR adds the `bcs` for Checkpoint to enable GraphQL Client to
correctly handle `CheckpointSummary` data.

## Test plan 

Added the field to two existing tests and updated the snapshots. A bit
uncertain why some things have changed, so would need some help to
figure out if it's correct or not. @wlmyng

---

## Release notes

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: `Checkpoint` has now a `bcs` field that represents the
Base64 encoded BCS serialization of the `CheckpointSummary` data.
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
stefan-mysten authored Nov 22, 2024
1 parent abdd331 commit fa52d46
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ task 1, line 31:
//# create-checkpoint 12
Checkpoint created: 12

task 2, lines 33-45:
task 2, lines 33-48:
//# run-graphql --cursors {"c":12,"s":6}
Response: {
"data": {
Expand All @@ -17,33 +17,37 @@ Response: {
{
"cursor": "eyJjIjoxMiwicyI6N30",
"node": {
"sequenceNumber": 7
"sequenceNumber": 7,
"bcs": "AAAAAAAAAAAHAAAAAAAAAAEAAAAAAAAAILMD/SjqlardhuNt4bDMq2GGFnNP4NrLhIpVn3gSq6xXASBzHtxWhL2GFWHw1uD1bpgd8vblqJQo/HfMtf2InJdZzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAA=="
}
},
{
"cursor": "eyJjIjoxMiwicyI6OH0",
"node": {
"sequenceNumber": 8
"sequenceNumber": 8,
"bcs": "AAAAAAAAAAAIAAAAAAAAAAEAAAAAAAAAILMD/SjqlardhuNt4bDMq2GGFnNP4NrLhIpVn3gSq6xXASCkAbT63pCVIPXzd6SPYLoprop+R5d98bmNLiEM1jx6UQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAA=="
}
},
{
"cursor": "eyJjIjoxMiwicyI6OX0",
"node": {
"sequenceNumber": 9
"sequenceNumber": 9,
"bcs": "AAAAAAAAAAAJAAAAAAAAAAEAAAAAAAAAILMD/SjqlardhuNt4bDMq2GGFnNP4NrLhIpVn3gSq6xXASCDmqDOafeT4t61pTBytQnoF1/hbFDoNh+BZwmyyY+aEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAA=="
}
},
{
"cursor": "eyJjIjoxMiwicyI6MTB9",
"node": {
"sequenceNumber": 10
"sequenceNumber": 10,
"bcs": "AAAAAAAAAAAKAAAAAAAAAAEAAAAAAAAAILMD/SjqlardhuNt4bDMq2GGFnNP4NrLhIpVn3gSq6xXASAMdzATObOHTdGYAryUpeEo6RBpyR+sNwe5oJfYHZCLwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAA=="
}
}
]
}
}
}

task 3, lines 47-59:
task 3, lines 50-62:
//# run-graphql --cursors {"c":12,"s":6} {"c":12,"s":8}
Response: {
"data": {
Expand All @@ -64,7 +68,7 @@ Response: {
}
}

task 4, lines 61-73:
task 4, lines 64-76:
//# run-graphql --cursors {"c":12,"s":6}
Response: {
"data": {
Expand Down Expand Up @@ -103,7 +107,7 @@ Response: {
}
}

task 5, lines 75-87:
task 5, lines 78-90:
//# run-graphql --cursors {"c":12,"s":3} {"c":12,"s":6}
Response: {
"data": {
Expand All @@ -130,7 +134,7 @@ Response: {
}
}

task 6, lines 89-101:
task 6, lines 92-104:
//# run-graphql --cursors {"c":12,"s":3}
Response: {
"data": {
Expand Down Expand Up @@ -163,7 +167,7 @@ Response: {
}
}

task 7, lines 103-115:
task 7, lines 106-118:
//# run-graphql --cursors {"c":12,"s":6}
Response: {
"data": {
Expand Down Expand Up @@ -202,7 +206,7 @@ Response: {
}
}

task 8, lines 117-129:
task 8, lines 120-132:
//# run-graphql --cursors {"c":12,"s":4}
Response: {
"data": {
Expand Down Expand Up @@ -241,7 +245,7 @@ Response: {
}
}

task 9, lines 131-143:
task 9, lines 134-146:
//# run-graphql --cursors {"c":12,"s":4}
Response: {
"data": {
Expand Down Expand Up @@ -304,7 +308,7 @@ Response: {
}
}

task 10, lines 145-157:
task 10, lines 148-160:
//# run-graphql --cursors {"c":12,"s":6}
Response: {
"data": {
Expand Down Expand Up @@ -343,7 +347,7 @@ Response: {
}
}

task 11, lines 159-171:
task 11, lines 162-174:
//# run-graphql --cursors {"c":12,"s":3} {"c":12,"s":6}
Response: {
"data": {
Expand All @@ -370,7 +374,7 @@ Response: {
}
}

task 12, lines 173-185:
task 12, lines 176-188:
//# run-graphql --cursors {"c":12,"s":9}
Response: {
"data": {
Expand Down Expand Up @@ -403,7 +407,7 @@ Response: {
}
}

task 13, lines 187-199:
task 13, lines 190-202:
//# run-graphql
Response: {
"data": {
Expand Down Expand Up @@ -496,7 +500,7 @@ Response: {
}
}

task 14, lines 201-213:
task 14, lines 204-216:
//# run-graphql
Response: {
"data": {
Expand Down Expand Up @@ -535,7 +539,7 @@ Response: {
}
}

task 15, lines 215-227:
task 15, lines 218-230:
//# run-graphql
Response: {
"data": {
Expand Down Expand Up @@ -574,7 +578,7 @@ Response: {
}
}

task 16, lines 229-241:
task 16, lines 232-244:
//# run-graphql
Response: {
"data": null,
Expand All @@ -597,7 +601,7 @@ Response: {
]
}

task 17, lines 243-256:
task 17, lines 246-259:
//# run-graphql --cursors {"c":10,"s":3} {"c":12,"s":6}
Response: {
"data": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
}
edges {
cursor
node { sequenceNumber }
node {
sequenceNumber
bcs
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,60 +15,65 @@ task 3, line 17:
//# advance-epoch
Epoch advanced: 0

task 4, lines 19-34:
task 4, lines 19-36:
//# run-graphql
Response: {
"data": {
"checkpoint": {
"sequenceNumber": 3
"sequenceNumber": 3,
"bcs": "AAAAAAAAAAADAAAAAAAAAAIAAAAAAAAAIAQ3s4Mbet/w/8Z/cvdXYfev9qtQv2TuFOZcI5XBlbOtASBccSay4jtpNOLJUZaWlhsTssP4qMfFMpVfgR+y0a9nOQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQFgsWTmpO9qta+EbhNi1JmfZoE7cnLjHchlXrKwsDBBHIfHhvDIyrS5XlX2SKSKymW1Cx+ffk0dthkl6k8iVO6dfANqvfU5l8TzbKggaQFYmzJMQJYP3u1VSIZ5EzM0GH1hECcAAAAAAAAzAAAAAAAAAAACAAA="
},
"epoch": {
"epochId": 0,
"checkpoints": {
"nodes": [
{
"sequenceNumber": 0
"sequenceNumber": 0,
"bcs": "AAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAIA1J8u1KucLNL1LEsIkImYRYHqL2cGqjpC9nlSCsS5nbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAA=="
},
{
"sequenceNumber": 1
"sequenceNumber": 1,
"bcs": "AAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAILMD/SjqlardhuNt4bDMq2GGFnNP4NrLhIpVn3gSq6xXASC9LDN3eeve+CTXzQsO9w9hAhFTuNfr+nHnztTf5VhotQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAA=="
},
{
"sequenceNumber": 2
"sequenceNumber": 2,
"bcs": "AAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAILMD/SjqlardhuNt4bDMq2GGFnNP4NrLhIpVn3gSq6xXASDXzherctqbdwF+KqXFVfyCfHjpTeC2EW77b1vqLPA6/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAA=="
},
{
"sequenceNumber": 3
"sequenceNumber": 3,
"bcs": "AAAAAAAAAAADAAAAAAAAAAIAAAAAAAAAIAQ3s4Mbet/w/8Z/cvdXYfev9qtQv2TuFOZcI5XBlbOtASBccSay4jtpNOLJUZaWlhsTssP4qMfFMpVfgR+y0a9nOQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQFgsWTmpO9qta+EbhNi1JmfZoE7cnLjHchlXrKwsDBBHIfHhvDIyrS5XlX2SKSKymW1Cx+ffk0dthkl6k8iVO6dfANqvfU5l8TzbKggaQFYmzJMQJYP3u1VSIZ5EzM0GH1hECcAAAAAAAAzAAAAAAAAAAACAAA="
}
]
}
}
}
}

task 5, line 36:
task 5, line 38:
//# create-checkpoint
Checkpoint created: 4

task 6, line 38:
task 6, line 40:
//# create-checkpoint
Checkpoint created: 5

task 7, line 40:
task 7, line 42:
//# create-checkpoint
Checkpoint created: 6

task 8, line 42:
task 8, line 44:
//# advance-epoch
Epoch advanced: 1

task 9, line 44:
task 9, line 46:
//# create-checkpoint
Checkpoint created: 8

task 10, line 46:
task 10, line 48:
//# create-checkpoint
Checkpoint created: 9

task 11, lines 48-87:
task 11, lines 50-89:
//# run-graphql
Response: {
"data": {
Expand Down Expand Up @@ -159,11 +164,11 @@ Response: {
}
}

task 12, line 89:
task 12, line 91:
//# create-checkpoint
Checkpoint created: 10

task 13, lines 91-122:
task 13, lines 93-124:
//# run-graphql --cursors {"s":3,"c":4} {"s":7,"c":8} {"s":9,"c":10}
Response: {
"data": {
Expand Down Expand Up @@ -215,7 +220,7 @@ Response: {
}
}

task 14, lines 124-155:
task 14, lines 126-157:
//# run-graphql --cursors {"s":0,"c":3} {"s":4,"c":7} {"s":8,"c":9}
Response: {
"data": {
Expand Down Expand Up @@ -267,7 +272,7 @@ Response: {
}
}

task 15, lines 157-188:
task 15, lines 159-190:
//# run-graphql --cursors {"s":1,"c":2} {"s":5,"c":6} {"s":9,"c":9}
Response: {
"data": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
{
checkpoint {
sequenceNumber
bcs
}
epoch {
epochId
checkpoints {
nodes {
sequenceNumber
bcs
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions crates/sui-graphql-rpc/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ type Checkpoint {
By default, the scanning range consists of all transactions in this checkpoint.
"""
transactionBlocks(first: Int, after: String, last: Int, before: String, filter: TransactionBlockFilter, scanLimit: Int): TransactionBlockConnection!
"""
The Base64 serialized BCS bytes of CheckpointSummary for this checkpoint.
"""
bcs: Base64
}

type CheckpointConnection {
Expand Down
Loading

0 comments on commit fa52d46

Please sign in to comment.