Skip to content

Commit

Permalink
change some logs to warn level
Browse files Browse the repository at this point in the history
  • Loading branch information
RaaCT0R committed Sep 11, 2024
1 parent e1620c8 commit 8908cee
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions packages/chains/bitcoin/lib/BitcoinChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class BitcoinChain extends AbstractUtxoChain<BitcoinTx, BitcoinUtxo> {
(Number(fee - estimatedFee) * 100) / Number(fee)
);
if (feeDifferencePercent > this.configs.txFeeSlippage) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified: Fee difference is too high. Slippage is higher than allowed value [${feeDifferencePercent} > ${this.configs.txFeeSlippage}]. fee: ${fee}, estimated fee: ${estimatedFee}`
);
return false;
Expand Down Expand Up @@ -346,7 +346,7 @@ class BitcoinChain extends AbstractUtxoChain<BitcoinTx, BitcoinUtxo> {
const changeBoxIndex = tx.txOutputs.length - 1;
const changeBox = tx.txOutputs[changeBoxIndex];
if (changeBox.script.toString('hex') !== this.lockScript) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified: Change box address is wrong`
);
return false;
Expand Down
6 changes: 3 additions & 3 deletions packages/chains/cardano/lib/CardanoChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ class CardanoChain extends AbstractUtxoChain<CardanoTx, CardanoUtxo> {
if (
tx.body().fee().compare(CardanoUtils.bigIntToBigNum(this.configs.fee)) > 0
) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified: Transaction fee [${tx
.body()
.fee()
Expand All @@ -589,7 +589,7 @@ class CardanoChain extends AbstractUtxoChain<CardanoTx, CardanoUtxo> {

// check metadata
if (tx.auxiliary_data()) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified: Contains metadata`
);
return false;
Expand All @@ -599,7 +599,7 @@ class CardanoChain extends AbstractUtxoChain<CardanoTx, CardanoUtxo> {
const changeBoxIndex = tx.body().outputs().len() - 1;
const changeBox = tx.body().outputs().get(changeBoxIndex);
if (changeBox.address().to_bech32() !== this.configs.addresses.lock) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified: Change box address is wrong`
);
return false;
Expand Down
6 changes: 3 additions & 3 deletions packages/chains/ergo/lib/ErgoChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ class ErgoChain extends AbstractUtxoChain<wasm.Transaction, wasm.ErgoBox> {
const box = outputBoxes.get(i);
if (box.ergo_tree().to_base16_bytes() === ErgoChain.feeBoxErgoTree) {
if (BigInt(box.value().as_i64().to_str()) > this.configs.fee) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified: Transaction fee [${box
.value()
.as_i64()
Expand Down Expand Up @@ -545,7 +545,7 @@ class ErgoChain extends AbstractUtxoChain<wasm.Transaction, wasm.ErgoBox> {
blockInfo.height - box.creation_height() >
NUMBER_OF_BLOCKS_PER_YEAR
) {
this.logger.info(
this.logger.error(
`Lock tx [${transaction.id().to_str()}] is not verified, box [${box
.box_id()
.to_str()}] creation_height [${box.creation_height()}] is more than a year ago`
Expand Down Expand Up @@ -581,7 +581,7 @@ class ErgoChain extends AbstractUtxoChain<wasm.Transaction, wasm.ErgoBox> {

const r4Value = output.register_value(4);
if (r4Value) {
this.logger.info(
this.logger.warn(
`Tx [${
transaction.txId
}] is not verified: Change box at index [${i}] has value [${r4Value.encode_to_base16()}] in R4`
Expand Down
30 changes: 15 additions & 15 deletions packages/chains/evm/lib/EvmChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,21 +365,21 @@ abstract class EvmChain extends AbstractChain<Transaction> {
try {
tx = Serializer.deserialize(transaction.txBytes);
} catch (error) {
this.logger.info(
this.logger.warn(
`Failed to deserialize tx [${transaction.txId}]: ${error}`
);
return false;
}

if (tx.to === null) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified: does not have \`to\``
);
return false;
}

if (tx.type !== 2) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified: is not of type 2`
);
return false;
Expand All @@ -400,7 +400,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
// check gas limit
let estimatedRequiredGas = await this.network.getGasRequired(tx);
if (estimatedRequiredGas > this.configs.gasLimitCap) {
this.logger.debug(
this.logger.info(
`Estimated required gas is more than gas limit cap config and cap is used for verification [${estimatedRequiredGas} > ${this.configs.gasLimitCap}]`
);
estimatedRequiredGas = this.configs.gasLimitCap;
Expand All @@ -414,7 +414,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
: gasRequired - tx.gasLimit;

if (gasDifference > gasLimitSlippage) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified: Transaction gas limit [${tx.gasLimit}] is too far from calculated gas limit [${gasRequired}]`
);
return false;
Expand All @@ -430,7 +430,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
: networkMaxFee - tx.maxFeePerGas;

if (maxFeeDifference > maxFeeSlippage) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified: Transaction max fee [${tx.maxFeePerGas}] is too far from network's max fee [${networkMaxFee}]`
);
return false;
Expand All @@ -445,7 +445,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
: networkMaxPriorityFee - tx.maxPriorityFeePerGas;

if (maxPriorityFeeDifference > priorityFeeSlippage) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified: Transaction max priority fee [${tx.maxPriorityFeePerGas}] is too far from network's max priority fee [${networkMaxPriorityFee}]`
);
return false;
Expand All @@ -470,7 +470,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
try {
trx = Serializer.deserialize(transaction.txBytes);
} catch (error) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is invalid: failed to deserialized due to error: ${error}`
);
return {
Expand Down Expand Up @@ -725,7 +725,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
const tx = Serializer.deserialize(transaction.txBytes);

if (tx.to === null) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified. \`to\` is null`
);
return false;
Expand All @@ -739,15 +739,15 @@ abstract class EvmChain extends AbstractChain<Transaction> {

// only type 2 transactions are allowed
if (tx.type !== 2) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified. It is not of type 2`
);
return false;
}

// tx data must have correct length
if (![eidlen + 2, eidlen + 2 + 136].includes(tx.data.length)) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified. Unexpected \`data\` bytes length [${tx.data.length}]`
);
return false;
Expand All @@ -756,7 +756,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
// eventId must be at the end of `data`
const eventId = tx.data.substring(tx.data.length - eidlen);
if (eventId !== transaction.eventId) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified. Encoded eventId [${eventId}] does not match with the expected one [${transaction.eventId}]`
);
return false;
Expand All @@ -767,7 +767,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
(tx.value === 0n && tx.data.length === eidlen + 2) ||
(tx.value !== 0n && tx.data.length === 136 + eidlen + 2)
) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified. It both transfers native-token and has extra data.`
);
return false;
Expand All @@ -776,7 +776,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
// only erc-20 `transfer` is allowed
if (tx.value === 0n) {
if (!EvmUtils.isTransfer(tx.to, tx.data)) {
this.logger.info(
this.logger.warn(
`Tx [${transaction.txId}] is not verified. \`data\` field [${tx.data}] can not be parsed with 'transfer' ABI.`
);
return false;
Expand Down Expand Up @@ -804,7 +804,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
);
const txStatus = await this.network.getTransactionStatus(transaction.hash);
if (txStatus !== EvmTxStatus.succeed) {
this.logger.info(
this.logger.error(
`Lock tx [${transaction.hash}] is not succeed (failed or unexpected status)`
);
return false;
Expand Down

0 comments on commit 8908cee

Please sign in to comment.