monadicus / mentat Goto Github PK
View Code? Open in Web Editor NEWA Rust-based implementation of the Coinbase Rosetta SDK
License: MIT License
A Rust-based implementation of the Coinbase Rosetta SDK
License: MIT License
Our initial launch code for serving is slowly becoming more and more complex.
We should have some simplistic builder pattern that makes launching the server easier.
Create a test framework where upon we could easily test our rosetta implementation.
Time taken: 5 hours
Call BTC endpoints so that we can setup a better testing framework.
Time taken: 3 hours
Write in release rules for the binary.
This will help build a smaller and more efficient binary.
Time estimate: 1 hour
Self explantory.
Several of us here use Windows for development, and Make isn't very windows friendly.
We should swap to a more cross-friendly tool to help development.
Implement RFC 001.
Have the ability to seamlessly support and add multiple networks.
The Rosetta design easily supports this, though the spec says you should not do this.
However, we should have the option to also allow this.
Change Mentat so you can implement multiple services at once and the routes should check the network and call to the correct network.
still need:
A configuration file would be cleaner and easier to work with than Env variable reading scattered everywhere in the code.
Flagging which methods support idempotence on the /call
Rosetta endpoint.
This can help us make server implementations more efficient.
Prob just a trait to add onto node runner.
Can have some default implementation that could be overridden when necessary.
An option for configurable Access-Control-Allow-Origin
, Access-Control-Allow-Method
, headers present on POST requests and OPTIONS endpoints for the Rosetta API endpoints.
When developing frontends that query remote APIs on different addresses, CORS is required for access. Having these headers present on Mentat removes the need for a reverse proxy solely for them.
The route_builder will need to be extended to add OPTIONS routes.
The configuration will need to add fields to support allowed origins/*.
We need to have documentation tracking what is and isn't currently possible for a rosetta-snarkOS implementation.
Wasm Bindgen for the client.
So it can be used from typescript and called from the front end.
Use the wasm_bindgen crate to help derive the typescript types.
right now in the middleware we only look at blockchain
and network
in NetworkIdentifier
. this is an issue because the kind of check done relies on the node being run. ie bitcoin doesnt have shards but other networks do and they will need to check those
i purposely made the signature to the check
function very generic. what we could do is allow the user to supply pointers to their own check functions that would get run in the middleware. we could obviously still provide default ones as well, but i think there are cases where overriding the default will be required.
Add format checks for the project.
/call
in Rosetta API has an idempotent
field that states the following:
Idempotent indicates that if /call is invoked with the same CallRequest again, at any point in time, it will return the same CallResponse. Integrators may cache the CallResponse if this is set to true to avoid making unnecessary calls to the Rosetta implementation. For this reason, implementers should be very conservative about returning true here or they could cause issues for the caller.
the issue is, our current caching system needs to know if caching is implemented on a route at compile time. so we would need to implement two different versions of /call
and call it based on the contents of idempotent
Some nodes need vastly different settings, that we should be able to support.
Time estimate: 2 hours
Mentat should match the Rosetta SDK spec.
The goal is to match the Rosetta SDK spec as Mentat is meant to be an SDK for implementing Rosetta services.
This allows us to be added to the rosetta-ecosystem repository and the ecosystem category of the community site.
Some of these may already be done or need to be slightly modified.
All bolded ones are required.
Just going to list them all here for now.
Additionally, each of these should be demonstrated in an examples directory.
Add an optional endpoint named sync/progress/etc.
This way you can see how synced your current block is and the latest block.
A new endpoint that returns this information, is only available in online mode.
Users should be able to specify custom tracing setups and teardown functions.
More custom user control.
Move the current logging functions to the node trait.
Time estimation: 3 hours
Make a containerized deployment for rosetta.
Spec found here.
We should create github issue templates to make the creation of issues easier.
Write a better in-memory cache that supports multiple request bodies and specific details of the request bodies.
A health check endpoint.
An API typically has a health check endpoint, which is typically cheap and easy to call so a user can test the server.
To build a performance test framework, we should use oha.
It is a binary, so we could either wrap around it from rust or write shell scripts to test individual endpoints.
I suppose we would also need different data to accomplish such a goal.
It may be cleaner to consider moving each Mentat implementation to different repositories so data for each isn't cluttering this repo.
We could add onto the readme or maybe a separate markdown file the list of repos who use Mentat. People could make PR's to add their service to it.
The node should always be launched, but it is only launched during online mode.
Launch node in offline mode and you cannot make any rpc calls.
(https://github.com/monadicus/mentat/blob/main/mentat/src/server/mod.rs#L143)
RPC calls should work as long as they don't make any outbound connections.
(Write what you expected to happen here)
Build a Request cache that goes to Postgres.
This is to avoid some duplications.
Make docs required on the rust code.
a check is never performed to make sure the network_identifier
field is correct before making a request to a node, meaning you can specify testnet
in your request to mentat but mentat will blindly pass on the request to whatever node is running without checking if its actually testnet
first. this would lead to either incorrect data being returned or an error being returned from a seemingly valid request.
"network_identifier": {
"blockchain": "bitcoin",
"network": "mainnet",
"sub_network_identifier": {
"network": "shard 1",
"metadata": {
"producer": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5"
}
}
},
so basically, we need to add checks for each endpoint in mentat to make sure the blockchain/network being requested actually exists and return an error if it doesn't. if i recall correctly this info should be available as environment variables, so this would be as simple as adding a method on the NetworkIdentifier
struct that performs this check then calling that method whenever network_identifier
is passed
Add cargo fmt and clippy to a CI.
Time taken: 1 hour
Right now we cant generate a default config file for a Rosetta impl
would fix some issues with features when building binaries. also just makes sense
We need to catch 404s
We should return a proper error for a 404.
Axum allows you to set a fallback 404 catcher.
Write the readme.
Possibly the same standard of readmes as done for rosetta-bitcoin/etherum.
we need to look at the output of coinbase's rosetta impl's /network/options
endpoint to make sure we implement all the errors that they implement
Generating a templated configuration file for mentat's rosetta-snarkos fails.
cargo run ./conf.dne.toml
thread 'main' panicked at 'Failed to create default toml configuration at `./conf2.toml`: unsupported Rust type', C:\Users\jonat\AppData\Roaming\work\Monadicus\mentat\mentat\src\conf\configuration.rs:195:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Should generate the configuration file.
Some blockchains have more than just a Testnet or Mainnet network but we only support those two.
This involves filling in the logic for the currently standing endpoints and then writing tests that confirm proper functionality.
We can use bitcoin data for now:
Graphql query language for all the rest calls.
Graphql is a great way for developers to write custom calls.
Ideally, once we have the types module auto-generate the graphql queries as well.
To have the tests run at a reasonable rate, as well as for general performance, there needs to be a caching layer.
This will allow us to test implementations other than just Aleo.
Time estimate: 8 hours
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.