gio256 / erigon-db Goto Github PK
View Code? Open in Web Editor NEWFully typed access to the Erigon db in rust
License: Apache License 2.0
Fully typed access to the Erigon db in rust
License: Apache License 2.0
The project fails to build on fresh checkout with the following issues. It is very likely I'm just being dumb, but wanted to enquire anyhow.
error: there is no argument named `expected`
.cargo/git/checkouts/fastrlp-4d3cd332b9d5b08f/70f5c13/src/decode.rs:74:59
|
74 | write!(f, "list length mismatch: expected {expected}, got {got}")
| ^^^^^^^^^^
error: there is no argument named `got`
.cargo/git/checkouts/fastrlp-4d3cd332b9d5b08f/70f5c13/src/decode.rs:74:75
|
74 | write!(f, "list length mismatch: expected {expected}, got {got}")
| ^^^^^
error: there is no argument named `err`
cargo/git/checkouts/fastrlp-4d3cd332b9d5b08f/70f5c13/src/decode.rs:76:52
|
76 | DecodeError::Custom(err) => write!(f, "{err}"),
| ^^^^^
error: could not compile `fastrlp` due to 3 previous errors
Currently this crate is heavily using eyre::Report
as its error type, even in public APIs. However, according to eyre
's docs, this is not recommended.
I'm trying to add a public error type to this crate. If you are interested, I'll make a PR later.
Thank you.
Error when compiling
error[E0599]: no method named `open_db_with_flags` found for struct `libmdbx::Transaction<'env, M, NoWriteMap>` in the current scope
--> /home/m4tsuri/.cargo/git/checkouts/erigon-db-118ee4f05d317cb2/f1a7261/src/kv/mod.rs:142:24
|
142 | self.inner.open_db_with_flags(Some(Db::NAME), flags)?,
| ^^^^^^^^^^^^^^^^^^ method not found in `libmdbx::Transaction<'env, M, NoWriteMap>`
|
= note: the method was found for
- `libmdbx::Transaction<'env, RW, E>`
erigon_db
: version: f1a7261I'm running into a compiler issue when attempting to import erigon-db into a project I'm working on. I'm new to Rust, so I'm probably missing something simple.
Cloning and running erigon-db from source with the following main.rs file leads to the code compiling and running as expected
git clone erigon-db
cd erigon-db
cargo run --bin erigon-db
// ./erigon-db/src/main.rs
use erigon_db::{Erigon, env_open};
use ethereum_types::Address;
use std::fs::File;
use std::io::Write;
use std::io::LineWriter;
fn main() -> eyre::Result<()> {
let path = std::path::Path::new(env!("ERIGON_CHAINDATA"));
// Open an mdbx environment and begin a read-only database transaction
let env = env_open(path)?;
let db = Erigon::begin(&env)?;
// get the current state of an account
let contract: Address = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f".parse()?; //univ2factory
let account = db.read_account(contract)?.unwrap();
// write populated storage slots to file
let file = File::create("output.txt")?;
let mut file = LineWriter::new(file);
for read in db.walk_storage(contract, account.incarnation, None)? {
let (slot, value) = read?;
file.write(format!("{}: {}\n", slot, value).as_bytes())?;
}
Ok(())
}
However, when I create a new cargo project and use erigon-db as a dependency:
# Cargo.toml
# --snip--
[dependencies]
erigon-db = {git = "https://github.com/gio256/erigon-db"}
ethers = { git = "https://github.com/gakonst/ethers-rs", optional = true }
I get the following error when running cargo run
:
error[E0277]: the trait bound `U256: MaxEncodedLenAssoc` is not satisfied
--> /home/plotchy/.cargo/git/checkouts/erigon-db-118ee4f05d317cb2/9b1347a/src/erigon/macros.rs:306:13
|
306 | ::fastrlp::RlpMaxEncodedLen,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MaxEncodedLenAssoc` is not implemented for `U256`
|
::: /home/plotchy/.cargo/git/checkouts/erigon-db-118ee4f05d317cb2/9b1347a/src/erigon/models/transaction.rs:93:1
|
93 | decl_u256_wrapper!(VPackChainId);
| -------------------------------- in this macro invocation
|
= help: the following other types implement trait `MaxEncodedLenAssoc`:
Bloom
H128
H160
H256
H512
H520
H64
VPackChainId
and 12 others
= note: this error originates in the derive macro `::fastrlp::RlpMaxEncodedLen` (in Nightly builds, run with -Z macro-backtrace for more info)
It seems that the forked repo with the uint patches created in the develop
branch of gio256/fastrlp
is not being found?
This pr for ethers-rs has made ethers-solc an optional feature:
gakonst/ethers-rs#1463
build.rs depends on ethers::solc
[build-dependencies]
ethers = { git = "https://github.com/gakonst/ethers-rs" , features = ["ethers-solc"]}
After making the change, build.rs still fails to compile. I'm not familiar with the logic in that file, otherwise I would've made the fix a PR. Hope this helps.
error[E0061]: this function takes 2 arguments but 1 argument was supplied
--> /home/plotchy/.cargo/git/checkouts/erigon-db-d1f243f9aeca17a7/d88f5bf/build.rs:29:31
|
29 | let contract = output.find(name).ok_or_else(|| {
| ^^^^------ an argument is missing
|
note: associated function defined here
--> /home/plotchy/.cargo/git/checkouts/ethers-rs-c3a7c0a0ae0fe6be/8db1899/ethers-solc/src/compile/output/mod.rs:246:12
|
246 | pub fn find(&self, path: impl AsRef<str>, contract: impl AsRef<str>) -> Option<&T::Artifact> {
| ^^^^
help: provide the argument
|
29 | let contract = output.find(name, {_}).ok_or_else(|| {
| ~~~~~~~~~~~~~~~
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.