Skip to content
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

chore(config): Fix server build with symlinks #740

Merged
merged 4 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"no-console": "off"
},
"ignorePatterns": [
"**/lib/*"
"**/lib/*",
"lib/*"
]
}
13 changes: 13 additions & 0 deletions l1-contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,23 @@ cache_path = "cache-forge"
test = "test/foundry"
solc_version = "0.8.24"
evm_version = "cancun"
allow_paths = ["../l2-contracts/contracts"]
fs_permissions = [
{ access = "read", path = "../system-contracts/bootloader/build/artifacts" },
{ access = "read", path = "../system-contracts/artifacts-zk/contracts-preprocessed" },
{ access = "read", path = "../l2-contracts/artifacts-zk/" },
{ access = "read", path = "../l2-contracts/zkout/" },
{ access = "read", path = "../system-contracts/zkout/" },
{ access = "read", path = "./script-config" },
{ access = "read-write", path = "./script-out" },
{ access = "read", path = "./out" }
]
ignored_error_codes = ["missing-receive-ether", "code-size"]
ignored_warnings_from = ["test", "contracts/dev-contracts"]
remappings = [
"forge-std/=../lib/forge-std/src/",
"murky/=../lib/murky/src/",
"foundry-test/=test/foundry/",
"@openzeppelin/contracts-v4/=./lib/openzeppelin-contracts-v4/contracts/",
"@openzeppelin/contracts-upgradeable-v4/=./lib/openzeppelin-contracts-upgradeable-v4/contracts/",
]
1 change: 1 addition & 0 deletions l1-contracts/lib/openzeppelin-contracts-upgradeable-v4
1 change: 1 addition & 0 deletions l1-contracts/lib/openzeppelin-contracts-v4
20 changes: 10 additions & 10 deletions system-contracts/SystemContractsHashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,35 +178,35 @@
"contractName": "bootloader_test",
"bytecodePath": "bootloader/build/artifacts/bootloader_test.yul.zbin",
"sourceCodePath": "bootloader/build/bootloader_test.yul",
"bytecodeHash": "0x010003cbdea8040793e57c3584e3ef2fd3260caf9244d1ab22a64e8cf890b485",
"sourceCodeHash": "0x8fe3cf367c26e64e8bfb85f7488723bcf229e71ee6685dda6ee6ce9bc7d28cab"
"bytecodeHash": "0x010003cb94018874dce8c4f3b254625cffc7032c37f85c6b743d30cbac87c934",
"sourceCodeHash": "0x42b9c4235bd0b3de0beff158d7d848381990c55907daeaa3a9c8b6d66b53c0f3"
},
{
"contractName": "fee_estimate",
"bytecodePath": "bootloader/build/artifacts/fee_estimate.yul.zbin",
"sourceCodePath": "bootloader/build/fee_estimate.yul",
"bytecodeHash": "0x0100094fe95a0ee1b8b9a86befeb23939f5036a69a5808235e058e1af1e935d8",
"sourceCodeHash": "0x6071a22c177ad6ed84a6d8a283eb3272dbb127da394417c11fb94056dfcce3cc"
"bytecodeHash": "0x0100092dd79e0d7171d5dfe246e20c2d3f2d8b1ba8104ba1199e0c1a4b8af9ef",
"sourceCodeHash": "0xe538d080f0071f7f31ab1ea013fccec31560450d67e2859257d627100a5fcd07"
},
{
"contractName": "gas_test",
"bytecodePath": "bootloader/build/artifacts/gas_test.yul.zbin",
"sourceCodePath": "bootloader/build/gas_test.yul",
"bytecodeHash": "0x010008d5319bd1a8c92f7519824ca73c6b993930a68982b205ad9cce2b50e147",
"sourceCodeHash": "0x0d08c8894d54a6498ae0ffbc10816439652c1b43022a77364b9aa4df91cd3ba5"
"bytecodeHash": "0x010008b3ffe296bc8b565f555fa15f8aca08d9b88f5b06c15d72094cf5d779b6",
"sourceCodeHash": "0xcc36539d29f136bccd80fea0c3f9976cfc9e238972930b2aca98e6ad2e38fd1c"
},
{
"contractName": "playground_batch",
"bytecodePath": "bootloader/build/artifacts/playground_batch.yul.zbin",
"sourceCodePath": "bootloader/build/playground_batch.yul",
"bytecodeHash": "0x0100095541c24966c34984d5521cb7a06263eb4715205f5632a6d5f596010c24",
"sourceCodeHash": "0x5a8ba82172223403a83ec95be070c87ec9bf931898f4df2091c93535fefd8223"
"bytecodeHash": "0x010009339296f1ba9bd8b81e7152125a8286c4e7f9c3e194e35fc325a9e5c7d2",
"sourceCodeHash": "0xaac0c38a7b033eec41e2533c04b3541099c0c6ee70eb4acd8eea69edd1ef936a"
},
{
"contractName": "proved_batch",
"bytecodePath": "bootloader/build/artifacts/proved_batch.yul.zbin",
"sourceCodePath": "bootloader/build/proved_batch.yul",
"bytecodeHash": "0x010008e50a84cb5e11b650d08b8040a90cd42203490f09362e5e39f1925234aa",
"sourceCodeHash": "0x2c4178f33c0c8ac6402d0f9f53c01c3a143c4d789cf97ba491ae590c4515a2b0"
"bytecodeHash": "0x010008c37ecadea8b003884eb9d81fdfb7161b3b309504e5318f15da19c500d8",
"sourceCodeHash": "0x64618bc0fd4affe7fd2a0fa6a5a16d16be2df194bbe3e0ad6d54f1878a4a6d95"
}
]
61 changes: 0 additions & 61 deletions system-contracts/bootloader/bootloader.yul
Original file line number Diff line number Diff line change
Expand Up @@ -692,63 +692,6 @@ object "Bootloader" {
ret := mload(0)
}

