-
Notifications
You must be signed in to change notification settings - Fork 5
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.
LGTM. The reason I request the change is because to wrap it up we should remove
function initGenesisEpoch(uint64 genesisEpoch) external systemActorOnly { |
topDownGenesisEpoch
for something, we can set it directly when the first proof of finality is committed, but it can be kind of a mess having to also call this initGenesisEpoch
implicitly when we are actually doing it implicitly when committing finality.
We can discuss sync if it is not clear.
src/lib/LibGateway.sol
Outdated
revert ValidatorWeightIsZero(); | ||
} | ||
|
||
s.validatorSet[s.validatorNonce][validatorAddress] = validatorWeight; |
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 don't think we need to address it immediately, but we will need to garbage collect the membership info instead of keeping all the history. We may be able to garbage collect outdated info.
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 added another variable to track the block height of the last committed height, we can commit and delete at the same time. I can implement this logic in follow up PRs.
@cryptoAtwill, we should also remove all the code around |
@adlrocha sounds good, I will do all those deletion related work in a PR on top of this so that the changes are not mixed in this PR. |
@adlrocha I will create a separate PR to delete other methods, such as |
cd0cc1a
to
e4172aa
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.
@cryptoAtwill, few more changes before we merge, I can address them myself if you want. Let me know.
/// This functions verifies that the checkpoint is valid before | ||
/// propagating it for commitment to the IPC gateway. It expects at least | ||
/// votes from 2/3 of miners with collateral. | ||
function submitCheckpoint(BottomUpCheckpoint calldata checkpoint) external; |
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 don't think we should remove submitCheckpoint
. It will change a lot, but will still be necessary with the new design (can you revert this one)?
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.
added back
@@ -104,52 +104,6 @@ contract SubnetActorManagerFacet is ISubnetActor, SubnetActorModifiers, Reentran | |||
IGateway(s.ipcGatewayAddr).kill(); | |||
} | |||
|
|||
/// @notice methods that allows a validator to submit a checkpoint (batch of messages) and vote for it with it's own voting power. | |||
/// @param checkpoint - the batch messages data | |||
function submitCheckpoint(BottomUpCheckpoint calldata checkpoint) external { |
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 remove this one for the same of above, bottom up checkpoints will be re-designed (without votings) but we still need it.
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.
added back
using StorableMsgHelper for StorableMsg; | ||
|
||
/// @notice submit a checkpoint in the gateway. Called from a subnet once the checkpoint is voted for and reaches majority | ||
function commitChildCheck(BottomUpCheckpoint calldata commit) external { |
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 also keep this one in the gateway.
|
||
subnet.prevCheckpoint = commit; | ||
/// @notice commit the ipc parent finality into storage | ||
function commitParentFinality( |
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.
Why is this method not in the GatewayActor interface?
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 added this into the interface already
|
||
subnet.prevCheckpoint = commit; | ||
/// @notice commit the ipc parent finality into storage | ||
function commitParentFinality( |
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.
Could you provide more information about that function? What is the relation between finality data and validators and why are these validators added to membership?
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.
Right, I think this is the mechanism of the top down checkpointing in fendermint
, not sure if it suitable to place the docs here.
But long story short, membership information is pulled from the parent ipc-agent
or node
in fendermint
. Then fendermint
call this function implicitly.
@@ -15,6 +15,10 @@ struct GatewayActorStorage { | |||
/// @notice a mapping of block number to cross messages | |||
/// SubnetID => blockNumber => messages | |||
mapping(bytes32 => mapping(uint256 => CrossMsg[])) topDownMsgs; | |||
/// @notice The parent finalities. Key is the block number, value is the finality struct. | |||
mapping(uint256 => ParentFinality) finalitiesMap; |
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 it that fine we do not have a relation between committed ParentFinality
and validators that committed it? Do we need it?
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.
Not really. We just need the block height to parent finality.
|
||
subnet.prevCheckpoint = commit; | ||
/// @notice commit the ipc parent finality into storage | ||
function commitParentFinality( |
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.
Where is the proof (multisig) that this was committed by these validators?
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.
For top down parent finality, we dont really need mutisig.
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.
Thank you for the changes, 🚢
Initial attempt to store and retrieve IPC parent finality in gateway contract. The updates are as follows:
setMembership
toGatewayLib
and remove the corresponding external function call inGatewayManagerFacet
.commitParentFinality
toRouterFacet
.queryParentFinality
toGatewayGetterFacet
.In follow up PR will clean up the code by removing submit top down and bottom up checkpoint and all their internal functions.