Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stateless MPT-based token script #11

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Stateless MPT-based token script #11

wants to merge 16 commits into from

Conversation

s1na
Copy link
Collaborator

@s1na s1na commented Jul 2, 2019

Initial prototype for a basic eth1-esque stateless token with the following characteristics:

  • Uses the merkle patricia tree for state
  • RLP to encode block data, merkle proofs, etc.
  • Eth1's signature scheme

Sample script for generating the merkle proofs: https://gist.github.com/s1na/df9682fc4f9a8f4290c7d34be8ffcd2f

Note: There seemed to be version conflicts for some parts of parity's trie implementation, so I had to copy the relevant parts to get it to work (keccak_hasher.rs and rlp_node_codec.rs specifically).

@s1na
Copy link
Collaborator Author

s1na commented Jul 2, 2019

Hm, not sure why the build failed 🤔 it says chisel: Failed to open wasm binary.. Locally it works for me

@s1na
Copy link
Collaborator Author

s1na commented Jul 3, 2019

Updates:

  • The script now processes blocks which have multiple transactions
  • Added a sample relayer in js which generates a yaml test suite, and a Makefile which generates a test case and runs the script

I'm facing a weird bug however: For some random blocks the test fails, but when I compile the same source to native (x86_64) and run it, the post_state_root is correct. Haven't found out the cause yet.


#[cfg(not(test))]
#[no_mangle]
pub extern "C" fn main() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the macro from ewasm-api.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fails because eth2_pushNewDeposits is not implemented yet.

scripts/smpt/Cargo.toml Outdated Show resolved Hide resolved
@s1na
Copy link
Collaborator Author

s1na commented Jul 5, 2019

I'm facing a weird bug however: For some random blocks the test fails, but when I compile the same source to native (x86_64) and run it, the post_state_root is correct. Haven't found out the cause yet.

This seems to be caused by qimalloc, when switching to wee_alloc the problem is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants