Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into add-tx-filterer-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
MexicanAce authored May 9, 2024
2 parents 782e23e + 4b80601 commit f917710
Show file tree
Hide file tree
Showing 43 changed files with 2,671 additions and 1,026 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/secrets_scanner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
with:
fetch-depth: 0
- name: TruffleHog OSS
uses: trufflesecurity/trufflehog@0a8cb77b83a6598feb733c2b4a2e47562abba1a6
uses: trufflesecurity/trufflehog@e76dfb98ab9001daa869191b6aebe8cf4cd3b22a
with:
path: ./
base: ${{ github.event.repository.default_branch }}
Expand Down
4 changes: 4 additions & 0 deletions cspell-zksync.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Arweave
Streamr
dutterbutter
zeek
Cyfrin

// Used libraries
numberish
Expand Down Expand Up @@ -128,6 +129,7 @@ Zetta
Zetta
Plonky
Zeeve
Chainlink

// NFT Marketplaces
Kreatorland
Expand Down Expand Up @@ -311,3 +313,5 @@ Aave
// testing ci
Omnibtc
Owlto
Gelato
VRFs
56 changes: 56 additions & 0 deletions docs/.vuepress/components/NetworkAdder.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<template>
<button type="button" class="add-network" @click="addNetwork">
<img width="18" src="/images/metamask_logo.svg" alt="Metamask">
Add {{ chainName }}
</button>
</template>

<script setup>
const props = defineProps(['network'])
const {network} = props
const chainName = props.network === 'mainnet' ? 'zkSync Era Mainnet' : 'zkSync Era Sepolia Testnet'
function addNetwork() {
const config = {
mainnet: {
chainId: '0x144',
rpcUrls: ['https://mainnet.era.zksync.io'],
blockExplorerUrls: ['https://explorer.zksync.io/'],
},
testnet: {
chainId: '0x12c',
rpcUrls: ['https://sepolia.era.zksync.dev'],
blockExplorerUrls: ['https://sepolia.explorer.zksync.dev/'],
},
}[network];
window.ethereum.request({
method: 'wallet_addEthereumChain',
params: [
{
chainId: config.chainId,
chainName: chainName,
nativeCurrency: {name: 'Ethereum', symbol: 'ETH', decimals: 18},
iconUrls: ['https://docs.zksync.io/favicon-32x32.png'],
rpcUrls: config.rpcUrls,
blockExplorerUrls: config.blockExplorerUrls,
},
],
});
}
</script>

<style scoped>
.add-network {
display: flex;
align-items: center;
justify-content: center;
padding: 4px 8px;
gap: 4px;
cursor: pointer;
}
img[src*="/images/metamask_logo.svg"] {
content: url("/images/metamask_logo.svg");
}
</style>
1 change: 1 addition & 0 deletions docs/.vuepress/public/images/metamask_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions docs/.vuepress/sidebar/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,10 @@ export const enSidebar = sidebar({
"/build/tooling/hardhat/hardhat-zksync-vyper.md",
"/build/tooling/hardhat/hardhat-zksync-deploy.md",
"/build/tooling/hardhat/hardhat-zksync-upgradable.md",
"/build/tooling/hardhat/hardhat-zksync-chai-matchers.md",
"/build/tooling/hardhat/hardhat-zksync-verify.md",
"/build/tooling/hardhat/hardhat-zksync-verify-vyper.md",
"/build/tooling/hardhat/hardhat-zksync-ethers.md",
"/build/tooling/hardhat/hardhat-zksync-toolbox.md",
"/build/tooling/hardhat/hardhat-zksync.md",
"/build/tooling/hardhat/hardhat-zksync-node.md",
"/build/tooling/hardhat/other-plugins.md",
]
Expand Down Expand Up @@ -392,6 +391,7 @@ export const enSidebar = sidebar({
"/build/sdks/js/features",
"/build/sdks/js/utils",
"/build/sdks/js/paymaster-utils",
"/build/sdks/js/smart-account-utils",
"/build/sdks/js/types",
"/build/sdks/js/front-end",
],
Expand All @@ -408,6 +408,7 @@ export const enSidebar = sidebar({
"/build/sdks/js/zksync-ethers/features",
"/build/sdks/js/zksync-ethers/utils",
"/build/sdks/js/zksync-ethers/paymaster-utils",
"/build/sdks/js/zksync-ethers/smart-account-utils",
"/build/sdks/js/zksync-ethers/types",
"/build/sdks/js/zksync-ethers/front-end",
"/build/sdks/js/zksync-ethers/migration"
Expand Down
60 changes: 1 addition & 59 deletions docs/.vuepress/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -840,62 +840,4 @@ $border-color: #e5e7eb;
--code-bg-color: #131417;
}
}

// TEMP BANNER RELATED - TO BE REMOVED ONCE IT IS GONE
.theme-container {
margin-top: 30px;
}

#temp-banner {
position: fixed;
display: flex;
top:0;
left: 0;
right: 0;
height: 30px;
background: #1755F4;
color: white;
font-size: small;
align-items: center;
justify-content: center;
z-index: 1000;

a {
color: white;
text-decoration: underline;
}
padding: 0 4px;
}

.navbar {
top: 30px;
}

/*responsive*/
@media(max-width: 1000px){
#temp-banner {
height: 40px;
}

.navbar {
top: 40px;
}

.theme-container {
margin-top: 40px;
}
}

@media(max-width: 500px){
#temp-banner {
height: 60px;
}

.navbar {
top: 60px;
}