/// @dev The function that is temporarily needed to upgrade the SystemContext system contract. This function is to be removed
/// once the upgrade is complete.
/// @dev Checks whether the code hash of the SystemContext contract is correct and updates it if needed.
/// @dev The bootloader calls `setPubdataInfo` before each transaction, including the upgrade one.
/// However, the old SystemContext does not have this method. So the bootloader should invoke this function
/// before starting any transaction.
function upgradeSystemContextIfNeeded() {
let expectedCodeHash := {{SYSTEM_CONTEXT_EXPECTED_CODE_HASH}}

let actualCodeHash := getRawCodeHash(SYSTEM_CONTEXT_ADDR(), true)
if iszero(eq(expectedCodeHash, actualCodeHash)) {
// Now, we need to encode the call to the `ContractDeployer.forceDeployOnAddresses()` function.

// The `mimicCallOnlyResult` requires that the first word of the data
// contains its length. Here it is 292 bytes.
mstore(0, 292)
mstore(32, {{PADDED_FORCE_DEPLOY_ON_ADDRESSES_SELECTOR}})

// The 0x20 offset, for the array of forced deployments
mstore(36, 0x0000000000000000000000000000000000000000000000000000000000000020)
// Only one force deployment
mstore(68, 0x0000000000000000000000000000000000000000000000000000000000000001)

// Now, starts the description of the forced deployment itself.
// Firstly, the offset.
mstore(100, 0x0000000000000000000000000000000000000000000000000000000000000020)
// The new hash of the SystemContext contract.
mstore(132, expectedCodeHash)
// The address of the system context
mstore(164, SYSTEM_CONTEXT_ADDR())
// The constructor must be called to reset the `blockGasLimit` variable
mstore(196, 0x0000000000000000000000000000000000000000000000000000000000000001)
// The value should be 0.
mstore(228, 0x0000000000000000000000000000000000000000000000000000000000000000)
// The offset of the input array.
mstore(260, 0x00000000000000000000000000000000000000000000000000000000000000a0)
// No input is provided, the array is empty.
mstore(292, 0x0000000000000000000000000000000000000000000000000000000000000000)

// We'll use a mimicCall to simulate the correct sender.
let success := mimicCallOnlyResult(
CONTRACT_DEPLOYER_ADDR(),
FORCE_DEPLOYER(),
0,
0,
0,
0,
0,
0
)

if iszero(success) {
assertionError("system context upgrade fail")
}
}
}

/// @dev Calculates the canonical hash of the L1->L2 transaction that will be
/// sent to L1 as a message to the L1 contract that a certain operation has been processed.
function getCanonicalL1TxHash(txDataOffset) -> ret {
Expand Down Expand Up @@ -4019,8 +3962,6 @@ object "Bootloader" {
assertionError("baseFee inconsistent")
}

upgradeSystemContextIfNeeded()

setNewBatch(PREV_BATCH_HASH, NEW_BATCH_TIMESTAMP, NEW_BATCH_NUMBER, EXPECTED_BASE_FEE)

<!-- @endif -->
Expand All @@ -4029,8 +3970,6 @@ object "Bootloader" {

let SHOULD_SET_NEW_BATCH := mload(224)

upgradeSystemContextIfNeeded()

switch SHOULD_SET_NEW_BATCH
case 0 {
unsafeOverrideBatch(NEW_BATCH_TIMESTAMP, NEW_BATCH_NUMBER, EXPECTED_BASE_FEE)
Expand Down
Loading