Skip to content

Commit

Permalink
(#126) Enforce Gas Limit on transaction responce
Browse files Browse the repository at this point in the history
  • Loading branch information
spilin authored and akeyder committed Jun 13, 2023
1 parent 04a7fec commit 1e41cde
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@

# JetBrains IDEs
.idea/*
.DS_Store
9 changes: 8 additions & 1 deletion db/badger/core/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,19 @@ func makeTransactionResponse(
hash primitives.Data32,
data *dbt.Transaction,
) *response.Transaction {
// It is not allowed to burn more gas than the gas limit. However, because of an error there were
// invalid gas consumption records. Below control is added to support the following fix.
// https://github.com/aurora-is-near/aurora-relayer/pull/348/files
gas := data.GasLimit.Uint64()
if gas > *utils.Constants.GasLimit() {
gas = *utils.Constants.GasLimit()
}

tx := &response.Transaction{
BlockHash: blockHash,
BlockNumber: primitives.HexUint(height),
From: data.From,
Gas: primitives.HexUint(data.GasLimit.Uint64()),
Gas: primitives.HexUint(gas),
GasPrice: data.GasPrice,
Hash: hash,
Input: data.Input,
Expand Down

0 comments on commit 1e41cde

Please sign in to comment.