Skip to content

PaymasterParams as a builder #33

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

Merged
merged 2 commits into from
Jun 1, 2023

Conversation

ilitteri
Copy link
Collaborator

@ilitteri ilitteri commented Jun 1, 2023

No description provided.

@ilitteri ilitteri requested a review from IAvecilla June 1, 2023 16:03
@ilitteri ilitteri self-assigned this Jun 1, 2023
…ksync-web3-rs into refactor_paymaster_params
@ilitteri ilitteri merged commit 39ecf3b into refactor_zk_wallet_methods Jun 1, 2023
@ilitteri ilitteri deleted the refactor_paymaster_params branch June 1, 2023 16:56
ilitteri added a commit that referenced this pull request Jun 1, 2023
* Refactor deployment-related methods, improve tests

* Fix clippy warnings

* Implement `PaymasterParams` as a builder (#33)
ilitteri added a commit that referenced this pull request Jun 2, 2023
* Remove dummy tests

* `custom_data` & `data` shouldn't be `Option`s

* Remove useless method

* Implement `Default` for `Eip712TransactionRequest`

* Remove `Option`s from structs

* Remove old files

* Remove commented code

* Add default implementation and methods to build (#35)

* Refactor deployment-related methods & improve testing (#32)

* Refactor deployment-related methods, improve tests

* Fix clippy warnings

* Implement `PaymasterParams` as a builder (#33)

* Rename `Eip712SignInput` -> `Eip712Transaction`

---------

Co-authored-by: Nacho Avecilla <iavecilla@fi.uba.ar>
ilitteri added a commit that referenced this pull request Jun 7, 2023
* Add clippy lints

* Re-export `ethers-rs`

* Add simple CLI for improving development

* Update imports

* Remove `unwrap`s

* Add Makefile

* Fix `README.md`

* Add serde_json as dependency

* Add solc and zksolc compiler binaries

* Add new compile module to use zkSolc as compiler

* Delete compiler binaries from repo

* Add compilation output struct for serialization

* Add solc and zksolc compiler binaries

* Update Makefile

* Add `compile` command

* cargo fmt

* Refactor `ZKProject::compile_zk`

* `solc` bin is no longer needed

* Rename

* `compile` cmd now returns the compilation output

* Refactor `compile` cmd

* cargo fmt

* Add documentation for `compile` cmd

* Revert "`solc` bin is no longer needed"

This reverts commit bb6ef73.

* Update deps

* Change solc compiler path

* Add test

* cargo fmt

* Add struct to serialize abi and bytecodes output compilation

* Add test for compiling with files

* Get both abi and bin when compiling

* Finish `ContractOuput`

* cargo fmt

* Change type of factory_deps field in to serialize

* Fix typo in serde-json version dependency

* Fix abi compilation output serialization

* Add support for multiple combined-json arguments in CLI

* Remove empty file

* Update `compile`'s `mod.rs`

* Handle errors

* Add EIP712 initial implementation

* `cargo fmt`

* Add `eip712` module to `lib.rs`

* Add future tests signatures

* Update deps

* Derive `Serialize` & `Deserialize` for `Eip712TransactionRequest`

* Add EIP712 metadata

* Wrap ethers project in ZKProject

* Fix fmt

* Add solc and zksolc path as constants

* `ZKSProvider` trait + `zks_estimateFee` & `zks_getTestnetPaymaster` methods (#8)

* Add `async-trait` dep

* Add `ZKSProvider` initial implementation

* Add `Fee` type

* Add `zks_provider` module to `lib.rs`

* cargo fmt

* Add implementation for get paymaster request (#10)

* Fix `pay` cmd

* Add `L2_CHAIN_ID`

* `cargo fmt`

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Refactor types

* Implement missing RPC methods

* Update Cargo.lock

* Add TODOs and fixes

* Fix commented code, add tests & schemas

* Add more tests

* Improve trait method docs

* Remove `TODO`

* Add docs to README.md

* Fix docs

* Implement `ZKSProvider` for `SignerMiddleware`

* cargo fmt

* Implement first version of `struct_hash`

* Add EIP712 structs

* Add deps

* Implement `Into<Eip712SignInput>` for `Eip712TransactionRequest`

* Add `sha2` crate as dep

* Start contract deployment test

* Fix `struct_hash`

* Update tests

* Update constants types

* Add dummy test

* Add verifier_contract address to the eip712 domain

* Remove TODO

* Cleanup `eip712` module

* Merge branch 'zkprovider_impl' of github.com:lambdaclass/zksync-web3-rs into support_transfers

* Support EIP1559 transfers on L2

* Fix bytecode hash function

* Add test to check bytecode hash correctness

* Add new bytecode hash function

* Mark struct hash function as todo

* Move comment

* Refactor contract hash concat step

* Add sign input types hash map

* Update imports

* Fix chain id in domain

* Implement `struct_hash`

* Add dummy test for `Eip712` trait impl

* Update `Eip712SignInput` struct serialization

* Add `zks_utils` module

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Complete factory deps Into implementation

* Refactor `hash_bytecode`

* `cargo fmt`

* Add `const`s to `zks_utils` module

* Add initial implementation of `ZKSSigner::deploy`

* Implement `Eip712TransactionRequestBuilder`

* Replace trait with struct

* Fix `data` generation

* Remove prints

* Improve integration test

* `cargo fmt`

* Remove unused imports

* EIP712 RLP Encoding (#22)

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Add `ZKSSigner::address` method

* Refactor API

* Rename struct

* Refactor modules

* Export module types

* Refactor transaction request building

* Refactor custom data building

* Refactor modules

* Remove `utils.rs` module

* Add `eth_balance` method

* Cleanup

* Fix meta default

* Initial impl

* Support transfers using EIP712 transactions

* Remove dummy tests

* Remove `utils.rs` module

* Change Into with From because it gives you Into for free

* Remove dummy tests

* Change From with TryFrom

* Remove unused imports

* Make clippy suggestions

* Solve conflicts

* Fix clippy suggestions

* EIP712 module cleanup (#34)

* Remove dummy tests

* `custom_data` & `data` shouldn't be `Option`s

* Remove useless method

* Implement `Default` for `Eip712TransactionRequest`

* Remove `Option`s from structs

* Remove old files

* Remove commented code

* Add default implementation and methods to build (#35)

* Refactor deployment-related methods & improve testing (#32)

* Refactor deployment-related methods, improve tests

* Fix clippy warnings

* Implement `PaymasterParams` as a builder (#33)

* Rename `Eip712SignInput` -> `Eip712Transaction`

---------

Co-authored-by: Nacho Avecilla <iavecilla@fi.uba.ar>

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
ilitteri added a commit that referenced this pull request Jun 7, 2023
* Add clippy lints

* Re-export `ethers-rs`

* Add simple CLI for improving development

* Update imports

* Remove `unwrap`s

* Add Makefile

* Fix `README.md`

* Add serde_json as dependency

* Add solc and zksolc compiler binaries

* Add new compile module to use zkSolc as compiler

* Delete compiler binaries from repo

* Add compilation output struct for serialization

* Add solc and zksolc compiler binaries

* Update Makefile

* Add `compile` command

* cargo fmt

* Refactor `ZKProject::compile_zk`

* `solc` bin is no longer needed

* Rename

* `compile` cmd now returns the compilation output

* Refactor `compile` cmd

* cargo fmt

* Add documentation for `compile` cmd

* Revert "`solc` bin is no longer needed"

This reverts commit bb6ef73.

* Update deps

* Change solc compiler path

* Add test

* cargo fmt

* Add struct to serialize abi and bytecodes output compilation

* Add test for compiling with files

* Get both abi and bin when compiling

* Finish `ContractOuput`

* cargo fmt

* Change type of factory_deps field in to serialize

* Fix typo in serde-json version dependency

* Fix abi compilation output serialization

* Add support for multiple combined-json arguments in CLI

* Remove empty file

* Update `compile`'s `mod.rs`

* Handle errors

* Add EIP712 initial implementation

* `cargo fmt`

* Add `eip712` module to `lib.rs`

* Add future tests signatures

* Update deps

* Derive `Serialize` & `Deserialize` for `Eip712TransactionRequest`

* Add EIP712 metadata

* Wrap ethers project in ZKProject

* Fix fmt

* Add solc and zksolc path as constants

* `ZKSProvider` trait + `zks_estimateFee` & `zks_getTestnetPaymaster` methods (#8)

* Add `async-trait` dep

* Add `ZKSProvider` initial implementation

* Add `Fee` type

* Add `zks_provider` module to `lib.rs`

* cargo fmt

* Add implementation for get paymaster request (#10)

* Fix `pay` cmd

* Add `L2_CHAIN_ID`

* `cargo fmt`

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Refactor types

* Implement missing RPC methods

* Update Cargo.lock

* Add TODOs and fixes

* Fix commented code, add tests & schemas

* Add more tests

* Improve trait method docs

* Remove `TODO`

* Add docs to README.md

* Fix docs

* Implement `ZKSProvider` for `SignerMiddleware`

* cargo fmt

* Implement first version of `struct_hash`

* Add EIP712 structs

* Add deps

* Implement `Into<Eip712SignInput>` for `Eip712TransactionRequest`

* Add `sha2` crate as dep

* Start contract deployment test

* Fix `struct_hash`

* Update tests

* Update constants types

* Add dummy test

* Add verifier_contract address to the eip712 domain

* Remove TODO

* Cleanup `eip712` module

* Merge branch 'zkprovider_impl' of github.com:lambdaclass/zksync-web3-rs into support_transfers

* Support EIP1559 transfers on L2

* Fix bytecode hash function

* Add test to check bytecode hash correctness

* Add new bytecode hash function

* Mark struct hash function as todo

* Move comment

* Refactor contract hash concat step

* Add sign input types hash map

* Update imports

* Fix chain id in domain

* Implement `struct_hash`

* Add dummy test for `Eip712` trait impl

* Update `Eip712SignInput` struct serialization

* Add `zks_utils` module

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Complete factory deps Into implementation

* Refactor `hash_bytecode`

* `cargo fmt`

* Add `const`s to `zks_utils` module

* Add initial implementation of `ZKSSigner::deploy`

* Implement `Eip712TransactionRequestBuilder`

* Replace trait with struct

* Fix `data` generation

* Remove prints

* Improve integration test

* `cargo fmt`

* Remove unused imports

* EIP712 RLP Encoding (#22)

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Add `ZKSSigner::address` method

* Refactor API

* Rename struct

* Refactor modules

* Export module types

* Refactor transaction request building

* Refactor custom data building

* Refactor modules

* Remove `utils.rs` module

* Add `eth_balance` method

* Cleanup

* Fix meta default

* Initial impl

* Support transfers using EIP712 transactions

* Remove dummy tests

* Remove `utils.rs` module

* Change Into with From because it gives you Into for free

* Remove dummy tests

* Change From with TryFrom

* Remove unused imports

* Make clippy suggestions

* Solve conflicts

* Fix clippy suggestions

* EIP712 module cleanup (#34)

* Remove dummy tests

* `custom_data` & `data` shouldn't be `Option`s

* Remove useless method

* Implement `Default` for `Eip712TransactionRequest`

* Remove `Option`s from structs

* Remove old files

* Remove commented code

* Add default implementation and methods to build (#35)

* Refactor deployment-related methods & improve testing (#32)

* Refactor deployment-related methods, improve tests

* Fix clippy warnings

* Implement `PaymasterParams` as a builder (#33)

* Rename `Eip712SignInput` -> `Eip712Transaction`

---------

Co-authored-by: Nacho Avecilla <iavecilla@fi.uba.ar>

* Compile all root contracts

* Remove old trait

* Improve compilation output

* Test contracts

* `test_deploy_contract_with_constructor_args`

* Remove old module

* Remove old module def

* Add `ContractDeployer` ABI

* Use `ethersabi::Abi` for deserializing `ZKSArtifact`

* Default `max_priority_fee_per_gas`

* Handle `eth_estimateGas` endpoint

I needed to do this because the `ethers-rs` method receives a `TypedTransaction` which doesn't support EIP712 transactions

* Add error

* Default `max_priority_fee_per_gas`

* Refactor deploy-related methods

* Update test contract

* `cargo fmt`

* Fix test for contract deployment with constructor

* Fix contract with constructor for tests

* Fix end of line

---------

Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
ilitteri added a commit that referenced this pull request Jun 7, 2023
* Add clippy lints

* Re-export `ethers-rs`

* Add simple CLI for improving development

* Update imports

* Remove `unwrap`s

* Add Makefile

* Fix `README.md`

* Add serde_json as dependency

* Add solc and zksolc compiler binaries

* Add new compile module to use zkSolc as compiler

* Delete compiler binaries from repo

* Add compilation output struct for serialization

* Add solc and zksolc compiler binaries

* Update Makefile

* Add `compile` command

* cargo fmt

* Refactor `ZKProject::compile_zk`

* `solc` bin is no longer needed

* Rename

* `compile` cmd now returns the compilation output

* Refactor `compile` cmd

* cargo fmt

* Add documentation for `compile` cmd

* Revert "`solc` bin is no longer needed"

This reverts commit bb6ef73.

* Update deps

* Change solc compiler path

* Add test

* cargo fmt

* Add struct to serialize abi and bytecodes output compilation

* Add test for compiling with files

* Get both abi and bin when compiling

* Finish `ContractOuput`

* cargo fmt

* Change type of factory_deps field in to serialize

* Fix typo in serde-json version dependency

* Fix abi compilation output serialization

* Add support for multiple combined-json arguments in CLI

* Remove empty file

* Update `compile`'s `mod.rs`

* Handle errors

* Add EIP712 initial implementation

* `cargo fmt`

* Add `eip712` module to `lib.rs`

* Add future tests signatures

* Update deps

* Derive `Serialize` & `Deserialize` for `Eip712TransactionRequest`

* Add EIP712 metadata

* Wrap ethers project in ZKProject

* Fix fmt

* Add solc and zksolc path as constants

* `ZKSProvider` trait + `zks_estimateFee` & `zks_getTestnetPaymaster` methods (#8)

* Add `async-trait` dep

* Add `ZKSProvider` initial implementation

* Add `Fee` type

* Add `zks_provider` module to `lib.rs`

* cargo fmt

* Add implementation for get paymaster request (#10)

* Fix `pay` cmd

* Add `L2_CHAIN_ID`

* `cargo fmt`

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Refactor types

* Implement missing RPC methods

* Update Cargo.lock

* Add TODOs and fixes

* Fix commented code, add tests & schemas

* Add more tests

* Improve trait method docs

* Remove `TODO`

* Add docs to README.md

* Fix docs

* Implement `ZKSProvider` for `SignerMiddleware`

* cargo fmt

* Implement first version of `struct_hash`

* Add EIP712 structs

* Add deps

* Implement `Into<Eip712SignInput>` for `Eip712TransactionRequest`

* Add `sha2` crate as dep

* Start contract deployment test

* Fix `struct_hash`

* Update tests

* Update constants types

* Add dummy test

* Add verifier_contract address to the eip712 domain

* Remove TODO

* Cleanup `eip712` module

* Merge branch 'zkprovider_impl' of github.com:lambdaclass/zksync-web3-rs into support_transfers

* Support EIP1559 transfers on L2

* Fix bytecode hash function

* Add test to check bytecode hash correctness

* Add new bytecode hash function

* Mark struct hash function as todo

* Move comment

* Refactor contract hash concat step

* Add sign input types hash map

* Update imports

* Fix chain id in domain

* Implement `struct_hash`

* Add dummy test for `Eip712` trait impl

* Update `Eip712SignInput` struct serialization

* Add `zks_utils` module

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Complete factory deps Into implementation

* Refactor `hash_bytecode`

* `cargo fmt`

* Add `const`s to `zks_utils` module

* Add initial implementation of `ZKSSigner::deploy`

* Implement `Eip712TransactionRequestBuilder`

* Replace trait with struct

* Fix `data` generation

* Remove prints

* Improve integration test

* `cargo fmt`

* Remove unused imports

* EIP712 RLP Encoding (#22)

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Add `ZKSSigner::address` method

* Refactor API

* Rename struct

* Refactor modules

* Export module types

* Refactor transaction request building

* Refactor custom data building

* Refactor modules

* Remove `utils.rs` module

* Add `eth_balance` method

* Cleanup

* Fix meta default

* Initial impl

* Support transfers using EIP712 transactions

* Remove dummy tests

* Remove `utils.rs` module

* Change Into with From because it gives you Into for free

* Remove dummy tests

* Change From with TryFrom

* Remove unused imports

* Make clippy suggestions

* Solve conflicts

* Fix clippy suggestions

* EIP712 module cleanup (#34)

* Remove dummy tests

* `custom_data` & `data` shouldn't be `Option`s

* Remove useless method

* Implement `Default` for `Eip712TransactionRequest`

* Remove `Option`s from structs

* Remove old files

* Remove commented code

* Add default implementation and methods to build (#35)

* Refactor deployment-related methods & improve testing (#32)

* Refactor deployment-related methods, improve tests

* Fix clippy warnings

* Implement `PaymasterParams` as a builder (#33)

* Rename `Eip712SignInput` -> `Eip712Transaction`

---------

Co-authored-by: Nacho Avecilla <iavecilla@fi.uba.ar>

* Compile all root contracts

* Remove old trait

* Improve compilation output

* Test contracts

* `test_deploy_contract_with_constructor_args`

* Remove old module

* Remove old module def

* Add `ContractDeployer` ABI

* Use `ethersabi::Abi` for deserializing `ZKSArtifact`

* Default `max_priority_fee_per_gas`

* Handle `eth_estimateGas` endpoint

I needed to do this because the `ethers-rs` method receives a `TypedTransaction` which doesn't support EIP712 transactions

* Add error

* Default `max_priority_fee_per_gas`

* Refactor deploy-related methods

* Update test contract

* `cargo fmt`

* Fix test for contract deployment with constructor

* Fix contract with constructor for tests

* Fix end of line

* Remove test file

* Add constants

* Fix data structures

- Serialization
- Fields

* Fix RLP encoding

* Fix helper functions

* Add new errors

* Fix deploy & cleanup

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
ilitteri added a commit that referenced this pull request Jun 7, 2023
* Add clippy lints

* Re-export `ethers-rs`

* Add simple CLI for improving development

* Update imports

* Remove `unwrap`s

* Add Makefile

* Fix `README.md`

* Add serde_json as dependency

* Add solc and zksolc compiler binaries

* Add new compile module to use zkSolc as compiler

* Delete compiler binaries from repo

* Add compilation output struct for serialization

* Add solc and zksolc compiler binaries

* Update Makefile

* Add `compile` command

* cargo fmt

* Refactor `ZKProject::compile_zk`

* `solc` bin is no longer needed

* Rename

* `compile` cmd now returns the compilation output

* Refactor `compile` cmd

* cargo fmt

* Add documentation for `compile` cmd

* Revert "`solc` bin is no longer needed"

This reverts commit bb6ef73.

* Update deps

* Change solc compiler path

* Add test

* cargo fmt

* Add struct to serialize abi and bytecodes output compilation

* Add test for compiling with files

* Get both abi and bin when compiling

* Finish `ContractOuput`

* cargo fmt

* Change type of factory_deps field in to serialize

* Fix typo in serde-json version dependency

* Fix abi compilation output serialization

* Add support for multiple combined-json arguments in CLI

* Remove empty file

* Update `compile`'s `mod.rs`

* Handle errors

* Add EIP712 initial implementation

* `cargo fmt`

* Add `eip712` module to `lib.rs`

* Add future tests signatures

* Update deps

* Derive `Serialize` & `Deserialize` for `Eip712TransactionRequest`

* Add EIP712 metadata

* Wrap ethers project in ZKProject

* Fix fmt

* Add solc and zksolc path as constants

* `ZKSProvider` trait + `zks_estimateFee` & `zks_getTestnetPaymaster` methods (#8)

* Add `async-trait` dep

* Add `ZKSProvider` initial implementation

* Add `Fee` type

* Add `zks_provider` module to `lib.rs`

* cargo fmt

* Add implementation for get paymaster request (#10)

* Fix `pay` cmd

* Add `L2_CHAIN_ID`

* `cargo fmt`

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Refactor types

* Implement missing RPC methods

* Update Cargo.lock

* Add TODOs and fixes

* Fix commented code, add tests & schemas

* Add more tests

* Improve trait method docs

* Remove `TODO`

* Add docs to README.md

* Fix docs

* Implement `ZKSProvider` for `SignerMiddleware`

* cargo fmt

* Implement first version of `struct_hash`

* Add EIP712 structs

* Add deps

* Implement `Into<Eip712SignInput>` for `Eip712TransactionRequest`

* Add `sha2` crate as dep

* Start contract deployment test

* Fix `struct_hash`

* Update tests

* Update constants types

* Add dummy test

* Add verifier_contract address to the eip712 domain

* Remove TODO

* Cleanup `eip712` module

* Merge branch 'zkprovider_impl' of github.com:lambdaclass/zksync-web3-rs into support_transfers

* Support EIP1559 transfers on L2

* Fix bytecode hash function

* Add test to check bytecode hash correctness

* Add new bytecode hash function

* Mark struct hash function as todo

* Move comment

* Refactor contract hash concat step

* Add sign input types hash map

* Update imports

* Fix chain id in domain

* Implement `struct_hash`

* Add dummy test for `Eip712` trait impl

* Update `Eip712SignInput` struct serialization

* Add `zks_utils` module

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Complete factory deps Into implementation

* Refactor `hash_bytecode`

* `cargo fmt`

* Add `const`s to `zks_utils` module

* Add initial implementation of `ZKSSigner::deploy`

* Implement `Eip712TransactionRequestBuilder`

* Replace trait with struct

* Fix `data` generation

* Remove prints

* Improve integration test

* `cargo fmt`

* Remove unused imports

* EIP712 RLP Encoding (#22)

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Add `ZKSSigner::address` method

* Refactor API

* Rename struct

* Refactor modules

* Export module types

* Refactor transaction request building

* Refactor custom data building

* Refactor modules

* Remove `utils.rs` module

* Add `eth_balance` method

* Cleanup

* Fix meta default

* Initial impl

* Support transfers using EIP712 transactions

* Remove dummy tests

* Remove `utils.rs` module

* Change Into with From because it gives you Into for free

* Remove dummy tests

* Change From with TryFrom

* Remove unused imports

* Make clippy suggestions

* Solve conflicts

* Fix clippy suggestions

* EIP712 module cleanup (#34)

* Remove dummy tests

* `custom_data` & `data` shouldn't be `Option`s

* Remove useless method

* Implement `Default` for `Eip712TransactionRequest`

* Remove `Option`s from structs

* Remove old files

* Remove commented code

* Add default implementation and methods to build (#35)

* Refactor deployment-related methods & improve testing (#32)

* Refactor deployment-related methods, improve tests

* Fix clippy warnings

* Implement `PaymasterParams` as a builder (#33)

* Rename `Eip712SignInput` -> `Eip712Transaction`

---------

Co-authored-by: Nacho Avecilla <iavecilla@fi.uba.ar>

* Compile all root contracts

* Remove old trait

* Improve compilation output

* Test contracts

* `test_deploy_contract_with_constructor_args`

* Remove old module

* Remove old module def

* Add `ContractDeployer` ABI

* Use `ethersabi::Abi` for deserializing `ZKSArtifact`

* Default `max_priority_fee_per_gas`

* Handle `eth_estimateGas` endpoint

I needed to do this because the `ethers-rs` method receives a `TypedTransaction` which doesn't support EIP712 transactions

* Add error

* Default `max_priority_fee_per_gas`

* Refactor deploy-related methods

* Update test contract

* `cargo fmt`

* Fix test for contract deployment with constructor

* Fix contract with constructor for tests

* Fix end of line

* Remove test file

* Add constants

* Fix data structures

- Serialization
- Fields

* Fix RLP encoding

* Fix helper functions

* Add new errors

* Fix deploy & cleanup

* Add first call implementation

* Modify test contract deleting the constructor

* Fix format

* Add implementation and test for call function

* `cargo fmt`

---------

Co-authored-by: Iván Litteri <ilitteri@fi.uba.ar>
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
ilitteri added a commit that referenced this pull request Jun 7, 2023
* Add clippy lints

* Re-export `ethers-rs`

* Add simple CLI for improving development

* Update imports

* Remove `unwrap`s

* Add Makefile

* Fix `README.md`

* Add serde_json as dependency

* Add solc and zksolc compiler binaries

* Add new compile module to use zkSolc as compiler

* Delete compiler binaries from repo

* Add compilation output struct for serialization

* Add solc and zksolc compiler binaries

* Update Makefile

* Add `compile` command

* cargo fmt

* Refactor `ZKProject::compile_zk`

* `solc` bin is no longer needed

* Rename

* `compile` cmd now returns the compilation output

* Refactor `compile` cmd

* cargo fmt

* Add documentation for `compile` cmd

* Revert "`solc` bin is no longer needed"

This reverts commit bb6ef73.

* Update deps

* Change solc compiler path

* Add test

* cargo fmt

* Add struct to serialize abi and bytecodes output compilation

* Add test for compiling with files

* Get both abi and bin when compiling

* Finish `ContractOuput`

* cargo fmt

* Change type of factory_deps field in to serialize

* Fix typo in serde-json version dependency

* Fix abi compilation output serialization

* Add support for multiple combined-json arguments in CLI

* Remove empty file

* Update `compile`'s `mod.rs`

* Handle errors

* Add EIP712 initial implementation

* `cargo fmt`

* Add `eip712` module to `lib.rs`

* Add future tests signatures

* Update deps

* Derive `Serialize` & `Deserialize` for `Eip712TransactionRequest`

* Add EIP712 metadata

* Wrap ethers project in ZKProject

* Fix fmt

* Add solc and zksolc path as constants

* `ZKSProvider` trait + `zks_estimateFee` & `zks_getTestnetPaymaster` methods (#8)

* Add `async-trait` dep

* Add `ZKSProvider` initial implementation

* Add `Fee` type

* Add `zks_provider` module to `lib.rs`

* cargo fmt

* Add implementation for get paymaster request (#10)

* Fix `pay` cmd

* Add `L2_CHAIN_ID`

* `cargo fmt`

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Refactor types

* Implement missing RPC methods

* Update Cargo.lock

* Add TODOs and fixes

* Fix commented code, add tests & schemas

* Add more tests

* Improve trait method docs

* Remove `TODO`

* Add docs to README.md

* Fix docs

* Implement `ZKSProvider` for `SignerMiddleware`

* cargo fmt

* Implement first version of `struct_hash`

* Add EIP712 structs

* Add deps

* Implement `Into<Eip712SignInput>` for `Eip712TransactionRequest`

* Add `sha2` crate as dep

* Start contract deployment test

* Fix `struct_hash`

* Update tests

* Update constants types

* Add dummy test

* Add verifier_contract address to the eip712 domain

* Remove TODO

* Cleanup `eip712` module

* Merge branch 'zkprovider_impl' of github.com:lambdaclass/zksync-web3-rs into support_transfers

* Support EIP1559 transfers on L2

* Fix bytecode hash function

* Add test to check bytecode hash correctness

* Add new bytecode hash function

* Mark struct hash function as todo

* Move comment

* Refactor contract hash concat step

* Add sign input types hash map

* Update imports

* Fix chain id in domain

* Implement `struct_hash`

* Add dummy test for `Eip712` trait impl

* Update `Eip712SignInput` struct serialization

* Add `zks_utils` module

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Complete factory deps Into implementation

* Refactor `hash_bytecode`

* `cargo fmt`

* Add `const`s to `zks_utils` module

* Add initial implementation of `ZKSSigner::deploy`

* Implement `Eip712TransactionRequestBuilder`

* Replace trait with struct

* Fix `data` generation

* Remove prints

* Improve integration test

* `cargo fmt`

* Remove unused imports

* EIP712 RLP Encoding (#22)

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Add `ZKSSigner::address` method

* Refactor API

* Rename struct

* Refactor modules

* Export module types

* Refactor transaction request building

* Refactor custom data building

* Refactor modules

* Remove `utils.rs` module

* Add `eth_balance` method

* Cleanup

* Fix meta default

* Initial impl

* Support transfers using EIP712 transactions

* Remove dummy tests

* Remove `utils.rs` module

* Change Into with From because it gives you Into for free

* Remove dummy tests

* Change From with TryFrom

* Remove unused imports

* Make clippy suggestions

* Solve conflicts

* Fix clippy suggestions

* EIP712 module cleanup (#34)

* Remove dummy tests

* `custom_data` & `data` shouldn't be `Option`s

* Remove useless method

* Implement `Default` for `Eip712TransactionRequest`

* Remove `Option`s from structs

* Remove old files

* Remove commented code

* Add default implementation and methods to build (#35)

* Refactor deployment-related methods & improve testing (#32)

* Refactor deployment-related methods, improve tests

* Fix clippy warnings

* Implement `PaymasterParams` as a builder (#33)

* Rename `Eip712SignInput` -> `Eip712Transaction`

---------

Co-authored-by: Nacho Avecilla <iavecilla@fi.uba.ar>

* Compile all root contracts

* Remove old trait

* Improve compilation output

* Test contracts

* `test_deploy_contract_with_constructor_args`

* Remove old module

* Remove old module def

* Add `ContractDeployer` ABI

* Use `ethersabi::Abi` for deserializing `ZKSArtifact`

* Default `max_priority_fee_per_gas`

* Handle `eth_estimateGas` endpoint

I needed to do this because the `ethers-rs` method receives a `TypedTransaction` which doesn't support EIP712 transactions

* Add error

* Default `max_priority_fee_per_gas`

* Refactor deploy-related methods

* Update test contract

* `cargo fmt`

* Fix test for contract deployment with constructor

* Fix contract with constructor for tests

* Fix end of line

* Remove test file

* Add constants

* Fix data structures

- Serialization
- Fields

* Fix RLP encoding

* Fix helper functions

* Add new errors

* Fix deploy & cleanup

* Add first call implementation

* Modify test contract deleting the constructor

* Fix format

* Add implementation and test for call function

* `cargo fmt`

* Refactor test

* Support `call` calls with arguments

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
ilitteri added a commit that referenced this pull request Jun 8, 2023
* Add clippy lints

* Re-export `ethers-rs`

* Add simple CLI for improving development

* Update imports

* Remove `unwrap`s

* Add Makefile

* Fix `README.md`

* Add serde_json as dependency

* Add solc and zksolc compiler binaries

* Add new compile module to use zkSolc as compiler

* Delete compiler binaries from repo

* Add compilation output struct for serialization

* Add solc and zksolc compiler binaries

* Update Makefile

* Add `compile` command

* cargo fmt

* Refactor `ZKProject::compile_zk`

* `solc` bin is no longer needed

* Rename

* `compile` cmd now returns the compilation output

* Refactor `compile` cmd

* cargo fmt

* Add documentation for `compile` cmd

* Revert "`solc` bin is no longer needed"

This reverts commit bb6ef73.

* Update deps

* Change solc compiler path

* Add test

* cargo fmt

* Add struct to serialize abi and bytecodes output compilation

* Add test for compiling with files

* Get both abi and bin when compiling

* Finish `ContractOuput`

* cargo fmt

* Change type of factory_deps field in to serialize

* Fix typo in serde-json version dependency

* Fix abi compilation output serialization

* Add support for multiple combined-json arguments in CLI

* Remove empty file

* Update `compile`'s `mod.rs`

* Handle errors

* Add EIP712 initial implementation

* `cargo fmt`

* Add `eip712` module to `lib.rs`

* Add future tests signatures

* Update deps

* Derive `Serialize` & `Deserialize` for `Eip712TransactionRequest`

* Add EIP712 metadata

* Wrap ethers project in ZKProject

* Fix fmt

* Add solc and zksolc path as constants

* `ZKSProvider` trait + `zks_estimateFee` & `zks_getTestnetPaymaster` methods (#8)

* Add `async-trait` dep

* Add `ZKSProvider` initial implementation

* Add `Fee` type

* Add `zks_provider` module to `lib.rs`

* cargo fmt

* Add implementation for get paymaster request (#10)

* Fix `pay` cmd

* Add `L2_CHAIN_ID`

* `cargo fmt`

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Refactor types

* Implement missing RPC methods

* Update Cargo.lock

* Add TODOs and fixes

* Fix commented code, add tests & schemas

* Add more tests

* Improve trait method docs

* Remove `TODO`

* Add docs to README.md

* Fix docs

* Implement `ZKSProvider` for `SignerMiddleware`

* cargo fmt

* Implement first version of `struct_hash`

* Add EIP712 structs

* Add deps

* Implement `Into<Eip712SignInput>` for `Eip712TransactionRequest`

* Add `sha2` crate as dep

* Start contract deployment test

* Fix `struct_hash`

* Update tests

* Update constants types

* Add dummy test

* Add verifier_contract address to the eip712 domain

* Remove TODO

* Cleanup `eip712` module

* Merge branch 'zkprovider_impl' of github.com:lambdaclass/zksync-web3-rs into support_transfers

* Support EIP1559 transfers on L2

* Fix bytecode hash function

* Add test to check bytecode hash correctness

* Add new bytecode hash function

* Mark struct hash function as todo

* Move comment

* Refactor contract hash concat step

* Add sign input types hash map

* Update imports

* Fix chain id in domain

* Implement `struct_hash`

* Add dummy test for `Eip712` trait impl

* Update `Eip712SignInput` struct serialization

* Add `zks_utils` module

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Complete factory deps Into implementation

* Refactor `hash_bytecode`

* `cargo fmt`

* Add `const`s to `zks_utils` module

* Add initial implementation of `ZKSSigner::deploy`

* Implement `Eip712TransactionRequestBuilder`

* Replace trait with struct

* Fix `data` generation

* Remove prints

* Improve integration test

* `cargo fmt`

* Remove unused imports

* EIP712 RLP Encoding (#22)

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Add `ZKSSigner::address` method

* Refactor API

* Rename struct

* Refactor modules

* Export module types

* Refactor transaction request building

* Refactor custom data building

* Refactor modules

* Remove `utils.rs` module

* Add `eth_balance` method

* Cleanup

* Fix meta default

* Initial impl

* Support transfers using EIP712 transactions

* Remove dummy tests

* Remove `utils.rs` module

* Change Into with From because it gives you Into for free

* Remove dummy tests

* Change From with TryFrom

* Remove unused imports

* Make clippy suggestions

* Solve conflicts

* Fix clippy suggestions

* EIP712 module cleanup (#34)

* Remove dummy tests

* `custom_data` & `data` shouldn't be `Option`s

* Remove useless method

* Implement `Default` for `Eip712TransactionRequest`

* Remove `Option`s from structs

* Remove old files

* Remove commented code

* Add default implementation and methods to build (#35)

* Refactor deployment-related methods & improve testing (#32)

* Refactor deployment-related methods, improve tests

* Fix clippy warnings

* Implement `PaymasterParams` as a builder (#33)

* Rename `Eip712SignInput` -> `Eip712Transaction`

---------

Co-authored-by: Nacho Avecilla <iavecilla@fi.uba.ar>

* Compile all root contracts

* Remove old trait

* Improve compilation output

* Test contracts

* `test_deploy_contract_with_constructor_args`

* Remove old module

* Remove old module def

* Add `ContractDeployer` ABI

* Use `ethersabi::Abi` for deserializing `ZKSArtifact`

* Default `max_priority_fee_per_gas`

* Handle `eth_estimateGas` endpoint

I needed to do this because the `ethers-rs` method receives a `TypedTransaction` which doesn't support EIP712 transactions

* Add error

* Default `max_priority_fee_per_gas`

* Refactor deploy-related methods

* Update test contract

* `cargo fmt`

* Fix test for contract deployment with constructor

* Fix contract with constructor for tests

* Fix end of line

* Remove test file

* Add constants

* Fix data structures

- Serialization
- Fields

* Fix RLP encoding

* Fix helper functions

* Add new errors

* Fix deploy & cleanup

* Add first call implementation

* Modify test contract deleting the constructor

* Fix format

* Add implementation and test for call function

* `cargo fmt`

* Refactor test

* Support `call` calls with arguments

* Cleanup

* Update `call` return

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
ilitteri added a commit that referenced this pull request Jun 8, 2023
* Add clippy lints

* Re-export `ethers-rs`

* Add simple CLI for improving development

* Update imports

* Remove `unwrap`s

* Add Makefile

* Fix `README.md`

* Add serde_json as dependency

* Add solc and zksolc compiler binaries

* Add new compile module to use zkSolc as compiler

* Delete compiler binaries from repo

* Add compilation output struct for serialization

* Add solc and zksolc compiler binaries

* Update Makefile

* Add `compile` command

* cargo fmt

* Refactor `ZKProject::compile_zk`

* `solc` bin is no longer needed

* Rename

* `compile` cmd now returns the compilation output

* Refactor `compile` cmd

* cargo fmt

* Add documentation for `compile` cmd

* Revert "`solc` bin is no longer needed"

This reverts commit bb6ef73.

* Update deps

* Change solc compiler path

* Add test

* cargo fmt

* Add struct to serialize abi and bytecodes output compilation

* Add test for compiling with files

* Get both abi and bin when compiling

* Finish `ContractOuput`

* cargo fmt

* Change type of factory_deps field in to serialize

* Fix typo in serde-json version dependency

* Fix abi compilation output serialization

* Add support for multiple combined-json arguments in CLI

* Remove empty file

* Update `compile`'s `mod.rs`

* Handle errors

* Add EIP712 initial implementation

* `cargo fmt`

* Add `eip712` module to `lib.rs`

* Add future tests signatures

* Update deps

* Derive `Serialize` & `Deserialize` for `Eip712TransactionRequest`

* Add EIP712 metadata

* Wrap ethers project in ZKProject

* Fix fmt

* Add solc and zksolc path as constants

* `ZKSProvider` trait + `zks_estimateFee` & `zks_getTestnetPaymaster` methods (#8)

* Add `async-trait` dep

* Add `ZKSProvider` initial implementation

* Add `Fee` type

* Add `zks_provider` module to `lib.rs`

* cargo fmt

* Add implementation for get paymaster request (#10)

* Fix `pay` cmd

* Add `L2_CHAIN_ID`

* `cargo fmt`

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Refactor types

* Implement missing RPC methods

* Update Cargo.lock

* Add TODOs and fixes

* Fix commented code, add tests & schemas

* Add more tests

* Improve trait method docs

* Remove `TODO`

* Add docs to README.md

* Fix docs

* Implement `ZKSProvider` for `SignerMiddleware`

* cargo fmt

* Implement first version of `struct_hash`

* Add EIP712 structs

* Add deps

* Implement `Into<Eip712SignInput>` for `Eip712TransactionRequest`

* Add `sha2` crate as dep

* Start contract deployment test

* Fix `struct_hash`

* Update tests

* Update constants types

* Add dummy test

* Add verifier_contract address to the eip712 domain

* Remove TODO

* Cleanup `eip712` module

* Merge branch 'zkprovider_impl' of github.com:lambdaclass/zksync-web3-rs into support_transfers

* Support EIP1559 transfers on L2

* Fix bytecode hash function

* Add test to check bytecode hash correctness

* Add new bytecode hash function

* Mark struct hash function as todo

* Move comment

* Refactor contract hash concat step

* Add sign input types hash map

* Update imports

* Fix chain id in domain

* Implement `struct_hash`

* Add dummy test for `Eip712` trait impl

* Update `Eip712SignInput` struct serialization

* Add `zks_utils` module

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Complete factory deps Into implementation

* Refactor `hash_bytecode`

* `cargo fmt`

* Add `const`s to `zks_utils` module

* Add initial implementation of `ZKSSigner::deploy`

* Implement `Eip712TransactionRequestBuilder`

* Replace trait with struct

* Fix `data` generation

* Remove prints

* Improve integration test

* `cargo fmt`

* Remove unused imports

* EIP712 RLP Encoding (#22)

* Implement `rlp::Encoding` for `Eip712TransactionRequest`

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>

* Update `test_eip712`

* Update `rlp` implementation

* Update constant type

* Fix structures

* Fixes

* EIP712 bug fixes (#27)

* testito

* Add stuff

* `value` & `gas_price` are not optional

* `verifying_contract` & `salt` should be `None` in the domain

* Fix `struct_hash`

* Implement `Default` for `PaymasterParams`

* Chain id as constant

* Update tests

* `cargo fmt`

* Add new line

* Remove test file

* Remove test file

* Fix new line and test import

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

---------

Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>

* Add `ZKSSigner::address` method

* Refactor API

* Rename struct

* Refactor modules

* Export module types

* Refactor transaction request building

* Refactor custom data building

* Refactor modules

* Remove `utils.rs` module

* Add `eth_balance` method

* Cleanup

* Fix meta default

* Initial impl

* Support transfers using EIP712 transactions

* Remove dummy tests

* Remove `utils.rs` module

* Change Into with From because it gives you Into for free

* Remove dummy tests

* Change From with TryFrom

* Remove unused imports

* Make clippy suggestions

* Solve conflicts

* Fix clippy suggestions

* EIP712 module cleanup (#34)

* Remove dummy tests

* `custom_data` & `data` shouldn't be `Option`s

* Remove useless method

* Implement `Default` for `Eip712TransactionRequest`

* Remove `Option`s from structs

* Remove old files

* Remove commented code

* Add default implementation and methods to build (#35)

* Refactor deployment-related methods & improve testing (#32)

* Refactor deployment-related methods, improve tests

* Fix clippy warnings

* Implement `PaymasterParams` as a builder (#33)

* Rename `Eip712SignInput` -> `Eip712Transaction`

---------

Co-authored-by: Nacho Avecilla <iavecilla@fi.uba.ar>

* Compile all root contracts

* Remove old trait

* Improve compilation output

* Test contracts

* `test_deploy_contract_with_constructor_args`

* Remove old module

* Remove old module def

* Add `ContractDeployer` ABI

* Use `ethersabi::Abi` for deserializing `ZKSArtifact`

* Default `max_priority_fee_per_gas`

* Handle `eth_estimateGas` endpoint

I needed to do this because the `ethers-rs` method receives a `TypedTransaction` which doesn't support EIP712 transactions

* Add error

* Default `max_priority_fee_per_gas`

* Refactor deploy-related methods

* Update test contract

* `cargo fmt`

* Fix test for contract deployment with constructor

* Fix contract with constructor for tests

* Fix end of line

* Remove test file

* Add constants

* Fix data structures

- Serialization
- Fields

* Fix RLP encoding

* Fix helper functions

* Add new errors

* Fix deploy & cleanup

* Add first call implementation

* Modify test contract deleting the constructor

* Fix format

* Add implementation and test for call function

* `cargo fmt`

* Refactor test

* Support `call` calls with arguments

* Cleanup

* Update `call` return

* Remove duplicated lines

* Update test contract

* Implement `send` feature

---------

Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
Co-authored-by: Nacho Avecilla <nachoavecilla@gmail.com>
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.

2 participants