py-evm icon indicating copy to clipboard operation
py-evm copied to clipboard

[WIP]Implement simple subroutine opcodes

Open Peppece opened this issue 5 years ago • 15 comments

What was wrong?

EIP 2315 introduces three new opcodes (BEGINSUB, JUMPSUB, ENDSUB) which deal with subroutines and needed to be implemented.

How was it fixed?

The opcodes were implemented. Also, while installing py-evm on a Mac during the project, I noticed that the doc page contributing.rst didn't include a step without which py-evm couldn't be installed on the system. I have fixed the doc accordingly. Finally, this also implements the code at #1933 as a basis for the Berlin VM.

Fixes #1926

To-Do

  • [x] Implement logic in eth/vm/logic

  • [x] Write tests

Cute Animal Picture

(https://images.pexels.com/photos/146083/pexels-photo-146083.jpeg)

Peppece avatar May 28 '20 20:05 Peppece

@cburgdorf since you started taking a look at Berlin already, do you mind coordinating this review?

carver avatar May 28 '20 23:05 carver

since you started taking a look at Berlin already, do you mind coordinating this review?

@carver yep, will do.

cburgdorf avatar May 29 '20 07:05 cburgdorf

@Peppece thanks for kicking this off!

I think you could rebase this on top of #1933. This will already give you the basic scaffolding for the Berlin fork including the BerlinVM which you'll need in test_opcodes.py

I just wanted to know if the mantainers think the changes I made up to this point conform to the style of the project

Yep, so far so good :+1:

I also wanted to ask if it was a good idea to create another file inside of the logic directory to implement the logic for the opcodes.

I think the implementation of the new opcodes should go into /eth/vm/logic/flow.py

cburgdorf avatar May 29 '20 07:05 cburgdorf

@cburgdorf Awesome! So how do I rebase things on #1933? Do I just copy + paste the code in my branch or is there some git fu I'm missing?

Peppece avatar May 29 '20 10:05 Peppece

You can either add my branch as a remote and pull it down or you edit your .git/config to always pull down PRs (makes your life much easier).

Then you can simple do:

git fetch origin
git rebase origin/pr/1933

cburgdorf avatar May 29 '20 10:05 cburgdorf

Do I just copy + paste the code in my branch or is there some git fu I'm missing?

Just in case: after you pull down the other PR, you would literally git rebase on top of it. (then git push -f) -- notice that these are destructive, and can cause you to lose code, especially if you're still getting comfortable with this tools.

If you're worried about that, you might want to save a reference to your starting point. I still occasionally find myself doing a:

git branch copy-of-branch
git rebase some-branch-i-want-to-add-my-changes-on-top-of
# tool around, write some more code, test it
# take a look around, realize I hate it, decide to blow all changes away since the git branch above
git reset --hard copy-of-branch

carver avatar May 29 '20 16:05 carver

Hey @Peppece just wanted to hear how things are going? Are you still working on this?

cburgdorf avatar Jun 17 '20 12:06 cburgdorf

Hey @Peppece just wanted to hear how things are going? Are you still working on this?

Hey @cburgdorf I was working on this while a school deadline blocked me and I had to focus on that. However, in max 3 days I’ll be back on this.

Peppece avatar Jun 17 '20 12:06 Peppece

@Peppece Sounds good!

cburgdorf avatar Jun 18 '20 08:06 cburgdorf

I only noticed your review now. Will get back to work on this ASAP.

Peppece avatar Sep 16 '20 14:09 Peppece

It's probably a good idea to rebase against the latest master, to minimize conflicts for yourself.

carver avatar Sep 16 '20 23:09 carver

Hello! Is there a particular reason this isn't getting merged? Feel like it has been stuck for a while now.

Peppece avatar Nov 17 '20 09:11 Peppece

Just a heads up that EIP-2315 was pulled from Berlin, so... I guess it makes sense to pause work on this. Sorry friend :/

carver avatar Mar 11 '21 00:03 carver

Just a heads up that EIP-2315 was pulled from Berlin, so... I guess it makes sense to pause work on this. Sorry friend :/

Wow, didn't see this coming. How is this possible? I mean, hasn't this already been implemented for geth and besu?

Peppece avatar Mar 11 '21 00:03 Peppece

@Peppece Yes, it was pulled last minute which is something you wouldn't normaly expect to happen. You may want to read up on the history here: https://github.com/ethereum/pm/issues/263

This doesn't mean your work was for nothing though. There's a chance that the concerns may be addressed and the EIP gets updated / replaced and ships in some other form in an upcoming fork. Sorry, for the disappointing news :/

cburgdorf avatar Mar 11 '21 11:03 cburgdorf