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

cmd/evm: implement input txs via rlp in t8n tool #23138

Merged
merged 3 commits into from
Aug 7, 2021

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Jun 30, 2021

This PR supersedes #22963. In many cases, it's desireable to use already-signed transactions as input to the state transition, instead of having the evm sign them internally (for example to use malformed or not-yet-valid transactions).
This PR adds support + docs for that feature.
cc @winsvega

cmd/evm/transition-test.sh Outdated Show resolved Hide resolved
@winsvega
Copy link
Contributor

I do send now tx as RLP to geth. works fine on this branch.

@holiman holiman added this to the 1.10.6 milestone Jul 27, 2021
@fjl fjl modified the milestones: 1.10.6, 1.10.7 Jul 27, 2021
cmd/evm/README.md Outdated Show resolved Hide resolved
@fjl fjl removed the status:triage label Jul 27, 2021
@holiman
Copy link
Contributor Author

holiman commented Jul 27, 2021

@fjl can I haz a review?

Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

LGTM

Name: "input.txs",
Usage: "`stdin` or file name of where to find the transactions to apply.",
Name: "input.txs",
Usage: "`stdin` or file name of where to find the transactions to apply. " +
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can add a comment that RLP list over stdin is not supported

echo signed_txs.rlp | ./evm t8n --state.fork=London --input.alloc=./testdata/13/alloc.json --input.txs=stdin --input.env=./testdata/13/env.json --output.result=alloc_rlptx.json
ERROR(10): failed unmarshaling stdin: invalid character 's' looking for beginning of value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Heh. Try cat instead of echo :)

Copy link
Member

@MariusVanDerWijden MariusVanDerWijden Jul 27, 2021

Choose a reason for hiding this comment

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

I'm doofus, but the general point still stands. We can't read RLP from stdin, because L147 tries to decode into an input object

cat signed_txs.rlp | ./evm t8n --state.fork=London --input.alloc=./testdata/13/alloc.json --input.txs=stdin --input.env=./testdata/13/env.json --output.result=alloc_rlptx.json
ERROR(10): failed unmarshaling stdin: json: cannot unmarshal string into Go value of type t8ntool.input

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, good catch! Fixing...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed this in my last commit. One can't just take the output and feed to the input, since the input can contain many things. Therefore, you need to envelop the leaf json into an object, and call it txsRlp:

[user@work evm]$ cat signed_txs.rlp.json| jq . 
{
  "txsRlp": "0xf8d2b86702f864010180820fa08284d09411111111111111111111111111111111111111118080c001a0b7dfab36232379bb3d1497a4f91c1966b1f932eae3ade107bf5d723b9cb474e0a06261c359a10f2132f126d250485b90cf20f30340801244a08ef6142ab33d1904b86702f864010280820fa08284d09411111111111111111111111111111111111111118080c080a0d4ec563b6568cd42d998fc4134b36933c6568d01533b5adf08769270243c6c7fa072bf7c21eac6bbeae5143371eef26d5e279637f3bd73482b55979d76d935b1e9"
}
[user@work evm]$ cat signed_txs.rlp.json| ./evm t8n --state.fork=London --input.alloc=./testdata/13/alloc.json --input.txs=stdin --input.env=./testdata/13/env.json --output.result=alloc_rlptx.json
INFO [07-28|09:56:08.806] Trie dumping started                     root=672261..31e1e5
INFO [07-28|09:56:08.806] Trie dumping complete                    accounts=3 elapsed="211.905µs"
INFO [07-28|09:56:08.806] Wrote file                               file=alloc.json
INFO [07-28|09:56:08.810] Wrote file                               file=alloc_rlptx.json

@holiman holiman merged commit 8a24b56 into ethereum:master Aug 7, 2021
@holiman holiman deleted the t8n_txs branch August 7, 2021 21:04
sidhujag pushed a commit to sidhujag/go-ethereum that referenced this pull request Aug 15, 2021
In many cases, it's desireable to use already-signed transactions as input to the state transition, instead of having the evm sign them internally (for example to use malformed or not-yet-valid transactions). This PR adds support + docs for that feature.
atif-konasl pushed a commit to frozeman/pandora-execution-engine that referenced this pull request Oct 15, 2021
In many cases, it's desireable to use already-signed transactions as input to the state transition, instead of having the evm sign them internally (for example to use malformed or not-yet-valid transactions). This PR adds support + docs for that feature.
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.

5 participants