.theme-container {
margin-top: 60px;
}
}

1 change: 0 additions & 1 deletion docs/.vuepress/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export default hopeTheme({
</div>
<p>Made with ❤️ by <a href='https://matter-labs.io/'>Matter Labs</a></p>
<div id="temp-banner"><div>zkSync Goerli Testnet will be shutdown on&nbsp;<strong>March 31st</strong>. Please use zkSync Sepolia Testnet instead. For more information see&nbsp;<a href="https://github.com/zkSync-Community-Hub/zksync-developers/discussions/228" target="_blank">this announcement</a>.</div></div>
`,

copyright: false,
Expand Down
7 changes: 5 additions & 2 deletions docs/build/developer-reference/contract-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Here's a [step-by-step guide on how to use it](../tooling/hardhat/getting-starte

You might wonder how validators obtain the preimage of the bytecode hashes necessary to execute the code. This is where the concept of factory dependencies, or factory_deps for short, comes into play. Factory dependencies refer to a list of bytecode hashes whose corresponding preimages were previously revealed on the L1 (where data is always available).

Under the hood, zkSync does not store bytecodes of contracts, but [specially formatted hashes of the bytecodes](#contract-size-limit-and-format-of-bytecode-hash). You can see that the [ContractDeployer](./system-contracts.md#contractdeployer) system contract accepts the bytecode hash of the deployed contract and not its bytecode. However, for contract deployment to succeed, the operator needs to know the bytecode. The `factory_deps` field of the transaction is used for this reason: it contains the bytecodes that should be known to the operator for this transaction to succeed. Once the transaction succeeds, these bytecodes are published on L1 and are considered "known" to the operator forever.
Under the hood, zkSync does not store bytecodes of contracts in its state tree, but [specially formatted hashes of the bytecodes](#contract-size-limit-and-format-of-bytecode-hash). You can see that the [ContractDeployer](./system-contracts.md#contractdeployer) system contract accepts the bytecode hash of the deployed contract and not its bytecode. However, for contract deployment to succeed, the operator needs to know the bytecode. The `factory_deps` field of the transaction is used for this reason: it contains the bytecodes that should be known to the operator for this transaction to succeed. Once the transaction succeeds, these bytecodes are published on L1 and are considered "known" to the operator forever.

Some examples of usage are:

Expand All @@ -50,7 +50,9 @@ Each zkEVM bytecode must adhere to the following format:

- Its length must be divisible by 32.
- Its length in words (32-byte chunks) should be odd. In other words, `bytecodeLength % 64 == 32`.
- It can not be longer than `2^16` 32-byte words, i.e. `2^21` bytes.
- There is a VM limit, the bytecode can not be more than `2^16` 32-byte words, i.e. `2^21` bytes.
- The bootloader has a memory limit for supplying pubdata of 450999 bytes, therefore limiting the contract size to it as well. This limit is valid for Validium hyperchains, that don’t have to publish the bytecode to the base layer.
- For rollups that must publish the deployed bytecode to the base layer (e.g. Ethereum), there is an additional pubdata limit, which is normally smaller. By default, for each batch, this limit is set to 100000 bytes for hyperchains using calldata DA, or 120000\*number_of_blobs, for hyperchains using EIP-4844 blobs.

The 32-byte hash of the bytecode of a zkSync contract is calculated in the following way:

Expand All @@ -70,6 +72,7 @@ The process of auditing a smart contract should be carried out by experts who ha

For detailed information on smart contract vulnerabilities and security best practices, refer to the following resources:

- [Cyfrin Updraft Security & Auditing Curriculum](https://updraft.cyfrin.io/courses/security).
- [Consensys smart contract best practices](https://consensys.github.io/smart-contract-best-practices/).
- [Solidity docs security considerations](https://docs.soliditylang.org/en/latest/security-considerations.html).
- [Security considerations and best practices on zkSync](../quick-start/best-practices.md)
Expand Down
12 changes: 12 additions & 0 deletions docs/build/quick-start/add-zksync-to-metamask.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ Fill in the following details for the zkSync network:

## Mainnet network info

Add zkSync Era Mainnet automatically using the button below:

<network-adder network="mainnet"></network-adder>

**Network details:**

- Network Name: `zkSync Era Mainnet`
- RPC URL: `https://mainnet.era.zksync.io`
- Chain ID: `324`
Expand All @@ -27,6 +33,12 @@ Fill in the following details for the zkSync network:

## Sepolia testnet network info

Add zkSync Era testnet automatically using the button below:

<network-adder network="testnet"></network-adder>

**Network details:**

- Network Name: `zkSync Era Sepolia Testnet`
- RPC URL: `https://sepolia.era.zksync.dev`
- Chain ID: `300`
Expand Down
2 changes: 1 addition & 1 deletion docs/build/sdks/js/accounts-l1-l2.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ method specification [`getBaseCost`](accounts.md#getbasecost).

## Withdrawal

`Wallet` and `Signer` objects provide a withdrawal workflow. For more information, please refer to the method specification [`Deposit`](accounts.md#deposit).
`Wallet` and `Signer` objects provide a withdrawal workflow. For more information, please refer to the method specification [`Withdraw`](accounts.md#withdraw).

For a complete example of how to execute the deposit workflow, take a look at the following: [Withdraw ETH and ERC20 token](https://github.com/zksync-sdk/zksync2-examples/blob/main/js/src/03_withdraw.ts).
Loading

0 comments on commit f917710

Please sign in to comment.