diff --git a/chains/evm/abi/spectreProxy.go b/chains/evm/abi/spectreProxy.go index 7278046..87b7e18 100644 --- a/chains/evm/abi/spectreProxy.go +++ b/chains/evm/abi/spectreProxy.go @@ -4,512 +4,504 @@ package abi const SpectreABI = `[ - { - "inputs": [ - { - "internalType": "uint8[]", - "name": "domainIDS", - "type": "uint8[]" - }, - { - "internalType": "address[]", - "name": "spectreAddresses", - "type": "address[]" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "sourceDomainID", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "slot", - "type": "uint256" - } - ], - "name": "CommitteeRotated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "sourceDomainID", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "slot", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "stateRoot", - "type": "bytes32" - } - ], - "name": "StateRootSubmitted", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STATE_ROOT_INDEX", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "sourceDomainID", - "type": "uint8" - }, - { - "internalType": "address", - "name": "spectreAddress", - "type": "address" - } - ], - "name": "adminSetSpectreAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getRoleMember", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleMemberCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getRoleMemberIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "sourceDomainID", - "type": "uint8" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "syncCommitteeSSZ", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "syncCommitteePoseidon", - "type": "uint256" - }, - { - "internalType": "uint256[12]", - "name": "accumulator", - "type": "uint256[12]" - } - ], - "internalType": "struct ISpectre.RotateInput", - "name": "rotateInput", - "type": "tuple" - }, - { - "internalType": "bytes", - "name": "rotateProof", - "type": "bytes" - }, - { - "components": [ - { - "internalType": "uint64", - "name": "attestedSlot", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "finalizedSlot", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "participation", - "type": "uint64" - }, - { - "internalType": "bytes32", - "name": "finalizedHeaderRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "executionPayloadRoot", - "type": "bytes32" - }, - { - "internalType": "uint256[12]", - "name": "accumulator", - "type": "uint256[12]" - } - ], - "internalType": "struct ISpectre.SyncStepInput", - "name": "stepInput", - "type": "tuple" - }, - { - "internalType": "bytes", - "name": "stepProof", - "type": "bytes" - } - ], - "name": "rotate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "name": "spectreContracts", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "stateRoots", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "sourceDomainID", - "type": "uint8" - }, - { - "components": [ - { - "internalType": "uint64", - "name": "attestedSlot", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "finalizedSlot", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "participation", - "type": "uint64" - }, - { - "internalType": "bytes32", - "name": "finalizedHeaderRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "executionPayloadRoot", - "type": "bytes32" - }, - { - "internalType": "uint256[12]", - "name": "accumulator", - "type": "uint256[12]" - } - ], - "internalType": "struct ISpectre.SyncStepInput", - "name": "input", - "type": "tuple" - }, - { - "internalType": "bytes", - "name": "stepProof", - "type": "bytes" - }, - { - "internalType": "bytes32", - "name": "stateRoot", - "type": "bytes32" - }, - { - "internalType": "bytes[]", - "name": "stateRootProof", - "type": "bytes[]" - } - ], - "name": "step", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -]` + { + "inputs": [ + { + "internalType": "uint8[]", + "name": "domainIDS", + "type": "uint8[]" + }, + { + "internalType": "address[]", + "name": "spectreAddresses", + "type": "address[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "sourceDomainID", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "slot", + "type": "uint256" + } + ], + "name": "CommitteeRotated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "sourceDomainID", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "slot", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "stateRoot", + "type": "bytes32" + } + ], + "name": "StateRootSubmitted", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STATE_ROOT_INDEX", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "sourceDomainID", + "type": "uint8" + }, + { + "internalType": "address", + "name": "spectreAddress", + "type": "address" + } + ], + "name": "adminSetSpectreAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getRoleMember", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getRoleMemberIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "sourceDomainID", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "slot", + "type": "uint256" + } + ], + "name": "getStateRoot", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "sourceDomainID", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "rotateProof", + "type": "bytes" + }, + { + "components": [ + { + "internalType": "uint64", + "name": "attestedSlot", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "finalizedSlot", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "participation", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "finalizedHeaderRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "executionPayloadRoot", + "type": "bytes32" + } + ], + "internalType": "struct ISpectre.SyncStepInput", + "name": "stepInput", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "stepProof", + "type": "bytes" + } + ], + "name": "rotate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "spectreContracts", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "stateRoots", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "sourceDomainID", + "type": "uint8" + }, + { + "components": [ + { + "internalType": "uint64", + "name": "attestedSlot", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "finalizedSlot", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "participation", + "type": "uint64" + }, + { + "internalType": "bytes32", + "name": "finalizedHeaderRoot", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "executionPayloadRoot", + "type": "bytes32" + } + ], + "internalType": "struct ISpectre.SyncStepInput", + "name": "input", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "stepProof", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "stateRoot", + "type": "bytes32" + }, + { + "internalType": "bytes[]", + "name": "stateRootProof", + "type": "bytes[]" + } + ], + "name": "step", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ]` diff --git a/chains/evm/contracts/spectre.go b/chains/evm/contracts/spectre.go index 192d578..a8447fb 100644 --- a/chains/evm/contracts/spectre.go +++ b/chains/evm/contracts/spectre.go @@ -46,7 +46,6 @@ func (c *Spectre) Step( func (c *Spectre) Rotate( domainID uint8, - rotateInput message.RotateInput, rotateProof []byte, stepInput message.SyncStepInput, stepProof []byte, @@ -55,6 +54,6 @@ func (c *Spectre) Rotate( return c.ExecuteTransaction( "rotate", opts, - domainID, rotateInput, rotateProof, stepInput, stepProof, + domainID, rotateProof, stepInput, stepProof, ) } diff --git a/chains/evm/executor/executor.go b/chains/evm/executor/executor.go index ae0cb66..dc3b705 100644 --- a/chains/evm/executor/executor.go +++ b/chains/evm/executor/executor.go @@ -24,7 +24,6 @@ type ProofSubmitter interface { ) (*common.Hash, error) Rotate( domainID uint8, - rotateInput message.RotateInput, rotateProof []byte, stepInput message.SyncStepInput, stepProof []byte, @@ -77,7 +76,6 @@ func (e *EVMExecutor) step(domainID uint8, stepData message.StepData) error { func (e *EVMExecutor) rotate(domainID uint8, rotateData message.RotateData) error { hash, err := e.proofSubmitter.Rotate( domainID, - rotateData.RotateInput, rotateData.RotateProof, rotateData.StepInput, rotateData.StepProof, diff --git a/chains/evm/executor/executor_test.go b/chains/evm/executor/executor_test.go index c08647c..5d64763 100644 --- a/chains/evm/executor/executor_test.go +++ b/chains/evm/executor/executor_test.go @@ -66,7 +66,7 @@ func (s *ExecutorTestSuite) Test_Execute_Step_Successful() { } func (s *ExecutorTestSuite) Test_Execute_Rotate_SubmissionFails() { - s.mockProofSubmitter.EXPECT().Rotate(uint8(1), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error")) + s.mockProofSubmitter.EXPECT().Rotate(uint8(1), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error")) err := s.executor.Execute([]*proposal.Proposal{{ Data: message.RotateData{}, @@ -78,7 +78,7 @@ func (s *ExecutorTestSuite) Test_Execute_Rotate_SubmissionFails() { } func (s *ExecutorTestSuite) Test_Execute_Rotate_Successful() { - s.mockProofSubmitter.EXPECT().Rotate(uint8(1), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(&common.Hash{}, nil) + s.mockProofSubmitter.EXPECT().Rotate(uint8(1), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(&common.Hash{}, nil) err := s.executor.Execute([]*proposal.Proposal{{ Data: message.RotateData{}, diff --git a/chains/evm/listener/handlers/rotate.go b/chains/evm/listener/handlers/rotate.go index ee33124..75b6fea 100644 --- a/chains/evm/listener/handlers/rotate.go +++ b/chains/evm/listener/handlers/rotate.go @@ -102,7 +102,6 @@ func (h *RotateHandler) HandleEvents(checkpoint *apiv1.Finality) error { log.Debug().Uint8("domainID", h.domainID).Msgf("Sending rotate message to domain %d", domain) h.msgChan <- []*message.Message{ evmMessage.NewEvmRotateMessage(h.domainID, domain, evmMessage.RotateData{ - RotateInput: rotateProof.Input, RotateProof: rotateProof.Proof, StepProof: stepProof.Proof, StepInput: stepProof.Input, diff --git a/chains/evm/listener/handlers/rotate_test.go b/chains/evm/listener/handlers/rotate_test.go index 530367e..e903817 100644 --- a/chains/evm/listener/handlers/rotate_test.go +++ b/chains/evm/listener/handlers/rotate_test.go @@ -79,9 +79,9 @@ func (s *RotateHandlerTestSuite) Test_HandleEvents_ValidPeriod() { Spec: "mainnet", Pubkeys: [512][48]byte{}, }, nil) - s.mockProver.EXPECT().RotateProof(gomock.Any()).Return(&prover.EvmProof[evmMessage.RotateInput]{ + s.mockProver.EXPECT().RotateProof(gomock.Any()).Return(&prover.EvmProof[struct{}]{ Proof: []byte{}, - Input: evmMessage.RotateInput{}, + Input: struct{}{}, }, nil) s.mockProver.EXPECT().StepProof(gomock.Any()).Return(&prover.EvmProof[evmMessage.SyncStepInput]{ Proof: []byte{}, diff --git a/chains/evm/listener/handlers/step.go b/chains/evm/listener/handlers/step.go index 46df0cd..6fd3865 100644 --- a/chains/evm/listener/handlers/step.go +++ b/chains/evm/listener/handlers/step.go @@ -32,7 +32,7 @@ type EventFetcher interface { type Prover interface { StepProof(args *prover.StepArgs) (*prover.EvmProof[evmMessage.SyncStepInput], error) - RotateProof(args *prover.RotateArgs) (*prover.EvmProof[evmMessage.RotateInput], error) + RotateProof(args *prover.RotateArgs) (*prover.EvmProof[struct{}], error) StepArgs() (*prover.StepArgs, error) RotateArgs(epoch uint64) (*prover.RotateArgs, error) } diff --git a/chains/evm/message/rotate.go b/chains/evm/message/rotate.go index a1dbe38..119bb6d 100644 --- a/chains/evm/message/rotate.go +++ b/chains/evm/message/rotate.go @@ -4,8 +4,6 @@ package message import ( - "math/big" - "github.com/rs/zerolog/log" "github.com/sygmaprotocol/sygma-core/relayer/message" "github.com/sygmaprotocol/sygma-core/relayer/proposal" @@ -16,15 +14,8 @@ const ( EVMRotateProposal proposal.ProposalType = "EVMRotateProposal" ) -type RotateInput struct { - SyncCommitteeSSZ [32]byte - SyncCommitteePoseidon *big.Int - Accumulator [12]*big.Int -} - type RotateData struct { RotateProof []byte - RotateInput RotateInput StepProof []byte StepInput SyncStepInput } diff --git a/chains/evm/message/step.go b/chains/evm/message/step.go index 2052d44..89e2cd8 100644 --- a/chains/evm/message/step.go +++ b/chains/evm/message/step.go @@ -4,8 +4,6 @@ package message import ( - "math/big" - "github.com/rs/zerolog/log" "github.com/sygmaprotocol/sygma-core/relayer/message" "github.com/sygmaprotocol/sygma-core/relayer/proposal" @@ -22,7 +20,6 @@ type SyncStepInput struct { Participation uint64 FinalizedHeaderRoot [32]byte ExecutionPayloadRoot [32]byte - Accumulator [12]*big.Int } type StepData struct { diff --git a/chains/evm/prover/prover.go b/chains/evm/prover/prover.go index 56dc52e..fcafbab 100644 --- a/chains/evm/prover/prover.go +++ b/chains/evm/prover/prover.go @@ -6,11 +6,9 @@ package prover import ( "context" "fmt" - "math/big" "github.com/attestantio/go-eth2-client/api" "github.com/attestantio/go-eth2-client/spec/phase0" - ssz "github.com/ferranbt/fastssz" "github.com/rs/zerolog/log" "github.com/sygmaprotocol/spectre-node/chains/evm/message" consensus "github.com/umbracle/go-eth-consensus" @@ -31,9 +29,8 @@ type RotateArgs struct { } type ProverResponse struct { - Accumulator [12]string `json:"accumulator"` - Proof []uint16 `json:"proof"` - Commitment string `json:"committee_poseidon"` + Proof []uint16 `json:"proof"` + Commitment string `json:"committee_poseidon"` } type EvmProof[T any] struct { @@ -101,11 +98,6 @@ func (p *Prover) StepProof(args *StepArgs) (*EvmProof[message.SyncStepInput], er return nil, err } - accumulator := [12]*big.Int{} - for i, value := range resp.Accumulator { - accumulator[i], _ = new(big.Int).SetString(value[2:], 16) - } - log.Info().Msgf("Generated step proof") finalizedHeaderRoot, err := args.Update.FinalizedHeader.Header.HashTreeRoot() @@ -124,19 +116,14 @@ func (p *Prover) StepProof(args *StepArgs) (*EvmProof[message.SyncStepInput], er Participation: uint64(CountSetBits(args.Update.SyncAggregate.SyncCommiteeBits)), FinalizedHeaderRoot: finalizedHeaderRoot, ExecutionPayloadRoot: executionRoot, - Accumulator: accumulator, }, } return proof, nil } // RotateProof generates the proof for the sync committee rotation for the period -func (p *Prover) RotateProof(args *RotateArgs) (*EvmProof[message.RotateInput], error) { +func (p *Prover) RotateProof(args *RotateArgs) (*EvmProof[struct{}], error) { args.Update.AttestedHeader = args.Update.FinalizedHeader - syncCommiteeRoot, err := p.pubkeysRoot(args.Update.NextSyncCommittee.PubKeys) - if err != nil { - return nil, err - } updateSzz, err := args.Update.MarshalSSZ() if err != nil { return nil, err @@ -147,6 +134,7 @@ func (p *Prover) RotateProof(args *RotateArgs) (*EvmProof[message.RotateInput], Spec Spec `json:"spec"` } var resp ProverResponse + err = p.proverClient.CallFor(context.Background(), &resp, "genEvmProof_CommitteeUpdateCompressed", rotateArgs{Update: ByteArrayToU16Array(updateSzz), Spec: args.Spec}) if err != nil { return nil, err @@ -154,19 +142,9 @@ func (p *Prover) RotateProof(args *RotateArgs) (*EvmProof[message.RotateInput], log.Info().Msgf("Generated rotate proof") - comm, _ := new(big.Int).SetString(resp.Commitment[2:], 16) - accumulator := [12]*big.Int{} - for i, value := range resp.Accumulator { - accumulator[i], _ = new(big.Int).SetString(value[2:], 16) - } - - proof := &EvmProof[message.RotateInput]{ + proof := &EvmProof[struct{}]{ Proof: U16ArrayToByteArray(resp.Proof), - Input: message.RotateInput{ - SyncCommitteeSSZ: syncCommiteeRoot, - SyncCommitteePoseidon: comm, - Accumulator: accumulator, - }, + Input: struct{}{}, } return proof, nil } @@ -247,13 +225,3 @@ func (p *Prover) pubkeysSSZ(pubkeys [512][48]byte) []byte { } return pubkeysSSZ } - -func (p *Prover) pubkeysRoot(pubkeys [512][48]byte) ([32]byte, error) { - h := ssz.NewHasher() - subIndx := h.Index() - for _, key := range pubkeys { - h.PutBytes(key[:]) - } - h.Merkleize(subIndx) - return h.HashRoot() -} diff --git a/mock/executor.go b/mock/executor.go index 2980288..a8f41fd 100644 --- a/mock/executor.go +++ b/mock/executor.go @@ -41,18 +41,18 @@ func (m *MockProofSubmitter) EXPECT() *MockProofSubmitterMockRecorder { } // Rotate mocks base method. -func (m *MockProofSubmitter) Rotate(domainID uint8, rotateInput message.RotateInput, rotateProof []byte, stepInput message.SyncStepInput, stepProof []byte, opts transactor.TransactOptions) (*common.Hash, error) { +func (m *MockProofSubmitter) Rotate(domainID uint8, rotateProof []byte, stepInput message.SyncStepInput, stepProof []byte, opts transactor.TransactOptions) (*common.Hash, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Rotate", domainID, rotateInput, rotateProof, stepInput, stepProof, opts) + ret := m.ctrl.Call(m, "Rotate", domainID, rotateProof, stepInput, stepProof, opts) ret0, _ := ret[0].(*common.Hash) ret1, _ := ret[1].(error) return ret0, ret1 } // Rotate indicates an expected call of Rotate. -func (mr *MockProofSubmitterMockRecorder) Rotate(domainID, rotateInput, rotateProof, stepInput, stepProof, opts any) *gomock.Call { +func (mr *MockProofSubmitterMockRecorder) Rotate(domainID, rotateProof, stepInput, stepProof, opts any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rotate", reflect.TypeOf((*MockProofSubmitter)(nil).Rotate), domainID, rotateInput, rotateProof, stepInput, stepProof, opts) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Rotate", reflect.TypeOf((*MockProofSubmitter)(nil).Rotate), domainID, rotateProof, stepInput, stepProof, opts) } // Step mocks base method. diff --git a/mock/step.go b/mock/step.go index 7e40661..a8b90e3 100644 --- a/mock/step.go +++ b/mock/step.go @@ -99,10 +99,10 @@ func (mr *MockProverMockRecorder) RotateArgs(epoch any) *gomock.Call { } // RotateProof mocks base method. -func (m *MockProver) RotateProof(args *prover.RotateArgs) (*prover.EvmProof[message.RotateInput], error) { +func (m *MockProver) RotateProof(args *prover.RotateArgs) (*prover.EvmProof[struct{}], error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RotateProof", args) - ret0, _ := ret[0].(*prover.EvmProof[message.RotateInput]) + ret0, _ := ret[0].(*prover.EvmProof[struct{}]) ret1, _ := ret[1].(error) return ret0, ret1 }