Skip to content

Commit

Permalink
Merge branch 'master' into fe/portfolio-gas-tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
abtestingalpha committed Apr 17, 2024
2 parents d39cb85 + 2149a39 commit b3a272c
Show file tree
Hide file tree
Showing 238 changed files with 12,391 additions and 9,928 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
fetch-depth: 0

# note: after this action is pushed, whatever this ends up being should go back to latest.
- uses: docker://ghcr.io/synapsecns/sanguine/git-changes-action:2806c6873f55ef6840e4ebea43a0f27b98f95516
- uses: docker://ghcr.io/synapsecns/sanguine/git-changes-action:latest
id: filter_go
with:
github_token: ${{ secrets.WORKFLOW_PAT || secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
fetch-depth: 0
submodules: 'recursive'

- uses: docker://ghcr.io/synapsecns/sanguine/git-changes-action:2806c6873f55ef6840e4ebea43a0f27b98f95516
- uses: docker://ghcr.io/synapsecns/sanguine/git-changes-action:latest
id: filter_go
with:
github_token: ${{ secrets.WORKFLOW_PAT || secrets.GITHUB_TOKEN }}
Expand Down
1,265 changes: 928 additions & 337 deletions committee/contracts/interchaindb/interchaindb.abigen.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

228 changes: 114 additions & 114 deletions committee/contracts/mocks/gasoraclemock/gasoraclemock.abigen.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,527 changes: 850 additions & 677 deletions committee/contracts/synapsemodule/synapsemodule.abigen.go

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion committee/db/base/signrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func toSignRequest(originChainID int, sr synapsemodule.SynapseModuleBatchVerific
TXHash: sr.Raw.TxHash.String(),
TransactionID: common.Bytes2Hex(sr.EthSignedBatchHash[:]),
Entry: common.Bytes2Hex(sr.Batch),
DestinationChainID: int(sr.DstChainId.Int64()),
DestinationChainID: int(sr.DstChainId),
Status: db.Seen,
}
}
Expand Down
4 changes: 2 additions & 2 deletions committee/node/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ func (n *NodeSuite) TestNodeSuite() {
auth := n.originChain.GetTxContext(n.GetTestContext(), nil)
_, originDB := n.deployManager.GetInterchainDB(n.GetTestContext(), n.originChain)

fee, err := originDB.GetInterchainFee(&bind.CallOpts{Context: n.GetSuiteContext()}, n.destChain.GetBigChainID(), []common.Address{n.originModule.Address()})
fee, err := originDB.GetInterchainFee(&bind.CallOpts{Context: n.GetSuiteContext()}, n.destChain.GetBigChainID().Uint64(), []common.Address{n.originModule.Address()})
n.Require().NoError(err)
auth.TransactOpts.Value = core.CopyBigInt(fee)

tx, err := originDB.WriteEntryWithVerification(auth.TransactOpts, n.destChain.GetBigChainID(), sha256.Sum256([]byte("fat")), []common.Address{n.originModule.Address()})
tx, err := originDB.WriteEntryWithVerification(auth.TransactOpts, n.destChain.GetBigChainID().Uint64(), sha256.Sum256([]byte("fat")), []common.Address{n.originModule.Address()})
n.Require().NoError(err)
// wait for the transaction to be mined
n.originChain.WaitForConfirmation(n.GetTestContext(), tx)
Expand Down
24 changes: 24 additions & 0 deletions packages/contracts-communication/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.2.0](https://github.com/synapsecns/sanguine/compare/contracts-communication@1.1.3...contracts-communication@1.2.0) (2024-04-17)


### Bug Fixes

* **contracts-communication:** Expose app config, finalize events ([#2506](https://github.com/synapsecns/sanguine/issues/2506)) ([a1cbda0](https://github.com/synapsecns/sanguine/commit/a1cbda0baa46bcbc83c896df829bf7f059792401))


### Features

* **contracts-communication:** use uint64 for chain IDs and DB nonces ([#2453](https://github.com/synapsecns/sanguine/issues/2453)) ([1096cfb](https://github.com/synapsecns/sanguine/commit/1096cfb69c8a1d6630255ddab88b4855c3efec8c)), closes [#2454](https://github.com/synapsecns/sanguine/issues/2454)





## [1.1.3](https://github.com/synapsecns/sanguine/compare/contracts-communication@1.1.2...contracts-communication@1.1.3) (2024-04-11)

**Note:** Version bump only for package contracts-communication





## [1.1.2](https://github.com/synapsecns/sanguine/compare/contracts-communication@1.1.1...contracts-communication@1.1.2) (2024-04-08)


Expand Down
8 changes: 4 additions & 4 deletions packages/contracts-communication/contracts/ExecutionFees.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ contract ExecutionFees is AccessControl, ExecutionFeesEvents, IExecutionFees {
bytes32 public constant RECORDER_ROLE = keccak256("RECORDER_ROLE");

/// @inheritdoc IExecutionFees
mapping(uint256 chainId => mapping(bytes32 transactionId => uint256 fee)) public executionFee;
mapping(uint64 chainId => mapping(bytes32 transactionId => uint256 fee)) public executionFee;
/// @inheritdoc IExecutionFees
mapping(address executor => uint256 totalAccumulated) public accumulatedRewards;
/// @inheritdoc IExecutionFees
mapping(address executor => uint256 totalClaimed) public unclaimedRewards;
/// @inheritdoc IExecutionFees
mapping(uint256 chainId => mapping(bytes32 transactionId => address executor)) public recordedExecutor;
mapping(uint64 chainId => mapping(bytes32 transactionId => address executor)) public recordedExecutor;

constructor(address admin) {
_grantRole(DEFAULT_ADMIN_ROLE, admin);
}

// @inheritdoc IExecutionFees
function addExecutionFee(uint256 dstChainId, bytes32 transactionId) external payable {
function addExecutionFee(uint64 dstChainId, bytes32 transactionId) external payable {
if (msg.value == 0) revert ExecutionFees__ZeroAmount();
executionFee[dstChainId][transactionId] += msg.value;
// Use the new total fee as the event parameter.
Expand All @@ -38,7 +38,7 @@ contract ExecutionFees is AccessControl, ExecutionFeesEvents, IExecutionFees {

// @inheritdoc IExecutionFees
function recordExecutor(
uint256 dstChainId,
uint64 dstChainId,
bytes32 transactionId,
address executor
)
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-communication/contracts/IInterchain.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.20;
interface IInterchain {
function interchainSend(
bytes32 receiver,
uint256 dstChainId,
uint64 dstChainId,
bytes calldata message,
address[] calldata modules
)
Expand Down
33 changes: 22 additions & 11 deletions packages/contracts-communication/contracts/InterchainClientV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ contract InterchainClientV1 is Ownable, InterchainClientV1Events, IInterchainCli
address public executionFees;

/// @dev Address of the InterchainClient contract on the remote chain
mapping(uint256 chainId => bytes32 remoteClient) internal _linkedClient;
mapping(uint64 chainId => bytes32 remoteClient) internal _linkedClient;
/// @dev Executor address that completed the transaction. Address(0) if not executed yet.
mapping(bytes32 transactionId => address executor) internal _txExecutor;

Expand All @@ -54,14 +54,14 @@ contract InterchainClientV1 is Ownable, InterchainClientV1Events, IInterchainCli
}

// @inheritdoc IInterchainClientV1
function setLinkedClient(uint256 chainId, bytes32 client) external onlyOwner {
function setLinkedClient(uint64 chainId, bytes32 client) external onlyOwner {
_linkedClient[chainId] = client;
emit LinkedClientSet(chainId, client);
}

// @inheritdoc IInterchainClientV1
function interchainSend(
uint256 dstChainId,
uint64 dstChainId,
bytes32 receiver,
address srcExecutionService,
address[] calldata srcModules,
Expand All @@ -77,7 +77,7 @@ contract InterchainClientV1 is Ownable, InterchainClientV1Events, IInterchainCli

// @inheritdoc IInterchainClientV1
function interchainSendEVM(
uint256 dstChainId,
uint64 dstChainId,
address receiver,
address srcExecutionService,
address[] calldata srcModules,
Expand Down Expand Up @@ -132,7 +132,7 @@ contract InterchainClientV1 is Ownable, InterchainClientV1Events, IInterchainCli
}

/// @inheritdoc IInterchainClientV1
function writeExecutionProof(bytes32 transactionId) external returns (uint256 dbNonce, uint64 entryIndex) {
function writeExecutionProof(bytes32 transactionId) external returns (uint64 dbNonce, uint64 entryIndex) {
address executor = _txExecutor[transactionId];
if (executor == address(0)) {
revert InterchainClientV1__TxNotExecuted(transactionId);
Expand Down Expand Up @@ -166,7 +166,7 @@ contract InterchainClientV1 is Ownable, InterchainClientV1Events, IInterchainCli

// @inheritdoc IInterchainClientV1
function getInterchainFee(
uint256 dstChainId,
uint64 dstChainId,
address srcExecutionService,
address[] calldata srcModules,
bytes calldata options,
Expand All @@ -189,15 +189,15 @@ contract InterchainClientV1 is Ownable, InterchainClientV1Events, IInterchainCli
}

/// @inheritdoc IInterchainClientV1
function getLinkedClient(uint256 chainId) external view returns (bytes32) {
function getLinkedClient(uint64 chainId) external view returns (bytes32) {
if (chainId == block.chainid) {
revert InterchainClientV1__NotRemoteChainId(chainId);
}
return _linkedClient[chainId];
}

/// @inheritdoc IInterchainClientV1
function getLinkedClientEVM(uint256 chainId) external view returns (address linkedClientEVM) {
function getLinkedClientEVM(uint64 chainId) external view returns (address linkedClientEVM) {
if (chainId == block.chainid) {
revert InterchainClientV1__NotRemoteChainId(chainId);
}
Expand All @@ -209,6 +209,17 @@ contract InterchainClientV1 is Ownable, InterchainClientV1Events, IInterchainCli
}
}

/// @notice Gets the V1 app config and trusted modules for the receiving app.
function getAppReceivingConfigV1(address receiver)
external
view
returns (AppConfigV1 memory config, address[] memory modules)
{
bytes memory encodedConfig;
(encodedConfig, modules) = IInterchainApp(receiver).getReceivingConfig();
config = encodedConfig.decodeAppConfigV1();
}

/// @notice Decodes the encoded options data into a OptionsV1 struct.
function decodeOptions(bytes memory encodedOptions) external view returns (OptionsV1 memory) {
return encodedOptions.decodeOptionsV1();
Expand All @@ -226,7 +237,7 @@ contract InterchainClientV1 is Ownable, InterchainClientV1Events, IInterchainCli

/// @dev Internal logic for sending a message to another chain.
function _interchainSend(
uint256 dstChainId,
uint64 dstChainId,
bytes32 receiver,
address srcExecutionService,
address[] calldata srcModules,
Expand Down Expand Up @@ -257,7 +268,7 @@ contract InterchainClientV1 is Ownable, InterchainClientV1Events, IInterchainCli
desc.transactionId = keccak256(encodeTransaction(icTx));
// Sanity check: nonce returned from DB should match the nonce used to construct the transaction
{
(uint256 dbNonce, uint64 entryIndex) = IInterchainDB(INTERCHAIN_DB).writeEntryWithVerification{
(uint64 dbNonce, uint64 entryIndex) = IInterchainDB(INTERCHAIN_DB).writeEntryWithVerification{
value: verificationFee
}(icTx.dstChainId, desc.transactionId, srcModules);
assert(dbNonce == desc.dbNonce && entryIndex == desc.entryIndex);
Expand Down Expand Up @@ -334,7 +345,7 @@ contract InterchainClientV1 is Ownable, InterchainClientV1Events, IInterchainCli
}

/// @dev Asserts that the chain is linked and returns the linked client address.
function _assertLinkedClient(uint256 chainId) internal view returns (bytes32 linkedClient) {
function _assertLinkedClient(uint64 chainId) internal view returns (bytes32 linkedClient) {
if (chainId == block.chainid) {
revert InterchainClientV1__NotRemoteChainId(chainId);
}
Expand Down
Loading

0 comments on commit b3a272c

Please sign in to comment.