Skip to content

Commit

Permalink
feat: boojum integration and eth_sendTransaction support (#235)
Browse files Browse the repository at this point in the history
* Integrate boojum

* Account impersonating using bootloader

* eth_sendTransaction + some fixes

* Bootloader impersonating fixes

* Update compile-yul script

* fix typo, cargo fmt

* Pin commit for the zksync-era dependency

* fix: support EIP-1559 fields for eth_sendTransaction (#192)

* feat: boojum integration sync with main (#200)

* chore: adds proper null response to zks_batchDetails method (#152)

* fix: add back call stacks, console logs, and correct call stack count (#155)

* fix: add back call stacks, console logs, and correct call stack count

* Add comments. Fix typo.

* fix lint

* feat: add eth_getStorageAt (#134)

* add get_storage_at

* add eth_getStorageAt

* limit max archived blocks to 128

* remove ethers-contract dep

* feat: add evm_snapshot/revert (#158)

* fix: update compiled smart contracts to latest (#157)

* Update compile smart contracts checked into source
* Hide Notes section of PR template by default
* Update e2e tests to also be run on MacOS
* Add commented link to YouTube video at the top of release notes
* Limit rust/clippy linting to only the era_test_node package/crate
* Re-enable e2e test for zks_estimateFee
* Add more trace level logs for gas estimation

* feat: add eth_getTransactionByBlockHashAndIndex and eth_getTransactionByBlockNumberAndIndex (#159)

* feat: add eth_protocolVersion (#161)

* feat: impl debug_traceCall (#151)

* feat: impl debug_traceCall

* feat: adds test contract dir

* add refresh_test_contracts in Makefile

* fix: rename contacts_for_l2_call -> contracts_for_l2_call

* move not_implemented() to crate::utils, replace usage of macro

---------

Co-authored-by: Nicolas Villanueva <[email protected]>

* feat: Add well-known log selectors to console output (#162)

* add aarch64-unknown-linux-gnu target (#164)

* feat: add rustbook (#163)

* fix: install mdbook for ci (#169)

* feat: impl debug_traceTransaction (#165)

* feat: impl `debug_traceBlockByHash` and `debug_traceBlockByNumber` (#168)

* fix: update zksync-era deps to v16.0.0 (#173)

* chore: remove hub usage in favour of gh for draft releases (#175)

* feat: add hardhat_setCode (#171)

* feat: impl `zks_getTransactionDetails` (#176)

* feat: forbid ".only" from e2e-tests (#179)

* feat: impl zks_getBlockDetails (#182)

* feat: support builtInWithoutSecurity option (#186)

* feat: add zks_getBridgeContracts (#184)

* feat: add zks_getBytecodeByHash (#180)

* feat: refactor logging to use tracing crate and make it dynamic (#187)

* feat: impl zks_getRawBlockTransactions (#185)

* fix: unit-tests fixed on main (#193)

* fix: fix forking for [email protected] (#194)

* fix: Release drafts now attach files correctly (#196)

* contracts_for_l2_call was missed during merge

* Fix compilation errors

* Fix tests

---------

Co-authored-by: Dustin Brickwood <[email protected]>
Co-authored-by: Nicolas Villanueva <[email protected]>
Co-authored-by: Nisheeth Barthwal <[email protected]>
Co-authored-by: George W <[email protected]>

* fix: boojum integration nightly rust (#177)

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

* Merge main

* latest vm

* Small refactoring

* System contracts 18.4.0

* EcAdd, EcMul, rebuild system contracts

* Small change in system-contracts/VERSION.md

* Update zksync-era dependency

* Fix test

* Prepare to merge into main

* Fix e2e tests

* Restore zksync-era version

* Sync system-contracts/bootloader directory

* Impersonating bootloader small fix

* system-contracts/VERSION.md formatting

* Update DefaultAccount.json bytecode to match source

* Update VERSION.md comments and add supported versions missing

* fix lint

* Fix BuiltInNoSecurity option. Fix unit tests. Fix e2e tests. Add test for hardhat_impersonateAccount

* Refresh bytecode of all contracts from source

* fix lint

* fix lint

---------

Co-authored-by: Dustin Brickwood <[email protected]>
Co-authored-by: Nicolas Villanueva <[email protected]>
Co-authored-by: Nisheeth Barthwal <[email protected]>
Co-authored-by: George W <[email protected]>
  • Loading branch information
5 people authored Dec 15, 2023
1 parent 956b134 commit 104da8e
Show file tree
Hide file tree
Showing 139 changed files with 12,678 additions and 1,997 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2023-07-21

- name: Install cargo-nextest
run: cargo install cargo-nextest

- name: Run tests
run: cargo nextest run
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build the system contracts
build-contracts:
cd etc/system-contracts && yarn; yarn install; yarn build; yarn preprocess; yarn build-bootloader
cd etc/system-contracts && yarn; yarn install; yarn build
./scripts/refresh_contracts.sh

# Clean the system contracts
Expand All @@ -10,7 +10,7 @@ clean-contracts:

# Rebuild the system contracts
rebuild-contracts:
cd etc/system-contracts && yarn build; yarn preprocess; yarn build-bootloader
cd etc/system-contracts && yarn build
./scripts/refresh_contracts.sh
./scripts/refresh_test_contracts.sh

Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/test/hardhat-apis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ describe("hardhat_mine", function () {
});
});

// TODO: Run this test once eth_sendTransaction has been implemented or when different tests have been added
xdescribe("hardhat_impersonateAccount & hardhat_stopImpersonatingAccount", function () {
describe("hardhat_impersonateAccount & hardhat_stopImpersonatingAccount", function () {
it("Should allow transfers of funds without knowing the Private Key", async function () {
// Arrange
const userWallet = Wallet.createRandom().connect(provider);
Expand All @@ -84,8 +83,9 @@ xdescribe("hardhat_impersonateAccount & hardhat_stopImpersonatingAccount", funct
await recieptTx.wait();

// Assert
expect(await userWallet.getBalance()).to.equal(ethers.utils.parseEther("0.42"));
expect(await provider.getBalance(RichAccounts[0].Account)).to.equal(beforeBalance.sub(0.42));
expect((await userWallet.getBalance()).eq(ethers.utils.parseEther("0.42"))).to.true;
expect((await provider.getBalance(RichAccounts[0].Account)).eq(beforeBalance.sub(ethers.utils.parseEther("0.42"))))
.to.true;
});
});

Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/test/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe("Greeter Smart Contract", function () {

// Validate log is created
expect(receipt.logs.length).to.greaterThanOrEqual(1);
const setGreetingLog = receipt.logs[1];
const setGreetingLog = receipt.logs[0];
expect(setGreetingLog.address).to.equal(greeter.address);

const eventInterface = new ethers.utils.Interface(["event LogString(string value)"]);
Expand All @@ -79,7 +79,7 @@ describe("Greeter Smart Contract", function () {
let receipt: TransactionReceipt = await setGreetingTx.wait();

// Create filter
const topic = receipt.logs[1].topics[0];
const topic = receipt.logs[0].topics[0];
const filterId = await provider.send("eth_newFilter", [
{
fromBlock: "earliest",
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/test/zks-apis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe("zks_estimateFee", function () {
const response: Fee = await provider.send("zks_estimateFee", [transaction]);

// Assert
expect(ethers.BigNumber.from(response.gas_limit)).to.eql(ethers.BigNumber.from("1230957"), "Unexpected gas_limit");
expect(ethers.BigNumber.from(response.gas_limit)).to.eql(ethers.BigNumber.from("621166"), "Unexpected gas_limit");
expect(ethers.BigNumber.from(response.gas_per_pubdata_limit)).to.eql(
ethers.BigNumber.from("4080"),
"Unexpected gas_per_pubdata_limit"
Expand Down
2 changes: 1 addition & 1 deletion etc/system-contracts/SystemConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"L1_TX_INTRINSIC_L2_GAS": 167157,
"L1_TX_INTRINSIC_PUBDATA": 88,
"MAX_GAS_PER_TRANSACTION": 80000000,
"BOOTLOADER_MEMORY_FOR_TXS": 485225,
"BOOTLOADER_MEMORY_FOR_TXS": 8740224,
"REFUND_GAS": 7343,
"KECCAK_ROUND_COST_GAS": 40,
"SHA256_ROUND_COST_GAS": 7,
Expand Down
25 changes: 25 additions & 0 deletions etc/system-contracts/VERSION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
This directory was copied from https://github.com/matter-labs/era-system-contracts.

The current commit: `a00ab9a11643f3a918ed95cdf8a04edff5499d92`.

The following directories/files were copied:
- [bootloader](bootloader)
- [contracts](contracts)
- [scripts](scripts)
- [hardhat.config.ts](hardhat.config.ts)
- [package.json](package.json)
- [SystemConfig.json](SystemConfig.json)
- [yarn.lock](yarn.lock)

The next changes were introduced:
- [bootloader.yul](bootloader/bootloader.yul)
- Debug data, marked as `DEBUG SUPPORT` blocks.
- Impersonating preprocessing mode, blocks `<!-- @ifdef ACCOUNT_IMPERSONATING -->` and at some places added `<!-- @ifndef ACCOUNT_IMPERSONATING -->` condition.
- [process.ts](scripts/process.ts)
- Impersonating preprocessing mode, "For impersonating" blocks.
- [DefaultAccount.sol](contracts/DefaultAccount.sol)
- Return transaction data (empty), marked as `FOUNDRY SUPPORT` blocks.
- [DefaultAccountNoSecurity.sol](contracts/DefaultAccountNoSecurity.sol)
- NEW smart contract, only for Hardhat/Forge testing.
- [IAccount.sol](contracts/interfaces/IAccount.sol)
- Return transaction data (empty), marked as `FOUNDRY SUPPORT` blocks.
Loading

0 comments on commit 104da8e

Please sign in to comment.