Skip to content
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

Add messages for get_pending_nonce mempool RPC #261

Merged
merged 1 commit into from
Oct 24, 2024
Merged

Conversation

mvandeberg
Copy link
Member

Brief description

Adds mempool RPC get_pending_nonce to return a pending nonce from the mempool if the payee has a transaction in the mempool.

Checklist

  • I have built this pull request locally
  • I have ran the unit tests locally
  • I have manually tested this pull request
  • I have reviewed my pull request
  • I have added any relevant tests

Demonstration

❯ ./run.sh pending_nonce                               
~/dev/koinos-integration-tests/tests/pending_nonce ~/dev/koinos-integration-tests
[+] Running 6/6
 ✔ Network pending_nonce_default          Created                                                                                                                                                                                                     0.1s 
 ✔ Container pending_nonce-amqp-1         Started                                                                                                                                                                                                     0.2s 
 ✔ Container pending_nonce-chain-1        Started                                                                                                                                                                                                     0.3s 
 ✔ Container pending_nonce-block_store-1  Started                                                                                                                                                                                                     0.5s 
 ✔ Container pending_nonce-jsonrpc-1      Started                                                                                                                                                                                                     0.5s 
 ✔ Container pending_nonce-mempool-1      Started                                                                                                                                                                                                     0.5s 
=== RUN   TestPublishTransaction
    integration.go:699: Waiting 1s for chain to be ready...
    integration.go:699: Waiting 2s for chain to be ready...
    integration.go:699: Waiting 4s for chain to be ready...
--- PASS: TestPublishTransaction (7.04s)
PASS
ok      koinos-integration-tests/tests/pending_nonce    7.056s
[+] Running 6/6
 ✔ Container pending_nonce-jsonrpc-1      Removed                                                                                                                                                                                                     0.2s 
 ✔ Container pending_nonce-mempool-1      Removed                                                                                                                                                                                                     0.3s 
 ✔ Container pending_nonce-block_store-1  Removed                                                                                                                                                                                                     0.1s 
 ✔ Container pending_nonce-chain-1        Removed                                                                                                                                                                                                     0.3s 
 ✔ Container pending_nonce-amqp-1         Removed                                                                                                                                                                                                     1.2s 
 ✔ Network pending_nonce_default          Removed                                                                                                                                                                                                     0.2s 
~/dev/koinos-integration-tests

@mvandeberg mvandeberg requested a review from sgerbino October 23, 2024 20:56
@@ -52,13 +52,23 @@ message get_reserved_account_rc_response {
uint64 rc = 1;
}

message get_pending_nonce_request {
bytes payee = 1 [(btype) = ADDRESS];
Copy link
Member

Choose a reason for hiding this comment

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

message get_account_nonce_arguments {
bytes account = 1 [(btype) = ADDRESS];
}

For consistency I think it's better to name this account.

Copy link
Member Author

Choose a reason for hiding this comment

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

In the mempool RPC, we follow payee/payer distinctions. I was following what we were doing in the other mempool RPC calls.

message check_pending_account_resources_request {
bytes payer = 1 [(btype) = ADDRESS];
uint64 max_payer_rc = 2 [jstype = JS_STRING];
uint64 rc_limit = 3 [jstype = JS_STRING];
optional bytes block_id = 4 [(btype) = BLOCK_ID];
}

message check_account_nonce_request {
bytes payee = 1 [(btype) = ADDRESS];
bytes nonce = 2;
optional bytes block_id = 3 [(btype) = BLOCK_ID];
}

Copy link
Member

Choose a reason for hiding this comment

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

Your logic is sound.

@sgerbino sgerbino merged commit 5bd1080 into master Oct 24, 2024
1 check passed
@sgerbino sgerbino deleted the get-pending-nonce branch October 24, 2024 15:54
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.

2 participants