-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track used gas in channel and packet transactions #22
Conversation
WalkthroughThe recent changes introduce a Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ChannelHandler
participant PacketHandler
participant Database
participant GraphQLAPI
User->>ChannelHandler: Initiate Channel Transaction
ChannelHandler->>Database: Add gasUsed to transaction
ChannelHandler->>GraphQLAPI: Send channel data with gasUsed
GraphQLAPI-->>User: Return transaction details with gasUsed
User->>PacketHandler: Send Packet Transaction
PacketHandler->>Database: Log packet with gasUsed
PacketHandler->>GraphQLAPI: Send packet data with gasUsed
GraphQLAPI-->>User: Return packet details with gasUsed
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (15)
- db/migrations/1723504100232-Data.js (1 hunks)
- schema.graphql (11 hunks)
- src/handlers/channels.ts (4 hunks)
- src/handlers/packets.ts (12 hunks)
- src/model/generated/acknowledgement.model.ts (1 hunks)
- src/model/generated/channelOpenAck.model.ts (1 hunks)
- src/model/generated/channelOpenConfirm.model.ts (1 hunks)
- src/model/generated/channelOpenInit.model.ts (1 hunks)
- src/model/generated/channelOpenTry.model.ts (1 hunks)
- src/model/generated/closeIbcChannel.model.ts (1 hunks)
- src/model/generated/recvPacket.model.ts (1 hunks)
- src/model/generated/sendPacket.model.ts (1 hunks)
- src/model/generated/timeout.model.ts (1 hunks)
- src/model/generated/writeAckPacket.model.ts (1 hunks)
- src/model/generated/writeTimeoutPacket.model.ts (1 hunks)
Additional comments not posted (33)
src/model/generated/timeout.model.ts (1)
48-49
: Addition ofgasUsed
property for enhanced gas tracking.The
gasUsed
property has been correctly added to theTimeout
class to track gas consumption. Its nullable nature allows for flexibility in scenarios where gas usage might not be recorded.src/model/generated/acknowledgement.model.ts (1)
49-50
: Addition ofgasUsed
property for enhanced gas tracking.The
gasUsed
property has been correctly added to theAcknowledgement
class to track gas consumption. Its nullable nature allows for flexibility in scenarios where gas usage might not be recorded.src/model/generated/recvPacket.model.ts (1)
51-52
: Addition ofgasUsed
property for enhanced gas tracking.The
gasUsed
property has been correctly added to theRecvPacket
class to track gas consumption. Its nullable nature allows for flexibility in scenarios where gas usage might not be recorded.src/model/generated/writeTimeoutPacket.model.ts (1)
57-58
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is a valuable addition for tracking transaction metrics and is correctly defined as a nullablebigint
, consistent with other gas-related properties.src/model/generated/closeIbcChannel.model.ts (1)
48-49
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is a valuable addition for tracking transaction metrics and is correctly defined as a nullablebigint
, consistent with other gas-related properties.src/model/generated/channelOpenAck.model.ts (1)
54-55
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is a valuable addition for tracking transaction metrics and is correctly defined as a nullablebigint
, consistent with other gas-related properties.src/model/generated/channelOpenConfirm.model.ts (1)
54-55
: Addition ofgasUsed
property looks good.The
gasUsed
property has been added correctly and is consistent with the existing properties. Ensure that any logic interacting with this class accommodates the new property.db/migrations/1723504100232-Data.js (1)
1-30
: Migration file is well-structured.The migration file correctly adds and removes the
gas_used
column across various tables. Ensure that this migration is tested in all environments to confirm its execution without issues.src/model/generated/writeAckPacket.model.ts (1)
55-56
: Addition ofgasUsed
property looks good.The
gasUsed
property has been added correctly and is consistent with the existing properties. Ensure that any logic interacting with this class accommodates the new property.src/model/generated/channelOpenTry.model.ts (1)
66-67
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is correctly added as abigint
type and is nullable, which aligns with the objective of tracking gas usage. This change is consistent with the existing pattern in the class.src/model/generated/channelOpenInit.model.ts (1)
70-71
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is correctly added as abigint
type and is nullable, which aligns with the objective of tracking gas usage. This change is consistent with the existing pattern in the class.src/model/generated/sendPacket.model.ts (1)
73-74
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is correctly added as abigint
type and is nullable, which aligns with the objective of tracking gas usage. This change is consistent with the existing pattern in the class.schema.graphql (11)
47-47
: Addition ofgasUsed
field toSendPacket
entity.The
gasUsed
field has been correctly added as aBigInt
. Ensure that this field is populated correctly in the application logic.
73-73
: Addition ofgasUsed
field toRecvPacket
entity.The
gasUsed
field has been correctly added as aBigInt
. Ensure that this field is populated correctly in the application logic.
96-96
: Addition ofgasUsed
field toWriteAckPacket
entity.The
gasUsed
field has been correctly added as aBigInt
. Ensure that this field is populated correctly in the application logic.
120-120
: Addition ofgasUsed
field toAcknowledgement
entity.The
gasUsed
field has been correctly added as aBigInt
. Ensure that this field is populated correctly in the application logic.
141-141
: Addition ofgasUsed
field toTimeout
entity.The
gasUsed
field has been correctly added as aBigInt
. Ensure that this field is populated correctly in the application logic.
164-164
: Addition ofgasUsed
field toWriteTimeoutPacket
entity.The
gasUsed
field has been correctly added as aBigInt
. Ensure that this field is populated correctly in the application logic.
233-233
: Addition ofgasUsed
field toChannelOpenInit
entity.The
gasUsed
field has been correctly added as aBigInt
. Ensure that this field is populated correctly in the application logic.
263-263
: Addition ofgasUsed
field toChannelOpenTry
entity.The
gasUsed
field has been correctly added as aBigInt
. Ensure that this field is populated correctly in the application logic.
287-287
: Addition ofgasUsed
field toChannelOpenAck
entity.The
gasUsed
field has been correctly added as aBigInt
. Ensure that this field is populated correctly in the application logic.
312-312
: Addition ofgasUsed
field toChannelOpenConfirm
entity.The
gasUsed
field has been correctly added as aBigInt
. Ensure that this field is populated correctly in the application logic.
335-335
: Addition ofgasUsed
field toCloseIbcChannel
entity.The
gasUsed
field has been correctly added as aBigInt
. Ensure that this field is populated correctly in the application logic.src/handlers/packets.ts (6)
Line range hint
19-42
:
Addition ofgasUsed
inhandleSendPacket
.The
gasUsed
variable is correctly added and integrated into theSendPacket
model. Ensure that this value is accurately derived from the transaction log.
Line range hint
54-72
:
Addition ofgasUsed
inhandleRecvPacket
.The
gasUsed
variable is correctly added and integrated into theRecvPacket
model. Ensure that this value is accurately derived from the transaction log.
Line range hint
85-105
:
Addition ofgasUsed
inhandleWriteAckPacket
.The
gasUsed
variable is correctly added and integrated into theWriteAckPacket
model. Ensure that this value is accurately derived from the transaction log.
Line range hint
116-134
:
Addition ofgasUsed
inhandleAcknowledgement
.The
gasUsed
variable is correctly added and integrated into theAcknowledgement
model. Ensure that this value is accurately derived from the transaction log.
Line range hint
146-164
:
Addition ofgasUsed
inhandleTimeout
.The
gasUsed
variable is correctly added and integrated into theTimeout
model. Ensure that this value is accurately derived from the transaction log.
Line range hint
176-197
:
Addition ofgasUsed
inhandleWriteTimeoutPacket
.The
gasUsed
variable is correctly added and integrated into theWriteTimeoutPacket
model. Ensure that this value is accurately derived from the transaction log.src/handlers/channels.ts (4)
45-45
: Addition ofgasUsed
inhandleChannelOpenInit
.The
gasUsed
property is correctly added and integrated into theChannelOpenInit
model. Ensure that this value is accurately derived from the transaction log.
78-78
: Addition ofgasUsed
inhandleChannelOpenTry
.The
gasUsed
property is correctly added and integrated into theChannelOpenTry
model. Ensure that this value is accurately derived from the transaction log.
106-106
: Addition ofgasUsed
inhandleChannelOpenAck
.The
gasUsed
property is correctly added and integrated into theChannelOpenAck
model. Ensure that this value is accurately derived from the transaction log.
133-133
: Addition ofgasUsed
inhandleChannelOpenConfirm
.The
gasUsed
property is correctly added and integrated into theChannelOpenConfirm
model. Ensure that this value is accurately derived from the transaction log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, will this trigger backfilling, or only affect moving forward unless we start a backfill explicitly?
8c6a1b9
to
f6e7018
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (15)
- db/migrations/1723504100232-Data.js (1 hunks)
- schema.graphql (11 hunks)
- src/handlers/channels.ts (4 hunks)
- src/handlers/packets.ts (12 hunks)
- src/model/generated/acknowledgement.model.ts (1 hunks)
- src/model/generated/channelOpenAck.model.ts (1 hunks)
- src/model/generated/channelOpenConfirm.model.ts (1 hunks)
- src/model/generated/channelOpenInit.model.ts (1 hunks)
- src/model/generated/channelOpenTry.model.ts (1 hunks)
- src/model/generated/closeIbcChannel.model.ts (1 hunks)
- src/model/generated/recvPacket.model.ts (1 hunks)
- src/model/generated/sendPacket.model.ts (1 hunks)
- src/model/generated/timeout.model.ts (1 hunks)
- src/model/generated/writeAckPacket.model.ts (1 hunks)
- src/model/generated/writeTimeoutPacket.model.ts (1 hunks)
Additional comments not posted (15)
src/model/generated/timeout.model.ts (1)
48-49
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is correctly added as a nullablebigint
, aligning with the existing structure and enhancing the model's capability to track gas usage.src/model/generated/acknowledgement.model.ts (1)
49-50
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is correctly added as a nullablebigint
, aligning with the existing structure and enhancing the model's capability to track gas usage.src/model/generated/recvPacket.model.ts (1)
51-52
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is correctly added as a nullablebigint
, aligning with the existing structure and enhancing the model's capability to track gas usage.src/model/generated/writeTimeoutPacket.model.ts (1)
57-58
: Addition ofgasUsed
property is appropriate.The
gasUsed
property has been correctly added as a nullable bigint, aligning with the objective to track gas usage in transactions. This enhances the data model's capability to represent gas consumption accurately.src/model/generated/closeIbcChannel.model.ts (1)
48-49
: Addition ofgasUsed
property is appropriate.The
gasUsed
property has been correctly added as a nullable bigint, aligning with the objective to track gas usage in channel closure transactions. This enhances the data model's capability to represent gas consumption accurately.src/model/generated/channelOpenAck.model.ts (1)
54-55
: Addition ofgasUsed
property is appropriate.The
gasUsed
property has been correctly added as a nullable bigint, aligning with the objective to track gas usage in channel opening acknowledgment transactions. This enhances the data model's capability to represent gas consumption accurately.src/model/generated/channelOpenConfirm.model.ts (1)
54-55
: Addition ofgasUsed
property is appropriate.The addition of the
gasUsed
property enhances the data model by allowing it to track gas usage, aligning with the PR objectives.db/migrations/1723504100232-Data.js (1)
1-30
: Migration script correctly addsgas_used
columns.The migration script appropriately adds the
gas_used
column to multiple tables and provides a down method to remove it, ensuring database schema consistency.src/model/generated/writeAckPacket.model.ts (1)
55-56
: Addition ofgasUsed
property is appropriate.The addition of the
gasUsed
property enhances the data model by allowing it to track gas usage, aligning with the PR objectives.src/model/generated/channelOpenTry.model.ts (1)
66-67
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is a valuable addition for tracking gas usage in transactions. Its nullable nature allows for flexibility in scenarios where gas usage data may not be available.src/model/generated/channelOpenInit.model.ts (1)
70-71
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is a valuable addition for tracking gas usage in transactions. Its nullable nature allows for flexibility in scenarios where gas usage data may not be available.src/model/generated/sendPacket.model.ts (1)
73-74
: Addition ofgasUsed
property is appropriate.The
gasUsed
property is a valuable addition for tracking gas usage in transactions. Its nullable nature allows for flexibility in scenarios where gas usage data may not be available.schema.graphql (1)
47-47
: LGTM! Consistent addition ofgasUsed
field.The addition of the
gasUsed
field across multiple entities is consistent and aligns with the PR objectives of tracking gas consumption. The use ofBigInt
is appropriate for handling large numerical values.Also applies to: 76-76, 99-99, 123-123, 144-144, 167-167, 236-236, 266-266, 290-290, 315-315, 338-338
src/handlers/packets.ts (1)
19-19
: LGTM! Consistent addition ofgasUsed
variable.The addition of the
gasUsed
variable across multiple functions enhances the tracking of gas consumption in packet transactions. The changes are consistent and align with the PR objectives.Also applies to: 42-42, 56-56, 74-74, 87-87, 107-107, 118-118, 136-136, 148-148, 166-166, 178-178, 199-199
src/handlers/channels.ts (1)
45-45
: LGTM! Consistent addition ofgasUsed
property.The addition of the
gasUsed
property in channel operation functions provides more detailed transaction data. The changes are consistent and align with the PR objectives.Also applies to: 78-78, 106-106, 133-133
f6e7018
to
45aaef1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (15)
- db/migrations/1724431013276-Data.js (1 hunks)
- schema.graphql (11 hunks)
- src/handlers/channels.ts (4 hunks)
- src/handlers/packets.ts (12 hunks)
- src/model/generated/acknowledgement.model.ts (1 hunks)
- src/model/generated/channelOpenAck.model.ts (1 hunks)
- src/model/generated/channelOpenConfirm.model.ts (1 hunks)
- src/model/generated/channelOpenInit.model.ts (1 hunks)
- src/model/generated/channelOpenTry.model.ts (1 hunks)
- src/model/generated/closeIbcChannel.model.ts (1 hunks)
- src/model/generated/recvPacket.model.ts (1 hunks)
- src/model/generated/sendPacket.model.ts (1 hunks)
- src/model/generated/timeout.model.ts (1 hunks)
- src/model/generated/writeAckPacket.model.ts (1 hunks)
- src/model/generated/writeTimeoutPacket.model.ts (1 hunks)
Files skipped from review due to trivial changes (2)
- src/model/generated/channelOpenAck.model.ts
- src/model/generated/writeAckPacket.model.ts
Files skipped from review as they are similar to previous changes (12)
- schema.graphql
- src/handlers/channels.ts
- src/handlers/packets.ts
- src/model/generated/acknowledgement.model.ts
- src/model/generated/channelOpenConfirm.model.ts
- src/model/generated/channelOpenInit.model.ts
- src/model/generated/channelOpenTry.model.ts
- src/model/generated/closeIbcChannel.model.ts
- src/model/generated/recvPacket.model.ts
- src/model/generated/sendPacket.model.ts
- src/model/generated/timeout.model.ts
- src/model/generated/writeTimeoutPacket.model.ts
Additional comments not posted (7)
db/migrations/1724431013276-Data.js (7)
4-9
: Ensure the indexes being dropped are no longer needed.Dropping indexes can impact query performance. Verify that these indexes are no longer required or have been replaced by more efficient ones.
10-13
: Confirm the impact of dropping columns.Dropping columns like
recv_gas_limit
andrecv_gas_price
might affect existing functionality. Ensure that these columns are truly obsolete and that any dependent code is updated.
14-25
: Addinggas_used
column to multiple tables.The addition of the
gas_used
column is consistent with the PR's objective to track gas usage. Ensure that the application logic is updated to populate these fields correctly.
19-20
: EnsureNOT NULL
constraints are appropriate.The
send_gas_limit
andsend_gas_price
columns are added withNOT NULL
constraints. Verify that there is no scenario where these values could be absent.
27-28
: Dropping foreign key and unique constraints.Ensure that dropping these constraints from
send_packet_fee_deposited
does not lead to data integrity issues.
29-32
: Recreate indexes and constraints.The new indexes and foreign key constraints seem to replace the old ones. Confirm that these changes align with the updated data model and query patterns.
35-64
: Verify thedown
method accurately reverts changes.The
down
method should precisely reverse theup
method's operations. Ensure that all changes, including constraints and indexes, are correctly reverted.
45aaef1
to
79f65aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (15)
- db/migrations/1724433295363-Data.js (1 hunks)
- schema.graphql (11 hunks)
- src/handlers/channels.ts (4 hunks)
- src/handlers/packets.ts (12 hunks)
- src/model/generated/acknowledgement.model.ts (1 hunks)
- src/model/generated/channelOpenAck.model.ts (1 hunks)
- src/model/generated/channelOpenConfirm.model.ts (1 hunks)
- src/model/generated/channelOpenInit.model.ts (1 hunks)
- src/model/generated/channelOpenTry.model.ts (1 hunks)
- src/model/generated/closeIbcChannel.model.ts (1 hunks)
- src/model/generated/recvPacket.model.ts (1 hunks)
- src/model/generated/sendPacket.model.ts (1 hunks)
- src/model/generated/timeout.model.ts (1 hunks)
- src/model/generated/writeAckPacket.model.ts (1 hunks)
- src/model/generated/writeTimeoutPacket.model.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- src/model/generated/sendPacket.model.ts
Files skipped from review as they are similar to previous changes (12)
- schema.graphql
- src/handlers/channels.ts
- src/handlers/packets.ts
- src/model/generated/acknowledgement.model.ts
- src/model/generated/channelOpenAck.model.ts
- src/model/generated/channelOpenInit.model.ts
- src/model/generated/channelOpenTry.model.ts
- src/model/generated/closeIbcChannel.model.ts
- src/model/generated/recvPacket.model.ts
- src/model/generated/timeout.model.ts
- src/model/generated/writeAckPacket.model.ts
- src/model/generated/writeTimeoutPacket.model.ts
Additional comments not posted (2)
src/model/generated/channelOpenConfirm.model.ts (1)
54-55
: Addition ofgasUsed
property is appropriate.The introduction of the
gasUsed
property aligns with the objective to track gas consumption. The use of@BigIntColumn_({nullable: true})
is suitable for handling cases where gas usage data might not be available.db/migrations/1724433295363-Data.js (1)
1-42
: Migration script is well-structured and aligns with objectives.The migration script effectively modifies the database schema to support gas tracking, with clear
up
anddown
methods for applying and reverting changes. This aligns with the PR objectives.
79f65aa
to
ae50161
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (15)
- db/migrations/1724433908520-Data.js (1 hunks)
- schema.graphql (11 hunks)
- src/handlers/channels.ts (4 hunks)
- src/handlers/packets.ts (12 hunks)
- src/model/generated/acknowledgement.model.ts (1 hunks)
- src/model/generated/channelOpenAck.model.ts (1 hunks)
- src/model/generated/channelOpenConfirm.model.ts (1 hunks)
- src/model/generated/channelOpenInit.model.ts (1 hunks)
- src/model/generated/channelOpenTry.model.ts (1 hunks)
- src/model/generated/closeIbcChannel.model.ts (1 hunks)
- src/model/generated/recvPacket.model.ts (1 hunks)
- src/model/generated/sendPacket.model.ts (1 hunks)
- src/model/generated/timeout.model.ts (1 hunks)
- src/model/generated/writeAckPacket.model.ts (1 hunks)
- src/model/generated/writeTimeoutPacket.model.ts (1 hunks)
Files skipped from review due to trivial changes (2)
- src/model/generated/channelOpenAck.model.ts
- src/model/generated/channelOpenInit.model.ts
Files skipped from review as they are similar to previous changes (10)
- schema.graphql
- src/handlers/channels.ts
- src/handlers/packets.ts
- src/model/generated/acknowledgement.model.ts
- src/model/generated/channelOpenTry.model.ts
- src/model/generated/closeIbcChannel.model.ts
- src/model/generated/recvPacket.model.ts
- src/model/generated/timeout.model.ts
- src/model/generated/writeAckPacket.model.ts
- src/model/generated/writeTimeoutPacket.model.ts
Additional comments not posted (3)
src/model/generated/channelOpenConfirm.model.ts (1)
54-55
: Addition ofgasUsed
property is appropriate.The inclusion of the
gasUsed
property in theChannelOpenConfirm
class aligns well with the objective of tracking gas usage. The use ofnullable: true
is appropriate for cases where gas usage data might not be available.db/migrations/1724433908520-Data.js (1)
1-30
: Migration script correctly addsgas_used
column.The migration script effectively adds the
gas_used
column to various tables, ensuring consistent tracking of gas usage. Thedown
method appropriately handles the removal of these columns, making the migration reversible.src/model/generated/sendPacket.model.ts (1)
73-74
: Addition ofgasUsed
property is appropriate.The inclusion of the
gasUsed
property in theSendPacket
class aligns well with the objective of tracking gas usage. The use ofnullable: true
is appropriate for cases where gas usage data might not be available.
Summary by CodeRabbit
New Features
gasUsed
property across various transaction-related models and handlers for improved tracking of gas consumption.gasUsed
fields for key entities, allowing for better gas usage reporting.Bug Fixes
Documentation