Skip to content

Commit

Permalink
Merge branch 'staging' into deploy-dnssec-registrar
Browse files Browse the repository at this point in the history
  • Loading branch information
mdtanrikulu committed Jan 18, 2024
2 parents 992dc9d + 5cb8128 commit 9fe938e
Show file tree
Hide file tree
Showing 17 changed files with 1,531 additions and 188 deletions.
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ yarn test
yarn pub
```

## Release flow
### Release flow

1. Create a `feature` branch from `staging` branch
2. Make code updates
Expand All @@ -176,11 +176,21 @@ yarn pub
5. Create a "Release Candidate" [release](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) on GitHub. This will be of the form `v1.2.3-RC0`. This tagged commit is now subject to our bug bounty.
6. Have the tagged commit audited if necessary
7. If changes are required, make the changes and then once ready for review create another GitHub release with an incremented RC value `v1.2.3-RC0` -> `v.1.2.3-RC1`. Repeat as necessary.
8. Deploy to testnet. Commit build artifacts to `feature` branch. You now MUST merge this branch into `staging` branch.
9. Create GitHub release of the form `v1.2.3-testnet` from the commit that has the new deployment artifacts.
8. Deploy to testnet. Open a pull request to merge the deploy artifacts into
the `feature` branch. Create GitHub release of the form `v1.2.3-testnet` from the commit that has the new deployment artifacts.
9. Get someone to review and approve the deployment and then merge. You now MUST merge this branch into `staging` branch.
10. If any further changes are needed, you can either make them on the existing feature branch that is in sync or create a new branch, and follow steps 1 -> 9. Repeat as necessary.
11. Make Deployment to mainnet from `staging`. Commit build artifacts. You now MUST merge this branch into `main`.
12. Create GitHub release of the form `v1.2.3-mainnet` from the commit that has the new deployment artifacts.
11. Make a deployment to ethereum mainnet from `staging`. Create a GitHub release of the form `v1.2.3` from the commit that has the new deployment artifacts.
12. Open a PR to merge into `main`. Have it reviewed and merged.

### Cherry-picked release flow

Certain changes can be released in isolation via cherry-picking, although ideally we would always release from `staging`.

1. Create a new branch from `mainnet`.
2. Cherry-pick from `staging` into new branch.
3. Deploy to ethereum mainnet, tag the commit that has deployment artifacts and create a release.
4. Merge into `mainnet`.

### Emergency release process

Expand All @@ -190,7 +200,8 @@ yarn pub

### Notes

- `staging` branch and `main` branch should start off in sync
- Deployed code should always match source code in mainnet releases. This may not be the case for `staging`.
- `staging` branch and `main` branch should start in sync
- `staging` is intended to be a practice `main`. Only code that is intended to be released to `main` can be merged to `staging`. Consequently:
- Feature branches will be long-lived
- Feature branches must be kept in sync with `staging`
Expand All @@ -199,4 +210,4 @@ yarn pub
- It is preferable to not edit the same file on different feature branches.
- Code on `staging` and `main` will always be a subset of what is deployed, as smart contracts cannot be undeployed.
- Release candidates, `staging` and `main` branch are subject to our bug bounty
- Releases follow semantic versioning and should contain a description of changes with developers being the intended audience
- Releases follow semantic versioning and releases should contain a description of changes with developers being the intended audience
4 changes: 4 additions & 0 deletions contracts/ethregistrar/ETHRegistrarController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ error CommitmentTooOld(bytes32 commitment);
error NameNotAvailable(string name);
error DurationTooShort(uint256 duration);
error ResolverRequiredWhenDataSupplied();
error ResolverRequiredWhenReverseRecord();
error UnexpiredCommitmentExists(bytes32 commitment);
error InsufficientValue();
error Unauthorised(bytes32 node);
Expand Down Expand Up @@ -120,6 +121,9 @@ contract ETHRegistrarController is
uint16 ownerControlledFuses
) public pure override returns (bytes32) {
bytes32 label = keccak256(bytes(name));
if (resolver == address(0) && reverseRecord == true) {
revert ResolverRequiredWhenReverseRecord();
}
if (data.length > 0 && resolver == address(0)) {
revert ResolverRequiredWhenDataSupplied();
}
Expand Down
2 changes: 2 additions & 0 deletions contracts/ethregistrar/IETHRegistrarController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ interface IETHRegistrarController {

function commit(bytes32) external;

function commitments(bytes32) external view returns (uint256);

function register(
string calldata,
address,
Expand Down
18 changes: 17 additions & 1 deletion contracts/utils/LowLevelCallUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,30 @@ library LowLevelCallUtils {
function functionStaticCall(
address target,
bytes memory data
) internal view returns (bool success) {
return functionStaticCall(target, data, gasleft());
}

/**
* @dev Makes a static call to the specified `target` with `data` using `gasLimit`. Return data can be fetched with
* `returnDataSize` and `readReturnData`.
* @param target The address to staticcall.
* @param data The data to pass to the call.
* @param gasLimit The gas limit to use for the call.
* @return success True if the call succeeded, or false if it reverts.
*/
function functionStaticCall(
address target,
bytes memory data,
uint256 gasLimit
) internal view returns (bool success) {
require(
target.isContract(),
"LowLevelCallUtils: static call to non-contract"
);
assembly {
success := staticcall(
gas(),
gasLimit,
target,
add(data, 32),
mload(data),
Expand Down
Loading

0 comments on commit 9fe938e

Please sign in to comment.