-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renamed SafeCore to Anchor #549
Renamed SafeCore to Anchor #549
Conversation
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 one 🏎💨
Just some comments on wording and indentation 👍
contracts/gateway/Anchor.sol
Outdated
* @notice SafeCore stores another chain's state roots. It stores the address of | ||
* the co-core, which will be the safe core on the other chain. State | ||
* @notice Anchor stores another chain's state roots. It stores the address of | ||
* the co-core, which will be the anchor on the other chain. State |
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.
* the co-core, which will be the anchor on the other chain. State | |
* the co-anchor, which will be the anchor on the other chain. State |
@@ -41,8 +41,8 @@ contract('SafeCore.getLatestStateRootBlockHeight()', function (accounts) { | |||
blockHeight = new BN(5); | |||
stateRoot = web3.utils.sha3("dummy_state_root"); | |||
membersManager = await MockMembersManager.new(owner, worker); | |||
|
|||
safeCore = await SafeCore.new( | |||
|
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.
@@ -46,8 +46,8 @@ contract('SafeCore.setCoCoreAddress()', function (accounts) { | |||
stateRoot = web3.utils.sha3("dummy_state_root"); | |||
membersManager = await MockMembersManager.new(owner, worker); | |||
coCoreAddress = accounts[6]; | |||
|
|||
safeCore = await SafeCore.new( | |||
|
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.
@@ -61,7 +61,7 @@ contract('SafeCore.setCoCoreAddress()', function (accounts) { | |||
coCoreAddress = NullAddress; | |||
|
|||
await Utils.expectRevert( | |||
safeCore.setCoCoreAddress(coCoreAddress, { from: owner }), | |||
anchor.setCoCoreAddress(coCoreAddress, { from: owner }), |
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.
In many places:
anchor.setCoCoreAddress(coCoreAddress, { from: owner }), | |
anchor.setCoCoreAddress(coCoreAddress, { from: owner }), |
contracts/gateway/Anchor.sol
Outdated
* @notice SafeCore stores another chain's state roots. It stores the address of | ||
* the co-core, which will be the safe core on the other chain. State | ||
* @notice Anchor stores another chain's state roots. It stores the address of | ||
* the co-core, which will be the anchor on the other chain. State | ||
* roots are exchanged bidirectionally between the core and the co-core |
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.
* roots are exchanged bidirectionally between the core and the co-core | |
* roots are exchanged bidirectionally between the anchor and the co-anchor |
…,modified unit test cases and removed reference of safe core
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.
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.
Almost done. 🙌
Some minor fixes are required.
Committed
should also be changed to Anchored
in various files.
Also fix terminology in below contracts:
- StateRootInterface
- GatewayLib
- GatewayBase
- MockAnchor L18, L42
I am not sure if StateRootInterface _core,
should be call as StateRootInterface _anchor
.
contracts/gateway/Anchor.sol
Outdated
@@ -184,7 +184,7 @@ contract SafeCore is StateRootInterface, Organized { | |||
// Input block height should be valid |
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.
Please add .
in the comments.
contracts/test/core/MockAnchor.sol
Outdated
|
||
/* Public functions */ | ||
|
||
/** | ||
* @notice Contract constructor | ||
* @notice Contract constructor. | ||
* | ||
* @param _remoteChainId _remoteChainId is the chain id of the chain that | ||
* this core tracks. |
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.
* this core tracks. | |
* this anchor tracks. |
@@ -42,7 +42,7 @@ contract MockGatewayBase is GatewayBase { | |||
* | |||
* @dev proveGateway can be called by anyone to verify merkle proof of | |||
* gateway/co-gateway contract address. Trust factor is brought by | |||
* stateRoots mapping. stateRoot is committed in commitStateRoot | |||
* stateRoots mapping. stateRoot is committed in anchorStateRoot |
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.
* stateRoots mapping. stateRoot is committed in anchorStateRoot | |
* stateRoots mapping. stateRoot is anchored in anchorStateRoot |
|
||
}); | ||
|
||
it('should return the latest committed state root block height', async () => { |
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.
it('should return the latest committed state root block height', async () => { | |
it('should return the latest anchored state root block height', async () => { |
|
||
}); | ||
|
||
it('should return the latest committed state root', async () => { |
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.
it('should return the latest committed state root', async () => { | |
it('should return the latest anchored state root', async () => { |
…m/gulshanvasnani/mosaic-contracts into gulshan/gh_537_safecore_to_anchor
…afecore_to_anchor # Conflicts: # contracts/gateway/Anchor.sol # contracts/test/core/MockAnchor.sol # test/gateway/gateway_base/prove_gateway.js # test/gateway/safe_core/commit_state_root.js # test/gateway/safe_core/constructor.js # test/gateway/safe_core/get_latest_state_root_block_height.js # test/gateway/safe_core/get_remote_chainId.js # test/gateway/safe_core/get_state_root.js # test/gateway/safe_core/set_co_core_address.js
I don't think the gateway code should be aware whether it's an anchor or a core. The gateways should only care about the state root interface. E.g. "state root provider". Or am I missing something? @gulshanvasnani @sarvesh-ost |
What should be the name of the variable which represents contract instance implementing |
Yes, we do. As it can be both. It can be an anchor as well as a core. In fact, it can be anything that implements the state root interface. It's just that in the past only different kinds of cores implemented that interface. Now that the safe core is called anchor, we need a more general name for the variable of that interface type. |
…afecore_to_anchor
…m/gulshanvasnani/mosaic-contracts into gulshan/gh_537_safecore_to_anchor
Name can be stateRoots. |
…afecore_to_anchor
…m/gulshanvasnani/mosaic-contracts into gulshan/gh_537_safecore_to_anchor
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.
Hey @gulshanvasnani,
this looks already much better, but unfortunately you went over the top when it comes to renaming things...
All the contracts must be checked again, as there are many places where it is now called anchor, bit should be more general.
All the tests must be checked again, as there are many places where it is now called anchor, but should be more general.
I added a relevant comment to some of the affected files.
See also some other minor comments in-line.
…erface variable in constructor and corrected js styling
…m/gulshanvasnani/mosaic-contracts into gulshan/gh_537_safecore_to_anchor
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.
Almost there 🧗🏽♂️
9300879
to
8735258
Compare
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.
LGTM ⚓️👍🚜
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.
PR does following :-
Fixes: #537