Skip to content

Commit

Permalink
Merge pull request #105 from criadoperez/fix/criadoperez
Browse files Browse the repository at this point in the history
Corrected .js files
  • Loading branch information
krlosMata committed Mar 21, 2024
2 parents 6de80b8 + 084a2f2 commit 6107b5c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Database {
* @param {String} dbNodesTable - Name of the table used to store/read nodes data. Default is "state.nodes"
* @param {String} dbProgramTable - Name of the table used to store/read program data. Default is "state.program"
* @param {Object} options - options for DB connection
* @param {Boolean} options.readOnly - read only on SQL DB connecton. Default: true
* @param {Boolean} options.readOnly - read only on SQL DB connection. Default: true
*/
async connect(connectionString, dbNodesTable, dbProgramTable, options = {}) {
if (connectionString && !['local', 'memdb'].includes(connectionString)) {
Expand Down
2 changes: 1 addition & 1 deletion src/mt-bridge-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function generateZeroHashes(height) {
/**
* Verify merkle proof
* @param {BigNumber} leaf - Leaf value
* @param {Array} smtProof - Array of sibilings
* @param {Array} smtProof - Array of siblings
* @param {Number} index - Index of the leaf
* @param {BigNumber} root - Merkle root
* @returns {Boolean} - Whether the merkle proof is correct or not
Expand Down
8 changes: 4 additions & 4 deletions src/processor-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function unarrayifyInteger(data, offset, length) {
* - Legacy: [rlp(nonce, gasprice, gaslimit, to, value, data, chainId, 0, 0)|r|s|v|effectivePercentage]
* to a standard raw ethereum tx: [rlp(nonce, gasprice, gaslimit, to, value, data, r, s, v)]
* @param {String} customRawTx - Custom raw transaction
* @returns {String} - Standar raw transaction
* @returns {String} - Standard raw transaction
*/
function customRawTxToRawTx(customRawTx) {
const signatureCharacters = Constants.SIGNATURE_BYTES * 2;
Expand Down Expand Up @@ -56,7 +56,7 @@ function customRawTxToRawTx(customRawTx) {
}

/**
* Reduce an array of rawTx to a single string wich will be the BatchL2Data
* Reduce an array of rawTx to a single string which will be the BatchL2Data
* @param {Array} rawTxs - Array of rawTxs
* @returns {String} - Reduced array
*/
Expand Down Expand Up @@ -110,7 +110,7 @@ function addressToHexStringRlp(address) {
* to our custom raw tx:
* - preEIP155: [rlp(nonce,gasprice,gaslimit,to,value,data)|r|s|v|effectivePercentage]
* - Legacy: [rlp(nonce,gasprice,gaslimit,to,value,data,chainId,0,0)|r|s|v|effectivePercentage]
* @param {String} rawTx - Standar raw transaction
* @param {String} rawTx - Standard raw transaction
* @returns {String} - Custom raw transaction
*/
function rawTxToCustomRawTx(rawTx, effectivePercentage) {
Expand Down Expand Up @@ -209,7 +209,7 @@ function encodedStringToArray(encodedTransactions) {
}

/**
* Decode The next string in rlp, wich has 0-55 bytes long
* Decode The next string in rlp, that is 0-55 bytes long
* @param {Uint8Array} data - Byte array
* @param {Number} offset - Offset of the data array
* @returns {Object} - Return the bytes consumed and the result encoded in hex string
Expand Down
14 changes: 7 additions & 7 deletions src/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ module.exports = class Processor {
/**
* Try to decode and check the validity of rawTxs
* Save the decoded transaction, whether is valid or not, and the invalidated reason if any in a new array: decodedTxs
* Note that, even if this funcion mark a transactions as valid, there are some checks that are performed
* Note that, even if this function mark a transactions as valid, there are some checks that are performed
* During the processing of the transactions, therefore can be invalidated after
* This funcion will check:
* This function will check:
* A: Well formed RLP encoding
* B: Valid ChainID
* C: Valid signature
Expand Down Expand Up @@ -348,7 +348,7 @@ module.exports = class Processor {
/**
* Process the decoded transactions decodedTxs
* Also this function will perform several checks and can mark a transactions as invalid
* This funcion will check:
* This function will check:
* A: VALID NONCE
* B: ENOUGH UPFRONT TX COST
* Process transaction will perform the following operations
Expand Down Expand Up @@ -1059,17 +1059,17 @@ module.exports = class Processor {
}

/**
* Throw error if batch is already builded
* Throw error if batch is already built
*/
_isNotBuilded() {
if (this.builded) throw new Error(`${getFuncName()}: Batch already builded`);
if (this.builded) throw new Error(`${getFuncName()}: Batch already built`);
}

/**
* Throw error if batch is already builded
* Throw error if batch is already built
*/
_isBuilded() {
if (!this.builded) throw new Error(`${getFuncName()}: Batch must first be builded`);
if (!this.builded) throw new Error(`${getFuncName()}: Batch must first be built`);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/smt-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ async function keyContractLength(_ethAddr) {
* Fill the dbObject with all the childs recursively
* @param {Array[Field]} node merkle node
* @param {Object} db Mem DB
* @param {Object} dbObject Object that will be fullfilled
* @param {Object} dbObject Object that will be fulfilled
* @param {Object} Fr - poseidon F
* @returns {Array} merkle tree
*/
Expand Down

0 comments on commit 6107b5c

Please sign in to comment.