Giter Club home page Giter Club logo

erigon-db's Issues

Error type in public API

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.

build on fresh checkout fails to compile

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

build.rs fails to compile -> ethers-rs has made ethers::solc a feature rather than default

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(|| {
    |                               ~~~~~~~~~~~~~~~

Compile error: no method named `open_db_with_flags`

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: f1a7261
  • rust version: rustc 1.65.0-nightly (c07a8b4e0 2022-08-26)

Compile failing due to ::fastrlp::RlpMacEncodedLen not implemented for trait bound `U256: MaxEncodedLenAssoc`

I'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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.