Skip to content

Commit

Permalink
feat: integrate v24 into the test node (#282)
Browse files Browse the repository at this point in the history
* integrate v24 into the test node

* fmt

* make tests work

* fmt and lint

* upd contracts

* fix tests

* fix unit tests
  • Loading branch information
StanislavBreadless committed May 15, 2024
1 parent de98ceb commit ae81a43
Show file tree
Hide file tree
Showing 53 changed files with 1,310 additions and 874 deletions.
1,023 changes: 626 additions & 397 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ categories = ["cryptography"]
publish = false # We don't want to publish our binaries.

[dependencies]
zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_core = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "e9d41a6927f832b5b3eb2a93e30c54d4bf090fe3" }
zksync_core = { git = "https://github.com/matter-labs/zksync-era.git", rev = "e9d41a6927f832b5b3eb2a93e30c54d4bf090fe3" }
multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "e9d41a6927f832b5b3eb2a93e30c54d4bf090fe3" }
zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", rev = "e9d41a6927f832b5b3eb2a93e30c54d4bf090fe3" }
zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "e9d41a6927f832b5b3eb2a93e30c54d4bf090fe3" }
zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "e9d41a6927f832b5b3eb2a93e30c54d4bf090fe3" }
zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "e9d41a6927f832b5b3eb2a93e30c54d4bf090fe3" }
zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "e9d41a6927f832b5b3eb2a93e30c54d4bf090fe3" }
sha3 = "0.10.6"


