Whenever an `Announcement` is parsed as transparent transaction info, we obtain
information about the UTXOs involved in that transaction. It would be nice to
display this information when we look up the UTXO, but there is no way to query
it from neptune-core.
This commit caches that information in order to display it.
Specifically, it extends `AppState` with a (smart pointer to) vector of
`TransparentUtxoInfo` (a new type). The vector, or its existing entries, are
extended with new information when it becomes available.
At this point the vector is rather silly because it is not persisted, and the
app reboots more often than not, resulting in a clear cache. A future commit
will persist this data.
Every transaction can have zero or more announcements, which are essentially
messages that must be included across all future mergers and updates.
Announcements are typically used for transmitting information related to
receiving UTXOs, encrypted. However, a new use case is that of *transparent
transaction info*, which is an announcement containing the UTXOs and the
commitment randomnesses needed to reproduce the transaction's inputs and
outputs. With such a transparent transaction info announcement, third parties
can transparently audit transactions.
This commit adds a page for viewing announcements, and if the announcement can
be parsed as a transparent transaction info type announcement then it is
rendered as such, complete with native currency amounts and linkable UTXOs
(where possible).
The path for accessing announcements is any of
- `/announcement/digest/<hex-string>/<index>`
- `/announcement/tip/<index>`
- `/announcement/genesis/<index>`
- `/announcement/height/<height>/<index>`
- `/announcement/height_or_digest/<height-or-diges>/index/<index>`.
The last bullet point exists to support the quick lookup functionality, which is
also new. A `AnnouncementSelector` has display and from-string methods relating
these path formats to the relevant object. A suite of (prop)tests verifies
parsing.
Also, this commit enables mocking, which is useful when the neptune-core node
the explorer is connected to is outdated, unsynced, or for whatever reason does
not serve the desired data. The RPC client call is intercepted, and if it fails
and mocking is enabled, an imagined (pseudorandom) resource of the requested
type is returned. To enable mocking, compile with the "mock" feature flag and
set the "MOCK" environment variable.
closes#7.
adds a blockchain watchdog that checks every hour if the tip height has
advanced or not. Sends alert email if height is less or equal to
height at the last check and enters a warning mode. In warning mode
it waits until the height is greater than previous, and then sends a
recovery alert and switches to normal mode.
Closes#5
Addresses #6
changes:
* field Mining Reward --> Coinbase. (actual reward)
* add field Expected Coinbase (expected/calced reward)
this field only displays if different from actual coinbase.
* add field Cumulative Proof-of-Work
* change tooltip 🛈 --> ⓘ . for mobile devices. (hopefully)
* css: make tooltip text bold, so the ⓘ is stronger.
Adds a 'Canonical' field to the /block page.
note: this requires updating neptune-core in order to obtain the field
from neptune-core's /block_info rpc endpoint.
it was also necessary to change 'use neptune_core::<x>" statements to
'use neptune_cash::<x>'
ArcSwap is lock-free and optimized for our use-case of lots of
concurrent reads and infrequent updates.
So it is pretty close to a shared-nothing architecture.
Some small changes were necessary, but its mostly a drop-in
replacement for RwLock.
closes#1
Implements a background watchdog task that:
1. calls neptune-core /network rpc every N seconds (default: 10)
2. emits log message on any state change
3. sends detailed email alert to admin on any state change
Changes:
* AppState now has internal Arc<RwLock<AppStateInner>> to permit
watchdog task to mutate the rpc_client field.
* adjust application to AppState changes (use locks)
* not_found functions no longer accept state arg
* move state initialization into AppState::init()
* add optional alert parameters: admin-email, smtp-*
* add neptune_rpc module with watchdog task
* add alert_email module
* simplify main()
* log warnings if alert parameters not set
* add chrono dep
* add lettre dep
Changes:
* adds --listen-port for specifying http port to listen on.
* renames --port to --neptune-rpc-port which is clearer
* updates README accordingly
We use axum route wildcards to merge duplicate page routes and handlers
into a single route and handler.
This makes the routes simpler/cleaner as well as the handlers, as there
is now just one of each for each html page.
Previous:
.route("/block/:selector", get(block_page))
.route("/block/:selector/value", get(block_page_with_value))
New:
.route("/block/*selector", get(block_page))
This is achieved by replacing PathBlockSelector with
BlockSelectorExtended which wraps BlockSelector to provide parsing for
height_or_digest/value. (which is needed for javascript-free input
form)
Changes:
* merge dup handlers for each of block, block_digest, block_info
* merge routes for same
* add BlockSelectorExtended and HeightOrDigest
* remove PathBlockSelector
Previously the logo looked very jagged against a dark background.
This makes it look smooth for dark theme. However it is a bit blurry
against white background.
Hopefully can replace with a higher quality graphic soon.
implements a generic solution to redirect query strings generated by
forms to path based URIs that can be handled by existing routes.
This eliminates the need for javascript that was doing the equivalent
client-side.
Changes:
+ present not-found page for unhandled uri paths, eg /stuff
+ display the tip-height on front page
+ add favicon and neptune logo to front page
+ use ServerDir instead of ServeFile for /image and /css
+ add help tooltips for fields on front page
+ use monospace font for digests
Changes:
1. integrates pico minimal responsive css framework for light/dark
themes and overall better looks.
2. adds a not-found page for bad url queries.
3. catches axum/serde deserialization errors of user input and routes
them to the not-found page with a helpful hint (parse error msg)