Skip to content

Commit

Permalink
calldata better
Browse files Browse the repository at this point in the history
  • Loading branch information
invocamanman committed Jan 24, 2023
1 parent 4854cef commit 7fbfcab
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 31 deletions.
4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVM.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMBridge.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMBridgeMock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions compiled-contracts/PolygonZkEVMMock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions contracts/PolygonZkEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ contract PolygonZkEVM is OwnableUpgradeable, EmergencyManager {
* @param batches Struct array which the necessary data to append new batces ot the sequence
*/
function sequenceBatches(
BatchData[] memory batches
BatchData[] calldata batches
) external ifNotEmergencyState onlyTrustedSequencer {
uint256 batchesNum = batches.length;
require(
Expand Down Expand Up @@ -918,7 +918,7 @@ contract PolygonZkEVM is OwnableUpgradeable, EmergencyManager {
* @param maticAmount Max amount of MATIC tokens that the sender is willing to pay
*/
function forceBatch(
bytes memory transactions,
bytes calldata transactions,
uint256 maticAmount
) external ifNotEmergencyState isForceBatchAllowed {
// Calculate matic collateral
Expand Down Expand Up @@ -970,7 +970,7 @@ contract PolygonZkEVM is OwnableUpgradeable, EmergencyManager {
* @param batches Struct array which the necessary data to append new batces ot the sequence
*/
function sequenceForceBatches(
ForcedBatchData[] memory batches
ForcedBatchData[] calldata batches
) external ifNotEmergencyState isForceBatchAllowed {
uint256 batchesNum = batches.length;

Expand Down
8 changes: 4 additions & 4 deletions contracts/PolygonZkEVMBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ contract PolygonZkEVMBridge is
function bridgeMessage(
uint32 destinationNetwork,
address destinationAddress,
bytes memory metadata
bytes calldata metadata
) external payable ifNotEmergencyState {
require(
destinationNetwork != networkID,
Expand Down Expand Up @@ -280,7 +280,7 @@ contract PolygonZkEVMBridge is
uint32 destinationNetwork,
address destinationAddress,
uint256 amount,
bytes memory metadata
bytes calldata metadata
) external ifNotEmergencyState {
// Verify leaf exist and it does not have been claimed
_verifyLeaf(
Expand Down Expand Up @@ -394,7 +394,7 @@ contract PolygonZkEVMBridge is
uint32 destinationNetwork,
address destinationAddress,
uint256 amount,
bytes memory metadata
bytes calldata metadata
) external ifNotEmergencyState {
// Verify leaf exist and it does not have been claimed
_verifyLeaf(
Expand Down Expand Up @@ -523,7 +523,7 @@ contract PolygonZkEVMBridge is
uint32 destinationNetwork,
address destinationAddress,
uint256 amount,
bytes memory metadata,
bytes calldata metadata,
uint8 leafType
) internal {
// Set and check nullifier
Expand Down
30 changes: 15 additions & 15 deletions gas_report.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ module.exports = {
},
hardhat: {
initialDate: '0',
allowUnlimitedContractSize: true,
accounts: {
mnemonic: process.env.MNEMONIC || DEFAULT_MNEMONIC,
path: "m/44'/60'/0'/0",
Expand Down
2 changes: 1 addition & 1 deletion test/contracts/bridge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ describe('PolygonZkEVMBridge Contract', () => {
const destinationNetwork = networkIDMainnet;
const destinationAddress = deployer.address;

const metadata = '0x'; // since is ether does not have metadata
const metadata = '0x176923791298713271763697869132'; // since is ether does not have metadata
const metadataHash = ethers.utils.solidityKeccak256(['bytes'], [metadata]);

const mainnetExitRoot = await polygonZkEVMGlobalExitRoot.lastMainnetExitRoot();
Expand Down

0 comments on commit 7fbfcab

Please sign in to comment.