Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
perekopskiy committed Sep 27, 2024
1 parent b1518a9 commit 53be1c1
Show file tree
Hide file tree
Showing 15 changed files with 493 additions and 114 deletions.
316 changes: 316 additions & 0 deletions core/lib/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -922,3 +922,319 @@ pub static DIAMOND_CUT: Lazy<Function> = Lazy::new(|| {
}"#;
serde_json::from_str(abi).unwrap()
});

pub static POST_SHARED_BRIDGE_COMMIT_FUNCTION: Lazy<Function> = Lazy::new(|| {
let abi = r#"
{
"inputs": [
{
"internalType": "uint256",
"name": "_chainId",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint64",
"name": "batchNumber",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "batchHash",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "indexRepeatedStorageChanges",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "numberOfLayer1Txs",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "priorityOperationsHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "l2LogsTreeRoot",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "commitment",
"type": "bytes32"
}
],
"internalType": "struct IExecutor.StoredBatchInfo",
"name": "_lastCommittedBatchData",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint64",
"name": "batchNumber",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "timestamp",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "indexRepeatedStorageChanges",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "newStateRoot",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "numberOfLayer1Txs",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "priorityOperationsHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "bootloaderHeapInitialContentsHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "eventsQueueStateHash",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "systemLogs",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "pubdataCommitments",
"type": "bytes"
}
],
"internalType": "struct IExecutor.CommitBatchInfo[]",
"name": "_newBatchesData",
"type": "tuple[]"
}
],
"name": "commitBatchesSharedBridge",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}"#;
serde_json::from_str(abi).unwrap()
});

pub static POST_SHARED_BRIDGE_PROVE_FUNCTION: Lazy<Function> = Lazy::new(|| {
let abi = r#"
{
"inputs": [
{
"internalType": "uint256",
"name": "_chainId",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint64",
"name": "batchNumber",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "batchHash",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "indexRepeatedStorageChanges",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "numberOfLayer1Txs",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "priorityOperationsHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "l2LogsTreeRoot",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "commitment",
"type": "bytes32"
}
],
"internalType": "struct IExecutor.StoredBatchInfo",
"name": "_prevBatch",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint64",
"name": "batchNumber",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "batchHash",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "indexRepeatedStorageChanges",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "numberOfLayer1Txs",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "priorityOperationsHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "l2LogsTreeRoot",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "commitment",
"type": "bytes32"
}
],
"internalType": "struct IExecutor.StoredBatchInfo[]",
"name": "_committedBatches",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "uint256[]",
"name": "recursiveAggregationInput",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "serializedProof",
"type": "uint256[]"
}
],
"internalType": "struct IExecutor.ProofInput",
"name": "_proof",
"type": "tuple"
}
],
"name": "proveBatchesSharedBridge",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}"#;
serde_json::from_str(abi).unwrap()
});

pub static POST_SHARED_BRIDGE_EXECUTE_FUNCTION: Lazy<Function> = Lazy::new(|| {
let abi = r#"
{
"inputs": [
{
"internalType": "uint256",
"name": "_chainId",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint64",
"name": "batchNumber",
"type": "uint64"
},
{
"internalType": "bytes32",
"name": "batchHash",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "indexRepeatedStorageChanges",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "numberOfLayer1Txs",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "priorityOperationsHash",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "l2LogsTreeRoot",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "commitment",
"type": "bytes32"
}
],
"internalType": "struct IExecutor.StoredBatchInfo[]",
"name": "_batchesData",
"type": "tuple[]"
}
],
"name": "executeBatchesSharedBridge",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}"#;
serde_json::from_str(abi).unwrap()
});
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ impl CommitBatches<'_> {
.map(|batch| CommitBatchInfo::new(self.mode, batch, self.pubdata_da).into_token())
.collect();

let encoded_data = encode(&[
stored_batch_info.clone(),
Token::Array(l1_batches_to_commit.clone()),
]);
let commit_data = [[SUPPORTED_ENCODING_VERSION].to_vec(), encoded_data]
.concat()
.to_vec();
if pre_gateway {
vec![stored_batch_info, Token::Array(l1_batches_to_commit)]
} else {
let encoded_data = encode(&[
stored_batch_info.clone(),
Token::Array(l1_batches_to_commit.clone()),
]);
let commit_data = [[SUPPORTED_ENCODING_VERSION].to_vec(), encoded_data]
.concat()
.to_vec();
vec![
Token::Uint((self.last_committed_l1_batch.header.number.0 + 1).into()),
Token::Uint(
Expand Down
Loading

0 comments on commit 53be1c1

Please sign in to comment.