Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

docs/Deployment Process #409

Merged
merged 4 commits into from
Jan 10, 2023
Merged

Conversation

TotalPizza
Copy link
Contributor

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • 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?

Resolves #382

What is the new behavior?

  • Adding starknet.py lib to poetry dependencies.
  • Documenting Process of deploying Kakarot using the .py deployment script + Some general documentation regarding the different components and their functionality.

Other information

Time spent on this PR: 0.5d

Copy link
Member

@Eikix Eikix left a comment

Choose a reason for hiding this comment

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

Nice PR! 👷
Could you add a small note for why someone would want to deploy Kakarot? (1 or 2 lines maximum). Since Kakarot acts as a blockchain, users probably don't need to "deploy it" unless they want to somehow play in an advanced way.

Somehow we need to put words on these ideas: someone wanting to interact with Kakarot should deploy contracts on Kakarot with the "usual" flow, whereas someone wanting to "meta-interact" with Kakarot should deploy Kakarot.

It may feel counter intuitive that we're deploying a quasi-blockchain as a smart contract

@codecov
Copy link

codecov bot commented Jan 4, 2023

Codecov Report

Base: 88.10% // Head: 88.23% // Increases project coverage by +0.12% 🎉

Coverage data is based on head (8a7fd5c) compared to base (ba15ba3).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #409      +/-   ##
==========================================
+ Coverage   88.10%   88.23%   +0.12%     
==========================================
  Files          28       29       +1     
  Lines        4053     4088      +35     
