update rotation logic according to LCG & Knuth Multipicative Method & Bitmask trick
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
12a3420657
commit
6ef9244025
@ -17,7 +17,7 @@ import {ReentrancyGuard} from "@openzeppelin-contracts/utils/ReentrancyGuard.sol
|
||||
|
||||
contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
|
||||
using Checkpoints for Checkpoints.Trace256;
|
||||
using GhostPacking for GhostPacking.RotationState;
|
||||
using GhostPacking for GhostPacking.RotationBits;
|
||||
using GhostPacking for GhostPacking.RequestPayload;
|
||||
using GhostPacking for GhostPacking.GovernancePayload;
|
||||
|
||||
@ -38,7 +38,7 @@ contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
|
||||
bool private _initialized;
|
||||
|
||||
Checkpoints.Trace256 private _aggregatedPublicKeys;
|
||||
mapping(bytes32 => uint256) private _packedRotationStates;
|
||||
mapping(bytes32 => uint256) private _exodusSessions;
|
||||
|
||||
constructor(address _storageHistory, address _staking) {
|
||||
storageHistory = _storageHistory;
|
||||
@ -71,18 +71,15 @@ contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
function updatePublicKeyMetadata(uint256 exodusSession, bytes32 publicKey, uint8 parity) external {
|
||||
function updatePublicKeyMetadata(uint256 exodusSession, bytes32 publicKey) external {
|
||||
require(msg.sender == deployer);
|
||||
// TODO: uncomment line below, needed only for testing purposes
|
||||
// and should push to hardcoded exodusSession 0 always
|
||||
// deployer = address(0);
|
||||
|
||||
if (parity % 2 != 0) revert InvalidPublicKey();
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
uint256 packedRotationState = GhostPacking.pack(parity, uint64(block.chainid), uint64(exodusSession));
|
||||
|
||||
StorageHistory(storageHistory).trySetTransactionExecuted(exodusSession);
|
||||
_aggregatedPublicKeys.push(exodusSession, uint256(publicKey));
|
||||
_packedRotationStates[publicKey] = packedRotationState;
|
||||
_exodusSessions[publicKey] = exodusSession;
|
||||
}
|
||||
|
||||
function previousAddress() external override view returns (address) {
|
||||
@ -93,30 +90,21 @@ contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
|
||||
return IStorageHistory(storageHistory).bridgeImbalance();
|
||||
}
|
||||
|
||||
function latestPublicKeyInfo() public view returns (bytes32, uint64) {
|
||||
function latestPublicKeyInfo() public view returns (bytes32, uint256) {
|
||||
bytes32 latestPublicKey = bytes32(_aggregatedPublicKeys.latest());
|
||||
uint256 packed = _packedRotationStates[latestPublicKey];
|
||||
|
||||
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);
|
||||
uint256 exodusSession = _exodusSessions[latestPublicKey];
|
||||
return (latestPublicKey, exodusSession);
|
||||
}
|
||||
|
||||
function getRotationInfoAt(uint256 exodusSession) public override view returns (bytes32, uint64) {
|
||||
bytes32 publicKey = bytes32(_aggregatedPublicKeys.upperLookup(exodusSession));
|
||||
uint256 packed = _packedRotationStates[publicKey];
|
||||
function getRotationInfoAt(uint256 atExodusSession) public override view returns (bytes32, uint256) {
|
||||
bytes32 publicKey = bytes32(_aggregatedPublicKeys.upperLookup(atExodusSession));
|
||||
uint256 exodusSession = _exodusSessions[publicKey];
|
||||
|
||||
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);
|
||||
if (atExodusSession < exodusSession) {
|
||||
return IGatekeeper(_previousAddress).getRotationInfoAt(atExodusSession);
|
||||
}
|
||||
|
||||
return (publicKey, state.session);
|
||||
return (publicKey, exodusSession);
|
||||
}
|
||||
|
||||
function getCurrentGasPrice() public view returns (uint256) {
|
||||
@ -200,30 +188,29 @@ contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
|
||||
}
|
||||
|
||||
function rotate(
|
||||
uint256 exodusSession,
|
||||
uint256 commonExodusSession,
|
||||
bytes32 newPublicKey,
|
||||
uint256 packed
|
||||
uint256 packedBits,
|
||||
bytes calldata sessions
|
||||
) external {
|
||||
if (msg.sender != address(this)) revert NotGatekeeper();
|
||||
|
||||
(bytes32 latestPublicKey, uint64 latestExodusSession) = latestPublicKeyInfo();
|
||||
(bytes32 publicKeyAt,) = getRotationInfoAt(exodusSession);
|
||||
(bytes32 latestPublicKey, uint256 latestExodusSession) = latestPublicKeyInfo();
|
||||
(bytes32 publicKeyAt,) = getRotationInfoAt(commonExodusSession);
|
||||
|
||||
if (commonExodusSession <= latestExodusSession) revert MalleableExodusSession();
|
||||
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 = GhostPacking.pack(payload.parity, payload.chainId, uint64(exodusSession));
|
||||
uint256 exodusSession = _extractExodusSession(packedBits, sessions);
|
||||
if (exodusSession > 0) {
|
||||
if (exodusSession <= latestExodusSession) revert MalleableExodusSession();
|
||||
StorageHistory(storageHistory).trySetTransactionExecuted(exodusSession);
|
||||
}
|
||||
|
||||
_aggregatedPublicKeys.push(exodusSession, uint256(newPublicKey));
|
||||
_packedRotationStates[newPublicKey] = packedRotationState;
|
||||
_exodusSessions[newPublicKey] = exodusSession;
|
||||
|
||||
emit Rotated(newPublicKey, exodusSession, payload.parity);
|
||||
emit Rotated(newPublicKey, exodusSession);
|
||||
}
|
||||
|
||||
function govern(
|
||||
@ -254,6 +241,66 @@ contract Gatekeeper is IGatekeeper, Weaver, ReentrancyGuard {
|
||||
return uint256(publicKey);
|
||||
}
|
||||
|
||||
function _extractExodusSession(
|
||||
uint256 packedBits,
|
||||
bytes calldata sessions
|
||||
) internal view returns (uint256 exodusSession) {
|
||||
GhostPacking.RotationBits memory payload = GhostPacking.unpackRotationBits(packedBits);
|
||||
|
||||
uint256 knuthHash = _computeKnuthPerfectHash(payload.xorKey);
|
||||
if (payload.bitMask > 0 && ((payload.bitMask >> knuthHash) & 1) == 0)
|
||||
revert InactiveSlotForChainId();
|
||||
|
||||
uint256 count = _popcount(payload.bitMask);
|
||||
if (count == 0) revert InvalidPayloadSize();
|
||||
|
||||
uint256 size = sessions.length / count;
|
||||
if (count * size != sessions.length || size == 0 || size > 32) revert InvalidPayloadSize();
|
||||
|
||||
uint256 slotIndex = _computeDenseIndex(knuthHash, payload.bitMask);
|
||||
uint256 offset = slotIndex * size;
|
||||
if (offset + size > sessions.length) revert OutOfBoundsSessions();
|
||||
|
||||
assembly {
|
||||
let data := calldataload(add(sessions.offset, offset))
|
||||
|
||||
let shiftBits := mul(8, sub(32, size))
|
||||
let shifted := shr(shiftBits, data)
|
||||
|
||||
let bits := mul(8, size)
|
||||
let mask := sub(shl(bits, 1), 1)
|
||||
|
||||
exodusSession := and(shifted, mask)
|
||||
}
|
||||
}
|
||||
|
||||
function _computeKnuthPerfectHash(uint128 xorKey) internal view returns (uint256 perfection) {
|
||||
unchecked {
|
||||
uint128 convertedValue = uint128(block.chainid);
|
||||
uint128 knuthHash = (convertedValue ^ xorKey) * 0x9E3779B97F4A7C15F39CC0605CEDC834;
|
||||
uint128 slotIndexConverted = (knuthHash >> 0x79) & 0x7F;
|
||||
perfection = uint256(slotIndexConverted);
|
||||
}
|
||||
}
|
||||
|
||||
function _computeDenseIndex(uint256 value, uint256 mask) internal pure returns (uint256 slotIndex) {
|
||||
unchecked {
|
||||
uint256 y = (uint256(1) << value) - 1;
|
||||
uint256 x = mask & y;
|
||||
slotIndex = _popcount(x);
|
||||
}
|
||||
}
|
||||
|
||||
function _popcount(uint256 x) internal pure returns (uint256) {
|
||||
unchecked {
|
||||
x = x - ((x >> 1) & 0x5555555555555555555555555555555555555555555555555555555555555555);
|
||||
x = (x & 0x3333333333333333333333333333333333333333333333333333333333333333)
|
||||
+ ((x >> 2) & 0x3333333333333333333333333333333333333333333333333333333333333333);
|
||||
x = (x + (x >> 4)) & 0x0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F;
|
||||
return (x * 0x0101010101010101010101010101010101010101010101010101010101010101) >> 248;
|
||||
}
|
||||
}
|
||||
|
||||
function _isContract(address account) internal view returns (bool) {
|
||||
uint256 size;
|
||||
assembly {
|
||||
|
||||
@ -15,17 +15,20 @@ interface IGatekeeper {
|
||||
error InsufficientValue();
|
||||
error ExecutionReverted();
|
||||
error HistoricalRotation();
|
||||
error InvalidPayloadSize();
|
||||
error OutOfBoundsSessions();
|
||||
error InactiveSlotForChainId();
|
||||
error MalleableExodusSession();
|
||||
|
||||
event Recalled(address indexed receiver, uint256 indexed amount);
|
||||
event Rotated(bytes32 indexed aggregatedPublicKey, uint256 indexed session, uint8 parity);
|
||||
event Rotated(bytes32 indexed aggregatedPublicKey, uint256 indexed session);
|
||||
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, uint64);
|
||||
function getRotationInfoAt(uint256 session) external view returns (bytes32, uint256);
|
||||
|
||||
function ghost(bytes32 receiver, uint256 amount) external;
|
||||
function initialize(address previousAddress) external;
|
||||
|
||||
@ -2,10 +2,9 @@
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
library GhostPacking {
|
||||
struct RotationState {
|
||||
uint8 parity;
|
||||
uint64 chainId;
|
||||
uint64 session;
|
||||
struct RotationBits {
|
||||
uint128 xorKey;
|
||||
uint128 bitMask;
|
||||
}
|
||||
|
||||
struct GovernancePayload {
|
||||
@ -19,21 +18,19 @@ library GhostPacking {
|
||||
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(uint128 xorKey, uint128 bitMask) internal pure returns (uint256 packed) {
|
||||
packed = (uint256(xorKey) << 128) | uint256(bitMask);
|
||||
}
|
||||
|
||||
function pack(RotationState calldata state) internal pure returns (uint256 packed) {
|
||||
packed = pack(state.parity, state.chainId, state.session);
|
||||
function pack(RotationBits calldata state) internal pure returns (uint256 packed) {
|
||||
packed = pack(state.xorKey, state.bitMask);
|
||||
}
|
||||
|
||||
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 unpackRotationBits(uint256 packed) internal pure returns (RotationBits memory state) {
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
state.xorKey = uint128(packed >> 128);
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
state.bitMask = uint128(packed & 0xFFFFFFFFFFFFFFFFffffffffffffffff);
|
||||
}
|
||||
|
||||
function pack(uint64 chainId, address target) internal pure returns (uint256 packed) {
|
||||
@ -45,9 +42,9 @@ library GhostPacking {
|
||||
}
|
||||
|
||||
function unpackGovernance(uint256 packed) internal pure returns (GovernancePayload memory state) {
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
state.target = address(uint160(packed >> 32));
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
state.chainId = uint64(packed >> 192);
|
||||
}
|
||||
|
||||
@ -60,11 +57,11 @@ library GhostPacking {
|
||||
}
|
||||
|
||||
function unpackRequest(uint256 packed) internal pure returns (RequestPayload memory state) {
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
state.bounty = uint32(packed & 0xFFFFFFFF);
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
state.chainId = uint64((packed >> 32) & 0xFFFFFFFFFFFFFFFF);
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
// forge-lint: disable-next-line(unsafe-typecast)
|
||||
state.receiver = address(uint160(packed >> 96));
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,30 +275,6 @@ contract GatekeeperTest is Test {
|
||||
assert(IStorageHistory(storageHistory).isTransactionExecuted(exodusSession));
|
||||
}
|
||||
|
||||
function test_rotationWorks() public {
|
||||
vm.warp(block.timestamp + 1);
|
||||
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, 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, 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, packed);
|
||||
}
|
||||
|
||||
function test_couldNotBridgeBelowExistential(uint256 amount) public {
|
||||
vm.assume(amount < gatekeeper.EXISTENTIAL_DEPOSIT());
|
||||
bytes32 receiver = bytes32(abi.encodePacked(ALICE));
|
||||
@ -317,66 +293,68 @@ contract GatekeeperTest is Test {
|
||||
staking.runGhost(bytes32(abi.encodePacked(ALICE)), type(uint104).max);
|
||||
|
||||
vm.prank(ALICE);
|
||||
gatekeeper.updatePublicKeyMetadata(0, 0xa55edb24891a8f92cce26d5ab8e359e6ef6ae36d41e0869676d7020e6135e12b, 0);
|
||||
gatekeeper.updatePublicKeyMetadata(0, 0xa2bc78dbf596f27949ae9a3cc680ce038a4830670b6e458b99424de55a77ca8b);
|
||||
|
||||
(bytes32 prevPublicKey,) = gatekeeper.latestPublicKeyInfo();
|
||||
|
||||
// DKG #1 <==> Context ExodusContext { session: 1, network_id: 420 }
|
||||
vm.expectRevert();
|
||||
// Inside 31337 we have no transactions yet
|
||||
gatekeeper.verify(
|
||||
hex"e9d50bc10000000000000000000000000000000000000000000000000000000000000001a55edb24891a8f92cce26d5ab8e359e6ef6ae36d41e0869676d7020e6135e12b0000000000000001a40000000000000000000000000000000000000000000000",
|
||||
0x75414a03277a1c46a19be98841e92e13156296592422fd648d7a11f8fa6e56ac,
|
||||
0xe1f442c13e62f0af437bf693a8d7098e38545cff6002c941f89eee31f8f170f4
|
||||
hex"e2528510000000000000000000000000000000000000000000000000000000000000000105d0d43c05e4fb7206614cde8416ed03c8d0b1ad4594fe52c6701d33816c8680123456789abcdef0123456789abcdef020000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000100000000000000000000000000000000",
|
||||
0x924713ed07e9d6550db826501bb3a1bc4b1996bd44bd690755ddd0b45e312984,
|
||||
0x458afab7a2f65589b71acf9587045d9b899cd4748cf242c0432384878759cc4e
|
||||
);
|
||||
|
||||
// DKG 2 <==> Context ExodusContext { session: 2, network_id: 420 }
|
||||
vm.expectRevert();
|
||||
gatekeeper.verify(
|
||||
hex"e9d50bc10000000000000000000000000000000000000000000000000000000000000002ee504738d924ff901dcee6e762b2c17ac0362a62471d5a942e1eb1eb363e91360000000000000001a40000000000000000000000000000000000000000000000",
|
||||
0x86890fa31f0564aad657a58bccbe8ce226d6834154d9434bbee2a69142980348,
|
||||
0xad5ec4d13c6f670050df3a2e28957cec23c376f7127248f700b663177942eab8
|
||||
);
|
||||
|
||||
// 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();
|
||||
(bytes32 publicKey, uint256 session) = gatekeeper.latestPublicKeyInfo();
|
||||
assertTrue(publicKey != prevPublicKey);
|
||||
assertEq(session, 10);
|
||||
assertEq(session, 0);
|
||||
|
||||
prevPublicKey = publicKey;
|
||||
|
||||
// DKG 3 <==> Context ExodusContext { session: 18, network_id: 31337 }
|
||||
// Bridge Out - amount: 210; commission: 50%; BOB
|
||||
// DKG #3 <==> Context ExodusContext { session: 12, network_id: 31337 }
|
||||
vm.prank(ALICE, ALICE);
|
||||
vm.expectRevert();
|
||||
gatekeeper.verify(
|
||||
hex"e9d50bc1000000000000000000000000000000000000000000000000000000000000001253e8a1afb125e0633c84099e04e4732af1d91eb1cd84da9c5ed1f0005bb375b6000000000000007a690000000000000000000000000000000000000000000000",
|
||||
0x3a4dc265fe4e7c6915ac9b717a9f11c9179d16b00d0c43a8e52bd4eecb4d7a9b,
|
||||
0x4cc8152116c4a6fe96b01a7ab20289dc3cf75c1c1529ede794a0f56476c77c7e
|
||||
hex"bf06188a000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000020000000000007a6980000000",
|
||||
0x998b818c9e56a90dffa61e876e2760f58bf83dcd172b1ec75328a3629b2fa5b1,
|
||||
0x2174c7270034b6b1d40e360b054431f41b558ad0389a3848cdba3b42388552a8
|
||||
);
|
||||
|
||||
// DKG #3 <==> Context ExodusContext { session: 1337, network_id: 420 }
|
||||
vm.expectRevert();
|
||||
gatekeeper.verify(
|
||||
hex"e252851000000000000000000000000000000000000000000000000000000000000005396f1587daa198f9a5ed8d301298890d467e51eca3ce978eaba24c034c8797a33d123456789abcdef0123456789abcdef020000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000100000000000000013000000000000053900000000000000000000000000000000",
|
||||
0x14d0c7c4f3f517055efa54f15699d25badc113d98e548982bead74f974ba89c7,
|
||||
0x53c634179b8cc1880148010d9ced4cd1b1239b7cee60d661f8f16104d74db3e3
|
||||
);
|
||||
|
||||
// DKG #2 <==> Context ExodusContext { session: 11, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"e2528510000000000000000000000000000000000000000000000000000000000000000bd2bfa65ff23d258957b624de498ada8ee31594eec89658dd1f7bb5dbda4db862123456789abcdef0123456789abcdef02000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000010000000000000000b000000000000000200000000000000000000000000000000",
|
||||
0x7e758c7ea5588da3cca5c8e0f42aa7b5850ab524338ef644e73bc5cf00e0b1ab,
|
||||
0x0ce5ac0022fe8704af938c599333e87585d0620281a705cb474362dcba590a42
|
||||
);
|
||||
|
||||
(publicKey, session) = gatekeeper.latestPublicKeyInfo();
|
||||
assertTrue(publicKey != prevPublicKey);
|
||||
assertEq(session, 18);
|
||||
assertEq(session, 11);
|
||||
|
||||
prevPublicKey = publicKey;
|
||||
|
||||
// DKG #3 <==> Context ExodusContext { session: 1337, network_id: 420 }
|
||||
// Inside 31337 we have session: 19
|
||||
gatekeeper.verify(
|
||||
hex"e252851000000000000000000000000000000000000000000000000000000000000005396f1587daa198f9a5ed8d301298890d467e51eca3ce978eaba24c034c8797a33d123456789abcdef0123456789abcdef020000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000100000000000000013000000000000053900000000000000000000000000000000",
|
||||
0x14d0c7c4f3f517055efa54f15699d25badc113d98e548982bead74f974ba89c7,
|
||||
0x53c634179b8cc1880148010d9ced4cd1b1239b7cee60d661f8f16104d74db3e3
|
||||
);
|
||||
|
||||
(publicKey, session) = gatekeeper.latestPublicKeyInfo();
|
||||
assertTrue(publicKey != prevPublicKey);
|
||||
assertEq(session, 19);
|
||||
|
||||
prevPublicKey = publicKey;
|
||||
|
||||
uint256 aliceAmountBefore = staking.recalledAmount(ALICE);
|
||||
uint256 bobAmountBefore = staking.recalledAmount(BOB);
|
||||
@ -384,12 +362,12 @@ contract GatekeeperTest is Test {
|
||||
uint256 bobBalanceBefore = BOB.balance;
|
||||
|
||||
// Bridge Out - amount: 34; commission: 0%; ALICE
|
||||
// DKG 2 <==> Context ExodusContext { session: 0, network_id: 31337 }
|
||||
// DKG #2 <==> Context ExodusContext { session: 1, network_id: 31337 }
|
||||
vm.prank(ALICE, ALICE);
|
||||
gatekeeper.verify(
|
||||
hex"bf06188a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000010000000000007a6900000000",
|
||||
0x8025f985dd8c7507a7451a1055435870ce798df3d122e8d03735efa192691550,
|
||||
0xb749bb2e5df5477eab850816a19786e6fa653c3d4402cee036fe1e506dad26dc
|
||||
hex"bf06188a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000010000000000007a6900000000",
|
||||
0xac8c25886fb6dba968832ee621076986bd7c57eb45448202aa74274ab2c78c16,
|
||||
0x4a6c5c8962ef2e27ee7ea23376555c8071e2ef387e237d3ba7d1b172720f5c82
|
||||
);
|
||||
|
||||
assertEq(aliceAmountBefore + 34, staking.recalledAmount(ALICE));
|
||||
@ -403,135 +381,135 @@ contract GatekeeperTest is Test {
|
||||
bobBalanceBefore = BOB.balance;
|
||||
|
||||
// Bridge Out - amount: 210; commission: 50%; BOB
|
||||
// DKG 3 <==> Context ExodusContext { session: 11, network_id: 31337 }
|
||||
// DKG #3 <==> Context ExodusContext { session: 12, network_id: 31337 }
|
||||
vm.prank(ALICE, ALICE);
|
||||
gatekeeper.verify(
|
||||
hex"bf06188a000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000020000000000007a6980000000",
|
||||
0xde80d861004bfa78c9a0605a4ad7ad78683cc79d98852e500100fb36e951da1c,
|
||||
0x2708c643a2a436e10809cfd7d75e38d1d352b35970fe4eca306946fec0c457ec
|
||||
hex"bf06188a000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000d200000000000000000000000000000000000000020000000000007a6980000000",
|
||||
0x998b818c9e56a90dffa61e876e2760f58bf83dcd172b1ec75328a3629b2fa5b1,
|
||||
0x2174c7270034b6b1d40e360b054431f41b558ad0389a3848cdba3b42388552a8
|
||||
);
|
||||
|
||||
assertApproxEqAbs(aliceAmountBefore + 105, staking.recalledAmount(ALICE), 1);
|
||||
assertApproxEqAbs(bobAmountBefore + 105, staking.recalledAmount(BOB), 1);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::Close { id: 420 } }
|
||||
// DKG 2 <==> Context ExodusContext { session: 8, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000080000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000240aebeb4e00000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
|
||||
0xb23927f82a762b2c70e40c5b834196f04b0b716d1f94073d9709c983364c34af,
|
||||
0x7051c41a28436c8b8454fc57aec4a808761a3d996a24eab9e9b225c552737435
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::RemovePool { index: 1337 } }
|
||||
// DKG 2 <==> Context ExodusContext { session: 7, network_id: 31337 }
|
||||
// DKG #2 <==> Context ExodusContext { session: 8, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000070000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024a38dcbd0000000000000000000000000000000000000000000000000000000000000053900000000000000000000000000000000000000000000000000000000",
|
||||
0xbfd1fe06886518072eed46b325a6c74b574879294fd0d4c924ee670645d22324,
|
||||
0x35498be823e5bf6a14e0172229359bf73d26153e94262bd9a51650eb825a99ad
|
||||
);
|
||||
|
||||
// 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"3137142600000000000000000000000000000000000000000000000000000000000000090000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000164206eb0f8000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000001a40000000000000000000000000000000000000000000000000000000000000539000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000000005390000000000000000000000000101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
|
||||
0x222edcb18d541d904861c9097f8dbfe24d5816b2a71246240033a8e794a6eec6,
|
||||
0xbc19a2d8be0b79219acc98529846e9427bb48a39110b8d0acb396abb015796e0
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::SetDistributor { distributor: 0x0101010101010101010101010101010101010101 } }
|
||||
// DKG 2 <==> Context ExodusContext { session: 1, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000010000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002475619ab5000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
||||
0xecd3afac10a3845f8f7a60a530531d0af7b94288f4894fc60bef233e11f5f60c,
|
||||
0x75b8a70d0a5cecbb1da45d87bae698dcb4cfa923051dfc3d5661a1d3a3d278de
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000080000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024a38dcbd0000000000000000000000000000000000000000000000000000000000000053900000000000000000000000000000000000000000000000000000000",
|
||||
0x32bb624814da6ec2663cb1fdf23bfcfa92c971fdd00be3fdb933bc04e92dfe8e,
|
||||
0xd71cec3db4fc72cd269a04831d278a342949bbeed43a034f15662ea7f0bfc81d
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::AddPool { address: 0x0101010101010101010101010101010101010101 } }
|
||||
// DKG 2 <==> Context ExodusContext { session: 6, network_id: 31337 }
|
||||
// DKG #2 <==> Context ExodusContext { session: 7, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000060000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024d914cd4b000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
||||
0x1deec2e18132e321cf3df76880bbd5bf37ba0c6cb7ce3a78fa24fb443dd89e9e,
|
||||
0x7266cccb8f15c651a016892dc647b1e4ee2bac9261095019c12b2a52e6f40cd8
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000070000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024d914cd4b000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
||||
0x5c83ff7a2ccf8b9e89a883704403bf9bfe4aeadbee18b6df392b372edef6a915,
|
||||
0x498efce0fadd9668199ccdf2161dd2b563217fc38018f214fce8fc6a48fdcd7d
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::Close { id: 420 } }
|
||||
// DKG #2 <==> Context ExodusContext { session: 9, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000090000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000240aebeb4e00000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
|
||||
0x8692a623d80fe3424d8748616ed3abf854377b5c236866d839bcc7a9fb60befc,
|
||||
0xc38505e1b0bcf6e5d6f9f9351d41ca4d79e3ac3934042cdfbefcf4dd141b7d4b
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::UpdateGatekeeperAddress { new_gatekeeper: 0x0101010101010101010101010101010101010101 } }
|
||||
// DKG 2 <==> Context ExodusContext { session: 5, network_id: 31337 }
|
||||
// DKG #2 <==> Context ExodusContext { session: 6, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000050000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002484f157cd000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
||||
0x650efb1c28a67fcd7a09cd677ee48d29d96ad02baea8d5749faa011c6d20865f,
|
||||
0xc577b059b0e85879a60b5da621a908da2cc4851f0cf82cf0a000b4149ce91574
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::SetWarmupPeriod { warmup_period: 69 } }
|
||||
// DKG 2 <==> Context ExodusContext { session: 2, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000020000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024a85667c5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000",
|
||||
0x887b1f90a0b71f75bb1f32d90d64c789d398b884b481257daa108fe8175a6024,
|
||||
0xd9e041cc4865ef88462efc7332f8e7d9be45a7d1d7f3f6aef31fb84489d31557
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000060000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002484f157cd000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
||||
0x677993ffdf86b16e33252a11ee458b07cafd6f6466011c8d61ce4d915d4dcfd2,
|
||||
0xcace2beda758c827f41ada31a9957f54dde47aa31e019c9b5b07212686eb2b3d
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::SetAdjustment { rate: 69, target: 420, add: true } }
|
||||
// DKG 2 <==> Context ExodusContext { session: 4, network_id: 31337 }
|
||||
// DKG #2 <==> Context ExodusContext { session: 5, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000040000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006446d36ab5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
|
||||
0xc6b5e25e62284b97b9d2fba27e09a49bf99f6abc02316f9d4d66597edef89405,
|
||||
0x95eacaa6e613e5fe42b65f5f6a04f6e5f5f327d232072ac21e15b513142d2e48
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000050000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000006446d36ab5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
|
||||
0xfab44bf2062ac65187345686d94fb0d750f47eab5e8676b3d0e0b110328a2199,
|
||||
0x9989e32112b402a667570ec2717b802fe65902476252296814bc9c7548a6b9f0
|
||||
);
|
||||
|
||||
// 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: 10, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"31371426000000000000000000000000000000000000000000000000000000000000000a0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000164206eb0f8000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000000001a40000000000000000000000000000000000000000000000000000000000000539000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000000005390000000000000000000000000101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
|
||||
0xa243c6bb2e135b1ee756f2489a968ce56cb27891ff22eca9c26fa3ea35a86486,
|
||||
0x65d1db30026bef6cdd3a8b2e9eea23f74cc579f493a78501f2dbefd68ade9d36
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::SetDistributor { distributor: 0x0101010101010101010101010101010101010101 } }
|
||||
// DKG #2 <==> Context ExodusContext { session: 2, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000020000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002475619ab5000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
||||
0x3e4bf03267f4f7137ff09de70c584b131e270b346de78832143ab3ef2345164b,
|
||||
0x3c4a2b60c7c0047de00a6821c8983f85e9c639f68c377f0c3588580ad0571ce6
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::SetBounty { bounty: 69 } }
|
||||
// DKG 2 <==> Context ExodusContext { session: 3, network_id: 31337 }
|
||||
// DKG #2 <==> Context ExodusContext { session: 4, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000030000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000245d87d363000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000",
|
||||
0xe9d1462dd8e8e80a3b8007628575179e92c249cd7684a1d28c0313a48f8558af,
|
||||
0x7a33389110ad43d6b51b8fb5d3e5ffbce9d37ce6986e75bab43ca49707012512
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000040000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000245d87d363000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000",
|
||||
0x975c6199aa814cbdcf870d7b2cfcf2b676c37656ae9b2a78570cea09fd03f235,
|
||||
0x0aab05570e567384ee6d143019e692c52ba0e353ee4a5cc99a491161ccf275f4
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::ForfeitReserves { router: 0x0101010101010101010101010101010101010101, liquidity: 420, destroyer_mode: true } }
|
||||
// DKG 3 <==> Context ExodusContext { session: 14, network_id: 31337 }
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::SetWarmupPeriod { warmup_period: 69 } }
|
||||
// DKG #2 <==> Context ExodusContext { session: 3, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"31371426000000000000000000000000000000000000000000000000000000000000000e0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064f0de236c000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
|
||||
0x139c9a2b23abfcc1e844b40e1c0b69c033d591f081e895fbcb597974d9fa1323,
|
||||
0x940773c75fddc4ff70ce13ea46521ad4f788322a4c40ed6e94490510ecd0b971
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::RedeemReserves { router: 0x0101010101010101010101010101010101010101, amount: 420 } }
|
||||
// DKG 3 <==> Context ExodusContext { session: 15, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"31371426000000000000000000000000000000000000000000000000000000000000000f0000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004482a21577000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
|
||||
0xcec7a9d8fa39e27fe4f33968741676d5ae948b8f2e42783e92850f10a90bb748,
|
||||
0xefb7605b627cbfc46f459642be156391d79e37e03ccb510d0d1eb3e5a325bc22
|
||||
);
|
||||
|
||||
// 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"31371426000000000000000000000000000000000000000000000000000000000000000d0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044529918310000000000000000000000000000000000000000000000000000000000000003000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
||||
0x86fdb0bf333d8c7a539da71dbdd8fe4112b4c5766060177215c5cf30caa36350,
|
||||
0x2c5c721d036cc7017df36e79159b35de07289672c4b0e0731cccc752097a92d1
|
||||
);
|
||||
|
||||
// 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"31371426000000000000000000000000000000000000000000000000000000000000000c0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064e4e33ef800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000101010101010101010101010101010101010101000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
||||
0xe35f59fd65e5b1e1d6402801b1b549bd331425252c35647102b7380f81260c01,
|
||||
0x9015326c5ced82020c66066479ecb108f243f1439d1d51fd49b3b1cad0cdb179
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000030000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000024a85667c5000000000000000000000000000000000000000000000000000000000000004500000000000000000000000000000000000000000000000000000000",
|
||||
0x6b244416e4edced7254e685dc33bac209375c7e83e4032de46ea39c430abdbe4,
|
||||
0xec45371821d04be6fb82372a42fb750fee1a2e697eb23bfe773d3fc6f569b9f3
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::AuditReserves }
|
||||
// DKG 3 <==> Context ExodusContext { session: 17, network_id: 31337 }
|
||||
// DKG #3 <==> Context ExodusContext { session: 18, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000110000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000042b7ce50000000000000000000000000000000000000000000000000000000000",
|
||||
0x2be51afcc627038389309a5b4b74ab70fe01b0ee9e1b75d0ce91120c36d2b081,
|
||||
0x3dc918d435a6ba882ab66d78d853d83d70f582bdfd1aac028b4b75ffefe277cc
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000120000000000007a69010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000042b7ce50000000000000000000000000000000000000000000000000000000000",
|
||||
0x6bdb0f659b8c8e35ba5d59014ec441a95ba236f0d9da71775f2ac9ed3f04489d,
|
||||
0x3ec6f44e57af7143f2b49431c1ae5459f95894bdd758743e0b83f51ab178316c
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::Disable { status: GovernanceStatus::LiquidityToken, address: 0x0101010101010101010101010101010101010101 } }
|
||||
// DKG #3 <==> Context ExodusContext { session: 14, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"31371426000000000000000000000000000000000000000000000000000000000000000e0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044529918310000000000000000000000000000000000000000000000000000000000000003000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
||||
0x6e02d583a3b870a918f9150c153f79d2f3f653c6461aa0029e54b80ec7b90e42,
|
||||
0x778cfdb98bdd083348deeca80840d0f6131c8cc157c6ddd767110b2c2dda98b1
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::ForfeitReserves { router: 0x0101010101010101010101010101010101010101, liquidity: 420, destroyer_mode: true } }
|
||||
// DKG #3 <==> Context ExodusContext { session: 15, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"31371426000000000000000000000000000000000000000000000000000000000000000f0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064f0de236c000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a4000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000",
|
||||
0x846e864907e7e2d22e51b6dd956d72f9a9a769930d6be9026d023aa654c5e8ba,
|
||||
0x2856077b65172e2328bebab57b68329c78e3057f0690ce24dfa9bbe1e49c1fac
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::Enable { status: GovernanceStatus::ReserveToken, address: 0x0101010101010101010101010101010101010101, calculator: 0x0101010101010101010101010101010101010101 } }
|
||||
// DKG #3 <==> Context ExodusContext { session: 13, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"31371426000000000000000000000000000000000000000000000000000000000000000d0000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000064e4e33ef800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000101010101010101010101010101010101010101000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000",
|
||||
0x14355ac448e9623a3be2aeaf1a21598e721999a7bb9455d1ef33c8c33a79d615,
|
||||
0x5f878532a68f6afba122a7f9dfcef1e75742ddf6c3c194c8794f230fb2cacc05
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::Withdraw { token: 0x0101010101010101010101010101010101010101, amount: 420 } }
|
||||
// DKG 3 <==> Context ExodusContext { session: 16, network_id: 31337 }
|
||||
// DKG #3 <==> Context ExodusContext { session: 17, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000100000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044f3fef3a3000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
|
||||
0xd9a91f2185c7f5055ca90461b4ad27c1a06aa2979e3a7f78f41affedd7172faf,
|
||||
0x4dcf0a720128e2a9952aecc33717e7fe4de0a4b0c8605e2830593c27e9c03daa
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000110000000000007a6901010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044f3fef3a3000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
|
||||
0xee3e0d737fa9447afec930b1be323c930355d1dcfa57a05d80dc57d0434770b4,
|
||||
0xca1a8f1c03287fcdaad37166cc1c3e7ae001c521e10f855c8d43ea783e5e9bea
|
||||
);
|
||||
|
||||
// Governance: ExodusRequestType::EvmGovernance { target: 0x0101010101010101010101010101010101010101, action: GovernanceAction::RedeemReserves { router: 0x0101010101010101010101010101010101010101, amount: 420 } }
|
||||
// DKG #3 <==> Context ExodusContext { session: 16, network_id: 31337 }
|
||||
gatekeeper.verify(
|
||||
hex"3137142600000000000000000000000000000000000000000000000000000000000000100000000000007a690101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004482a21577000000000000000000000000010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000",
|
||||
0xb660d9d61850866db2ddcb6ee5a7ea06006ac4e76c9e42e56b2aae9c11219546,
|
||||
0xe249616ba71082c4b7ea43dc9118afb3eaffdf8b5263ec87f30cc612e65d9d2b
|
||||
);
|
||||
|
||||
address storageHistory = gatekeeper.storageHistory();
|
||||
|
||||
@ -107,7 +107,7 @@ contract GatekeeperRecallTest is Test {
|
||||
function test_gasPriceCorrectDuringRecall() public {
|
||||
vm.startPrank(INITIALIZER);
|
||||
Gatekeeper gatekeeper = Gatekeeper(payable(staking.gatekeeper()));
|
||||
gatekeeper.updatePublicKeyMetadata(0, 0xb5cd0d028a5e1b6a4eecb113b7e49c8176385eb77c8f134bc1db4bddd7654de6, 0);
|
||||
gatekeeper.updatePublicKeyMetadata(0, 0xb5cd0d028a5e1b6a4eecb113b7e49c8176385eb77c8f134bc1db4bddd7654de6);
|
||||
vm.stopPrank();
|
||||
|
||||
vm.startPrank(ALICE);
|
||||
@ -171,7 +171,7 @@ contract GatekeeperRecallTest is Test {
|
||||
function test_recallChainWorks() public {
|
||||
vm.startPrank(INITIALIZER);
|
||||
Gatekeeper gatekeeper = Gatekeeper(payable(staking.gatekeeper()));
|
||||
gatekeeper.updatePublicKeyMetadata(0, 0xb5cd0d028a5e1b6a4eecb113b7e49c8176385eb77c8f134bc1db4bddd7654de6, 0);
|
||||
gatekeeper.updatePublicKeyMetadata(0, 0xb5cd0d028a5e1b6a4eecb113b7e49c8176385eb77c8f134bc1db4bddd7654de6);
|
||||
vm.stopPrank();
|
||||
|
||||
vm.startPrank(ALICE);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user