Skip to content

Commit

Permalink
Upgrade tests (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-CZ committed Sep 13, 2024
1 parent 48fc1fc commit e760bbc
Show file tree
Hide file tree
Showing 4 changed files with 468 additions and 551 deletions.
4 changes: 4 additions & 0 deletions contracts/sfc/SFC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ contract SFC is SFCBase, Version {
_delegate(libAddress);
}

receive() external payable {
revert("transfers not allowed");
}

/*
Getters
*/
Expand Down
2 changes: 1 addition & 1 deletion contracts/sfc/SFCLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ contract SFCLib is SFCBase {

function createValidator(bytes calldata pubkey) external payable {
require(msg.value >= c.minSelfStake(), "insufficient self-stake");
require(pubkey.length == 66 && pubkey[0] == 0xc0, "malformed pubkey");
require(pubkey.length > 0, "empty pubkey");
require(pubkeyHashToValidatorID[keccak256(pubkey)] == 0, "already used");
_createValidator(msg.sender, pubkey);
_delegate(msg.sender, lastValidatorID, msg.value);
Expand Down
4 changes: 2 additions & 2 deletions test/NodeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import {
NodeDriver,
NodeDriverAuth,
SFCI,
SFCLib
SFCLib, UnitTestSFC
} from "../typechain-types";

describe('NodeDriver', () => {
const fixture = async () => {
const [ owner, nonOwner ] = await ethers.getSigners();
const sfc: SFCI = await ethers.deployContract("UnitTestSFC");
const sfc: UnitTestSFC = await ethers.deployContract("UnitTestSFC");
const nodeDriver: NodeDriver = await ethers.deployContract("NodeDriver");
const evmWriter: EVMWriter = await ethers.deployContract("StubEvmWriter");
const nodeDriverAuth: NodeDriverAuth = await ethers.deployContract("NodeDriverAuth");
Expand Down
Loading

0 comments on commit e760bbc

Please sign in to comment.