Skip to content

Introduce blockStartingTxNoncesQuery #2720

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
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

OnedgeLee
Copy link
Contributor

특정 블록 실행 전의 논스값들을 가져올 수 있는 쿼리를 추가합니다.

  • Arguments로서는 블록의 hash 혹은 index 둘 중의 하나를 받아,
    • 해당 블록이 실행되기 이전의 해당 블록에 포함된 트랜잭션 서명자들에 대한 논스값을 리턴하며,
    • 만약 hash와 index 양 쪽 모두 기입하지 않을 경우, tip에 대하여 위의 논스값들을 리턴합니다.

@OnedgeLee OnedgeLee force-pushed the feature/nonce-query branch from 66da16b to 4373876 Compare May 22, 2025 08:03
@OnedgeLee OnedgeLee self-assigned this May 22, 2025
@OnedgeLee OnedgeLee changed the title Introduce tipStartingTxNoncesQuery Introduce blockStartingTxNoncesQuery May 22, 2025
@OnedgeLee OnedgeLee force-pushed the feature/nonce-query branch from a3aa923 to 4f4804b Compare May 22, 2025 12:22
@OnedgeLee OnedgeLee force-pushed the feature/nonce-query branch from 4f4804b to d12e010 Compare May 23, 2025 03:38
@OnedgeLee OnedgeLee requested review from Copilot, ipdae and sky1045 May 23, 2025 03:38
@OnedgeLee OnedgeLee marked this pull request as ready for review May 23, 2025 03:38
@auto-assign auto-assign bot requested a review from area363 May 23, 2025 03:38
@OnedgeLee OnedgeLee requested a review from limebell May 23, 2025 03:39
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Add a new GraphQL query to fetch starting transaction nonces for each signer in a specified block (by hash or index) or the tip if no arguments are provided.

  • Define blockStartingTxNoncesQuery with hash/index arguments and fallback to tip
  • Create BlockStartingTxNoncesType to map signer/nonces tuples
  • Add a unit test covering the hash-based case

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
NineChronicles.Headless/GraphTypes/StandaloneQuery.cs Add blockStartingTxNoncesQuery field with argument parsing and resolve logic
NineChronicles.Headless/GraphTypes/BlockStartingTxNoncesType.cs Define GraphQL type for (Address Signer, long Nonce) tuples
NineChronicles.Headless.Tests/GraphTypes/StandaloneQueryTest.cs Implement test for the new query when called with a block hash
Comments suppressed due to low confidence (2)

NineChronicles.Headless/GraphTypes/StandaloneQuery.cs:603

  • [nitpick] The error message could be clearer. For example: "Provide either 'hash' or 'index', but not both."
=> throw new ArgumentException("Only one of 'hash' and 'index' must be given."),

NineChronicles.Headless.Tests/GraphTypes/StandaloneQueryTest.cs:779

  • Coverage currently only tests the hash argument case. Consider adding tests for the index parameter and the default (no-argument) tip case to fully exercise the new query.
[Fact]

@OnedgeLee OnedgeLee requested a review from Copilot May 23, 2025 05:14
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new GraphQL query, blockStartingTxNoncesQuery, to retrieve the starting transaction nonces for a given block before execution. Key changes include:

  • Adding the new query to StandaloneQuery.cs with tuple-based input handling.
  • Creating a new GraphQL object type for block starting transaction nonces.
  • Implementing tests in StandaloneQueryTest.cs to verify the query returns the expected nonce grouping.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
NineChronicles.Headless/GraphTypes/StandaloneQuery.cs Introduces the blockStartingTxNoncesQuery with input validation and grouping logic.
NineChronicles.Headless/GraphTypes/BlockStartingTxNoncesType.cs Defines the GraphQL type used by the new query.
NineChronicles.Headless.Tests/GraphTypes/StandaloneQueryTest.cs Adds tests for the new query using the hash parameter.
Comments suppressed due to low confidence (1)

NineChronicles.Headless.Tests/GraphTypes/StandaloneQueryTest.cs:780

  • [nitpick] Consider adding additional tests for scenarios when the query is called with the 'index' argument and when both 'hash' and 'index' are provided, to fully cover all input variations.
public async Task BlockStartingTxNonces()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant