Conversation
|
@raulk Regarding |
|
@raulk So in summary, the high level flow diagram is:
A few questions I have:
|
| /// @notice Called by the subnet manager contract to instruct the rewarder to process the subnet summary and | ||
| /// disburse any relevant rewards. | ||
| /// The | ||
| /// @dev This method should revert if the summary is invalid; this will cause the |
There was a problem hiding this comment.
this will cause the what will it cause? And what criteria makes a summary invalid?
| /// @dev The block range the activity summary spans; these are the local heights of the start and the end, inclusive. | ||
| uint256[2] blockRange; | ||
| /// @dev The validators whose activity we're reporting about. | ||
| address[] validators; |
There was a problem hiding this comment.
Just curious why 2 arrays instead of a mapping?
There was a problem hiding this comment.
I understand the arrays if when distributing the rewards we have to process them all but I agree with @cryptoAtwill, validators could claim their own rewards, so a mapping would make sense.
There was a problem hiding this comment.
This is a DTO, so mapping cannot, but I have updated the data struct slightly for storage
| address[] validators; | ||
| /// @dev The number of blocks committed by each validator in the position they appear in the validators array. | ||
| /// If there is a configuration change applied at this checkpoint, this carries information about the _old_ validator set. | ||
| uint64[] blocksCommitted; |
There was a problem hiding this comment.
Could we have a metadata bytes typed member here to allow to pass additional info? or are there other alternatives for customization that are still in the making?
There was a problem hiding this comment.
Nice suggestion @JulissaDantes. @raulk, in particular, we have additional information we'd like to propagate up the hierarchy. I know we had talked about specific "zones" for this type of information in the checkpoints at one point. What is your thinking here at this stage?
There was a problem hiding this comment.
At least for solidity, there is no generic, then perhaps only bytes array? To let the subnet/fendermint and parent IValidatorRewarder handle the bytes deserialization + distribution. What the framework does is just checking:
- Validator has claimed before?
- Does the claim actually exists?
- The lifecycle of the validator reward
There was a problem hiding this comment.
Yes, this is the direction I wanted to move things in. This was the idea:
- We add a region in checkpoints to carry extensible subnet activity reports in the form of
{ namespace/type/discriminator: bytes, payload: bytes }[]-- we can call this checkpoint extensions. - IPC ships with a set of default subnet activity reporters as extensions, e.g. the block production one here.
- Users can plug in custom subnet activity reporters to, e.g. report on quality of service, retrieval rate, scoring, etc.
- Ideally the reporters are Wasm actors, so they can compose easily and be upgraded through governance in the future. However, to truly make this design client/node-agnostic, users would likely need to add custom syscalls to access the metadata actors will want to report on.
- We'd need a master actor to orchestrate "hooks". The
extend_checkpointhook would be called by the IPC node, injecting the raw Checkpoint and expecting an array of extension fragments in return. The client would assemble them into the Checkpoint and submit that on chain for local quorum signature.
@carsonfarmer @JulissaDantes In my head we could defer this feature, but it sounds like it would be beneficial to you guys to have it now, right?
If so, I think we can simplify the above on several fronts to try to meet the time constraints while delivering the feature. How about:
- We don't bother with developing the checkpoint extensions as Wasm-land actors for now; we just add well-bounded hook callbacks in Fendermint with the intention to migrate them to actors in the future.
- We have the node orchestrate the hooks instead of a master actor.
Open points:
- Namespacing.
- Parent execution.
|
Integrated into #1181. |
This PR prototypes the Validator Rewards feature (#1079). I tried to keep it as simple as possible for now. I've authored the data structures and inserted
TODO(rewards)comments everywhere I think we need to extend the implementation, but there may be other spots that I haven't covered.IValidatorRewarder
This is the interface that should be implemented to disburse validator rewards for a subnet on its parent.
Summaries and commitments
The ActivitySummary is the central object that is created by the subnet and committed in the checkpoint in a hash. The full payload is emitted as an event on the local chain so that the relayer can pick it up and submit it to the root network once the commitment has fully travelled upwards.
Subnet Actor storage
There are new fields added to specify the address of a ValidatorRewarder, and to track commitments to summaries that are pending forwarding and presentation.
Relayer
The relayer should be augmented to watch multiple subnets at once. It will also track summaries that are emitted locally and will present them in the root chain once the relevant commitment has travelled all the way up.
Fendermint
In
maybe_create_checkpointwe should craft the ValidatorSummary object by querying the chain in CometBFT. That said, this is not the ideal solution as it likely adds latency. Instead, we should keep a cache (queue) that's updated when new blocks are committed, and pruned when new checkpoints are generated. However, that might be more complex, so maybe we start simple and only implement the cache if we observe performance issues?