From b54c90f44f9be4766fe284d6361845455cf6dfcf Mon Sep 17 00:00:00 2001 From: JK Date: Fri, 1 Nov 2024 08:41:05 +0100 Subject: [PATCH] npm run lint:fix --- contracts/interfaces/ISFC.sol | 7 ++++++- contracts/sfc/NodeDriver.sol | 7 ++++++- contracts/sfc/NodeDriverAuth.sol | 7 ++++++- contracts/sfc/SFC.sol | 10 ++++++++-- test/NodeDriver.ts | 14 +++++--------- test/SFC.ts | 28 +++++++--------------------- 6 files changed, 38 insertions(+), 35 deletions(-) diff --git a/contracts/interfaces/ISFC.sol b/contracts/interfaces/ISFC.sol index fabee0c..dda7107 100644 --- a/contracts/interfaces/ISFC.sol +++ b/contracts/interfaces/ISFC.sol @@ -163,7 +163,12 @@ interface ISFC { address _owner ) external; - function setGenesisValidator(address auth, uint256 validatorID, bytes calldata pubkey, uint256 createdTime) external; + function setGenesisValidator( + address auth, + uint256 validatorID, + bytes calldata pubkey, + uint256 createdTime + ) external; function setGenesisDelegation(address delegator, uint256 toValidatorID, uint256 stake) external; diff --git a/contracts/sfc/NodeDriver.sol b/contracts/sfc/NodeDriver.sol index 81c4da9..c8979d6 100644 --- a/contracts/sfc/NodeDriver.sol +++ b/contracts/sfc/NodeDriver.sol @@ -91,7 +91,12 @@ contract NodeDriver is Initializable { // Methods which are called only by the node - function setGenesisValidator(address auth, uint256 validatorID, bytes calldata pubkey, uint256 createdTime) external onlyNode { + function setGenesisValidator( + address auth, + uint256 validatorID, + bytes calldata pubkey, + uint256 createdTime + ) external onlyNode { backend.setGenesisValidator(auth, validatorID, pubkey, createdTime); } diff --git a/contracts/sfc/NodeDriverAuth.sol b/contracts/sfc/NodeDriverAuth.sol index f95bf0b..fe87a3d 100644 --- a/contracts/sfc/NodeDriverAuth.sol +++ b/contracts/sfc/NodeDriverAuth.sol @@ -119,7 +119,12 @@ contract NodeDriverAuth is Initializable, Ownable { driver.updateValidatorPubkey(validatorID, pubkey); } - function setGenesisValidator(address auth, uint256 validatorID, bytes calldata pubkey, uint256 createdTime) external onlyDriver { + function setGenesisValidator( + address auth, + uint256 validatorID, + bytes calldata pubkey, + uint256 createdTime + ) external onlyDriver { sfc.setGenesisValidator(auth, validatorID, pubkey, createdTime); } diff --git a/contracts/sfc/SFC.sol b/contracts/sfc/SFC.sol index cf286a9..0cce6b2 100644 --- a/contracts/sfc/SFC.sol +++ b/contracts/sfc/SFC.sol @@ -62,7 +62,8 @@ contract SFC is Initializable, Ownable, Version { } // delegator => validator ID => withdrawal ID => withdrawal request - mapping(address delegator => mapping(uint256 validatorID => mapping(uint256 wrID => WithdrawalRequest))) public getWithdrawalRequest; + mapping(address delegator => mapping(uint256 validatorID => mapping(uint256 wrID => WithdrawalRequest))) + public getWithdrawalRequest; // delegator => validator ID => current stake mapping(address delegator => mapping(uint256 validatorID => uint256 stake)) public getStake; @@ -340,7 +341,12 @@ contract SFC is Initializable, Ownable, Version { node.updateMinGasPrice(minGasPrice); } - function setGenesisValidator(address auth, uint256 validatorID, bytes calldata pubkey, uint256 createdTime) external onlyDriver { + function setGenesisValidator( + address auth, + uint256 validatorID, + bytes calldata pubkey, + uint256 createdTime + ) external onlyDriver { _rawCreateValidator( auth, validatorID, diff --git a/test/NodeDriver.ts b/test/NodeDriver.ts index f9a25c1..9d55595 100644 --- a/test/NodeDriver.ts +++ b/test/NodeDriver.ts @@ -119,12 +119,7 @@ describe('NodeDriver', () => { it('Should revert when not node', async function () { const account = ethers.Wallet.createRandom(); await expect( - this.nodeDriver.setGenesisValidator( - account, - 1, - account.publicKey, - Date.now(), - ), + this.nodeDriver.setGenesisValidator(account, 1, account.publicKey, Date.now()), ).to.be.revertedWithCustomError(this.nodeDriver, 'NotNode'); }); }); @@ -138,9 +133,10 @@ describe('NodeDriver', () => { describe('Set genesis delegation', () => { it('Should revert when not node', async function () { const account = ethers.Wallet.createRandom(); - await expect( - this.nodeDriver.setGenesisDelegation(account, 1, 100), - ).to.be.revertedWithCustomError(this.nodeDriver, 'NotNode'); + await expect(this.nodeDriver.setGenesisDelegation(account, 1, 100)).to.be.revertedWithCustomError( + this.nodeDriver, + 'NotNode', + ); }); }); diff --git a/test/SFC.ts b/test/SFC.ts index 692e7c9..6041bfc 100644 --- a/test/SFC.ts +++ b/test/SFC.ts @@ -56,12 +56,7 @@ describe('SFC', () => { beforeEach(async function () { const validator = ethers.Wallet.createRandom(); await this.sfc.enableNonNodeCalls(); - await this.sfc.setGenesisValidator( - validator.address, - 1, - validator.publicKey, - Date.now(), - ); + await this.sfc.setGenesisValidator(validator.address, 1, validator.publicKey, Date.now()); await this.sfc.deactivateValidator(1, 1 << 3); await this.sfc.disableNonNodeCalls(); }); @@ -312,12 +307,7 @@ describe('SFC', () => { it('Should revert when setGenesisValidator is not called not node', async function () { const validator = ethers.Wallet.createRandom(); await expect( - this.sfc.setGenesisValidator( - validator, - 1, - validator.publicKey, - Date.now(), - ), + this.sfc.setGenesisValidator(validator, 1, validator.publicKey, Date.now()), ).to.be.revertedWithCustomError(this.sfc, 'NotDriverAuth'); }); @@ -970,19 +960,15 @@ describe('SFC', () => { it('Should revert when calling setGenesisValidator if not NodeDriver', async function () { const key = ethers.Wallet.createRandom().publicKey; await expect( - this.nodeDriverAuth.setGenesisValidator( - this.delegator, - 1, - key, - Date.now(), - ), + this.nodeDriverAuth.setGenesisValidator(this.delegator, 1, key, Date.now()), ).to.be.revertedWithCustomError(this.nodeDriverAuth, 'NotDriver'); }); it('Should revert when calling setGenesisDelegation if not NodeDriver', async function () { - await expect( - this.nodeDriverAuth.setGenesisDelegation(this.delegator, 1, 100), - ).to.be.revertedWithCustomError(this.nodeDriverAuth, 'NotDriver'); + await expect(this.nodeDriverAuth.setGenesisDelegation(this.delegator, 1, 100)).to.be.revertedWithCustomError( + this.nodeDriverAuth, + 'NotDriver', + ); }); it('Should revert when calling deactivateValidator if not NodeDriver', async function () {