Code Monkey home page Code Monkey logo

ethereum's Introduction

ethereum-rs

Apache-2 licensed common Ethereum structs shared by crates.

ethereum's People

Contributors

eh2406 avatar elichai avatar gagarin55 avatar joshorndorff avatar koushiro avatar mersinvald avatar notlesh avatar sorpaas avatar tgmichel avatar vorot93 avatar zjb0807 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ethereum's Issues

U256 Nonce waste

pub struct Account { pub nonce: U256, ... }
But in go ethereum, it is
type Account struct { Nonce uint64 ... }
looks like 24 bytes are wasted, is this intended? why?

TransactionV2 should not be rlp encoded

There is no need to implement rlp::Encodable and rlp::Decodable on the enveloped TransactionV1 and TransactionV2 types.

According to EIP-2718, the leading byte of an enveloped transaction determines the format of the remaining bytes, but the envelope itself is not rlp-encoded.

In other words, the format for enveloped transactions is TransactionType || TransactionPayload, so in the case of EIP1559 transactions for example, the envelope should be 0x02 || rlp(EIP1559Transaction). However using this library, you effectively end up with rlp(0x02 || rlp(EIP1559Transaction)), which is incorrect.

This means, for example, I would have expected to be able to decode a raw ethereum tx like so: TransactionV2::decode(&raw_bytes), however for non-legacy transactions this fails with RlpExpectedToBeList.

It might make sense to remove/deprecate the implementations of rlp::Encodable and rlp::Decodable for the TransactionV1 and TransactionV2 enums since there should never be a reason to rlp-encode the envelope in the first place.

Receipt.state_root should RLP encode/decode as a U256

As currently implemented, the Receipts message test case in EIP-2481 cannot be deserialized. This is because the definition of Receipt uses type H256 (which has a fixed-sized, 32 byte serialization) instead of U256, which has a variable length serialization.

pub struct Receipt {
	pub state_root: H256, // Should to be U256
	pub used_gas: U256,
	pub logs_bloom: Bloom,
	pub logs: Vec<Log>,
}

To verify the issue, you can use an RLP debugger to deserialize the test case and check that the entry corresponding to state_root is encoded as a number, not a vector.

Screen Shot 2021-08-16 at 9 16 26 PM

You can also reproduce the issue by pulling akula-bft/akula#19 locally, patching your ethereum crate on disk, and then verifying that the unit test decode_receipts passes.

AccessListItem metadata should use storageKeys

type: {
              path: [
                ethereum
                transaction
                AccessListItem
              ]
              params: []
              def: {
                Composite: {
                  fields: [
                    {
                      name: address
                      type: 37
                      typeName: Address
                      docs: []
                    }
                    {
                      name: slots
                      type: 170
                      typeName: Vec<H256>
                      docs: []
                    }
                  ]
                }
              }

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.