Skip to content

Commit

Permalink
evm: remove unused const; fix approve
Browse files Browse the repository at this point in the history
  • Loading branch information
a5-pickle committed Dec 22, 2023
1 parent 8095770 commit da6a7e3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 38 deletions.
69 changes: 34 additions & 35 deletions evm/.gas-snapshot-current
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
CircleIntegrationComparison:test_Composed__RedeemUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 271983, ~: 271924)
CircleIntegrationComparison:test_Composed__TransferUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 389671, ~: 389667)
CircleIntegrationComparison:test_Control__RedeemTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 73879, ~: 73749)
CircleIntegrationComparison:test_Control__TransferTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 207779, ~: 207783)
CircleIntegrationComparison:test_Fork__RedeemTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 278942, ~: 278898)
CircleIntegrationComparison:test_Fork__TransferTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 365857, ~: 365857)
CircleIntegrationComparison:test_Inherited__RedeemUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 230381, ~: 230322)
CircleIntegrationComparison:test_Inherited__TransferUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 341198, ~: 341198)
CircleIntegrationComparison:test_Latest__RedeemTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 255627, ~: 255566)
CircleIntegrationComparison:test_Latest__TransferTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 357032, ~: 357028)
CircleIntegrationTest:test_CannotRedeemTokensWithPayloadCallerMustBeMintRecipient(address) (runs: 256, μ: 76122, ~: 76122)
CircleIntegrationTest:test_CannotRedeemTokensWithPayloadInvalidMessagePair() (gas: 95728)
CircleIntegrationTest:test_CannotRedeemTokensWithPayloadMintTokenNotSupported(bytes32) (runs: 256, μ: 143305, ~: 143298)
CircleIntegrationTest:test_CannotRedeemTokensWithPayloadUnknownEmitter(bytes32) (runs: 256, μ: 206423, ~: 206415)
CircleIntegrationTest:test_CannotTransferTokensWithPayloadInvalidMintRecipient() (gas: 243114)
CircleIntegrationTest:test_CannotTransferTokensWithPayloadInvalidToken() (gas: 247595)
CircleIntegrationTest:test_CannotTransferTokensWithPayloadTargetContractNotRegistered() (gas: 195787)
CircleIntegrationTest:test_CannotTransferTokensWithPayloadZeroAmount() (gas: 55800)
CircleIntegrationTest:test_RedeemTokensWithPayload() (gas: 244219)
CircleIntegrationTest:test_TransferTokensWithPayload(uint256,bytes32) (runs: 256, μ: 487769, ~: 487727)
GovernanceTest:test_CannotConsumeGovernanceMessageInvalidAction(uint8,uint8) (runs: 256, μ: 80052, ~: 80052)
GovernanceTest:test_CannotConsumeGovernanceMessageInvalidGovernanceChainId(uint16,uint8) (runs: 256, μ: 77927, ~: 77927)
GovernanceTest:test_CannotConsumeGovernanceMessageInvalidGovernanceContract(bytes32,uint8) (runs: 256, μ: 77662, ~: 77662)
GovernanceTest:test_CannotConsumeGovernanceMessageInvalidModule(bytes32,uint8) (runs: 256, μ: 79776, ~: 79776)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidDomain(uint16,bytes32) (runs: 256, μ: 113836, ~: 113836)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidEmitterAddress(uint16,uint32) (runs: 256, μ: 114711, ~: 114711)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidForeignChain(bytes32,uint32) (runs: 256, μ: 187305, ~: 187305)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidLength(uint16,bytes32,uint32) (runs: 256, μ: 115441, ~: 115441)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidTargetChain(uint16,uint16,bytes32,uint32) (runs: 256, μ: 115159, ~: 115159)
GovernanceTest:test_CannotUpdateWormholeFinalityUnsupportedGovernanceAction(uint8) (runs: 256, μ: 52498, ~: 52498)
GovernanceTest:test_CannotUpgradeContractInvalidImplementation(bytes12,address) (runs: 256, μ: 237112, ~: 237112)
GovernanceTest:test_RegisterEmitterAndDomain(uint16,bytes32,uint32) (runs: 256, μ: 260947, ~: 260947)
GovernanceTest:test_RegisterEmitterAndDomainNoTarget() (gas: 196350)
GovernanceTest:test_UpgradeContract() (gas: 2372528)
InheritingWormholeCctpTest:test_TransferUsdc(uint256,bytes32) (runs: 256, μ: 360180, ~: 360142)
CircleIntegrationComparison:test_Composed__RedeemUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 271883, ~: 271760)
CircleIntegrationComparison:test_Composed__TransferUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 389234, ~: 389232)
CircleIntegrationComparison:test_Control__RedeemTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 73884, ~: 73749)
CircleIntegrationComparison:test_Control__TransferTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 207780, ~: 207785)
CircleIntegrationComparison:test_Fork__RedeemTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 278940, ~: 278805)
CircleIntegrationComparison:test_Fork__TransferTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 365863, ~: 365862)
CircleIntegrationComparison:test_Inherited__RedeemUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 230293, ~: 230196)
CircleIntegrationComparison:test_Inherited__TransferUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 341205, ~: 341200)
CircleIntegrationComparison:test_Latest__RedeemTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 255543, ~: 255478)
CircleIntegrationComparison:test_Latest__TransferTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 356595, ~: 356588)
CircleIntegrationTest:test_CannotRedeemTokensWithPayloadCallerMustBeMintRecipient(address) (runs: 256, μ: 76034, ~: 76034)
CircleIntegrationTest:test_CannotRedeemTokensWithPayloadInvalidMessagePair() (gas: 95552)
CircleIntegrationTest:test_CannotRedeemTokensWithPayloadMintTokenNotSupported(bytes32) (runs: 256, μ: 143217, ~: 143210)
CircleIntegrationTest:test_CannotRedeemTokensWithPayloadUnknownEmitter(bytes32) (runs: 256, μ: 206357, ~: 206349)
CircleIntegrationTest:test_CannotTransferTokensWithPayloadInvalidMintRecipient() (gas: 242634)
CircleIntegrationTest:test_CannotTransferTokensWithPayloadInvalidToken() (gas: 247084)
CircleIntegrationTest:test_CannotTransferTokensWithPayloadTargetContractNotRegistered() (gas: 195724)
CircleIntegrationTest:test_CannotTransferTokensWithPayloadZeroAmount() (gas: 55268)
CircleIntegrationTest:test_RedeemTokensWithPayload() (gas: 244131)
CircleIntegrationTest:test_TransferTokensWithPayload(uint256,bytes32) (runs: 256, μ: 486838, ~: 486810)
GovernanceTest:test_CannotConsumeGovernanceMessageInvalidAction(uint8,uint8) (runs: 256, μ: 79965, ~: 79965)
GovernanceTest:test_CannotConsumeGovernanceMessageInvalidGovernanceChainId(uint16,uint8) (runs: 256, μ: 77861, ~: 77861)
GovernanceTest:test_CannotConsumeGovernanceMessageInvalidGovernanceContract(bytes32,uint8) (runs: 256, μ: 77596, ~: 77596)
GovernanceTest:test_CannotConsumeGovernanceMessageInvalidModule(bytes32,uint8) (runs: 256, μ: 79732, ~: 79732)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidDomain(uint16,bytes32) (runs: 256, μ: 113726, ~: 113726)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidEmitterAddress(uint16,uint32) (runs: 256, μ: 114579, ~: 114579)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidForeignChain(bytes32,uint32) (runs: 256, μ: 187107, ~: 187107)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidLength(uint16,bytes32,uint32) (runs: 256, μ: 115309, ~: 115309)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidTargetChain(uint16,uint16,bytes32,uint32) (runs: 256, μ: 115049, ~: 115049)
GovernanceTest:test_CannotUpgradeContractInvalidImplementation(bytes12,address) (runs: 256, μ: 236936, ~: 236936)
GovernanceTest:test_RegisterEmitterAndDomain(uint16,bytes32,uint32) (runs: 256, μ: 260771, ~: 260771)
GovernanceTest:test_RegisterEmitterAndDomainNoTarget() (gas: 196262)
GovernanceTest:test_UpgradeContract() (gas: 2310240)
InheritingWormholeCctpTest:test_TransferUsdc(uint256,bytes32) (runs: 256, μ: 360178, ~: 360142)
MessagesTest:test_DepositWithPayloadSerde(bytes32,uint256,uint32,uint32,uint64,bytes32,bytes32,bytes) (runs: 256, μ: 7871, ~: 7706)
2 changes: 1 addition & 1 deletion evm/src/contracts/WormholeCctp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ abstract contract WormholeCctp {
}

function setTokenMessengerApproval(address token, uint256 amount) internal {
IERC20(token).forceApprove(address(_tokenMessenger), amount);
IERC20(token).approve(address(_tokenMessenger), amount);
}

function burnAndPublish(
Expand Down
2 changes: 0 additions & 2 deletions evm/src/libraries/WormholeCctpMessages.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ library WormholeCctpMessages {
// Payload IDs.
uint8 private constant DEPOSIT = 0x1;

uint256 public constant PAYLOAD_OFFSET = 149;

error MissingPayload();
error PayloadTooLarge(uint256);
error InvalidMessage();
Expand Down

0 comments on commit da6a7e3

Please sign in to comment.