Skip to content

Conversation

@YukiTsuchida
Copy link
Contributor

@YukiTsuchida YukiTsuchida commented Jan 13, 2026

Introduced CoordStateCompact to replace the proto-generated CoordinatorState.Data in storage. This allows us to pack protocol, phase, decision, and masks into a single slot.

@YukiTsuchida YukiTsuchida changed the base branch from main to delete-txMsg January 13, 2026 01:24
@github-actions
Copy link

github-actions bot commented Jan 13, 2026

⛽ Gas Usage Changes

Comparison against develop branch:

Click to view gas diff
test_getCoordStorage_IsIsolated() (gas: +442 (2.141%)) 
test_getAuthStorage_IsIsolated() (gas: +479 (2.351%)) 
test_getTxStorage_IsIsolated() (gas: +541 (2.624%)) 
test_handleAck_RevertWhen_StateNotFound() (gas: +10340 (8.294%)) 
test_handleAck_RevertWhen_CoordinatorStateNotFound() (gas: -28202 (-9.080%)) 
test_runTx_RevertWhen_ChannelNotFound() (gas: +10341 (12.197%)) 
test_runTx_RevertWhen_UnexpectedReturnValue() (gas: +10339 (14.453%)) 
test_handleAck_RevertWhen_ChannelNotFound() (gas: -47440 (-14.819%)) 
test_handleAck_RevertWhen_ChannelMismatch() (gas: -48842 (-15.200%)) 
test_runTx_SucceedsAndSendsPacket() (gas: -52145 (-15.248%)) 
test_handleAck_RevertWhen_CoordinatorPhaseNotPrepare() (gas: -46608 (-15.259%)) 
test_handleAck_RevertWhen_InvalidTxIDLength() (gas: -50969 (-15.592%)) 
test_handleAck_RevertWhen_PacketTypeURLUnexpected() (gas: -50969 (-16.139%)) 
test_handleAck_RevertWhen_PacketPayloadDecodeFailed() (gas: -50969 (-18.320%)) 
test_handleAck_RevertWhen_AllTransactionsConfirmed() (gas: -68764 (-19.507%)) 
test_handleAck_RevertWhen_AckTypeURLUnexpected() (gas: -50969 (-19.628%)) 
test_handleAck_RevertWhen_UnexpectedCommitStatus() (gas: -69218 (-20.295%)) 
test_handleAck_RevertWhen_AckPayloadDecodeFailed() (gas: -50969 (-21.041%)) 
test_handleAck_RevertWhen_AckIsNotSuccess() (gas: -50969 (-21.988%)) 
test_runTx_RevertWhen_TxIDAlreadyExists() (gas: -46545 (-22.353%)) 
test_handleAck_Failure() (gas: -110057 (-24.342%)) 
test_handleAck_Success() (gas: -110052 (-24.362%)) 
test_handleAck_RevertWhen_OnAbortReverts() (gas: -109903 (-24.433%)) 
test_handleAck_RevertWhen_OnCommitReverts() (gas: -109898 (-24.456%)) 
test_runTx_RevertWhen_Tx0NotLocal() (gas: +10337 (24.685%)) 
test_handleAck_RevertWhen_CoordinatorStateInconsistent() (gas: -108401 (-26.267%)) 
test_getCoordinatorState_ReturnsCorrectState() (gas: -20150 (-27.140%)) 
test_handleAck_RevertWhen_CoordinatorTxStatusNotPrepare() (gas: -109933 (-27.411%)) 
test_handleAck_RevertWhen_ModuleNotInitialized() (gas: -109900 (-27.820%)) 
test_runTx_RevertWhen_ModuleNotInitialized() (gas: +10338 (28.114%)) 
test_runTx_PrepareFailed() (gas: -91896 (-30.835%)) 
test_runTx_RevertWhen_LinksNotSupported() (gas: +10337 (36.922%)) 
test_getCoordinatorState_RevertsIfNotFound() (gas: +10211 (56.274%)) 
Overall gas change: -1520063 (-0.141%)

Calculated by Foundry Gas Snapshot Action

@github-actions
Copy link

github-actions bot commented Jan 13, 2026

LCOV of commit 8c538ed during Coverage Report #274

Summary coverage rate:
  lines......: 96.5% (614 of 636 lines)
  functions..: 95.5% (106 of 111 functions)
  branches...: no data found

Files changed coverage rate:
                                         |Lines       |Functions  |Branches    
  Filename                               |Rate     Num|Rate    Num|Rate     Num
  =============================================================================
  src/core/CrossStore.sol                |17.1%     41| 0.0%     7|    -      0
  src/core/TxAtomicSimple.sol            | 4.9%    182| 0.0%     9|    -      0
  src/core/TxManager.sol                 |31.1%     45| 0.0%    14|    -      0

Full coverage report

@datachainlab datachainlab deleted a comment from github-actions bot Jan 13, 2026
@YukiTsuchida YukiTsuchida changed the base branch from delete-txMsg to develop January 14, 2026 01:33
@YukiTsuchida YukiTsuchida changed the title Improve gas coord state compact2 Improve gas coord state compact Jan 14, 2026
@YukiTsuchida YukiTsuchida marked this pull request as ready for review January 14, 2026 23:34
@YukiTsuchida YukiTsuchida self-assigned this Jan 14, 2026
Copy link
Member

@mattsu6666 mattsu6666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment!

string participantChannel;

uint8 confirmedMask; // bit0=coord, bit1=participant
uint8 ackMask; // bit0=coord, bit1=participant
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to add a comment clarifying that this struct is only intended for a 1:1 relationship between the coordinator and the participant. It would also be good to note that introducing 2PC would require a redesign.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: 8c538ed

Copy link
Member

@mattsu6666 mattsu6666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@YukiTsuchida YukiTsuchida merged commit e7581b1 into develop Jan 16, 2026
6 checks passed
@YukiTsuchida YukiTsuchida deleted the improve-gas-CoordStateCompact2 branch January 16, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants