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

Logs Index RPC API #262

Merged
merged 4 commits into from
Dec 18, 2019
Merged

Logs Index RPC API #262

merged 4 commits into from
Dec 18, 2019

Conversation

shemnon
Copy link
Contributor

@shemnon shemnon commented Dec 17, 2019

Add a RPC API to create the logs index.

Example usage:

curl -H "Content-Type: application/json" \
  -X POST \
  --data '{"jsonrpc":"2.0","method":"admin_generateLogBloomCache", "params":["0x0", "0x10000"], "id":1}' \
  <node RPC port>

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>

PR description

Fixed Issue(s)

Add a RPC API to create the logs index.

Example usage:
```
curl -H "Content-Type: application/json" \
  -X POST \
  --data '{"jsonrpc":"2.0","method":"admin_indexTransactionLogs", "params":["0x0", "0x10000"], "id":1}' \
  <node RPC port>
```

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
@shemnon
Copy link
Contributor Author

shemnon commented Dec 17, 2019

Some more examples
query the indexing state, no params

$ curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"admin_generateLogBloomCache", "params":[], "id":1}' localhost:8555
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : {
    "startBlock" : "0x0",
    "endBlock" : "0x0",
    "currentBlock" : "0x0",
    "indexing" : false,
    "requestAccepted" : false
  }
}

Start indexing from 0 to chain head

$ curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"admin_generateLogBloomCache", "params":["0x0"], "id":1}' localhost:8555
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : {
    "startBlock" : "0x0",
    "endBlock" : "latest",
    "currentBlock" : "0x0",
    "indexing" : true,
    "requestAccepted" : true
  }
}

request is ignored if indexing is already occurring

$ curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"admin_generateLogBloomCache", "params":["0x0"], "id":1}' localhost:8555
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : {
    "startBlock" : "0x0",
    "endBlock" : "latest",
    "currentBlock" : "0x738c",
    "indexing" : true,
    "requestAccepted" : false
  }
}

@CjHare
Copy link
Contributor

CjHare commented Dec 17, 2019

The changes look good (although spotless is currently complaining) ...but I notice tthe absence of tests, is the logic tested elsewhere (already covered / follow up PR)?

@shemnon
Copy link
Contributor Author

shemnon commented Dec 17, 2019

That's why it's a draft PR. ;)

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
* have CLI and RPC share one name - GenerateLogBloomCache
* JSON-RPC tests
* Use EthScheduler instead of our own Executor

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
@shemnon shemnon marked this pull request as ready for review December 18, 2019 22:00
@shemnon
Copy link
Contributor Author

shemnon commented Dec 18, 2019

Tests for the cache generation and querying were in the initial checkin last week. This focuses on the RPC exposure of the GenerateLogBloomCache and refactors the CLI, so the new test validates we get what we want out of the RPC call into the other systems.

}
}
} catch (final InterruptedException e) {
// ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

nit; might a DEBUG or TRACE level log message be useful in this InterruptedException case, given it is around indexing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only place it would be seen is when attempting to acquire the lock, and we wouldn't re-try if we got interrupted waiting for the lock, we would fail just like a timeout occured. So I don't see logging as adding any value.

@shemnon shemnon merged commit 756d097 into hyperledger:master Dec 18, 2019
@shemnon shemnon deleted the logindex branch December 19, 2019 15:10
edwardmack pushed a commit to ChainSafe/besu that referenced this pull request Feb 4, 2020
Add a RPC API to create the logs bloom cache.

Example usage:
```
curl -H "Content-Type: application/json" \
  -X POST \
  --data '{"jsonrpc":"2.0","method":"admin_generateLogBloomCache", "params":["0x0", "0x10000"], "id":1}' \
  <node RPC port>
```

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
edwardmack pushed a commit to ChainSafe/besu that referenced this pull request Feb 4, 2020
Add a RPC API to create the logs bloom cache.

Example usage:
```
curl -H "Content-Type: application/json" \
  -X POST \
  --data '{"jsonrpc":"2.0","method":"admin_generateLogBloomCache", "params":["0x0", "0x10000"], "id":1}' \
  <node RPC port>
```

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
Signed-off-by: edwardmack <ed@edwardmack.com>
siladu pushed a commit to siladu/besu that referenced this pull request Oct 28, 2024
* Add GraphQL Schema

Add support for generating the GraphQL Schema, which
is the common schema form used for GraphQL libraries.

* Update schema.graphqls

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* Update schema.graphqls

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* Update schema.graphqls

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* Update schema.graphqls

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* Update schema.graphqls

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>

* Enhance validate script

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>

* add missing package

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>

Co-authored-by: Sina Mahmoodi <1591639+s1na@users.noreply.github.com>
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