Skip to content

Commit

Permalink
evm: remove sequential
Browse files Browse the repository at this point in the history
  • Loading branch information
a5-pickle committed Dec 22, 2023
1 parent da6a7e3 commit f32f514
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 55 deletions.
44 changes: 22 additions & 22 deletions evm/.gas-snapshot-current
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
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)
CircleIntegrationComparison:test_Composed__RedeemUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 271898, ~: 271836)
CircleIntegrationComparison:test_Composed__TransferUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 389236, ~: 389232)
CircleIntegrationComparison:test_Control__RedeemTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 73886, ~: 73749)
CircleIntegrationComparison:test_Control__TransferTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 207775, ~: 207784)
CircleIntegrationComparison:test_Fork__RedeemTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 278942, ~: 278898)
CircleIntegrationComparison:test_Fork__TransferTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 365854, ~: 365857)
CircleIntegrationComparison:test_Inherited__RedeemUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 230294, ~: 230234)
CircleIntegrationComparison:test_Inherited__TransferUsdc(uint256,bytes32,bytes32) (runs: 256, μ: 341202, ~: 341200)
CircleIntegrationComparison:test_Latest__RedeemTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 255532, ~: 255402)
CircleIntegrationComparison:test_Latest__TransferTokensWithPayload(uint256,bytes32,bytes32) (runs: 256, μ: 356588, ~: 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_CannotRedeemTokensWithPayloadMintTokenNotSupported(bytes32) (runs: 256, μ: 143218, ~: 143210)
CircleIntegrationTest:test_CannotRedeemTokensWithPayloadUnknownEmitter(bytes32) (runs: 256, μ: 206356, ~: 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)
CircleIntegrationTest:test_TransferTokensWithPayload(uint256,bytes32) (runs: 256, μ: 486829, ~: 486792)
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_CannotRegisterEmitterAndDomainInvalidDomain(uint16,bytes32) (runs: 256, μ: 113714, ~: 113714)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidEmitterAddress(uint16,uint32) (runs: 256, μ: 114570, ~: 114570)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidForeignChain(bytes32,uint32) (runs: 256, μ: 187095, ~: 187095)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidLength(uint16,bytes32,uint32) (runs: 256, μ: 115297, ~: 115297)
GovernanceTest:test_CannotRegisterEmitterAndDomainInvalidTargetChain(uint16,uint16,bytes32,uint32) (runs: 256, μ: 115043, ~: 115043)
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)
GovernanceTest:test_RegisterEmitterAndDomain(uint16,bytes32,uint32) (runs: 256, μ: 238444, ~: 238444)
GovernanceTest:test_RegisterEmitterAndDomainNoTarget() (gas: 173941)
GovernanceTest:test_UpgradeContract() (gas: 2286181)
InheritingWormholeCctpTest:test_TransferUsdc(uint256,bytes32) (runs: 256, μ: 360185, ~: 360144)
MessagesTest:test_DepositWithPayloadSerde(bytes32,uint256,uint32,uint32,uint64,bytes32,bytes32,bytes) (runs: 256, μ: 7871, ~: 7706)
18 changes: 1 addition & 17 deletions evm/src/contracts/CircleIntegration/Governance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ import {IGovernance} from "src/interfaces/IGovernance.sol";

import {State} from "./State.sol";
import {
SequentialRegistration,
getRegisteredEmitters,
getChainToDomain,
getConsumedVaas,
getDomainToChain,
getSequentialRegistration
getDomainToChain
} from "./Storage.sol";

abstract contract Governance is IGovernance, State, ERC1967Upgrade {
Expand Down Expand Up @@ -64,20 +62,6 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade {
// Set the registeredEmitters state variable.
registeredEmitters[foreignChain] = foreignAddress;

// Ideally we would like to be able to update foreign emitters with governance VAAs instead
// of having to upgrade the contract to change this contract's state. But currently
// governance VAA sequence numbers and timestamps are not reliable enough to order these
// registrations. Until either value becomes reliable, we will store the timestamp in the
// sequential registration storage slot.
mapping(uint16 => SequentialRegistration) storage sequentialRegistration =
getSequentialRegistration();

// Update sequential registration. This slot may be used when governance VAA timestamps (or
// another sequential field) becomes a reliable way to order these registrations. But for
// now, we just store this info.
sequentialRegistration[foreignChain] =
SequentialRegistration({vaaTimestamp: vaa.timestamp, _gap: 0});

// update the chainId to domain (and domain to chainId) mappings
getChainToDomain()[foreignChain] = cctpDomain;
getDomainToChain()[cctpDomain] = foreignChain;
Expand Down
17 changes: 1 addition & 16 deletions evm/src/contracts/CircleIntegration/Storage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,4 @@ function getConsumedVaas() pure returns (mapping(bytes32 => bool) storage state)
assembly ("memory-safe") {
state.slot := 0x9
}
}

struct SequentialRegistration {
uint32 vaaTimestamp;
bytes28 _gap; // in case there are other fields we can use to sequence registrations
}

function getSequentialRegistration()
pure
returns (mapping(uint16 => SequentialRegistration) storage state)
{
// keccak("SequentialRegistration") - 1
assembly ("memory-safe") {
state.slot := 0x07306813d6fa63b8466c23605d190b86cd25907dd68f8c68756869f910de4f82
}
}
}

0 comments on commit f32f514

Please sign in to comment.