Uncle Fatso 2026-10-15 12:27:03 +03:00
parent 6d73358f0a
commit ef598ae702
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
5 changed files with 233 additions and 213 deletions

View File

@ -12,14 +12,14 @@ import {Weaver} from "./types/Weaver.sol";
import {FullMath} from "./libraries/FullMath.sol";
import {Verifier} from "./libraries/Verifier.sol";
import {Checkpoints} from "./libraries/Checkpoints.sol";
import {RotationPacking, RequestPacking, GovernancePacking} from "./libraries/Packing.sol";
import {GhostPacking} from "./libraries/Packing.sol";
import {ReentrancyGuard} from "@openzeppelin-contracts/utils/ReentrancyGuard.sol";
contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
using Checkpoints for Checkpoints.Trace256;
using RotationPacking for RotationPacking.RotationState;
using RequestPacking for RequestPacking.RequestPayload;
using GovernancePacking for GovernancePacking.GovernancePayload;
using GhostPacking for GhostPacking.RotationState;
using GhostPacking for GhostPacking.RequestPayload;
using GhostPacking for GhostPacking.GovernancePayload;
uint256 public constant BOUNTY_DIVISOR = type(uint32).max;
uint256 public constant EXISTENTIAL_DEPOSIT = 500 * 1e12; // 0.005
@ -71,10 +71,11 @@ contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
require(msg.sender == deployer);
// TODO: uncomment line below, needed only for testing purposes
// and should push to hardcoded exodusSession 0 always
// _deployer = address(0);
// deployer = address(0);
if (parity % 2 != 0) revert InvalidPublicKey();
// forge-lint: disable-next-line(unsafe-typecast)
uint256 packedRotationState = RotationPacking.pack(parity, uint64(exodusSession));
uint256 packedRotationState = GhostPacking.pack(parity, uint64(block.chainid), uint64(exodusSession));
_aggregatedPublicKeys.push(exodusSession, uint256(publicKey));
_packedRotationStates[publicKey] = packedRotationState;
@ -88,24 +89,30 @@ contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
return IStorageHistory(storageHistory).bridgeImbalance();
}
function latestPublicKeyInfo() external view returns (bytes32, uint8, uint64) {
function latestPublicKeyInfo() public view returns (bytes32, uint64) {
bytes32 latestPublicKey = bytes32(_aggregatedPublicKeys.latest());
uint256 packed = _packedRotationStates[latestPublicKey];
RotationPacking.RotationState memory state = RotationPacking.unpack(packed);
return (latestPublicKey, state.parity, state.session);
GhostPacking.RotationState memory state = GhostPacking.unpackRotation(packed);
if (state.parity % 2 != 0) revert InvalidPublicKey();
if (state.chainId != uint64(block.chainid)) revert WrongChainId();
return (latestPublicKey, state.session);
}
function getRotationInfoAt(uint256 exodusSession) public override view returns (bytes32, uint8, uint64) {
function getRotationInfoAt(uint256 exodusSession) public override view returns (bytes32, uint64) {
bytes32 publicKey = bytes32(_aggregatedPublicKeys.upperLookup(exodusSession));
uint256 packed = _packedRotationStates[publicKey];
RotationPacking.RotationState memory state = RotationPacking.unpack(packed);
GhostPacking.RotationState memory state = GhostPacking.unpackRotation(packed);
if (state.parity % 2 != 0) revert InvalidPublicKey();
if (state.chainId != uint64(block.chainid)) revert WrongChainId();
if (exodusSession < state.session) {
return IGatekeeper(_previousAddress).getRotationInfoAt(exodusSession);
}
return (publicKey, state.parity, state.session);
return (publicKey, state.session);
}
function getCurrentGasPrice() public view returns (uint256) {
@ -166,7 +173,7 @@ contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
) external {
if (msg.sender != address(this)) revert NotGatekeeper();
RequestPacking.RequestPayload memory payload = RequestPacking.unpack(packed);
GhostPacking.RequestPayload memory payload = GhostPacking.unpackRequest(packed);
if (payload.chainId != block.chainid) revert WrongChainId();
uint256 requestedBountyAmount = FullMath.mulDiv(amount, uint256(payload.bounty), BOUNTY_DIVISOR);
@ -191,19 +198,28 @@ contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
function rotate(
uint256 exodusSession,
bytes32 newPublicKey,
uint8 newParity
uint256 packed
) external {
if (msg.sender != address(this)) revert NotGatekeeper();
if (newParity % 2 != 0) revert InvalidPublicKey();
(bytes32 latestPublicKey, uint64 latestExodusSession) = latestPublicKeyInfo();
(bytes32 publicKeyAt,) = getRotationInfoAt(exodusSession);
if (latestPublicKey != publicKeyAt) revert HistoricalRotation();
if (exodusSession <= latestExodusSession) revert MalleableExodusSession();
GhostPacking.RotationState memory payload = GhostPacking.unpackRotation(packed);
if (payload.chainId != block.chainid) revert WrongChainId();
if (payload.parity % 2 != 0) revert InvalidPublicKey();
StorageHistory(storageHistory).trySetTransactionExecuted(exodusSession);
// forge-lint: disable-next-line(unsafe-typecast)
uint256 packedRotationState = RotationPacking.pack(newParity, uint64(exodusSession));
uint256 packedRotationState = GhostPacking.pack(payload.parity, payload.chainId, uint64(exodusSession));
_aggregatedPublicKeys.push(exodusSession, uint256(newPublicKey));
_packedRotationStates[newPublicKey] = packedRotationState;
emit Rotated(newPublicKey, newParity);
emit Rotated(newPublicKey, exodusSession, payload.parity);
}
function govern(
@ -213,7 +229,7 @@ contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
) external {
if (msg.sender != address(this)) revert NotGatekeeper();
GovernancePacking.GovernancePayload memory payload = GovernancePacking.unpack(packed);
GhostPacking.GovernancePayload memory payload = GhostPacking.unpackGovernance(packed);
if (payload.chainId != block.chainid) revert WrongChainId();
StorageHistory(storageHistory).trySetTransactionExecuted(exodusSession);
@ -229,7 +245,7 @@ contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
exodusSession := calldataload(add(call.offset, 4))
}
(bytes32 publicKey,,) = getRotationInfoAt(exodusSession);
(bytes32 publicKey,) = getRotationInfoAt(exodusSession);
return uint256(publicKey);
}

View File

@ -14,16 +14,18 @@ interface IGatekeeper {
error NonExistentAmount();
error InsufficientValue();
error ExecutionReverted();
error HistoricalRotation();
error MalleableExodusSession();
event Recalled(address indexed receiver, uint256 indexed amount);
event Rotated(bytes32 indexed aggregatedPublicKey, uint8 indexed parity);
event Rotated(bytes32 indexed aggregatedPublicKey, uint256 indexed session, uint8 parity);
event VoluntaryVerification(address indexed sender, uint256 indexed gasSpent);
function staking() external view returns (address);
function deployer() external view returns (address);
function ghostedSupply() external view returns (uint256);
function storageHistory() external view returns (address);
function getRotationInfoAt(uint256 session) external view returns (bytes32, uint8, uint64);
function getRotationInfoAt(uint256 session) external view returns (bytes32, uint64);
function ghost(bytes32 receiver, uint256 amount) external;
function initialize(address previousAddress) external;

View File

@ -1,78 +1,70 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
library RotationPacking {
library GhostPacking {
struct RotationState {
uint8 parity;
uint64 chainId;
uint64 session;
}
function pack(uint8 parity, uint64 session) internal pure returns (uint256 packed) {
// forge-lint: disable-next-line(unsafe-typecast)
return (uint256(session) << 8) | uint256(parity);
}
function pack(RotationState calldata state) internal pure returns (uint256 packed) {
return pack(state.parity, state.session);
}
function unpack(uint256 packed) internal pure returns (RotationState memory state) {
// forge-lint: disable-next-line(unsafe-typecast)
state.parity = uint8(packed & 0xFF);
state.session = uint64((packed >> 8) & 0xFFFFFFFFFFFFFFFF);
return state;
}
}
library GovernancePacking {
struct GovernancePayload {
uint64 chainId;
address target;
}
function pack(uint64 chainId, address target) internal pure returns (uint256 packed) {
// forge-lint: disable-next-line(unsafe-typecast)
return (uint256(chainId) << 192) | (uint256(uint160(target)) << 32);
}
function pack(GovernancePayload calldata data) internal pure returns (uint256 packed) {
return pack(data.chainId, data.target);
}
function unpack(uint256 packed) internal pure returns (GovernancePayload memory state) {
// forge-lint: disable-next-line(unsafe-typecast)
state.target = address(uint160(packed >> 32));
// forge-lint: disable-next-line(unsafe-typecast)
state.chainId = uint64(packed >> 192);
return state;
}
}
library RequestPacking {
struct RequestPayload {
uint32 bounty;
uint64 chainId;
address receiver;
}
function pack(uint8 parity, uint64 chainId, uint64 session) internal pure returns (uint256 packed) {
packed = (uint256(parity) << 248) | (uint256(chainId) << 184) | (uint256(session) << 120);
}
function pack(RotationState calldata state) internal pure returns (uint256 packed) {
packed = pack(state.parity, state.chainId, state.session);
}
function unpackRotation(uint256 packed) internal pure returns (RotationState memory state) {
// forge-lint: disable-next-line(unsafe-typecast)
state.parity = uint8(packed >> 248);
// forge-lint: disable-next-line(unsafe-typecast)
state.chainId = uint64((packed >> 184) & 0xFFFFFFFFFFFFFFFF);
// forge-lint: disable-next-line(unsafe-typecast)
state.session = uint64((packed >> 120) & 0xFFFFFFFFFFFFFFFF);
}
function pack(uint64 chainId, address target) internal pure returns (uint256 packed) {
packed = (uint256(chainId) << 192) | (uint256(uint160(target)) << 32);
}
function pack(GovernancePayload calldata data) internal pure returns (uint256 packed) {
packed = pack(data.chainId, data.target);
}
function unpackGovernance(uint256 packed) internal pure returns (GovernancePayload memory state) {
// forge-lint: disable-next-line(unsafe-typecast)
state.target = address(uint160(packed >> 32));
// forge-lint: disable-next-line(unsafe-typecast)
state.chainId = uint64(packed >> 192);
}
function pack(uint32 bounty, uint64 chainId, address receiver) internal pure returns (uint256 packed) {
packed = uint256(uint160(receiver)) << 96;
packed |= uint256(chainId) << 32;
packed |= uint256(bounty);
return packed;
packed = (uint256(uint160(receiver)) << 96) | (uint256(chainId) << 32) | uint256(bounty);
}
function pack(RequestPayload calldata data) internal pure returns (uint256 packed) {
return pack(data.bounty, data.chainId, data.receiver);
packed = pack(data.bounty, data.chainId, data.receiver);
}
function unpack(uint256 packed) internal pure returns (RequestPayload memory data) {
// forge-lint: disable-next-line(unsafe-typecast)
data.bounty = uint32(packed & 0xFFFFFFFF);
// forge-lint: disable-next-line(unsafe-typecast)
data.chainId = uint64((packed >> 32) & 0xFFFFFFFFFFFFFFFF);
// forge-lint: disable-next-line(unsafe-typecast)
data.receiver = address(uint160(packed >> 96));
return data;
function unpackRequest(uint256 packed) internal pure returns (RequestPayload memory state) {
// forge-lint: disable-next-line(unsafe-typecast)
state.bounty = uint32(packed & 0xFFFFFFFF);
// forge-lint: disable-next-line(unsafe-typecast)
state.chainId = uint64((packed >> 32) & 0xFFFFFFFFFFFFFFFF);
// forge-lint: disable-next-line(unsafe-typecast)
state.receiver = address(uint160(packed >> 96));
}
}

View File

@ -4,7 +4,7 @@ import {Test} from "forge-std/Test.sol";
import {Gatekeeper} from "../../src/Gatekeeper.sol";
import {FullMath} from "../../src/libraries/FullMath.sol";
import {RequestPacking} from "../../src/libraries/Packing.sol";
import {GhostPacking} from "../../src/libraries/Packing.sol";
import {IStorageHistory} from "../../src/interfaces/IStorageHistory.sol";
import {StorageHistory} from "../../src/types/StorageHistory.sol";
import {WETH9} from "../../src/mocks/WETH9.sol";
@ -193,7 +193,7 @@ contract MockStaking is Test {
}
contract GatekeeperTest is Test {
using RequestPacking for RequestPacking.RequestPayload;
using GhostPacking for GhostPacking.RequestPayload;
address constant ALICE = 0x0000000000000000000000000000000000000001;
address constant BOB = 0x0000000000000000000000000000000000000002;
@ -259,7 +259,7 @@ contract GatekeeperTest is Test {
address storageHistory = gatekeeper.storageHistory();
uint256 commissionAmount = FullMath.mulDiv(bobAmount, uint256(bobCommission), type(uint32).max);
uint256 bobPacked = RequestPacking.pack(uint32(bobCommission), uint64(block.chainid), BOB);
uint256 bobPacked = GhostPacking.pack(uint32(bobCommission), uint64(block.chainid), BOB);
vm.prank(ALICE);
staking.runGhost(bytes32(abi.encodePacked(ALICE)), bobAmount);
@ -275,22 +275,28 @@ contract GatekeeperTest is Test {
assert(IStorageHistory(storageHistory).isTransactionExecuted(exodusSession));
}
function test_rotateWork() public {
function test_rotationWorks() public {
vm.warp(block.timestamp + 1);
vm.prank(address(gatekeeper));
gatekeeper.rotate(block.timestamp, 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798, 0);
vm.prank(ALICE);
gatekeeper.updatePublicKeyMetadata(block.timestamp, 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798, 0);
vm.warp(block.timestamp + 1);
// forge-lint: disable-next-line(unsafe-typecast)
uint256 packed = GhostPacking.pack(uint8(0), uint64(block.chainid), uint64(1));
vm.prank(address(gatekeeper));
gatekeeper.rotate(block.timestamp, 0xF9308A019258C31049344F85F89D5229B531C845836F99B08601F113BCE036F9, 0);
gatekeeper.rotate(block.timestamp, 0xF9308A019258C31049344F85F89D5229B531C845836F99B08601F113BCE036F9, packed);
vm.warp(block.timestamp + 1);
// forge-lint: disable-next-line(unsafe-typecast)
packed = GhostPacking.pack(uint8(0), uint64(block.chainid), uint64(2));
vm.prank(address(gatekeeper));
gatekeeper.rotate(block.timestamp, 0x3590A94E768F8E1815C2F24B4D80A8E3149316C3518CE7B7AD338368D038CA66, 0);
gatekeeper.rotate(block.timestamp, 0x3590A94E768F8E1815C2F24B4D80A8E3149316C3518CE7B7AD338368D038CA66, packed);
vm.warp(block.timestamp + 1);
// forge-lint: disable-next-line(unsafe-typecast)
packed = GhostPacking.pack(uint8(0), uint64(block.chainid), uint64(3));
vm.prank(address(gatekeeper));
gatekeeper.rotate(block.timestamp, 0xD4E0D4642DB1613B2C94A81FCD34E39A2A31ACD774CD42525A88CF69EBA2E611, 0);
gatekeeper.rotate(block.timestamp, 0xD4E0D4642DB1613B2C94A81FCD34E39A2A31ACD774CD42525A88CF69EBA2E611, packed);
}
function test_couldNotBridgeBelowExistential(uint256 amount) public {
@ -311,73 +317,79 @@ contract GatekeeperTest is Test {
staking.runGhost(bytes32(abi.encodePacked(ALICE)), type(uint104).max);
vm.prank(ALICE);
gatekeeper.updatePublicKeyMetadata(0, 0x36ff5b7f0fc50100b563c6072e499980d6e6aa8528ea0ae6d776cf7e8e96c374, 0);
gatekeeper.updatePublicKeyMetadata(0, 0xa55edb24891a8f92cce26d5ab8e359e6ef6ae36d41e0869676d7020e6135e12b, 0);
(bytes32 prevPublicKey, uint8 prevParity,) = gatekeeper.latestPublicKeyInfo();
(bytes32 prevPublicKey,) = gatekeeper.latestPublicKeyInfo();
// genesis validators 4 validators, DKG #0
// exodus session #0
gatekeeper.verify(
hex"49f03a67000000000000000000000000000000000000000000000000000000000000000036ff5b7f0fc50100b563c6072e499980d6e6aa8528ea0ae6d776cf7e8e96c3740000000000000000000000000000000000000000000000000000000000000000",
0x58a4ef4e4f9cad19e9bb3707a48f01920ba309f69892609b196bbc112b6aebea,
0x2de1a8116c65a290c51fee3bac24546c09522423640ae0e38f45791b1d81a069
);
(bytes32 publicKey, uint8 parity, uint64 session) = gatekeeper.latestPublicKeyInfo();
assertEq(publicKey, prevPublicKey);
assertEq(parity, prevParity);
assertEq(session, 0);
// could not apply signature from DKG #2
// DKG #1 <==> Context ExodusContext { session: 1, network_id: 420 }
vm.expectRevert();
gatekeeper.verify(
hex"49f03a6700000000000000000000000000000000000000000000000000000000000000135353a4ce3430b37cabb7c495aabfec94895183672738873f4b227bf4ce31fbe50000000000000000000000000000000000000000000000000000000000000000",
0xd1e4b50b4ff3e9b98ce17b375d6007cf0cf9d65e795cbe682609c1343361a81c,
0x0cdd6c13658d862e7f816c59ad9cb1b6f5b3b981f019e698f27d1a354dc69cd5
hex"e9d50bc10000000000000000000000000000000000000000000000000000000000000001a55edb24891a8f92cce26d5ab8e359e6ef6ae36d41e0869676d7020e6135e12b0000000000000001a40000000000000000000000000000000000000000000000",
0x75414a03277a1c46a19be98841e92e13156296592422fd648d7a11f8fa6e56ac,
0xe1f442c13e62f0af437bf693a8d7098e38545cff6002c941f89eee31f8f170f4
);
// genesis validators 7 validators, DKG #1
// exodus session #11
// DKG 2 <==> Context ExodusContext { session: 2, network_id: 420 }
vm.expectRevert();
gatekeeper.verify(
hex"49f03a67000000000000000000000000000000000000000000000000000000000000000bb5cd0d028a5e1b6a4eecb113b7e49c8176385eb77c8f134bc1db4bddd7654de60000000000000000000000000000000000000000000000000000000000000000",
0x993fc0c870e1010f4933cbdb17b4539aea07234ff787eb3185d03ef8c0d2787e,
0x4bfe369753a3125a37d13db08ea9125fe2280b70aa47e5890bf9401c785bdb92
hex"e9d50bc10000000000000000000000000000000000000000000000000000000000000002ee504738d924ff901dcee6e762b2c17ac0362a62471d5a942e1eb1eb363e91360000000000000001a40000000000000000000000000000000000000000000000",
0x86890fa31f0564aad657a58bccbe8ce226d6834154d9434bbee2a69142980348,
0xad5ec4d13c6f670050df3a2e28957cec23c376f7127248f700b663177942eab8
);
(publicKey, parity, session) = gatekeeper.latestPublicKeyInfo();
assert(publicKey != prevPublicKey);
assertEq(parity, prevParity);
assertEq(session, 11);
// DKG 3 <==> Context ExodusContext { session: 18, network_id: 31337 }
vm.expectRevert();
gatekeeper.verify(
hex"e9d50bc1000000000000000000000000000000000000000000000000000000000000001253e8a1afb125e0633c84099e04e4732af1d91eb1cd84da9c5ed1f0005bb375b6000000000000007a690000000000000000000000000000000000000000000000",
0x3a4dc265fe4e7c6915ac9b717a9f11c9179d16b00d0c43a8e52bd4eecb4d7a9b,
0x4cc8152116c4a6fe96b01a7ab20289dc3cf75c1c1529ede794a0f56476c77c7e
);
// Bridge Out - amount: 210; commission: 50%; BOB
// DKG 3 <==> Context ExodusContext { session: 11, network_id: 31337 }
vm.expectRevert();
gatekeeper.verify(
hex"bf06188a000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000020000000000007a6980000000",
0xde80d861004bfa78c9a0605a4ad7ad78683cc79d98852e500100fb36e951da1c,
0x2708c643a2a436e10809cfd7d75e38d1d352b35970fe4eca306946fec0c457ec
);
// DKG 2 <==> Context ExodusContext { session: 10, network_id: 31337 }
gatekeeper.verify(
hex"e9d50bc1000000000000000000000000000000000000000000000000000000000000000aee504738d924ff901dcee6e762b2c17ac0362a62471d5a942e1eb1eb363e9136000000000000007a690000000000000000000000000000000000000000000000",
0xa94b3c3959bd94741cb93604293406cbce4e209a7c1dfd75ad22ea87878e15ca,
0xc4a83a7cd52ac5b9a7b9f698bd48726edbbe8741e110444502d7ce062236ee04
);
(bytes32 publicKey, uint64 session) = gatekeeper.latestPublicKeyInfo();
assertTrue(publicKey != prevPublicKey);
assertEq(session, 10);
prevPublicKey = publicKey;
prevParity = parity;
// genesis validators 5 validators, DKG #2
// exodus session #19
// DKG 3 <==> Context ExodusContext { session: 18, network_id: 31337 }
gatekeeper.verify(
hex"49f03a6700000000000000000000000000000000000000000000000000000000000000135353a4ce3430b37cabb7c495aabfec94895183672738873f4b227bf4ce31fbe50000000000000000000000000000000000000000000000000000000000000000",
0xd1e4b50b4ff3e9b98ce17b375d6007cf0cf9d65e795cbe682609c1343361a81c,
0x0cdd6c13658d862e7f816c59ad9cb1b6f5b3b981f019e698f27d1a354dc69cd5
hex"e9d50bc1000000000000000000000000000000000000000000000000000000000000001253e8a1afb125e0633c84099e04e4732af1d91eb1cd84da9c5ed1f0005bb375b6000000000000007a690000000000000000000000000000000000000000000000",
0x3a4dc265fe4e7c6915ac9b717a9f11c9179d16b00d0c43a8e52bd4eecb4d7a9b,
0x4cc8152116c4a6fe96b01a7ab20289dc3cf75c1c1529ede794a0f56476c77c7e
);
(publicKey, parity, session) = gatekeeper.latestPublicKeyInfo();
assert(publicKey != prevPublicKey);
assertEq(parity, prevParity);
assertEq(session, 19);
(publicKey, session) = gatekeeper.latestPublicKeyInfo();
assertTrue(publicKey != prevPublicKey);
assertEq(session, 18);
uint256 aliceAmountBefore = staking.recalledAmount(ALICE);
uint256 bobAmountBefore = staking.recalledAmount(BOB);
uint256 aliceBalanceBefore = ALICE.balance;
uint256 bobBalanceBefore = BOB.balance;
// execute bridge out, happened on DKG #1
// amount: 34; commission: 0%; ALICE
// exodus session #1
// Bridge Out - amount: 34; commission: 0%; ALICE
// DKG 2 <==> Context ExodusContext { session: 0, network_id: 31337 }
vm.prank(ALICE, ALICE);
gatekeeper.verify(
hex"bf06188a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000010000000000007a6900000000",
0x74e1ee0256e3a1f6c38744fff8d72ffb905d660679e69c76b0af2e75db9fbfcc,
0x4c512ab429d8c38a199daaa7f2c3d74956d2ff435871b160946b69804a1e5d54
hex"bf06188a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000010000000000007a6900000000",
0x8025f985dd8c7507a7451a1055435870ce798df3d122e8d03735efa192691550,
0xb749bb2e5df5477eab850816a19786e6fa653c3d4402cee036fe1e506dad26dc
);
assertEq(aliceAmountBefore + 34, staking.recalledAmount(ALICE));
@ -385,150 +397,148 @@ contract GatekeeperTest is Test {
assertEq(aliceBalanceBefore, ALICE.balance);
assertEq(bobBalanceBefore, BOB.balance);
vm.deal(ALICE, 220);
aliceAmountBefore = staking.recalledAmount(ALICE);
bobAmountBefore = staking.recalledAmount(BOB);
aliceBalanceBefore = ALICE.balance;
bobBalanceBefore = BOB.balance;
// execute bridge out, happened on DKG #2
// amount: 210; commission: 50%; BOB
// exodus session #12
// Bridge Out - amount: 210; commission: 50%; BOB
// DKG 3 <==> Context ExodusContext { session: 11, network_id: 31337 }
vm.prank(ALICE, ALICE);
gatekeeper.verify(
hex"bf06188a000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000020000000000007a6980000000",
0x99c5f02bf312fc6b1a125b83397aa87df369738f85275bc42d249660abb1f0e1,
0x8326ee3fc1cbb1421e2c974d6cc7cb2bfdc9c4f6ebfd403363f6b3a3bc8e9bef
hex"bf06188a000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000020000000000007a6980000000",
0xde80d861004bfa78c9a0605a4ad7ad78683cc79d98852e500100fb36e951da1c,
0x2708c643a2a436e10809cfd7d75e38d1d352b35970fe4eca306946fec0c457ec
);
assertApproxEqAbs(aliceAmountBefore + 105, staking.recalledAmount(ALICE), 1);
assertApproxEqAbs(bobAmountBefore + 105, staking.recalledAmount(BOB), 1);
// execute setDistributor, exodusSession: 2
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::Close { id: 420 } }
// DKG 2 <==> Context ExodusContext { session: 8, network_id: 31337 }
gatekeeper.verify(
hex"3137142600000000000000000000000000000000000000000000000000000000000000020000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002475619ab5000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
0x45a9889cb48e0eca44c3add96dc68d6ab728c1a7e4eab14323f0dcfe67472c1f,
0x40e6980e96efc0fc6acf47aa0cd665bc5d85a01b909fc4d960948c76f45723b4
hex"3137142600000000000000000000000000000000000000000000000000000000000000080000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000240aebeb4e00000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
0xb23927f82a762b2c70e40c5b834196f04b0b716d1f94073d9709c983364c34af,
0x7051c41a28436c8b8454fc57aec4a808761a3d996a24eab9e9b225c552737435
);
// execute setWarmupPeriod, exodusSession: 3
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::RemovePool { index: 1337 } }
// DKG 2 <==> Context ExodusContext { session: 7, network_id: 31337 }
gatekeeper.verify(
hex"3137142600000000000000000000000000000000000000000000000000000000000000030000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024a85667c5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000",
0x356ef46cfd654b0b609bdff33147df25c20ff9ca7ac3334c57f12e99b6248112,
0xa6363286f97c02a39aa5280d74f8dc02dabd078911eef60e4848b7d5deeb325b
hex"3137142600000000000000000000000000000000000000000000000000000000000000070000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024a38dcbd0000000000000000000000000000000000000000000000000000000000000053900000000000000000000000000000000000000000000000000000000",
0xbfd1fe06886518072eed46b325a6c74b574879294fd0d4c924ee670645d22324,
0x35498be823e5bf6a14e0172229359bf73d26153e94262bd9a51650eb825a99ad
);
// execute setBounty, exodusSession: 4
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::Create { market: [69, 420, 1337, 0], terms: [420, 1337], token: 0x0101010101010101010101010101010101010101, intervals: [34, 35], booleans: [true, true] } }
// DKG 2 <==> Context ExodusContext { session: 9, network_id: 31337 }
gatekeeper.verify(
hex"3137142600000000000000000000000000000000000000000000000000000000000000040000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000245d87d363000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000",
0xe6a419a5314afed1ff25df0cbf76f2002bfa9d7746817670f2487be5d7774118,
0x7ce4c7207efdfdb9c71b26c7dd071572544fb27a329b348379d70b2e7a5f21fc
hex"3137142600000000000000000000000000000000000000000000000000000000000000090000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000164206eb0f8000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000001a40000000000000000000000000000000000000000000000000000000000000539000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000000005390000000000000000000000000101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
0x222edcb18d541d904861c9097f8dbfe24d5816b2a71246240033a8e794a6eec6,
0xbc19a2d8be0b79219acc98529846e9427bb48a39110b8d0acb396abb015796e0
);
// execute setAdjustment, exodusSession: 5
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::SetDistributor { distributor: 0x0101010101010101010101010101010101010101 } }
// DKG 2 <==> Context ExodusContext { session: 1, network_id: 31337 }
gatekeeper.verify(
hex"3137142600000000000000000000000000000000000000000000000000000000000000050000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006446d36ab5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
0x649a51e565d154f549e24aaf400ed9a2bb8812ed87eeac36372f36ac8cd6aa34,
0xc9decb2fa41d9217f9a609d568f86bf92b66d6a91ed3c34031025d3845e34b09
hex"3137142600000000000000000000000000000000000000000000000000000000000000010000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002475619ab5000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
0xecd3afac10a3845f8f7a60a530531d0af7b94288f4894fc60bef233e11f5f60c,
0x75b8a70d0a5cecbb1da45d87bae698dcb4cfa923051dfc3d5661a1d3a3d278de
);
// execute updateGatekeeperAddress, exodusSession: 6
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::AddPool { address: 0x0101010101010101010101010101010101010101 } }
// DKG 2 <==> Context ExodusContext { session: 6, network_id: 31337 }
gatekeeper.verify(
hex"3137142600000000000000000000000000000000000000000000000000000000000000060000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002484f157cd000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
0xb445285e36eb120a47bd995ce7ecc07f73bf1ec99b5024ef14e87aa1bffd8b39,
0x8f7241cd388505b0f964dd54243c968559ba603400ee71dea0738a9084f5cf50
hex"3137142600000000000000000000000000000000000000000000000000000000000000060000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024d914cd4b000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
0x1deec2e18132e321cf3df76880bbd5bf37ba0c6cb7ce3a78fa24fb443dd89e9e,
0x7266cccb8f15c651a016892dc647b1e4ee2bac9261095019c12b2a52e6f40cd8
);
// execute addPool, exodusSession: 7
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::UpdateGatekeeperAddress { new_gatekeeper: 0x0101010101010101010101010101010101010101 } }
// DKG 2 <==> Context ExodusContext { session: 5, network_id: 31337 }
gatekeeper.verify(
hex"3137142600000000000000000000000000000000000000000000000000000000000000070000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024d914cd4b000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
0x83cdbf2cee6f13d60c2261feed4d0643e847cfba6af316722538281c9cb433c8,
0xdd0c8c1d6d154c951a4171ff9a40084afbfe5f7b3c70c0521e5b6605310e77cb
hex"3137142600000000000000000000000000000000000000000000000000000000000000050000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002484f157cd000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
0x650efb1c28a67fcd7a09cd677ee48d29d96ad02baea8d5749faa011c6d20865f,
0xc577b059b0e85879a60b5da621a908da2cc4851f0cf82cf0a000b4149ce91574
);
// execute removePool, exodusSession: 8
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::SetWarmupPeriod { warmup_period: 69 } }
// DKG 2 <==> Context ExodusContext { session: 2, network_id: 31337 }
gatekeeper.verify(
hex"3137142600000000000000000000000000000000000000000000000000000000000000080000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024a38dcbd0000000000000000000000000000000000000000000000000000000000000053900000000000000000000000000000000000000000000000000000000",
0x622a8a5d57b10682a90e1b92f797375a6bcbb78f30c45877ea570091af1b2831,
0xd72cd8354a7be788b801e19994a8155f3938ef58005095b398bc96cd2dc77166
hex"3137142600000000000000000000000000000000000000000000000000000000000000020000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024a85667c5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000",
0x887b1f90a0b71f75bb1f32d90d64c789d398b884b481257daa108fe8175a6024,
0xd9e041cc4865ef88462efc7332f8e7d9be45a7d1d7f3f6aef31fb84489d31557
);
// execute close, exodusSession: 9
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::SetAdjustment { rate: 69, target: 420, add: true } }
// DKG 2 <==> Context ExodusContext { session: 4, network_id: 31337 }
gatekeeper.verify(
hex"3137142600000000000000000000000000000000000000000000000000000000000000090000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000240aebeb4e00000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
0x0ad9c560affebaea5c589fe831033bac2d9c828aacf58559bbf5b2d00f7842b2,
0x10121ffe0cc95cf3cbb4e92d72d61feec3e94045185cd7f3c5ce0d01e3a644ea
hex"3137142600000000000000000000000000000000000000000000000000000000000000040000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006446d36ab5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
0xc6b5e25e62284b97b9d2fba27e09a49bf99f6abc02316f9d4d66597edef89405,
0x95eacaa6e613e5fe42b65f5f6a04f6e5f5f327d232072ac21e15b513142d2e48
);
// execute create, exodusSession: 10
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::SetBounty { bounty: 69 } }
// DKG 2 <==> Context ExodusContext { session: 3, network_id: 31337 }
gatekeeper.verify(
hex"31371426000000000000000000000000000000000000000000000000000000000000000a0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000164206eb0f8000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000001a40000000000000000000000000000000000000000000000000000000000000539000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000000005390000000000000000000000000101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
0x18c5c0b98ac8221b75b1f7bf3e36fc0d820d5866b23010f4861d8602066f93b0,
0x45db6a091ddc9d19156c6d2f1d3aca7541733faeebdeed7b8572192d050e4e06
hex"3137142600000000000000000000000000000000000000000000000000000000000000030000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000245d87d363000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000",
0xe9d1462dd8e8e80a3b8007628575179e92c249cd7684a1d28c0313a48f8558af,
0x7a33389110ad43d6b51b8fb5d3e5ffbce9d37ce6986e75bab43ca49707012512
);
// execute enable, exodusSession: 13
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::ForfeitReserves { router: 0x0101010101010101010101010101010101010101, liquidity: 420, destroyer_mode: true } }
// DKG 3 <==> Context ExodusContext { session: 14, network_id: 31337 }
gatekeeper.verify(
hex"31371426000000000000000000000000000000000000000000000000000000000000000d0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064e4e33ef800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000101010101010101010101010101010101010101000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
0x0716f763060cfd52339544a203d0e156a42370b0e22d78ea9bf8766b0b66682b,
0xc2da93948f869c5102992bd1cbd70ef5f821ff522305c69d113faf2e89570ce7
hex"31371426000000000000000000000000000000000000000000000000000000000000000e0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064f0de236c000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
0x139c9a2b23abfcc1e844b40e1c0b69c033d591f081e895fbcb597974d9fa1323,
0x940773c75fddc4ff70ce13ea46521ad4f788322a4c40ed6e94490510ecd0b971
);
// execute disable, exodusSession: 14
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::RedeemReserves { router: 0x0101010101010101010101010101010101010101, amount: 420 } }
// DKG 3 <==> Context ExodusContext { session: 15, network_id: 31337 }
gatekeeper.verify(
hex"31371426000000000000000000000000000000000000000000000000000000000000000e0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044529918310000000000000000000000000000000000000000000000000000000000000003000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
0x7ed91b176c29b73a077e51de0c2a12f6df5e7e04862eb07f9c393f6fc1cd3a8f,
0x798563362adaade33f39266bb3fa233ac9161ca55d532ca65d5b6d4d0f1edbd2
hex"31371426000000000000000000000000000000000000000000000000000000000000000f0000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004482a21577000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
0xcec7a9d8fa39e27fe4f33968741676d5ae948b8f2e42783e92850f10a90bb748,
0xefb7605b627cbfc46f459642be156391d79e37e03ccb510d0d1eb3e5a325bc22
);
// execute forfeitReserves, exodusSession: 15
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::Disable { status: GovernanceStatus::LiquidityToken, address: 0x0101010101010101010101010101010101010101 } }
// DKG 3 <==> Context ExodusContext { session: 13, network_id: 31337 }
gatekeeper.verify(
hex"31371426000000000000000000000000000000000000000000000000000000000000000f0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064f0de236c000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
0x7f90802deb959f3bea4aa2cda26dad5ec601fc6e45dcd941a19ee9ff57e3f571,
0xf61bb645ce15a7e4d0a693e0e4defe1f58fa1b113818a083b582fce05ec728f5
hex"31371426000000000000000000000000000000000000000000000000000000000000000d0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044529918310000000000000000000000000000000000000000000000000000000000000003000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
0x86fdb0bf333d8c7a539da71dbdd8fe4112b4c5766060177215c5cf30caa36350,
0x2c5c721d036cc7017df36e79159b35de07289672c4b0e0731cccc752097a92d1
);
// execute redeemReserve, exodusSession: 16
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::Enable { status: GovernanceStatus::ReserveToken, address: 0x0101010101010101010101010101010101010101, calculator: 0x0101010101010101010101010101010101010101 } }
// DKG 3 <==> Context ExodusContext { session: 12, network_id: 31337 }
gatekeeper.verify(
hex"3137142600000000000000000000000000000000000000000000000000000000000000100000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004482a21577000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
0x197fd53cb6c9c89e8689419c2ea745233487ba7666f896a2469fc5269c785160,
0x79480d2dfee9c8dcdc2a28a22b3d49ed193c912390c0be655253028fd8ca883d
hex"31371426000000000000000000000000000000000000000000000000000000000000000c0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064e4e33ef800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000101010101010101010101010101010101010101000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
0xe35f59fd65e5b1e1d6402801b1b549bd331425252c35647102b7380f81260c01,
0x9015326c5ced82020c66066479ecb108f243f1439d1d51fd49b3b1cad0cdb179
);
// execute withdraw, exodusSession: 17
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::AuditReserves }
// DKG 3 <==> Context ExodusContext { session: 17, network_id: 31337 }
gatekeeper.verify(
hex"3137142600000000000000000000000000000000000000000000000000000000000000110000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044f3fef3a3000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
0x53a249b4952662c3a86a810cff1e530ba354761e4091dee9a8997279160b017b,
0x8042a9b2521d07612ef0fdccaa98ce9561914b20bf75af49310fc36c240073c7
hex"3137142600000000000000000000000000000000000000000000000000000000000000110000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000042b7ce50000000000000000000000000000000000000000000000000000000000",
0x2be51afcc627038389309a5b4b74ab70fe01b0ee9e1b75d0ce91120c36d2b081,
0x3dc918d435a6ba882ab66d78d853d83d70f582bdfd1aac028b4b75ffefe277cc
);
// execute auditReserves, exodusSession: 18
vm.prank(ALICE);
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::Withdraw { token: 0x0101010101010101010101010101010101010101, amount: 420 } }
// DKG 3 <==> Context ExodusContext { session: 16, network_id: 31337 }
gatekeeper.verify(
hex"3137142600000000000000000000000000000000000000000000000000000000000000120000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000042b7ce50000000000000000000000000000000000000000000000000000000000",
0xf1f4d62d27c3d0388b2298b621b23cd5791e1b97d4423ffc16b14e81ff0df97c,
0xdbeed3eb94a829710147595c1b10f2ac6ec761c9721d8cc4711842c212ac517e
hex"3137142600000000000000000000000000000000000000000000000000000000000000100000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044f3fef3a3000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
0xd9a91f2185c7f5055ca90461b4ad27c1a06aa2979e3a7f78f41affedd7172faf,
0x4dcf0a720128e2a9952aecc33717e7fe4de0a4b0c8605e2830593c27e9c03daa
);
address storageHistory = gatekeeper.storageHistory();
for (uint256 exodusSession; exodusSession < 19; exodusSession++) {
assert(IStorageHistory(storageHistory).isTransactionExecuted(exodusSession));
}
assert(IStorageHistory(storageHistory).isTransactionExecuted(19));
assert(!IStorageHistory(storageHistory).isTransactionExecuted(20));
}
}

