Conversation
.circleci/config.yml
Outdated
- run: | ||
name: Install dependencies | ||
working_directory: ~/project/solidity | ||
command: npm install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm ci
is the jam here.
lint: | ||
jobs: | ||
- setup_github_package_registry: | ||
context: github-package-registry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don't need this anymore since the repo is open, though not certain about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, Unable to authenticate, need: Basic realm="GitHub Package Registry"
😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this happened for a couple of reasons:
- You need to update
package-lock
by runningnpm i
. - You need to drop
.npmrc
. - You need to drop the
publishConfig
.
However, I'll do all of this stuff in one step when I handle deployment later today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments around the prettier config for JS.
solidity/.prettierrc.yaml
Outdated
@@ -0,0 +1,2 @@ | |||
semi: false | |||
trailingComma: "all" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't have a custom .prettierrc
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I just copy-pasted it from tbtc 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it predates my adding prettier to eslint and I haven't migrated it yet 😬
"security/no-call-value": "off", | ||
"security/no-inline-assembly": "off" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider unifying these rules at the keep
level, as a side note. Haven't peeked into this yet, so not a blocking note or anything.
@@ -1,3 +1,4 @@ | |||
/* solium-disable function-order */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason for this? I would kind of rather just go with the function order in our linter. Fewer toggles is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tried to place the functions in a logical order as they may be used in the flow. But yeah, sure I can rearrange the functions order to satisfy solium.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually get this and it tends to be my first preference during initial dev, but there are some strong arguments for function ordering for visibility. Diligence also flagged this possibility. My main thing is I'd rather either go all in on ignoring this, or not ignore it ever heh. I'm already twitchy over the other exceptions we have to solium.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I like the idea to conform to the rules and order the functions accordingly, there is one place where IMO it would be better to disable the check.
It's in BondedECDSAKeepVendor
contract where we have a long list of getters/setters pairs where getters are public and setters internal:
keep-ecdsa/solidity/contracts/BondedECDSAKeepVendor.sol
Lines 158 to 260 in d7bf095
/// @dev Returns the current implementation. Implements function from `Proxy` | |
/// contract. | |
/// @return Address of the current implementation | |
function _implementation() internal view returns (address impl) { | |
bytes32 slot = IMPLEMENTATION_SLOT; | |
/* solium-disable-next-line */ | |
assembly { | |
impl := sload(slot) | |
} | |
} | |
/// @notice Sets the address of the current implementation. | |
/// @param _implementation Address representing the new implementation to | |
/// be set. | |
function setImplementation(address _implementation) internal { | |
bytes32 slot = IMPLEMENTATION_SLOT; | |
/* solium-disable-next-line */ | |
assembly { | |
sstore(slot, _implementation) | |
} | |
} | |
function upgradeTimeDelay() | |
public | |
view | |
returns (uint256 _upgradeTimeDelay) | |
{ | |
bytes32 position = UPGRADE_TIME_DELAY_SLOT; | |
/* solium-disable-next-line */ | |
assembly { | |
_upgradeTimeDelay := sload(position) | |
} | |
} | |
function setUpgradeTimeDelay(uint256 _upgradeTimeDelay) internal { | |
bytes32 position = UPGRADE_TIME_DELAY_SLOT; | |
/* solium-disable-next-line */ | |
assembly { | |
sstore(position, _upgradeTimeDelay) | |
} | |
} | |
function newImplementation() | |
public | |
view | |
returns (address _newImplementation) | |
{ | |
bytes32 position = UPGRADE_IMPLEMENTATION_SLOT; | |
/* solium-disable-next-line */ | |
assembly { | |
_newImplementation := sload(position) | |
} | |
} | |
function setNewImplementation(address _newImplementation) internal { | |
bytes32 position = UPGRADE_IMPLEMENTATION_SLOT; | |
/* solium-disable-next-line */ | |
assembly { | |
sstore(position, _newImplementation) | |
} | |
} | |
function upgradeInitiatedTimestamp() | |
public | |
view | |
returns (uint256 _upgradeInitiatedTimestamp) | |
{ | |
bytes32 position = UPGRADE_INIT_TIMESTAMP_SLOT; | |
/* solium-disable-next-line */ | |
assembly { | |
_upgradeInitiatedTimestamp := sload(position) | |
} | |
} | |
function setUpgradeInitiatedTimestamp(uint256 _upgradeInitiatedTimestamp) | |
internal | |
{ | |
bytes32 position = UPGRADE_INIT_TIMESTAMP_SLOT; | |
/* solium-disable-next-line */ | |
assembly { | |
sstore(position, _upgradeInitiatedTimestamp) | |
} | |
} | |
/// @notice The admin slot. | |
/// @return The contract owner's address. | |
function admin() public view returns (address adm) { | |
bytes32 slot = ADMIN_SLOT; | |
/* solium-disable-next-line */ | |
assembly { | |
adm := sload(slot) | |
} | |
} | |
/// @dev Sets the address of the proxy admin. | |
/// @param _newAdmin Address of the new proxy admin. | |
function setAdmin(address _newAdmin) internal { | |
bytes32 slot = ADMIN_SLOT; | |
/* solium-disable-next-line */ | |
assembly { | |
sstore(slot, _newAdmin) | |
} | |
} |
solidity/package.json
Outdated
@@ -43,7 +52,14 @@ | |||
"@truffle/hdwallet-provider": "^1.0.25", | |||
"bn-chai": "^1.0.1", | |||
"chai": "^4.2.0", | |||
"eslint": "^6.8.0", | |||
"eslint-config-keep": "github:keep-network/eslint-config-keep", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's anchor this to a version tag.
solidity/package.json
Outdated
@@ -43,7 +52,14 @@ | |||
"@truffle/hdwallet-provider": "^1.0.25", | |||
"bn-chai": "^1.0.1", | |||
"chai": "^4.2.0", | |||
"eslint": "^6.8.0", | |||
"eslint-config-keep": "github:keep-network/eslint-config-keep", | |||
"eslint-config-prettier": "^6.10.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Burn it please :) eslint-config-keep
should handle this. I realize it doesn't currently deal with the Solidity plugin, but we still need to explicitly include the prettier dependency here anyway.
My suggestion:
- Kill
eslint-config-prettier
. Leteslint-config-keep#0.3.0
handle the JS side of prettier. You still need the prettier dependency below for this, but you lose the explicitprettier
invocation forlint:js
andlint:fix:js
. - Continue to pull in
prettier-plugin-solidity
and run prettier in the:sol
scripts.
I also want to see if I can pull prettier into solium's config, but that seems unlikely. There may be room to set something up with our core eslint config and Solidity though, TBD.
/// @param _keepBonding Address of the KeepBonding contract. | ||
/// @param _keepFactory Address of the BondedECDSAKeepFactory that created | ||
/// this keep. | ||
function initialize( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving this function below external
ones hurts me because this is like a constructor that we use in the factory pattern.
We no longer need it as required repos are public
This reverts commit c453285.
It is included in eslint-config-keep#0.3.0
const RegistryAddress = "0x9aF7d664E6d7DB318c6BdE54ED77A7D99361F539" | ||
const TokenStakingAddress = "0x602c5f7d11eb786E14cDfBafe34E70c0b6717a8c" | ||
const RandomBeaconAddress = "0xB901EDDE70EcB59c1243f404a238fd97B78f1F54" | ||
const TBTCSystemAddress = "0x065c3Ab1D2cb67c70dAC17Cf3BD4B8A165ffceFa" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this on purpose? <_<
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh boy, no! It's fixed in 43bfb27.
Thanks for noticing that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok… Let's do this crazy thing.
In this PR we:
Closes #42