Compare commits

..

3 Commits

Author SHA1 Message Date
Zhang Zhuo
27d627e318 feat(coordinator & prover): upgrade libzkp to v0.11.3 (#1384)
Co-authored-by: colinlyguo <colinlyguo@scroll.io>
Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
2024-06-18 10:39:32 +08:00
Kenn
8c3ecd395f chore: spelling fixes (#1378) 2024-06-18 09:31:20 +08:00
Hsiao_Jan
33016b1d5d fix(db): the function UpdateProvingStatusFailed proving_status determines the condition incorrectly (#1377)
Co-authored-by: xiaoranlu <xiaoranlu@tencent.com>
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
2024-06-14 10:01:33 +08:00
26 changed files with 86 additions and 222 deletions

View File

@@ -147,7 +147,7 @@ func (b *EventUpdateLogic) updateL2WithdrawMessageInfos(ctx context.Context, bat
}
if withdrawTrie.NextMessageNonce != l2WithdrawMessages[0].MessageNonce {
log.Error("nonce mismatch", "expected next message nonce", withdrawTrie.NextMessageNonce, "actuall next message nonce", l2WithdrawMessages[0].MessageNonce)
log.Error("nonce mismatch", "expected next message nonce", withdrawTrie.NextMessageNonce, "actual next message nonce", l2WithdrawMessages[0].MessageNonce)
return fmt.Errorf("nonce mismatch")
}

View File

@@ -31,7 +31,7 @@ dependencies = [
[[package]]
name = "aggregator"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"ark-std 0.3.0",
"bitstream-io",
@@ -537,7 +537,7 @@ checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
[[package]]
name = "bus-mapping"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"eth-types",
"ethers-core",
@@ -1126,7 +1126,7 @@ dependencies = [
[[package]]
name = "eth-types"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"base64 0.13.1",
"ethers-core",
@@ -1283,7 +1283,7 @@ dependencies = [
[[package]]
name = "external-tracer"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"eth-types",
"geth-utils",
@@ -1465,7 +1465,7 @@ dependencies = [
[[package]]
name = "gadgets"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"eth-types",
"halo2_proofs",
@@ -1488,7 +1488,7 @@ dependencies = [
[[package]]
name = "geth-utils"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"env_logger 0.10.0",
"gobuild",
@@ -2237,7 +2237,7 @@ dependencies = [
[[package]]
name = "mock"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"eth-types",
"ethers-core",
@@ -2252,7 +2252,7 @@ dependencies = [
[[package]]
name = "mpt-zktrie"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"eth-types",
"halo2curves",
@@ -2724,7 +2724,7 @@ dependencies = [
[[package]]
name = "prover"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"aggregator",
"anyhow",
@@ -4361,7 +4361,7 @@ dependencies = [
[[package]]
name = "zkevm-circuits"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"array-init",
"bus-mapping",

View File

@@ -25,7 +25,7 @@ bls12_381 = { git = "https://github.com/scroll-tech/bls12_381", branch = "feat/i
[dependencies]
halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "v1.1" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", branch = "develop", default-features = false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }
prover = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.11.1", default-features = false, features = ["parallel_syn", "scroll"] }
prover = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.11.3", default-features = false, features = ["parallel_syn", "scroll"] }
base64 = "0.13.0"
env_logger = "0.9.0"

View File

@@ -5,7 +5,7 @@ import (
"runtime/debug"
)
var tag = "v4.4.17"
var tag = "v4.4.19"
var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {

View File

@@ -38,7 +38,7 @@ Mapping from L2 ERC20 token address to corresponding L2ERC20Gateway.
function defaultERC20Gateway() external view returns (address)
```
The addess of default L2 ERC20 gateway, normally the L2StandardERC20Gateway contract.
The address of default L2 ERC20 gateway, normally the L2StandardERC20Gateway contract.

View File

@@ -83,45 +83,6 @@ function committedBatches(uint256) external view returns (bytes32)
|---|---|---|
| _0 | bytes32 | The batch hash of a committed batch. |
### finalizeBatch
```solidity
function finalizeBatch(bytes _batchHeader, bytes32 _prevStateRoot, bytes32 _postStateRoot, bytes32 _withdrawRoot) external nonpayable
```
Finalize a committed batch on layer 1 without providing proof.
#### Parameters
| Name | Type | Description |
|---|---|---|
| _batchHeader | bytes | undefined |
| _prevStateRoot | bytes32 | undefined |
| _postStateRoot | bytes32 | undefined |
| _withdrawRoot | bytes32 | undefined |
### finalizeBatch4844
```solidity
function finalizeBatch4844(bytes _batchHeader, bytes32 _prevStateRoot, bytes32 _postStateRoot, bytes32 _withdrawRoot, bytes _blobDataProof) external nonpayable
```
Finalize a committed batch (with blob) on layer 1 without providing proof.
*Memory layout of `_blobDataProof`: ```text | z | y | kzg_commitment | kzg_proof | |---------|---------|----------------|-----------| | bytes32 | bytes32 | bytes48 | bytes48 | ```*
#### Parameters
| Name | Type | Description |
|---|---|---|
| _batchHeader | bytes | undefined |
| _prevStateRoot | bytes32 | undefined |
| _postStateRoot | bytes32 | undefined |
| _withdrawRoot | bytes32 | undefined |
| _blobDataProof | bytes | undefined |
### finalizeBatchWithProof
```solidity
@@ -984,7 +945,7 @@ error ErrorRevertFinalizedBatch()
*Thrown when reverting a finialized batch.*
*Thrown when reverting a finalized batch.*
### ErrorRevertNotStartFromEnd
@@ -995,7 +956,7 @@ error ErrorRevertNotStartFromEnd()
*Thrown when the reverted batches are not in the ending of commited batch chain.*
*Thrown when the reverted batches are not in the ending of committed batch chain.*
### ErrorRevertZeroBatches

View File

@@ -44,7 +44,7 @@ contract L1ScrollMessenger is ScrollMessengerBase, IL1ScrollMessenger {
struct ReplayState {
// The number of replayed times.
uint128 times;
// The queue index of lastest replayed one. If it is zero, it means the message has not been replayed.
// The queue index of latest replayed one. If it is zero, it means the message has not been replayed.
uint128 lastIndex;
}

View File

@@ -167,7 +167,7 @@ abstract contract L1ERC20Gateway is IL1ERC20Gateway, IMessageDropCallback, Scrol
/// @dev Internal function to do all the deposit operations.
///
/// @param _token The token to deposit.
/// @param _to The recipient address to recieve the token in L2.
/// @param _to The recipient address to receive the token in L2.
/// @param _amount The amount of token to deposit.
/// @param _data Optional data to forward to recipient's account.
/// @param _gasLimit Gas limit required to complete the deposit on L2.

View File

@@ -25,7 +25,7 @@ contract L1GatewayRouter is OwnableUpgradeable, IL1GatewayRouter {
/// @notice The address of L1ETHGateway.
address public ethGateway;
/// @notice The addess of default ERC20 gateway, normally the L1StandardERC20Gateway contract.
/// @notice The address of default ERC20 gateway, normally the L1StandardERC20Gateway contract.
address public defaultERC20Gateway;
/// @notice Mapping from ERC20 token address to corresponding L1ERC20Gateway.

View File

@@ -97,7 +97,7 @@ contract L1StandardERC20Gateway is L1ERC20Gateway {
/// @inheritdoc IL1ERC20Gateway
function getL2ERC20Address(address _l1Token) public view override returns (address) {
// In StandardERC20Gateway, all corresponding l2 tokens are depoyed by Create2 with salt,
// In StandardERC20Gateway, all corresponding l2 tokens are deployed by Create2 with salt,
// we can calculate the l2 address directly.
bytes32 _salt = keccak256(abi.encodePacked(counterpart, keccak256(abi.encodePacked(_l1Token))));

View File

@@ -122,36 +122,4 @@ interface IScrollChain {
bytes calldata blobDataProof,
bytes calldata aggrProof
) external;
/// @notice Finalize a committed batch on layer 1 without providing proof.
/// @param batchHeader The header of current batch, see the encoding in comments of `commitBatch.
/// @param prevStateRoot The state root of parent batch.
/// @param postStateRoot The state root of current batch.
/// @param withdrawRoot The withdraw trie root of current batch.
function finalizeBatch(
bytes calldata batchHeader,
bytes32 prevStateRoot,
bytes32 postStateRoot,
bytes32 withdrawRoot
) external;
/// @notice Finalize a committed batch (with blob) on layer 1 without providing proof.
///
/// @dev Memory layout of `blobDataProof`:
/// | z | y | kzg_commitment | kzg_proof |
/// |---------|---------|----------------|-----------|
/// | bytes32 | bytes32 | bytes48 | bytes48 |
///
/// @param batchHeader The header of current batch, see the encoding in comments of `commitBatch.
/// @param prevStateRoot The state root of parent batch.
/// @param postStateRoot The state root of current batch.
/// @param withdrawRoot The withdraw trie root of current batch.
/// @param blobDataProof The proof for blob data.
function finalizeBatch4844(
bytes calldata batchHeader,
bytes32 prevStateRoot,
bytes32 postStateRoot,
bytes32 withdrawRoot,
bytes calldata blobDataProof
) external;
}

View File

@@ -89,10 +89,10 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
/// @dev Thrown when the number of batches to revert is zero.
error ErrorRevertZeroBatches();
/// @dev Thrown when the reverted batches are not in the ending of commited batch chain.
/// @dev Thrown when the reverted batches are not in the ending of committed batch chain.
error ErrorRevertNotStartFromEnd();
/// @dev Thrown when reverting a finialized batch.
/// @dev Thrown when reverting a finalized batch.
error ErrorRevertFinalizedBatch();
/// @dev Thrown when the given state root is zero.
@@ -509,104 +509,6 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
emit FinalizeBatch(_batchIndex, _batchHash, _postStateRoot, _withdrawRoot);
}
/// @inheritdoc IScrollChain
function finalizeBatch(
bytes calldata _batchHeader,
bytes32 _prevStateRoot,
bytes32 _postStateRoot,
bytes32 _withdrawRoot
) external override OnlyProver whenNotPaused {
require(_prevStateRoot != bytes32(0), "previous state root is zero");
require(_postStateRoot != bytes32(0), "new state root is zero");
// compute batch hash and verify
(uint256 memPtr, bytes32 _batchHash, uint256 _batchIndex, ) = _loadBatchHeader(_batchHeader);
// verify previous state root.
require(finalizedStateRoots[_batchIndex - 1] == _prevStateRoot, "incorrect previous state root");
// avoid duplicated verification
require(finalizedStateRoots[_batchIndex] == bytes32(0), "batch already verified");
// check and update lastFinalizedBatchIndex
unchecked {
require(lastFinalizedBatchIndex + 1 == _batchIndex, "incorrect batch index");
lastFinalizedBatchIndex = _batchIndex;
}
// record state root and withdraw root
finalizedStateRoots[_batchIndex] = _postStateRoot;
withdrawRoots[_batchIndex] = _withdrawRoot;
// Pop finalized and non-skipped message from L1MessageQueue.
_popL1Messages(
BatchHeaderV0Codec.getSkippedBitmapPtr(memPtr),
BatchHeaderV0Codec.getTotalL1MessagePopped(memPtr),
BatchHeaderV0Codec.getL1MessagePopped(memPtr)
);
emit FinalizeBatch(_batchIndex, _batchHash, _postStateRoot, _withdrawRoot);
}
/// @inheritdoc IScrollChain
/// @dev Memory layout of `_blobDataProof`:
/// ```text
/// | z | y | kzg_commitment | kzg_proof |
/// |---------|---------|----------------|-----------|
/// | bytes32 | bytes32 | bytes48 | bytes48 |
/// ```
function finalizeBatch4844(
bytes calldata _batchHeader,
bytes32 _prevStateRoot,
bytes32 _postStateRoot,
bytes32 _withdrawRoot,
bytes calldata _blobDataProof
) external override OnlyProver whenNotPaused {
if (_prevStateRoot == bytes32(0)) revert ErrorPreviousStateRootIsZero();
if (_postStateRoot == bytes32(0)) revert ErrorStateRootIsZero();
// compute batch hash and verify
(uint256 memPtr, bytes32 _batchHash, uint256 _batchIndex, ) = _loadBatchHeader(_batchHeader);
bytes32 _blobVersionedHash = BatchHeaderV1Codec.getBlobVersionedHash(memPtr);
// Calls the point evaluation precompile and verifies the output
{
(bool success, bytes memory data) = POINT_EVALUATION_PRECOMPILE_ADDR.staticcall(
abi.encodePacked(_blobVersionedHash, _blobDataProof)
);
// We verify that the point evaluation precompile call was successful by testing the latter 32 bytes of the
// response is equal to BLS_MODULUS as defined in https://eips.ethereum.org/EIPS/eip-4844#point-evaluation-precompile
if (!success) revert ErrorCallPointEvaluationPrecompileFailed();
(, uint256 result) = abi.decode(data, (uint256, uint256));
if (result != BLS_MODULUS) revert ErrorUnexpectedPointEvaluationPrecompileOutput();
}
// verify previous state root.
if (finalizedStateRoots[_batchIndex - 1] != _prevStateRoot) revert ErrorIncorrectPreviousStateRoot();
// avoid duplicated verification
if (finalizedStateRoots[_batchIndex] != bytes32(0)) revert ErrorBatchIsAlreadyVerified();
// check and update lastFinalizedBatchIndex
unchecked {
if (lastFinalizedBatchIndex + 1 != _batchIndex) revert ErrorIncorrectBatchIndex();
lastFinalizedBatchIndex = _batchIndex;
}
// record state root and withdraw root
finalizedStateRoots[_batchIndex] = _postStateRoot;
withdrawRoots[_batchIndex] = _withdrawRoot;
// Pop finalized and non-skipped message from L1MessageQueue.
_popL1Messages(
BatchHeaderV1Codec.getSkippedBitmapPtr(memPtr),
BatchHeaderV1Codec.getTotalL1MessagePopped(memPtr),
BatchHeaderV1Codec.getL1MessagePopped(memPtr)
);
emit FinalizeBatch(_batchIndex, _batchHash, _postStateRoot, _withdrawRoot);
}
/************************
* Restricted Functions *
************************/
@@ -678,7 +580,7 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
/// @param _chunks The list of chunks to commit.
/// @param _skippedL1MessageBitmap The bitmap indicates whether each L1 message is skipped or not.
/// @return _batchDataHash The computed data hash for the list of chunks.
/// @return _totalL1MessagesPoppedInBatch The total number of L1 messages poped in this batch, including skipped one.
/// @return _totalL1MessagesPoppedInBatch The total number of L1 messages popped in this batch, including skipped one.
function _commitChunksV0(
uint256 _totalL1MessagesPoppedOverall,
bytes[] memory _chunks,
@@ -725,7 +627,7 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
/// @param _skippedL1MessageBitmap The bitmap indicates whether each L1 message is skipped or not.
/// @return _blobVersionedHash The blob versioned hash for the blob carried in this transaction.
/// @return _batchDataHash The computed data hash for the list of chunks.
/// @return _totalL1MessagesPoppedInBatch The total number of L1 messages poped in this batch, including skipped one.
/// @return _totalL1MessagesPoppedInBatch The total number of L1 messages popped in this batch, including skipped one.
function _commitChunksV1(
uint256 _totalL1MessagesPoppedOverall,
bytes[] memory _chunks,
@@ -1048,7 +950,7 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
/// @dev Internal function to pop finalized l1 messages.
/// @param bitmapPtr The memory offset of `skippedL1MessageBitmap`.
/// @param totalL1MessagePopped The total number of L1 messages poped in all batches including current batch.
/// @param totalL1MessagePopped The total number of L1 messages popped in all batches including current batch.
/// @param l1MessagePopped The number of L1 messages popped in current batch.
function _popL1Messages(
uint256 bitmapPtr,

View File

@@ -58,7 +58,11 @@ contract L2CustomERC20Gateway is L2ERC20Gateway {
/// @param _counterpart The address of `L1CustomERC20Gateway` contract in L1.
/// @param _router The address of `L2GatewayRouter` contract in L2.
/// @param _messenger The address of `L2ScrollMessenger` contract in L2.
function initialize(address _counterpart, address _router, address _messenger) external initializer {
function initialize(
address _counterpart,
address _router,
address _messenger
) external initializer {
ScrollGatewayBase._initialize(_counterpart, _router, _messenger);
}

View File

@@ -21,7 +21,7 @@ contract L2GatewayRouter is OwnableUpgradeable, IL2GatewayRouter {
/// @notice The address of L2ETHGateway.
address public ethGateway;
/// @notice The addess of default L2 ERC20 gateway, normally the L2StandardERC20Gateway contract.
/// @notice The address of default L2 ERC20 gateway, normally the L2StandardERC20Gateway contract.
address public defaultERC20Gateway;
/// @notice Mapping from L2 ERC20 token address to corresponding L2ERC20Gateway.

View File

@@ -242,7 +242,7 @@ contract L1BlockContainer is OwnableBase, IL1BlockContainer {
let _computedBlockHash := keccak256(memPtr, headerPayloadLength)
require(eq(_blockHash, _computedBlockHash), "Block hash mismatch")
// load 16 vaules
// load 16 values
for {
let i := 0
} lt(i, 16) {

View File

@@ -169,7 +169,12 @@ contract L1BatchBridgeGateway is AccessControlEnumerableUpgradeable, ReentrancyG
/// @param _router The address of `L1GatewayRouter` contract in L1.
/// @param _messenger The address of `L1ScrollMessenger` contract in L1.
/// @param _queue The address of `L1MessageQueue` contract in L1.
constructor(address _counterpart, address _router, address _messenger, address _queue) {
constructor(
address _counterpart,
address _router,
address _messenger,
address _queue
) {
_disableInitializers();
counterpart = _counterpart;
@@ -335,7 +340,11 @@ contract L1BatchBridgeGateway is AccessControlEnumerableUpgradeable, ReentrancyG
/// @param token The address of token to deposit.
/// @param sender The address of token sender.
/// @param amount The amount of token to deposit.
function _deposit(address token, address sender, uint96 amount) internal {
function _deposit(
address token,
address sender,
uint96 amount
) internal {
BatchConfig memory cachedBatchConfig = configs[token];
TokenState memory cachedTokenState = tokens[token];
_tryFinalizeCurrentBatch(token, cachedBatchConfig, cachedTokenState);
@@ -400,7 +409,11 @@ contract L1BatchBridgeGateway is AccessControlEnumerableUpgradeable, ReentrancyG
/// @param token The address of token.
/// @param receiver The address of token receiver.
/// @param amount The amount of token to transfer.
function _transferToken(address token, address receiver, uint256 amount) private {
function _transferToken(
address token,
address receiver,
uint256 amount
) private {
if (token == address(0)) {
(bool success, ) = receiver.call{value: amount}("");
if (!success) revert ErrorTransferETHFailed();

View File

@@ -185,7 +185,11 @@ contract L2BatchBridgeGateway is AccessControlEnumerableUpgradeable {
/// @param l2Token The address of L2 token.
/// @param batchIndex The index of batch to distribute.
/// @param nodes The list of encoded L1 deposits.
function distribute(address l2Token, uint64 batchIndex, bytes32[] memory nodes) external onlyRole(KEEPER_ROLE) {
function distribute(
address l2Token,
uint64 batchIndex,
bytes32[] memory nodes
) external onlyRole(KEEPER_ROLE) {
address l1Token = tokenMapping[l2Token];
bytes32 hash = BatchBridgeCodec.encodeInitialNode(l1Token, batchIndex);
for (uint256 i = 0; i < nodes.length; i++) {
@@ -221,7 +225,11 @@ contract L2BatchBridgeGateway is AccessControlEnumerableUpgradeable {
/// @param receiver The address of token receiver.
/// @param amount The amount of token to transfer.
/// @return success Whether the transfer is successful.
function _transferToken(address token, address receiver, uint256 amount) private returns (bool success) {
function _transferToken(
address token,
address receiver,
uint256 amount
) private returns (bool success) {
if (token == address(0)) {
// We add gas limit here to avoid DDOS from malicious receiver.
(success, ) = receiver.call{value: amount, gas: SAFE_ETH_TRANSFER_GAS_LIMIT}("");

View File

@@ -23,7 +23,7 @@ contract ScrollStandardERC20Factory is Ownable, IScrollStandardERC20Factory {
/// @inheritdoc IScrollStandardERC20Factory
function computeL2TokenAddress(address _gateway, address _l1Token) external view returns (address) {
// In StandardERC20Gateway, all corresponding l2 tokens are depoyed by Create2 with salt,
// In StandardERC20Gateway, all corresponding l2 tokens are deployed by Create2 with salt,
// we can calculate the l2 address directly.
bytes32 _salt = _getSalt(_gateway, _l1Token);

View File

@@ -369,7 +369,7 @@ library PatriciaMerkleTrieVerifier {
// first item is considered the root node.
// Otherwise verifies that the hash of the current node
// is the same as the previous choosen one.
// is the same as the previous chosen one.
switch i
case 1 {
rootHash := hash
@@ -425,7 +425,7 @@ library PatriciaMerkleTrieVerifier {
}
}
// lastly, derive the path of the choosen one (TM)
// lastly, derive the path of the chosen one (TM)
path := derivePath(key, depth)
}

View File

@@ -113,7 +113,7 @@ library ZkTrieVerifier {
// first item is considered the root node.
// Otherwise verifies that the hash of the current node
// is the same as the previous choosen one.
// is the same as the previous chosen one.
switch depth
case 1 {
rootHash := hash
@@ -262,7 +262,7 @@ library ZkTrieVerifier {
ptr, storageValue := verifyStorageProof(poseidon, storageKey, storageRootHash, ptr)
// the one and only boundary check
// in case an attacker crafted a malicous payload
// in case an attacker crafted a malicious payload
// and succeeds in the prior verification steps
// then this should catch any bogus accesses
if iszero(eq(ptr, add(proof.offset, proof.length))) {

View File

@@ -173,7 +173,11 @@ contract L1BatchBridgeGatewayTest is L1GatewayTestBase {
assertEq(safeBridgeGasLimit, config.safeBridgeGasLimit);
}
function checkBatchState(address token, uint256 phase, L1BatchBridgeGateway.BatchState memory expected) private {
function checkBatchState(
address token,
uint256 phase,
L1BatchBridgeGateway.BatchState memory expected
) private {
(uint128 amount, uint64 startTime, uint64 numDeposits, bytes32 hash) = batch.batches(token, phase);
assertEq(amount, expected.amount);
assertEq(startTime, expected.startTime);

View File

@@ -10,7 +10,11 @@ contract RevertOnTransferToken is MockERC20 {
bool private revertOnTransfer;
bool private transferReturn;
constructor(string memory _name, string memory _symbol, uint8 _decimals) MockERC20(_name, _symbol, _decimals) {
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) MockERC20(_name, _symbol, _decimals) {
transferReturn = true;
}

View File

@@ -309,7 +309,7 @@ func (o *Batch) UpdateProvingStatusFailed(ctx context.Context, hash string, maxA
db = db.Model(&Batch{})
db = db.Where("hash", hash)
db = db.Where("total_attempts >= ?", maxAttempts)
db = db.Where("proving_status != ?", int(types.ProverProofValid))
db = db.Where("proving_status != ?", int(types.ProvingTaskVerified))
if err := db.Update("proving_status", int(types.ProvingTaskFailed)).Error; err != nil {
return fmt.Errorf("Batch.UpdateProvingStatus error: %w, batch hash: %v, status: %v", err, hash, types.ProvingTaskFailed.String())
}

View File

@@ -332,7 +332,7 @@ func (o *Chunk) UpdateProvingStatusFailed(ctx context.Context, hash string, maxA
db = db.Model(&Chunk{})
db = db.Where("hash", hash)
db = db.Where("total_attempts >= ?", maxAttempts)
db = db.Where("proving_status != ?", int(types.ProverProofValid))
db = db.Where("proving_status != ?", int(types.ProvingTaskVerified))
if err := db.Update("proving_status", int(types.ProvingTaskFailed)).Error; err != nil {
return fmt.Errorf("Batch.UpdateProvingStatus error: %w, batch hash: %v, status: %v", err, hash, types.ProvingTaskFailed.String())
}

20
prover/Cargo.lock generated
View File

@@ -59,7 +59,7 @@ dependencies = [
[[package]]
name = "aggregator"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"ark-std 0.3.0",
"bitstream-io",
@@ -661,7 +661,7 @@ dependencies = [
[[package]]
name = "bus-mapping"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"eth-types 0.11.0",
"ethers-core 2.0.7 (git+https://github.com/scroll-tech/ethers-rs.git?branch=v2.0.7)",
@@ -1381,7 +1381,7 @@ dependencies = [
[[package]]
name = "eth-types"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"base64 0.13.1",
"ethers-core 2.0.7 (git+https://github.com/scroll-tech/ethers-rs.git?branch=v2.0.7)",
@@ -1615,7 +1615,7 @@ dependencies = [
[[package]]
name = "external-tracer"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"eth-types 0.11.0",
"geth-utils 0.11.0",
@@ -1853,7 +1853,7 @@ dependencies = [
[[package]]
name = "gadgets"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"eth-types 0.11.0",
"halo2_proofs",
@@ -1886,7 +1886,7 @@ dependencies = [
[[package]]
name = "geth-utils"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"env_logger 0.10.2",
"gobuild",
@@ -2785,7 +2785,7 @@ dependencies = [
[[package]]
name = "mock"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"eth-types 0.11.0",
"ethers-core 2.0.7 (git+https://github.com/scroll-tech/ethers-rs.git?branch=v2.0.7)",
@@ -2815,7 +2815,7 @@ dependencies = [
[[package]]
name = "mpt-zktrie"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"eth-types 0.11.0",
"halo2curves",
@@ -3440,7 +3440,7 @@ dependencies = [
[[package]]
name = "prover"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"aggregator 0.11.0",
"anyhow",
@@ -5584,7 +5584,7 @@ dependencies = [
[[package]]
name = "zkevm-circuits"
version = "0.11.0"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.1#512996f1bac1218c93d9d3de49d7b86f52726c27"
source = "git+https://github.com/scroll-tech/zkevm-circuits.git?tag=v0.11.3#19c813167ed0dfa72753a9f1eacdac969c6e94e6"
dependencies = [
"array-init",
"bus-mapping 0.11.0",

View File

@@ -30,7 +30,7 @@ ethers-providers = { git = "https://github.com/scroll-tech/ethers-rs.git", branc
halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "v1.1" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", branch = "develop", default-features = false, features = ["loader_halo2", "loader_evm", "halo2-pse"] }
prover = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "v0.10", default-features = false, features = ["parallel_syn", "scroll", "shanghai"] }
prover_next = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.11.1", package = "prover", default-features = false, features = ["parallel_syn", "scroll"] }
prover_next = { git = "https://github.com/scroll-tech/zkevm-circuits.git", tag = "v0.11.3", package = "prover", default-features = false, features = ["parallel_syn", "scroll"] }
base64 = "0.13.1"
reqwest = { version = "0.12.4", features = ["gzip"] }
reqwest-middleware = "0.3"