View File

@ -5,7 +5,7 @@ import {Test} from "forge-std/Test.sol";
import {Gatekeeper} from "../../src/Gatekeeper.sol";
import {IStorageHistory} from "../../src/interfaces/IStorageHistory.sol";
import {IGatekeeper} from "../../src/interfaces/IGatekeeper.sol";
import {RequestPacking} from "../../src/libraries/Packing.sol";
import {GhostPacking} from "../../src/libraries/Packing.sol";
import {StorageHistory} from "../../src/types/StorageHistory.sol";
import {WETH9} from "../../src/mocks/WETH9.sol";
@ -66,7 +66,7 @@ contract MockStaking is Test {
}
contract GatekeeperStorageHistoryTest is Test {
using RequestPacking for RequestPacking.RequestPayload;
using GhostPacking for GhostPacking.RequestPayload;
address constant ALICE = 0x0000000000000000000000000000000000000001;
address constant BOB = 0x0000000000000000000000000000000000000002;
@ -122,7 +122,7 @@ contract GatekeeperStorageHistoryTest is Test {
amountIn += uint104(amountToGhost);
} else {
// forge-lint: disable-next-line(unsafe-typecast)
uint256 packed = RequestPacking.pack(0, uint64(block.chainid), BOB);
uint256 packed = GhostPacking.pack(0, uint64(block.chainid), BOB);
uint256 previousAmount = staking.recalledAmounts(BOB);
staking.runRecall(exodusSession, amountToMaterialize, packed);
@ -140,7 +140,7 @@ contract GatekeeperStorageHistoryTest is Test {
function test_inheritanceWorksForHistoricalStorge() public {
uint256 exodusSession = 69;
uint256 packed = RequestPacking.pack(0, uint64(block.chainid), BOB);
uint256 packed = GhostPacking.pack(0, uint64(block.chainid), BOB);
staking.runRecall(exodusSession, INIT_AMOUNT, packed);
staking.runGhost(bytes32(abi.encodePacked(ALICE)), INIT_AMOUNT);