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 Block Explorer to Demos #1428

Merged
merged 12 commits into from
May 15, 2024
Merged

Add Block Explorer to Demos #1428

merged 12 commits into from
May 15, 2024

Conversation

Ayiga
Copy link
Member

@Ayiga Ayiga commented May 6, 2024

Closes #1276

This PR:

Adds the Explorer API to Sequencer nodes that are backed by SQL Storage.

This is necessary in order for the block-explorer to be added to the project when running the demo.

Add Block Explorer to process-compose and docker-compose

This adds the block-explorer as a docker deployable to the process-compose and docker-compose files so that the Block Explorer can be accessed for demo purposes.

This PR does not:

Build the Docker image for the Block Explorer, as that is already done in the block-explorer repo:
https://github.com/EspressoSystems/espresso-block-explorer

Populate statistics or summary data for Rollup information. This is due to this information not being stored in a way that is easily queryable. It is a next implementation detail for the Explorer API in the HotShot Query Service.

Key places to review:

sequencer/src/state.rs:893
This implements conversion between FeeAmount to MonetaryValue. At the moment MonetaryValue is backed by an i128 whereas FeeAmount is backed by a U256. It is very possible for truncation / overflow here. It is desired to update MonetaryValue to allow for a larger precision in the future, but at the moment nothing gets large enough for this to matter yet.

How to test this PR:

just demo-native

Once up and everything's settled, you should be able to navigate to http://localhost:3000/ in order to check that the Block Explorer is reflecting the current state of Sequencer 1.

Things tested

I have manually tested the landing explorer page, search functionality, and the links between the different pages.

Ayiga added 2 commits May 6, 2024 09:31
The explorer API that is available in the hotshot query servicer is
available to archival nodes that are backed by postgres sql.  In order
to make the explorer API available to consume, it needs to be exposed
as a module.

Adds the explorer API so that it is available for all `storage-sql`
featured nodes.
With the `explorer api` being available to to `sequencer`s backed by
sql storage, we have the ability to run the `block-explorer` as a docker
container.

This adds the `block-explorer` to the `process-compose` and
`docker-compose` files for use in the demo commands.
docker-compose.yaml Outdated Show resolved Hide resolved
docker-compose.yaml Outdated Show resolved Hide resolved
process-compose.yaml Outdated Show resolved Hide resolved
sequencer/src/api/options.rs Outdated Show resolved Hide resolved
sequencer/src/header.rs Outdated Show resolved Hide resolved
process-compose.yaml Outdated Show resolved Hide resolved
Ayiga added 5 commits May 7, 2024 07:32
The specific port that the `Block Explorer` is being served on should be
listed within the `.env` file in order to ensure that there is not a
potential for port reuse.  In addition this environment variable should be
referenced in `docker-compose.yaml` and `process-compose.yaml`
where necessary.
The behaviors, features, and modules available within the `sequencer`
binary are enabled via a command specified within the command line
arguments.  Since the explorer is another such module, it too should be
configured to be enabled or disabled based on the same configuration
pattern.

This adds the explorer configuration option for optionally enabling the
explorer module.  It also links the dependencies of the module in order
to ensure that is is enabled correctly.
Since this is the `main` branch of the project, and not a `release`
branch, we should refer to the `main` branch of our corresponding
docker images.
The http options currently aren't getting passed any explorer options
when configured.  This is due to missing a configuration call in
`init_with_storage` when adding the explorer options.
The `--platform` flag being `linux/amd64` really limits the ability to pull
and run the demo on certain machines.  It was here due to the `arm64`
build timing out.  However, this has since been resolved, and this
platform flag can now be removed.
Ayiga added 3 commits May 13, 2024 07:33
The `ExplorerHeader` trait no longer has the `namespace_ids_for_offset`
method.

Add `ExplorerTransaction` trait implementation

The new `ExplorerTransaction` trait implementation allows for the
retrieval of a `NamespaceId` from a given `Transaction`.
Add TODO mark for stub implementation to comment

Add Tracked issue reference to comment

The `reward_balance` method for the `ExplorerHeader` implementation
has a stub implementation as the Block Reward is not currently supported
within the sequencer.  In order to document this effectively, a comment
has been added to track it as such, along with a TODO that explains what
change will need to happen, and an issue for added visibility / lookup.
Copy link
Member

@jbearer jbearer left a comment

Choose a reason for hiding this comment

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

Looks good! I also tried it locally and it works great for me

@Ayiga Ayiga marked this pull request as ready for review May 14, 2024 13:27
@tbro
Copy link
Contributor

tbro commented May 14, 2024

Looks cool. I did notice that some fields are getting updated in the UI while others are not. "Time" increments while "Latest Block" requires a page reload. Also since "Time" after 1min only has 1min precision, it doesn't look like it is incrementing so there's not much to signal to us that things are happening.

@Ayiga
Copy link
Member Author

Ayiga commented May 15, 2024

Looks cool. I did notice that some fields are getting updated in the UI while others are not. "Time" increments while "Latest Block" requires a page reload. Also since "Time" after 1min only has 1min precision, it doesn't look like it is incrementing so there's not much to signal to us that things are happening.

Yeah, the specification for the Block Explorer didn't contain any intention of it automatically refreshing or anything, so it doesn't. The time since last block is just updating so that its referenced timestamp isn't continually out-of-date.

@Ayiga Ayiga merged commit c41c0fd into main May 15, 2024
15 checks passed
@Ayiga Ayiga deleted the ts/feat/block-explorer branch May 15, 2024 16:14
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.

Add block explorer to process-compose.yaml and docker-compose.yaml
4 participants