Skip to content

Commit

Permalink
feat: update spectre proxy according to the latest spectre contract (#38
Browse files Browse the repository at this point in the history
)

* fix: update spectre proxy according to the latest contracts

* Update spectre test contract
  • Loading branch information
mpetrun5 authored Mar 13, 2024
1 parent 9cafa97 commit 9721143
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 28 deletions.
8 changes: 0 additions & 8 deletions src/contracts/TestContracts.sol
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,6 @@ contract TestSpectre {
uint64 participation;
bytes32 finalizedHeaderRoot;
bytes32 executionPayloadRoot;
uint256[12] accumulator;
}

struct RotateInput {
bytes32 syncCommitteeSSZ;
uint256 syncCommitteePoseidon;
uint256[12] accumulator;
}

mapping(uint256 => bytes32) public executionPayloadRoots;
Expand All @@ -238,7 +231,6 @@ contract TestSpectre {
}

function rotate(
RotateInput calldata rotateInput,
bytes calldata rotateProof,
SyncStepInput calldata stepInput,
bytes calldata stepProof
Expand Down
8 changes: 0 additions & 8 deletions src/contracts/interfaces/ISpectre.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ interface ISpectre {
uint64 participation;
bytes32 finalizedHeaderRoot;
bytes32 executionPayloadRoot;
uint256[12] accumulator;
}
struct RotateInput {
bytes32 syncCommitteeSSZ;
uint256 syncCommitteePoseidon;
uint256[12] accumulator;
}

/// @notice Verify that a sync committee has attested to a block that finalizes
Expand All @@ -30,12 +24,10 @@ interface ISpectre {


/// @notice Use the current sync committee to verify the transition to a new sync committee
/// @param rotateInput The input to the sync step.
/// @param rotateProof The proof for the rotation
/// @param stepInput The input to the sync step.
/// @param stepProof The proof for the sync step
function rotate(
RotateInput calldata rotateInput,
bytes calldata rotateProof,
SyncStepInput calldata stepInput,
bytes calldata stepProof
Expand Down
4 changes: 1 addition & 3 deletions src/contracts/proxies/SpectreProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@ contract SpectreProxy is AccessControl {
/**
@notice Proxy for the Spectre rotate function that supports multiple domains
@param sourceDomainID DomainID of the network for which the proof is submitted
@param rotateInput The input to the sync step
@param rotateProof The proof for the rotation
@param stepInput The input to the sync step
@param stepProof The proof for the sync step
*/
function rotate(
uint8 sourceDomainID,
ISpectre.RotateInput calldata rotateInput,
bytes calldata rotateProof,
ISpectre.SyncStepInput calldata stepInput,
bytes calldata stepProof
Expand All @@ -76,7 +74,7 @@ contract SpectreProxy is AccessControl {
require(spectreAddress != address(0), "no spectre address found");

ISpectre spectre = ISpectre(spectreAddress);
spectre.rotate(rotateInput, rotateProof, stepInput, stepProof);
spectre.rotate(rotateProof, stepInput, stepProof);

emit CommitteeRotated(sourceDomainID, stepInput.attestedSlot);
}
Expand Down
9 changes: 0 additions & 9 deletions test/proxies/spectre/spectreProxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ describe("Spectre Proxy", () => {
"0x59dac95a8278295a3a05d809156f69b45007af3f3df94bcabe4bbbdd9cce5c5a",
];

const rotateInput: ISpectre.RotateInputStruct = {
syncCommitteePoseidon: "256",
syncCommitteeSSZ:
"0xcc69885fda6bcc1a4ace058b4a62bf5e179ea78fd58a1ccd71c22cc9b688792f",
accumulator: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
};
const stepInput: ISpectre.SyncStepInputStruct = {
finalizedHeaderRoot:
"0xcc69885fda6bcc1a4ace058b4a62bf5e179ea78fd58a1ccd71c22cc9b688792f",
Expand All @@ -44,7 +38,6 @@ describe("Spectre Proxy", () => {
participation: 8,
executionPayloadRoot:
"0x9109d68183cb2c2b4d8d769a4263195c153ece0d2bc797f44b8f6cec4814439c",
accumulator: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
};

const constructorDomains = [2, 3];
Expand Down Expand Up @@ -105,7 +98,6 @@ describe("Spectre Proxy", () => {
await expect(
spectreProxyInstance.rotate(
invalidOriginDomainID,
rotateInput,
rotateProof,
stepInput,
stepProof,
Expand All @@ -116,7 +108,6 @@ describe("Spectre Proxy", () => {
it("should emit event even if rotate successful", async () => {
const rotateTx = await spectreProxyInstance.rotate(
validDomainID,
rotateInput,
rotateProof,
stepInput,
stepProof,
Expand Down

0 comments on commit 9721143

Please sign in to comment.