Skip to content

Commit

Permalink
feat: back git history
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Ortega committed Oct 10, 2023
1 parent f794d11 commit e534234
Show file tree
Hide file tree
Showing 58 changed files with 13,725 additions and 7,885 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- v*
branches:
- main
- release/*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
- release/*
jobs:
check-changelog:
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Check code format
on:
push:
paths:
- '.github/workflows/code_format.yml'
- '.github/workflows/check-code-format.yml'
- 'onchain/**'
jobs:
check-code-format:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ jobs:
run: yarn install

- name: Publish package
run: yarn publish --access public
if: ${{ ! contains(github.ref_name, '-rc.') }}
run: yarn npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish release candidate
if: ${{ contains(github.ref_name, '-rc.') }}
run: yarn publish --access public --tag rc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49 changes: 25 additions & 24 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.1.0] - 2023-10-04

### Added

- `abi` directory to the `@cartesi/rollups` package, ideal for language bindings.
- `AuthorityFactory`: Allows anyone to deploy `Authority` contracts. Supports deterministic deployment.
- `HistoryFactory`: Allows anyone to deploy `History` contracts. Supports deterministic deployment.
- `AuthorityHistoryPairFactory`: Allows anyone to deploy `Authority` and `History` contract pairs (such that `History` is owned by `Authority`, and `Authority` stores/retrieves claims from `History`). Supports deterministic deployment.

### Removed
### Changed

- `docker-bake*.hcl`
- `.dockerignore`
- `onchain/Dockerfile`
- `offchain` (now maintained in [`cartesi/rollups-node`](https://github.com/cartesi/rollups-node))
- `grpc-interfaces` submodule
- `rollups-cli` package
- `onchain/rollups/abi`
- `Authority`: Removed deployment files and script.
- `History`: Removed deployment files and script.
- Updated yarn version to 3.6.3 (berry)

## Changed
### Removed

- Updated yarn version to 3.6.3 (berry)
- `rollups-cli` package

## [1.0.0] 2023-08-22

Expand Down Expand Up @@ -74,13 +74,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed input size limit in `InputBox` contract
- Fixed vouchers and notices proofs in `host-runner`

## [0.9.1] 2023-06-14
## [0.9.1] - 2023-06-14

### Changed

- Fixed dispatcher to not finish empty epoch

## [0.9.0] 2023-05-19
## [0.9.0] - 2023-05-19

### Added

Expand Down Expand Up @@ -124,14 +124,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed headers from inputs added by trusted permissionless contracts like portals and relayers
- Remove polling-based indexer

## [0.8.2] 2023-01-04
## [0.8.2] - 2023-01-04

### Changed

- Fixed proxy start up after restart
- Changed `sm_pending_inputs_max_retries` default to 600 (retries while polling server-manager for pending inputs)

## [0.8.1] 2022-12-02
## [0.8.1] - 2022-12-02

### Added

Expand All @@ -141,7 +141,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixed epoch finalization when running rollups in host mode

## [0.8.0] 2022-11-29
## [0.8.0] - 2022-11-29

### Added

Expand All @@ -157,21 +157,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Modified the dispatcher to produce rollups events instead of managing the server-manager.
- Bumped grpc-interfaces to version 0.9.0

## [0.7.0] 2022-11-02
## [0.7.0] - 2022-11-02

### Changed

- Increase machine deadline
- Minor documentation updates

## [0.6.1] 2022-10-04
## [0.6.1] - 2022-10-04

### Changed

- Fix dispatcher's configuration for server-manager threads
- Improve documentation of GraphQL API

## [0.6.0] 2022-09-13
## [0.6.0] - 2022-09-13

### Added

Expand All @@ -182,7 +182,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Send inspect-server logs to stdout instead of stderr

## [0.5.0] 2022-08-17
## [0.5.0] - 2022-08-17

### Added

Expand All @@ -195,13 +195,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Remove hardhat-rollups
- Fix indexer to store proofs only when epoch is finished

## [0.4.0] 2022-07-04
## [0.4.0] - 2022-07-04

### Changed

- Update dependencies to latest emulator SDK with improved exception handling (grpc-interfaces 0.8)

## [0.3.0] 2022-06-14
## [0.3.0] - 2022-06-14

### Added

Expand Down Expand Up @@ -230,7 +230,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Security

## [0.2.0] 2022-04-28
## [0.2.0] - 2022-04-28

### Added

Expand All @@ -252,7 +252,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Specific ERC-20 Portal
- Deprecated mock contracts

[Unreleased]: https://github.com/cartesi/rollups-contracts/compare/v1.0.0...HEAD
[Unreleased]: https://github.com/cartesi/rollups-contracts/compare/v1.1.0...HEAD
[1.1.0]: https://github.com/cartesi/rollups-contracts/releases/tag/v1.1.0
[1.0.0]: https://github.com/cartesi/rollups/releases/tag/v1.0.0
[0.9.1]: https://github.com/cartesi/rollups/releases/tag/v0.9.1
[0.9.0]: https://github.com/cartesi/rollups/releases/tag/v0.9.0
Expand Down
874 changes: 874 additions & 0 deletions onchain/.yarn/releases/yarn-3.6.4.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions onchain/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.6.4.cjs
3 changes: 2 additions & 1 deletion onchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
],
"devDependencies": {
"prettier": "^3"
}
},
"packageManager": "[email protected]"
}
50 changes: 50 additions & 0 deletions onchain/rollups/contracts/consensus/authority/AuthorityFactory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)

pragma solidity ^0.8.8;

import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";

import {IAuthorityFactory} from "./IAuthorityFactory.sol";
import {Authority} from "./Authority.sol";

/// @title Authority Factory
/// @notice Allows anyone to reliably deploy a new `Authority` contract.
contract AuthorityFactory is IAuthorityFactory {
function newAuthority(
address _authorityOwner
) external override returns (Authority) {
Authority authority = new Authority(_authorityOwner);

emit AuthorityCreated(_authorityOwner, authority);

return authority;
}

function newAuthority(
address _authorityOwner,
bytes32 _salt
) external override returns (Authority) {
Authority authority = new Authority{salt: _salt}(_authorityOwner);

emit AuthorityCreated(_authorityOwner, authority);

return authority;
}

function calculateAuthorityAddress(
address _authorityOwner,
bytes32 _salt
) external view override returns (address) {
return
Create2.computeAddress(
_salt,
keccak256(
abi.encodePacked(
type(Authority).creationCode,
abi.encode(_authorityOwner)
)
)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)

pragma solidity ^0.8.8;

import {IAuthorityHistoryPairFactory} from "./IAuthorityHistoryPairFactory.sol";
import {Authority} from "./Authority.sol";
import {IAuthorityFactory} from "./IAuthorityFactory.sol";
import {History} from "../../history/History.sol";
import {IHistoryFactory} from "../../history/IHistoryFactory.sol";

/// @title Authority-History Pair Factory
/// @notice Allows anyone to reliably deploy a new Authority-History pair.
contract AuthorityHistoryPairFactory is IAuthorityHistoryPairFactory {
IAuthorityFactory immutable authorityFactory;
IHistoryFactory immutable historyFactory;

/// @notice Constructs the factory.
/// @param _authorityFactory The `Authority` factory
/// @param _historyFactory The `History` factory
constructor(
IAuthorityFactory _authorityFactory,
IHistoryFactory _historyFactory
) {
authorityFactory = _authorityFactory;
historyFactory = _historyFactory;

emit AuthorityHistoryPairFactoryCreated(
_authorityFactory,
_historyFactory
);
}

function getAuthorityFactory()
external
view
override
returns (IAuthorityFactory)
{
return authorityFactory;
}

function getHistoryFactory()
external
view
override
returns (IHistoryFactory)
{
return historyFactory;
}

function newAuthorityHistoryPair(
address _authorityOwner
) external override returns (Authority authority_, History history_) {
authority_ = authorityFactory.newAuthority(address(this));
history_ = historyFactory.newHistory(address(authority_));

authority_.setHistory(history_);
authority_.transferOwnership(_authorityOwner);
}

function newAuthorityHistoryPair(
address _authorityOwner,
bytes32 _salt
) external override returns (Authority authority_, History history_) {
authority_ = authorityFactory.newAuthority(
address(this),
calculateCompoundSalt(_authorityOwner, _salt)
);
history_ = historyFactory.newHistory(address(authority_), _salt);

authority_.setHistory(history_);
authority_.transferOwnership(_authorityOwner);
}

function calculateAuthorityHistoryAddressPair(
address _authorityOwner,
bytes32 _salt
)
external
view
override
returns (address authorityAddress_, address historyAddress_)
{
authorityAddress_ = authorityFactory.calculateAuthorityAddress(
address(this),
calculateCompoundSalt(_authorityOwner, _salt)
);

historyAddress_ = historyFactory.calculateHistoryAddress(
authorityAddress_,
_salt
);
}

/// @notice Calculate the compound salt.
/// @param _authorityOwner authority owner
/// @param _salt salt
/// @return compound salt
/// @dev The purpose of calculating a compound salt is to
/// prevent attackers front-running the creation of an Authority
/// occupying the to-be-deployed address, but with a different owner.
function calculateCompoundSalt(
address _authorityOwner,
bytes32 _salt
) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_authorityOwner, _salt));
}
}
Loading

0 comments on commit e534234

Please sign in to comment.