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

Commit

Permalink
EIP-4844 blob submission and finalization changes (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
thedarkjester authored Mar 19, 2024
1 parent 76afb8d commit be602ab
Show file tree
Hide file tree
Showing 207 changed files with 15,915 additions and 12,569 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module.exports = {
mocha: true,
node: true,
},
plugins: ["@typescript-eslint"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "prettier"],
parserOptions: {
ecmaVersion: 12,
},
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ typechain-types
cache
build
.openzeppelin

.DS_Store
28 changes: 22 additions & 6 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
{
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"singleQuote": false,
"printWidth": 120,
"bracketSpacing": true
"plugins": [
"prettier-plugin-solidity"
],
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"singleQuote": false,
"printWidth": 120,
"bracketSpacing": true,
"overrides": [
{
"files": "*.sol",
"options": {
"parser": "solidity-parse",
"bracketSpacing": true,
"printWidth": 120,
"singleQuote": false,
"tabWidth": 2,
"useTabs": false
}
}
]
}
16 changes: 12 additions & 4 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{
"extends": "solhint:recommended",
"rules": {
"prettier/prettier": "error",
"compiler-version": ["error", "^0.8.0"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"no-inline-assembly": "off"
},
"plugins": ["prettier"]
"no-inline-assembly": "off",
"var-name-mixedcase": "off",
"const-name-snakecase": "off",
"func-name-mixedcase": "off",
"custom-errors": "off",
"state-visibility": "off",
"no-empty-blocks": "off",
"avoid-low-level-calls": "off",
"reason-string": "off",
"check-send-result": "off",
"no-unused-import": ["error"]
}
}
2 changes: 2 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
contracts/test-contracts
58 changes: 1 addition & 57 deletions common.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,5 @@
import fs from "fs";

const MAX_GAS_LIMIT = process.env.TX_GAS_LIMIT ? parseInt(process.env.TX_GAS_LIMIT) : 500000000;

/**
* Helper function to deal with account JSON files
* @param {string} filePath full path to file with private key
*/
function getPrivateKeyFromFile(filePath: string): string {
let privateKey;
if (fs.existsSync(filePath)) {
const account = fs.readFileSync(filePath, "utf8");
privateKey = JSON.parse(account).account_key.priv_key;
} else {
console.warn(`Path ${filePath} with private key does not exist`);
}
return privateKey;
}

/**
* Get private key of contract owner, based on several assumptions
*/
function getContractOwnerPrivateKey(
keyFile: string,
bridgeOwnerPathOverride: string,
bridgeOwnerPrivateKeyOverride: string,
): string {
let contractOwnerJsonPath;

if (bridgeOwnerPrivateKeyOverride) {
return bridgeOwnerPrivateKeyOverride;
} else if (bridgeOwnerPathOverride && fs.existsSync(bridgeOwnerPathOverride)) {
contractOwnerJsonPath = bridgeOwnerPathOverride;
} else {
contractOwnerJsonPath = keyFile;
}
return getPrivateKeyFromFile(contractOwnerJsonPath);
}

function getBlockchainNode(): string {
return process.env.BLOCKCHAIN_NODE || "http://127.0.0.1:8545";
}
Expand All @@ -45,23 +8,4 @@ function getL2BlockchainNode(): string | undefined {
return process.env.L2_BLOCKCHAIN_NODE;
}

/**
* Returns path to JSON file with address of deployed rollup smart config, which contains address and ABI
* @returns {string}
*/
function getRollupContractConfigPath(): string {
return process.env.SMC_CONFIG_PATH || "/smart_contract/data/smc_config.json";
}

function getRollupJsonPath(): string {
return process.env.ROLLUP_JSON_PATH || "/smart_contract/data/rollup.json";
}

export {
MAX_GAS_LIMIT,
getBlockchainNode,
getContractOwnerPrivateKey,
getL2BlockchainNode,
getRollupContractConfigPath,
getRollupJsonPath,
};
export { MAX_GAS_LIMIT, getBlockchainNode, getL2BlockchainNode };
Loading

0 comments on commit be602ab

Please sign in to comment.