==========================================
+ Hits         3571     3607      +36     
+ Misses        482      481       -1     
Impacted Files Coverage Δ
src/kakarot/precompiles/ecadd.cairo 100.00% <0.00%> (ø)
src/kakarot/precompiles/ec_recover.cairo 100.00% <0.00%> (ø)
src/kakarot/instructions/system_operations.cairo 97.18% <0.00%> (+0.01%) ⬆️
src/utils/utils.cairo 88.61% <0.00%> (+0.23%) ⬆️
src/kakarot/instructions.cairo 40.10% <0.00%> (+0.24%) ⬆️
src/kakarot/precompiles/precompiles.cairo 69.86% <0.00%> (+2.73%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@TotalPizza TotalPizza marked this pull request as ready for review January 8, 2023 13:52
@TotalPizza
Copy link
Contributor Author

I think my changes reflect what you suggested.

The description in the ./docs describing the deployment is a bit mid.
But the deployment on starknet is going to be temporary anyways if we're going L3.
And it would probably be better to have some nice graphics like architecture.png instead of just text.

Copy link
Member

@Eikix Eikix left a comment

Choose a reason for hiding this comment

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

Ouiiii just what we needed in the readme! GGs

@Eikix Eikix merged commit bc9ca20 into kkrt-labs:main Jan 10, 2023
Flydexo pushed a commit to Flydexo/kakarot that referenced this pull request Jan 25, 2023
<!--- Please provide a general summary of your changes in the title
above -->

<!-- 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
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [x] Documentation content changes
- [ ] Other (please describe):

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

Resolves #<Issue number>

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

-
-
-

<!-- 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:

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

feat: add ecAdd precompile (kkrt-labs#405)

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):

There is no ecAdd implementation.

Resolves kkrt-labs#362

- Implements ecAdd precompile and a unit test.

Time spent on this PR:  1 day

fix ci and readme (kkrt-labs#406)

Please check the type of change your PR introduces:

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

The CI fails because the auto format cannot commit to main. There is an
open discussion about how this should be done (allowing the bot to push
to a protected branch is not the right way, see
https://github.com/orgs/community/discussions/25305).
This is a quick fix.

Just applied `make-format` to fix the CI.

I've also fixed the build link in the CI and replaced the project owner
in all-contributors

Feat staticcall disallows subcontext statechanges (kkrt-labs#260) (kkrt-labs#398)

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):

Opcodes invoked in staticcall calling context can change state.

Resolves kkrt-labs#260

Stateful opcodes check against a read_only field in the calling context.
When in read only mode, it returns a context with an updated stack and
bypasses state changing behavior.

Time spent on this PR:  .75 days

Co-authored-by: kakarot CI <sayajin-labs@users.noreply.github.com>

Remove unsupported opcode section (kkrt-labs#408)

Please check the type of change your PR introduces:

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

Diagram in README is not up to date

Diagram shows 100% opcodes.

Use foundry output files in for tests and remove old docker build (kkrt-labs#410)

Please check the type of change your PR introduces:

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

Solidity files are duplicated and foundry is not used to compile files
used for testing.

Use foundry for building all the solidity files in the projet and make
these builds available for integration tests.

I removed the scripts using docker that became useless since it's a
single command with forge, so added it directly to the Makefile

Time spent on this PR:  0.5

[Precompiles] ecrecover (kkrt-labs#407)

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):

Not implemented

Resolves kkrt-labs#357

Implemented

Fix some bugs related to Precompiles when used in integration test. We
need to add integration test for all opcodes!

Time spent on this PR:  1 day

Fix state update is persisted across tests (kkrt-labs#412)

Please check the type of change your PR introduces:

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

When using a Solidity contracts in tests, state modifications are
persisted across different tests.
Furthermore it's not possible to deploy to times the same contract (with
different constructor args for example).

The `StarknetState` is cached in an `autouse` fixture; contracts can be
deployed at module level, cached while state is reset after each test to
its initial value.

I have moved some tests according to TODOs that were written herein
(test concerning EXTCODECOPY inside test_erc20 and test_counter.
`Counter.sol` actually had no test so I wrote a bunch of them.

Time spent on this PR:  1 day

Parse events data for solidity contracts (kkrt-labs#414)

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):

There is no way to test events emitted by a Solidity contract

Contract's events can be accessed with `contract.events.{event_name}`
(one attribute per event).
This returns a list of emitted events in the last transaction; events
are described as dict, eg.:

```
await token.approve(...)
assert token.events.Approval == [{
    "owner": "0x..",
    "spender": "0x...",
    "value": 10,
}]
```

`web3.Contract` class already had `events.{event_name}` attributes. I've
overridden this attribute to ease manipulation in our context.

Time spent on this PR:  1 day

add unchecked and in place cases for decrementing (kkrt-labs#415)

<!--- Please provide a general summary of your changes in the title
above -->

<!-- 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
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [X] Other (please describe):

Minimal working example of error cases that came up when testing the
solmates erc721 impl. The decrementing comes up in `burn` and
`transferFrom` and tests involving these had failure. See:
https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol#L178

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

Resolves #<Issue number>

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

-
-
-

<!-- 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:  1/4 of a day

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Co-authored-by: kakarot CI <sayajin-labs@users.noreply.github.com>

fix test env

kethaa

format cairo code

fix ci

fix tests

test clarification, typos, comments and fixtures

fix: comments & TODO: address fixture && interface id

fix: comments TODO: addresses fixture with new Clement's PR

Feat/unsupported precompile event (kkrt-labs#404)

In order to allow for granular knowledge of what precompile users need
most, we include the address of the unimplemented precompile in the
`NotImplementedPrecompile` error

 ## Pull request type
 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):

Resolves kkrt-labs#372

Time spent on this PR: 0.1d

Co-authored-by: kakarot CI <sayajin-labs@users.noreply.github.com>

docs/Deployment Process (kkrt-labs#409)

<!--- Please provide a general summary of your changes in the title
above -->

<!-- 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
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [X] Documentation content changes
- [ ] Other (please describe):

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

Resolves kkrt-labs#382

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

- Adding starknet.py lib to poetry dependencies.
- Documenting Process of deploying Kakarot using the .py deployment
script + Some general documentation regarding the different components
and their functionality.
-

Time spent on this PR:   0.5d

Creating a github action to automatically generate the contract's call graph + readme  (kkrt-labs#413)

This PR contains:
 - A new github action
 - Updating the readme with a small  decription

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
- [X] Documentation content changes
- [ ] Other (please describe):

Time spent on this PR:

1 day

Co-authored-by: gaetbout <gaetant.ansotte@hotmail.com>
Co-authored-by: kakarot CI <sayajin-labs@users.noreply.github.com>

Univ2 token test (kkrt-labs#425)

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):

The uniswap contracts are not tested

The tests from
https://github.com/Uniswap/v2-core/blob/master/test/UniswapV2ERC20.spec.ts
have been ported into the kakarot framework.

Still need to port factory and pair tests, see
https://github.com/Uniswap/v2-core/tree/master/test

Time spent on this PR:  2 day

addresses fixture

addresses fixture

CI Generating contract's call graphs

remove helper clone functions

CI Generating contract's call graphs

remove unused bytes_to_words

CI Generating contract's call graphs

parametized tests

CI Generating contract's call graphs

precompile RIPEMD-160 + Tests (kkrt-labs#421)

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):

no precompile RIPEMD-160

Resolves kkrt-labs#359

precompile RIPEMD-160 🚀

<!-- 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:  1 day

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Co-authored-by: kakarot CI <sayajin-labs@users.noreply.github.com>

Complete solmate Erc20 integration testing (kkrt-labs#352) (kkrt-labs#430)

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):

Incomplete integration test coverage for the solmates erc20 contract.

Resolves kkrt-labs#352

Richer integration testing ported from solmates
[here](https://github.com/transmissions11/solmate/blob/main/src/test/ERC20.t.sol)
<!-- Please describe the behavior or changes that are being added by
this PR. -->

-
-
-

<!-- 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:  3/4s of a day

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Co-authored-by: Clément Walter <clement0walter@gmail.com>
Co-authored-by: kakarot CI <sayajin-labs@users.noreply.github.com>

Feat/erc721 testing (kkrt-labs#353) (kkrt-labs#418)

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):

Minimal integration testing for the solmates erc721 contract

Resolves kkrt-labs#353

Richer tests based on those found
[here](https://github.com/transmissions11/solmate/blob/main/src/test/ERC721.t.sol)

- All tests involving burning or transferring will fail, because they
involve unchecked arithmetic ops.
- I reproduced a MWE here kkrt-labs#415 and in the telegram danilo suggested a
fix, which I added to the example and resolved it
- With those changes in kkrt-labs#415, tests should pass 100% (or atleast they do
locally)
- I made two changes to the solmates logic to adapt to our test runner,
will comment in line but briefly
- safeMint / safeTransfer were methods that had dispatching based on
arguments. I renamed the variants off each method that take a data
argument safeMint2 and safeTransfer2.
- Justification: when I tried to call the methods as is, I was seeing
the following error:
  ```python
    def get_function_by_identifier(
        fns: Sequence[ContractFunction], identifier: str
    ) -> ContractFunction:
        if len(fns) > 1:
           raise ValueError(
                'Found multiple functions with matching {0}. '
                'Found: {1!r}'.format(identifier, fns)
ValueError: Found multiple functions with matching name. Found:
[<Function safeMint(address,uint256,bytes)>, <Function
safeMint(address,uint256)>
   ```
- In the `ERC721Recipient` contract, there is a public address field
named 'from.' I renamed this to from_.
- Justification: when trying to call the getter 'from' in python I was
getting this error, which I presumed to mean there was some overlap in
the kakarot wrapping:
    ```shell
File
"./starknet/kakarot/tests/integration/solidity_contracts/Solmate/test_erc721.py",
line 399
       recipient_from = await erc_721_recipient.from()
SyntaxError: invalid syntax
    ```

<!-- 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:  1 day

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Co-authored-by: kakarot CI <sayajin-labs@users.noreply.github.com>

CI Generating contract's call graphs

fix: typo and native functions

CI Generating contract's call graphs

set solidity files to main branch last commit

CI Generating contract's call graphs

fix web3

CI Generating contract's call graphs

fix web3

CI Generating contract's call graphs

Kakarot Ethereum Account Abstraction (kkrt-labs#422)

The Kakarot Ethereum Account Abstraction (KETHAA) is a set of two
contracts, a deployer and the account. The deployer is in charge of
deploying the accounts and the account manages the EVM transaction
verification and execution. For the moment only EIP-1559 transactions
are considered valid and no tx is executed. Few more things will be
added (see related issues). Not final state.

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):

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

Resolves kkrt-labs#388

Kakarot itself is not altered.

Time spent on this PR:  10 days

Co-authored-by: kakarot CI <sayajin-labs@users.noreply.github.com>

docs: add evm summary (kkrt-labs#429)

<!--- Please provide a general summary of your changes in the title
above -->

<!-- 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
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

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

Resolves #<Issue number>

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

-
-
-

<!-- 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:

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

CI Generating contract's call graphs

tests:rlp_list_encode

CI Formatting Auto Commit

fix conflicts

CI Formatting Auto Commit

docs: put time spent on PR field at top of PR template (kkrt-labs#435)

<!--- Please provide a general summary of your changes in the title
above -->

<!-- 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
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [x] Documentation content changes
- [ ] Other (please describe):

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

Resolves #<Issue number>

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

-
-
-

<!-- 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:

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Load revert reason short string (kkrt-labs#431)

Please check the type of change your PR introduces:

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

The revert opcode does not load the revert reason but only returns a
random number.

Resolves kkrt-labs#416

The reason is loaded as a bytes array. Only the short string is
propagated with the `error_attr`.

Time spent on this PR:  1 day

We definitely need to fix REVERT (see kkrt-labs#432) because this is close to a
nightmare in terms of hard fixing to have something ok for testing.

Fix: typos (kkrt-labs#437)

<!-- 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:

- [x] Documentation content changes

CI Generating contract's call graphs

remove unused file

CI Generating contract's call graphs

pending

fix env (source main branch) & review

CI Formatting Auto Commit

clean

CI Generating contract's call graphs

Add autoflake to format and poetry check to build (kkrt-labs#436)

Please check the type of change your PR introduces:

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

Some files have unused imports and variables

Added the tool `autoflake` to format-check and format to check and
automatically fix these issues.

Time spent on this PR:  0.5

Add tests for CREATE2 and require in PlainOpcodes (kkrt-labs#440)

Time spent on this PR: 1 day

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):

Facing an error when testing Univ2Factory, I have eventually manage to
isolate the error case in a `PlainOpcode.sol` test.

The error is illustrated in `class TestRequire` that is currently
skipped (see also create issue
kkrt-labs#439)

UniswapV2Factory test (kkrt-labs#433)

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):

The `UniswapV2Factory.sol` contract is not tested.

Tests from
https://github.com/Uniswap/v2-core/blob/master/test/UniswapV2Factory.spec.ts
have been ported to kakarot test framework.

Still missing UniswapV2Pair.

Time spent on this PR:  2 days

Co-authored-by: kakarot CI <sayajin-labs@users.noreply.github.com>

Test

[Fix] Generate 20 bytes instead of a uint160 in Univ2Factory test (kkrt-labs#444)

Time spent on this PR: 0.5

Please check the type of change your PR introduces:

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

Random addresses are generated without setting the seed
These addresses may have a leading `0` nibble in bytes representation
which breaks the `to_checksum_address`

Set seed
Generate 20 random bytes instead of a uint160.

fix: change RNG to allow seeding (kkrt-labs#447)

Time spent on this PR: 0.2 days

Please check the type of change your PR introduces:

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

Random bytes drawing for TEST_ADDRESSES is not seedable.

The TEST_ADDRESSES are deterministically generated.

Add devcontainers for codespace

Use Python3 microsoft image and setup after build

Add test for ORIGIN and CALLER (+some refacto) (kkrt-labs#448)

Time spent on this PR: 1 day

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):

Resolves kkrt-labs#342

No test to illustrate the bug of the ORIGIN opcode

Added a `originAndSender` function in `PlainOpcodes.sol` to check that
`tx.origin` and `msg.sender` are correctly returned when called both
from an EAO and from a contract.

Some minor refacto along the way, especially I added a forge test to
check my .sol function to be tested in kakarot (!).
We may want to start diff testing one day or another

CI Generating contract's call graphs

simplify tests

CI Formatting Auto Commit

Bugfix: create2 opcode should use deterministically derived evm contract address (kkrt-labs#443)

<!--- 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: 1.75 days

<!-- 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:

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

The EVM address of a contract account is computed as follows:

```
        // Generate EVM_contract address from the new cairo contract
        // TODO: Use RLP to compute proper EVM address, see https://www.evm.codes/#f0
        let (_, low) = split_felt(starknet_contract_address);
        local evm_contract_address = 0xAbdE100700000000000000000000000000000000 + low;
```

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

Resolves kkrt-labs#427

also resolves kkrt-labs#426 wrt create2 opcode

<!-- Please describe the behavior or changes that are being added by
this PR. -->
Create2's address is defined via
```
address = keccak256(0xff + sender_address + salt + keccak256(initialisation_code))[12:]
```
-
-
-

There is a current temporary split in deploy code, where create2 logic
is handled separately from create. When both construct their address
deterministically, the temporary refactor will be removed.
<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Co-authored-by: Clément Walter <clement0walter@gmail.com>
Co-authored-by: kakarot CI <sayajin-labs@users.noreply.github.com>

CI Generating contract's call graphs

fix randomness in tests

CI Formatting Auto Commit

fix randomness in tests

CI Generating contract's call graphs

test randomness & compare list to implementation

CI Generating contract's call graphs

fix tests

CI Generating contract's call graphs

Refacto tests

CI Generating contract's call graphs

CI Generating contract's call graphs
@TotalPizza TotalPizza deleted the feat/deployment_docs branch January 31, 2023 16:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dev: add details about the Kakarot deployment in the README.md
2 participants