Skip to content

Commit

Permalink
feat: eip-3074 (#1104)
Browse files Browse the repository at this point in the history
<!--- Please provide a general summary of your changes in the title
above -->

<!-- Give an estimate of the time you spent on this PR in terms of work
days.
Did you spend 0.5 days on this PR or rather 2 days?  -->

Time spent on this PR: 2d

## Pull request type

<!-- Please try to limit your pull request to one type,
submit multiple pull requests if needed. -->

Please check the type of change your PR introduces:

- [ ] Bugfix
- [x] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying,
or link to a relevant issue. -->

Resolves #1103

## What is the new behavior?

<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Implements EIP 3074
-
-

<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg"
height="34" align="absmiddle"
alt="Reviewable"/>](https://reviewable.io/reviews/kkrt-labs/kakarot/1104)
<!-- Reviewable:end -->
  • Loading branch information
enitrat authored Apr 19, 2024
1 parent a041778 commit fdad69f
Show file tree
Hide file tree
Showing 17 changed files with 700 additions and 35 deletions.
3 changes: 3 additions & 0 deletions blockchain-tests-skip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ testname:
- sha3_d3g0v0_Cancun #RunResources error
stAttackTest:
- ContractCreationSpam_d0g0v0_Cancun #RunResources error
stBadOpcode:
- badOpcodes_d111g0v0_Cancun #EIP-3074
- badOpcodes_d112g0v0_Cancun #EIP-3074
stChainId:
- chainId_d0g0v0_Cancun
stCreate2:
Expand Down
19 changes: 11 additions & 8 deletions src/kakarot/constants.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ namespace Constants {
const MAX_CODE_SIZE = 0x6000;

const BURN_ADDRESS = 0xdead;

// AUTH MAGIC
const MAGIC = 0x04;
}

// See model.Opcode:
Expand Down Expand Up @@ -1503,18 +1506,18 @@ dw Gas.CREATE;
dw 4;
dw 4;
dw -3;
// INVALID
// AUTH
dw 0xf6;
dw 0;
dw 0;
dw 0;
dw 0;
// INVALID
dw 3;
dw 3;
dw -2;
// AUTHCALL
dw 0xf7;
dw 0;
dw 0;
dw 0;
dw 0;
dw 7;
dw 7;
dw -6;
// INVALID
dw 0xf8;
dw 0;
Expand Down
2 changes: 2 additions & 0 deletions src/kakarot/evm.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace EVM {
code_address=evm.message.code_address,
read_only=evm.message.read_only,
is_create=evm.message.is_create,
authorized=evm.message.authorized,
depth=evm.message.depth,
env=evm.message.env,
);
Expand Down Expand Up @@ -244,6 +245,7 @@ namespace EVM {
code_address=self.message.code_address,
read_only=self.message.read_only,
is_create=self.message.is_create,
authorized=self.message.authorized,
depth=self.message.depth,
env=self.message.env,
);
Expand Down
2 changes: 2 additions & 0 deletions src/kakarot/gas.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace Gas {
const ZERO = 0;
const NEW_ACCOUNT = 25000;
const CALL_VALUE = 9000;
const AUTHCALL_VALUE = 6700;
const CALL_STIPEND = 2300;
const SELF_DESTRUCT = 5000;
const SELF_DESTRUCT_NEW_ACCOUNT = 25000;
Expand All @@ -53,6 +54,7 @@ namespace Gas {
const TX_ACCESS_LIST_ADDRESS_COST = 2400;
const TX_ACCESS_LIST_STORAGE_KEY_COST = 1900;
const BLOBHASH = 3;
const AUTH = 3100;
// @notice Compute the cost of the memory for a given words length.
// @dev To avoid range_check overflow, we compute words_len / 512
Expand Down
Loading

0 comments on commit fdad69f

Please sign in to comment.