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

refactor: use a match table for execute_opcode" #1019

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

enitrat
Copy link
Contributor

@enitrat enitrat commented Oct 4, 2024

more optimized than if / elses


This change is Reviewable

manlikeHB and others added 28 commits September 30, 2024 09:59
* add validate_eth_tx test

* polish: fmt + docstrings
* First batch of replacements

* Second batch of replacements

* Clean commented code

* scarb fmt

* Apply code review recommendations
* ceil to bytes32

* overflow and nits
* load word to bytes

* unwrap and nits
* implement eth_get_balance

* add missing files

* made requested changes

* fmt

---------

Co-authored-by: enitrat <[email protected]>
* dev: use native in ci

* remove outdated gas reports

* fix fmt

* fix runtime location

* avoid clearing the ssj checkout

* use correct working dir

* update stack size when running rust ef-tests

* update workflows

* simplify workflows by avoiding re-building runtimes

* rework workflow structure
* dev: implement compile-time filtering

* fmt
* Implementation of eth_get_transaction_count function

* Refactoring validate nonce in validation.cairo

* Changing the deprecated function

* Validating nonce without new function

* Adding method to interface and test it

* fix tests

* fmt

---------

Co-authored-by: enitrat <[email protected]>
* fix: mulmod

* fmt
* fix: overflow in message_call_gas

* fmt
* fix typos

* fix typo

* fix typos

* fix typo

* fix typo
* fix: saturate jumpi index taken on stack

* scout: remove print
dev: optimized bitshifts by using a lookup table for powers of two

tmp
* fix: conversion of stack values in opcode execution

* fix test
* test_kakarot_core_get_starknet_address

* ci: downgrade cairo native (#1008)

* dev: use checked math (#1009)

* fix get_starknet_address test

---------

Co-authored-by: Mathieu <[email protected]>
* creating test case for emit events

* fixing format

* side stuff

* Update crates/evm/src/model.cairo

Co-authored-by: Mathieu <[email protected]>

* Update crates/evm/src/backend/starknet_backend.cairo

Co-authored-by: Mathieu <[email protected]>

* changes for implementation of  into trait

---------

Co-authored-by: enitrat <[email protected]>
Co-authored-by: Mathieu <[email protected]>
* dev: optimize to u64 words

* opti from_le_bytes

* dev: optimize ToBytes

* fmt

* fix bug
…1012)

* refactor: decode_legacy_tx for consistency with typed transactions

* fmt

---------

Co-authored-by: enitrat <[email protected]>
* refactor: eth_send_raw_transaction

* fix tests

* fix test

* revert unwanted change
// STOP
return Result::Ok(self.exec_stop());
match opcode {
0 => // STOP
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be better in hex notation no ?

12 => Result::Err(EVMError::InvalidOpcode(opcode)),
13 => Result::Err(EVMError::InvalidOpcode(opcode)),
14 => Result::Err(EVMError::InvalidOpcode(opcode)),
15 => Result::Err(EVMError::InvalidOpcode(opcode)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why adding those ?
Removing it might be easier to read and will go into the default case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't skip numbers unfortunately they have to be sequential 😮‍💨

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.

10 participants