From f03eb7e3503ec2261e9259cec849a96cffb9f7f5 Mon Sep 17 00:00:00 2001 From: Salman Pathan Date: Wed, 24 Apr 2024 19:01:29 +0530 Subject: [PATCH] Use correct jobs precompile address and update interface contract (#622) --- precompiles/jobs/Jobs.sol | 47 ++++++++++++++---------------- precompiles/jobs/src/lib.rs | 5 ++++ runtime/testnet/src/precompiles.rs | 2 +- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/precompiles/jobs/Jobs.sol b/precompiles/jobs/Jobs.sol index fb11cd3c9..d406ddc44 100644 --- a/precompiles/jobs/Jobs.sol +++ b/precompiles/jobs/Jobs.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.3; /// @dev The Jobs contract's address. -address constant JOBS_ADDRESS = 0x0000000000000000000000000000000000000820; +address constant JOBS_ADDRESS = 0x0000000000000000000000000000000000000814; /// @dev The Jobs contract's instance. Jobs constant JOBS_CONTRACT = Jobs(JOBS_ADDRESS); @@ -10,7 +10,7 @@ Jobs constant JOBS_CONTRACT = Jobs(JOBS_ADDRESS); /// @author Webb Inc /// @title Pallet Jobs Interface /// @title The interface through which solidity contracts will interact with the jobs pallet -/// @custom:address 0x0000000000000000000000000000000000000820 +/// @custom:address 0x0000000000000000000000000000000000000814 interface Jobs { /// Submit a DKG phase one job @@ -19,9 +19,12 @@ interface Jobs { /// @notice Submits a job for the first phase of the Distributed Key Generation (DKG) process. /// /// @param expiry The expiration timestamp for the submitted job. + /// @param ttl The time-to-live for the submitted job. /// @param participants An array of Ethereum addresses representing participants in the DKG. /// @param threshold The minimum number of participants required for the DKG to succeed. - /// @param permitted_caller The Ethereum address of the permitted caller initiating the job submission. + /// @param roleType The role type identifier. + /// @param permittedCaller The Ethereum address of the permitted caller initiating the job submission. + /// @param hdWallet A boolean indicating whether the job is for an HD wallet. /// /// @dev This function initiates the first phase of a DKG process, allowing participants to collaborate /// in generating cryptographic keys. The submitted job includes information such as the expiration time, @@ -30,9 +33,12 @@ interface Jobs { /// function submitDkgPhaseOneJob( uint64 expiry, + uint64 ttl, address[] memory participants, uint8 threshold, - address permitted_caller + uint16 roleType, + address permittedCaller, + bool hdWallet ) external; /// @custom:selector @@ -40,9 +46,10 @@ interface Jobs { /// @notice Submits a job for the second phase of the Distributed Key Generation (DKG) process. /// /// @param expiry The expiration timestamp for the submitted job. - /// @param phase_one_id The identifier of the corresponding phase one DKG job. + /// @param ttl The time-to-live for the submitted job. + /// @param phaseOneId The identifier of the corresponding phase one DKG job. /// @param submission The byte array containing the data submission for the DKG phase two. - /// @param derivation_path The byte array containing the derivation path for the DKG phase two. + /// @param derivationPath The byte array containing the derivation path for the DKG phase two. /// /// @dev This function initiates the second phase of a Distributed Key Generation process, building upon /// the results of a prior phase one submission. The submitted job includes an expiration time, the identifier @@ -51,29 +58,19 @@ interface Jobs { /// function submitDkgPhaseTwoJob( uint64 expiry, - uint32 phase_one_id, + uint64 ttl, + uint64 phaseOneId, bytes memory submission, - bytes memory derivation_path - ) external; - - /// @custom:selector - /// - /// @notice Initiates the withdrawal of accumulated rewards for the caller. - /// - /// @dev This function allows the caller to withdraw any rewards accumulated through participation in - /// various activities or processes within the contract. The withdrawal process is triggered by invoking - /// this function, and the caller receives their entitled rewards accordingly. - /// - function withdrawRewards( + bytes memory derivationPath ) external; /// @custom:selector /// /// @notice Sets a new permitted caller for a specific job type identified by the given key and job ID. /// - /// @param role_type An identifier specifying the role type to update the permitted caller for. - /// @param job_id The unique identifier of the job for which the permitted caller is being updated. - /// @param new_permitted_caller The Ethereum address of the new permitted caller. + /// @param roleType An identifier specifying the role type to update the permitted caller for. + /// @param jobId The unique identifier of the job for which the permitted caller is being updated. + /// @param newPermittedCaller The Ethereum address of the new permitted caller. /// /// @dev This function provides flexibility in managing permitted callers for different job types. /// The caller can specify the job key, job ID, and the new Ethereum address that will be granted permission @@ -81,8 +78,8 @@ interface Jobs { /// align with the ongoing processes and permissions within the contract. /// function setPermittedCaller( - uint16 role_type, - uint32 job_id, - address new_permitted_caller + uint16 roleType, + uint32 jobId, + address newPermittedCaller ) external; } diff --git a/precompiles/jobs/src/lib.rs b/precompiles/jobs/src/lib.rs index 37cae1f5b..2f515271c 100644 --- a/precompiles/jobs/src/lib.rs +++ b/precompiles/jobs/src/lib.rs @@ -82,6 +82,9 @@ where /// /// Returns an `EvmResult`, indicating the success or failure of the operation. #[precompile::public("submitDkgPhaseOneJob(uint64,uint64,address[],uint8,uint16,address,bool)")] + #[precompile::public( + "submit_dkg_phase_one_job(uint64,uint64,address[],uint8,uint16,address,bool)" + )] fn submit_dkg_phase_one_job( handle: &mut impl PrecompileHandle, expiry: BlockNumber, @@ -173,6 +176,7 @@ where /// /// Returns an `EvmResult`, indicating the success or failure of the operation. #[precompile::public("submitDkgPhaseTwoJob(uint64,uint64,uint64,bytes,bytes)")] + #[precompile::public("submit_dkg_phase_two_job(uint64,uint64,uint64,bytes,bytes)")] fn submit_dkg_phase_two_job( handle: &mut impl PrecompileHandle, expiry: BlockNumber, @@ -258,6 +262,7 @@ where /// /// Returns an `EvmResult`, indicating the success or failure of the operation. #[precompile::public("setPermittedCaller(uint16,uint64,address)")] + #[precompile::public("set_permitted_caller(uint16,uint64,address)")] fn set_permitted_caller( handle: &mut impl PrecompileHandle, role_type: u16, diff --git a/runtime/testnet/src/precompiles.rs b/runtime/testnet/src/precompiles.rs index 66abaa337..8ff7bc213 100644 --- a/runtime/testnet/src/precompiles.rs +++ b/runtime/testnet/src/precompiles.rs @@ -124,5 +124,5 @@ pub type WebbPrecompilesAt = ( pub type WebbPrecompiles = PrecompileSetBuilder< R, - (PrecompilesInRangeInclusive<(AddressU64<1>, AddressU64<4095>), WebbPrecompilesAt>,), + (PrecompilesInRangeInclusive<(AddressU64<1>, AddressU64<2095>), WebbPrecompilesAt>,), >;