Skip to content

Commit

Permalink
Add a configuration number getter (#867)
Browse files Browse the repository at this point in the history
Co-authored-by: Jorge M. Soares <[email protected]>
  • Loading branch information
cryptoAtwill and jsoares authored May 8, 2024
1 parent 60da65d commit afc4d6c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions contracts/src/gateway/GatewayGetterFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {QuorumInfo} from "../structs/Quorum.sol";
import {SubnetID, Subnet} from "../structs/Subnet.sol";
import {Membership} from "../structs/Subnet.sol";
import {LibGateway} from "../lib/LibGateway.sol";
import {LibStaking} from "../lib/LibStaking.sol";
import {LibQuorum} from "../lib/LibQuorum.sol";
import {GatewayActorStorage} from "../lib/LibGatewayActorStorage.sol";
import {SubnetIDHelper} from "../lib/SubnetIDHelper.sol";
Expand All @@ -20,6 +21,12 @@ contract GatewayGetterFacet {
using EnumerableSet for EnumerableSet.AddressSet;
using EnumerableSet for EnumerableSet.Bytes32Set;

/// @notice Returns the next and start configuration numbers in the validator changes.
/// The configuration numbers are from changes made in the parent.
function getValidatorConfigurationNumbers() external view returns (uint64, uint64) {
return LibStaking.getConfigurationNumbers();
}

/// @notice Returns code commit SHA where this contract is from.
function getCommitSha() external view returns (bytes32) {
return s.commitSha;
Expand Down
9 changes: 9 additions & 0 deletions contracts/src/gateway/router/TopDownFinalityFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ contract TopDownFinalityFacet is GatewayActorModifiers {
s.validatorsTracker.batchStoreChange(changeRequests);
}

/// @notice Returns the next and start configuration numbers in the tracker of changes
/// from the parent in the child gateway
function getTrackerConfigurationNumbers() external view returns (uint64, uint64) {
return (
s.validatorsTracker.changes.nextConfigurationNumber,
s.validatorsTracker.changes.startConfigurationNumber
);
}

/// @notice Apply all changes committed through the commitment of parent finality.
/// @return configurationNumber The configuration number of the changes set that has been confirmed.
function applyFinalityChanges() external systemActorOnly returns (uint64) {
Expand Down

0 comments on commit afc4d6c

Please sign in to comment.