Expand All @@ -43,7 +43,7 @@ colored = "2.0"
lazy_static = "1.4"
eyre = "0.6"
serde_json = "1.0.67"
bigdecimal = { version = "0.2.2", features = ["serde"] }
bigdecimal = { version = "0.3.0", features = ["serde"] }
hex = "0.4"
ethabi = "16.0.0"
itertools = "0.10.5"
Expand Down
2 changes: 1 addition & 1 deletion contracts
Submodule contracts updated 495 files
3 changes: 1 addition & 2 deletions e2e-tests/test/debug-apis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ describe("debug_traceCall", function () {
const deployer = new Deployer(hre, wallet);
const secondary = await deployContract(deployer, "Secondary", ["3"]);
await deployContract(deployer, "Primary", [secondary.address]);

const result = await provider.send("debug_traceCall", [
{
to: secondary.address,
data: secondary.interface.encodeFunctionData("multiply", ["4"]),
gas: "0x5f5e100",
gas: "0x7f5e100",
},
"latest",
{ tracer: "callTracer", tracerConfig: { onlyTopCall: true } },
Expand Down
12 changes: 7 additions & 5 deletions e2e-tests/test/zks-apis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ describe("zks_estimateFee", function () {
// Act
const response: Fee = await provider.send("zks_estimateFee", [transaction]);
// Assert
expect(ethers.BigNumber.from(response.gas_limit)).to.eql(ethers.BigNumber.from("2407036"), "Unexpected gas_limit");
expect(ethers.BigNumber.from(response.gas_limit)).to.eql(ethers.BigNumber.from("5448356"), "Unexpected gas_limit");
expect(ethers.BigNumber.from(response.gas_per_pubdata_limit)).to.eql(
ethers.BigNumber.from("32000"),
ethers.BigNumber.from("37500"),
"Unexpected gas_per_pubdata_limit"
);
expect(ethers.BigNumber.from(response.max_fee_per_gas)).to.eql(
ethers.BigNumber.from("58593750"),
ethers.BigNumber.from("50000000"),
"Unexpected max_fee_per_gas"
);
expect(ethers.BigNumber.from(response.max_priority_fee_per_gas)).to.eql(
Expand Down Expand Up @@ -79,8 +79,10 @@ describe("zks_getBridgeContracts", function () {
const bridgeAddresses = await provider.send("zks_getBridgeContracts", []);

expect(bridgeAddresses).to.deep.equal({
l1Erc20DefaultBridge: "0x0000000000000000000000000000000000000000",
l2Erc20DefaultBridge: "0x0000000000000000000000000000000000000000",
l1Erc20DefaultBridge: null,
l1SharedDefaultBridge: null,
l2Erc20DefaultBridge: null,
l2SharedDefaultBridge: null,
l1WethBridge: null,
l2WethBridge: null,
});
Expand Down
4 changes: 2 additions & 2 deletions scripts/refresh_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ DST_DIR=src/deps/contracts/

mkdir -p $DST_DIR

contracts=("AccountCodeStorage" "BootloaderUtilities" "Compressor" "ComplexUpgrader" "ContractDeployer" "DefaultAccount" "DefaultAccountNoSecurity" "EmptyContract" "ImmutableSimulator" "KnownCodesStorage" "L1Messenger" "L2EthToken" "MsgValueSimulator" "NonceHolder" "SystemContext" "PubdataChunkPublisher" )
contracts=("AccountCodeStorage" "BootloaderUtilities" "Compressor" "ComplexUpgrader" "ContractDeployer" "DefaultAccount" "DefaultAccountNoSecurity" "EmptyContract" "ImmutableSimulator" "KnownCodesStorage" "L1Messenger" "L2BaseToken" "MsgValueSimulator" "NonceHolder" "SystemContext" "PubdataChunkPublisher" "Create2Factory")

for contract in "${contracts[@]}"; do
cp $SRC_DIR/$contract.sol/$contract.json $DST_DIR
done

precompiles=("EcAdd" "EcMul" "Ecrecover" "Keccak256" "SHA256")
precompiles=("EcAdd" "EcMul" "Ecrecover" "Keccak256" "SHA256" "EcPairing" "CodeOracle" "P256Verify")

for precompile in "${precompiles[@]}"; do
cp contracts/system-contracts/contracts-preprocessed/precompiles/artifacts/$precompile.yul.zbin $DST_DIR
Expand Down
2 changes: 1 addition & 1 deletion src/bootloader_debug.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use multivm::interface::{dyn_tracers::vm_1_4_1::DynTracer, tracer::VmExecutionStopReason};
use multivm::interface::{dyn_tracers::vm_1_5_0::DynTracer, tracer::VmExecutionStopReason};
use std::sync::Arc;

use multivm::vm_latest::{
Expand Down
18 changes: 12 additions & 6 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,10 @@ mod tests {
raw_bytes: None,
}];
let bridge_addresses = BridgeAddresses {
l1_erc20_default_bridge: H160::repeat_byte(0x1),
l2_erc20_default_bridge: H160::repeat_byte(0x2),
l1_shared_default_bridge: Some(H160::repeat_byte(0x5)),
l2_shared_default_bridge: Some(H160::repeat_byte(0x6)),
l1_erc20_default_bridge: Some(H160::repeat_byte(0x1)),
l2_erc20_default_bridge: Some(H160::repeat_byte(0x2)),
l1_weth_bridge: Some(H160::repeat_byte(0x3)),
l2_weth_bridge: Some(H160::repeat_byte(0x4)),
};
Expand Down Expand Up @@ -472,8 +474,10 @@ mod tests {
raw_bytes: None,
}];
let bridge_addresses = BridgeAddresses {
l1_erc20_default_bridge: H160::repeat_byte(0x1),
l2_erc20_default_bridge: H160::repeat_byte(0x2),
l1_shared_default_bridge: Some(H160::repeat_byte(0x5)),
l2_shared_default_bridge: Some(H160::repeat_byte(0x6)),
l1_erc20_default_bridge: Some(H160::repeat_byte(0x1)),
l2_erc20_default_bridge: Some(H160::repeat_byte(0x2)),
l1_weth_bridge: Some(H160::repeat_byte(0x3)),
l2_weth_bridge: Some(H160::repeat_byte(0x4)),
};
Expand Down Expand Up @@ -570,8 +574,10 @@ mod tests {
raw_bytes: None,
}];
let bridge_addresses = BridgeAddresses {
l1_erc20_default_bridge: H160::repeat_byte(0x1),
l2_erc20_default_bridge: H160::repeat_byte(0x2),
l1_shared_default_bridge: Some(H160::repeat_byte(0x5)),
l2_shared_default_bridge: Some(H160::repeat_byte(0x6)),
l2_erc20_default_bridge: Some(H160::repeat_byte(0x2)),
l1_erc20_default_bridge: Some(H160::repeat_byte(0x1)),
l1_weth_bridge: Some(H160::repeat_byte(0x3)),
l2_weth_bridge: Some(H160::repeat_byte(0x4)),
};
Expand Down
20 changes: 20 additions & 0 deletions src/data/address_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,34 @@
"Compressor",
"System"
],
[
"0x000000000000000000000000000000000000800f",
"ComplexUpgrader",
"System"
],
[
"0x0000000000000000000000000000000000008010",
"Keccak",
"Precompile"
],
[
"0x0000000000000000000000000000000000008011",
"PubdataChunkPublisher",
"System"
],
[
"0x0000000000000000000000000000000000008012",
"CodeOracle",
"System"
],
[
"0x000000000000000000636f6e736f6c652e6c6f67",
"Console log",
"Precompile"
],
[
"0x0000000000000000000000000000000000010000",
"Create2Factory",
"Popular"
]
]
Loading

0 comments on commit ae81a43

Please sign in to comment.