Skip to content
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

Feat/dynamic fees #382

Merged
merged 37 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
970a32e
feat: fee settings
ameeshaagrawal May 30, 2024
04a70e4
fix: batch fees setter
ameeshaagrawal May 30, 2024
a9519ae
Merge branch 'master' into feat/dynamic-fees
ameeshaagrawal Jun 14, 2024
a253520
feat: optimize fee struct
ameeshaagrawal Jun 17, 2024
a4163f4
feat: execute simulator
ameeshaagrawal Jun 17, 2024
6937659
feat: multicall
ameeshaagrawal Jun 17, 2024
40baacb
feat: generate execute calldata
ameeshaagrawal Jun 17, 2024
9f35b33
fix: tests
ameeshaagrawal Jun 17, 2024
8640a08
fix: add check for payload size
ameeshaagrawal Jun 18, 2024
3e3ac88
fix: imports
ameeshaagrawal Jun 18, 2024
f3916b9
fix: deploy script
ameeshaagrawal Jun 18, 2024
26f814c
Merge branch 'master' into feat/dynamic-fees
ameeshaagrawal Jun 18, 2024
2259993
fix: lint
ameeshaagrawal Jun 18, 2024
8ea21a3
feat: dev contract migrations
ameeshaagrawal Jun 18, 2024
9a51578
feat: dev s3 config upload
ameeshaagrawal Jun 18, 2024
1ea7658
feat: temp script for em migration
ameeshaagrawal Jun 18, 2024
53b9173
fix: lint
ameeshaagrawal Jun 18, 2024
08956d5
fix: switchboard simulator
ameeshaagrawal Jun 20, 2024
f10bf7b
fix: calldata generation
ameeshaagrawal Jun 20, 2024
4e39680
feat: new em version
ameeshaagrawal Jun 21, 2024
71ea76d
feat: scripts to migrate and revert em
ameeshaagrawal Jun 24, 2024
2d70beb
feat: add old em fees array
ameeshaagrawal Jun 24, 2024
a539317
chore: dl core test bump
ameeshaagrawal Jun 24, 2024
cf75c00
fix: rename gas price
ameeshaagrawal Jun 24, 2024
70d86bb
fix: comment
ameeshaagrawal Jun 24, 2024
3339dff
fix: chain slug type
ameeshaagrawal Jun 25, 2024
88ad516
fix: rename
ameeshaagrawal Jun 25, 2024
88b3d22
fix: script refactors
ameeshaagrawal Jun 25, 2024
dc73712
fix: comments and small scripts
ameeshaagrawal Jun 25, 2024
9dad292
fix: socket types
ameeshaagrawal Jun 25, 2024
0ede188
fix: refactor
ameeshaagrawal Jun 25, 2024
57f8cc7
fix: migrate scripts
ameeshaagrawal Jun 25, 2024
b1c9933
Merge branch 'master' into feat/dynamic-fees
ameeshaagrawal Jun 25, 2024
adb8edc
fix: use siblings
ameeshaagrawal Jun 25, 2024
6267e5c
feat: migrate
arthcp Jun 25, 2024
044920a
core publish
arthcp Jun 25, 2024
ccdb092
Merge remote-tracking branch 'origin/feat/dynamic-fees' into feat/dyn…
arthcp Jun 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ It is recommended to setup the ide to work with solidity development. In case of
| InvalidNonce() | 0x756688fe |
| MsgValueTooLow() | 0x508aaf00 |
| MsgValueTooHigh() | 0x5dffc92f |
| PayloadTooLarge() | 0x492f620d |
| InsufficientMsgValue() | 0x78f38f76 |
| InsufficientFees() | 0x8d53e553 |
| InvalidMsgValue() | 0x1841b4e1 |
| FeesTooHigh() | 0xc9034e18 |
| PayloadTooLarge() | 0x492f620d |
| InvalidBatchSize() | 0x7862e959 |
| InsufficientMessageLength() | 0xbcfdc01d |
| InvalidPacketLength() | 0x5a375a8e |
Expand Down
40 changes: 12 additions & 28 deletions contracts/ExecutionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {FEES_UPDATE_SIG_IDENTIFIER, RELATIVE_NATIVE_TOKEN_PRICE_UPDATE_SIG_IDENT
* managing execution and other fees. This contract also implements the AccessControl interface, allowing for role-based
* access control.
*/
contract ExecutionManager is IExecutionManager, AccessControlExtended {
contract ExecutionManager is AccessControlExtended {
ISignatureVerifier public immutable signatureVerifier__;
ISocket public immutable socket__;
uint32 public immutable chainSlug;
Expand Down Expand Up @@ -183,13 +183,7 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
function isExecutor(
bytes32 packedMessage,
bytes memory sig
)
external
view
virtual
override
returns (address executor, bool isValidExecutor)
{
) external view virtual returns (address executor, bool isValidExecutor) {
executor = signatureVerifier__.recoverSigner(packedMessage, sig);
isValidExecutor = _hasRole(EXECUTOR_ROLE, executor);
}
Expand All @@ -198,17 +192,11 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
* @notice updates the total fee used by an executor to execute a message
* @dev to be used for accounting when onchain fee distribution for individual executors is implemented
* @dev this function should be called by socket only
* @inheritdoc IExecutionManager
*/
function updateExecutionFees(
address,
uint128,
bytes32
) external view override {
function updateExecutionFees(address, uint128, bytes32) external view {
if (msg.sender != address(socket__)) revert OnlySocket();
}

/// @inheritdoc IExecutionManager
function payAndCheckFees(
uint256 minMsgGasLimit_,
uint256 payloadSize_,
Expand All @@ -223,7 +211,6 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
)
external
payable
override
returns (uint128 executionFee, uint128 transmissionFees)
{
if (msg.value >= type(uint128).max) revert InvalidMsgValue();
Expand Down Expand Up @@ -282,7 +269,7 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
uint256 payloadSize_,
bytes32 executionParams_,
uint32 siblingChainSlug_
) external view override returns (uint128 minExecutionFee) {
) external view returns (uint128 minExecutionFee) {
minExecutionFee = _getMinFees(
gasLimit_,
payloadSize_,
Expand All @@ -291,7 +278,6 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
);
}

/// @inheritdoc IExecutionManager
function getExecutionTransmissionMinFees(
uint256 minMsgGasLimit_,
uint256 payloadSize_,
Expand All @@ -302,7 +288,6 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
)
external
view
override
returns (uint128 minExecutionFee, uint128 transmissionFees)
{
minExecutionFee = _getMinFees(
Expand Down Expand Up @@ -357,7 +342,7 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
function verifyParams(
bytes32 executionParams_,
uint256 msgValue_
) external pure override {
) external pure {
uint256 params = uint256(executionParams_);
uint8 paramType = uint8(params >> 248);

Expand All @@ -381,7 +366,7 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
uint32 siblingChainSlug_,
uint128 executionFees_,
bytes calldata signature_
) external override {
) external {
address feesUpdater = signatureVerifier__.recoverSigner(
keccak256(
abi.encode(
Expand Down Expand Up @@ -420,7 +405,7 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
uint32 siblingChainSlug_,
uint256 relativeNativeTokenPrice_,
bytes calldata signature_
) external override {
) external {
address feesUpdater = signatureVerifier__.recoverSigner(
keccak256(
abi.encode(
Expand Down Expand Up @@ -461,7 +446,7 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
uint32 siblingChainSlug_,
uint256 msgValueMinThreshold_,
bytes calldata signature_
) external override {
) external {
address feesUpdater = signatureVerifier__.recoverSigner(
keccak256(
abi.encode(
Expand Down Expand Up @@ -498,7 +483,7 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
uint32 siblingChainSlug_,
uint256 msgValueMaxThreshold_,
bytes calldata signature_
) external override {
) external {
address feesUpdater = signatureVerifier__.recoverSigner(
keccak256(
abi.encode(
Expand Down Expand Up @@ -526,12 +511,11 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
/**
* @notice updates the transmission fee needed for transmission
* @dev this function stores value against msg.sender hence expected to be called by transmit manager
* @inheritdoc IExecutionManager
*/
function setTransmissionMinFees(
uint32 remoteChainSlug_,
uint128 fees_
) external override {
) external {
transmissionMinFees[msg.sender][remoteChainSlug_] = fees_;
}

Expand Down Expand Up @@ -568,7 +552,7 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
uint32 siblingChainSlug_,
address switchboard_,
uint128 amount_
) external override {
) external {
if (totalSwitchboardFees[switchboard_][siblingChainSlug_] < amount_)
revert InsufficientFees();

Expand All @@ -590,7 +574,7 @@ contract ExecutionManager is IExecutionManager, AccessControlExtended {
function withdrawTransmissionFees(
uint32 siblingChainSlug_,
uint128 amount_
) external override {
) external {
if (
totalExecutionAndTransmissionFees[siblingChainSlug_]
.totalTransmissionFees < amount_
Expand Down
Loading
Loading