Skip to content

Commit

Permalink
Merge branch 'main' into preconf-driver-apis
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Nov 7, 2024
2 parents 4158e3a + bc0ee99 commit ed06d66
Show file tree
Hide file tree
Showing 22 changed files with 125 additions and 108 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/bridge-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- "packages/bridge-ui/**"
branches-ignore:
- dependabot/**
- release-please--branches--**
tags:
- "bridge-ui-v*"

Expand All @@ -16,7 +17,7 @@ on:

jobs:
build-and-test:
if: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*') }}
if: ${{ github.event.pull_request.draft == false }}
uses: ./.github/workflows/bridge-ui--ci.yml

# Deployment name follow the pattern: deploy_<appname(bridge-ui)>_<network(devnet|hekla|mainnet)>_<environment(preview|production)>
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/docs-site--preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "packages/docs-site/**"
branches-ignore:
- release-please--branches--**

jobs:
deploy-docs-site-preview:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
if: ${{ github.event.pull_request.draft == false }}
runs-on: [arc-runner-set]
steps:
- name: Install Git
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/eventindexer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
- "packages/eventindexer/**"
- "go.mod"
- "go.sum"
branches-ignore:
- release-please--branches--**

jobs:
lint-eventindexer:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/fork-diff--preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "packages/fork-diff/**"
branches-ignore:
- release-please--branches--**

jobs:
deploy-fork-diff-preview:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
if: ${{ github.event.pull_request.draft == false }}
runs-on: [arc-runner-set]
steps:
- name: Install Git
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/guardian-prover-health-check-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
paths:
- "packages/guardian-prover-health-check-ui/**"
branches-ignore:
- release-please--branches--**

jobs:
build-and-test:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/guardian-prover-health-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
- "packages/guardian-prover-health-check/**"
- "go.mod"
- "go.sum"
branches-ignore:
- release-please--branches--**

jobs:
lint-guardian-prover-health-check:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/nfts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ on:
paths:
- "packages/nfts/**"
- "!packages/nfts/contract_layout_*"
branches-ignore:
- release-please--branches--**

jobs:
build-nfts-contracts:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
if: ${{ github.event.pull_request.draft == false }}
runs-on: [arc-runner-set]
steps:
- name: Cancel previous runs
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/protocol-monitors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "packages/monitors/**"
branches-ignore:
- release-please--branches--**

jobs:
deploy-protocol-monitors:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
if: ${{ github.event.pull_request.draft == false }}
runs-on: [taiko-runner]
permissions:
# Give the necessary permissions for stefanzweifel/git-auto-commit-action.
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ on:
- "!packages/protocol/docs/**"
- "!packages/protocol/simulation/**"
- "!packages/protocol/deployments/**"
branches-ignore:
- release-please--branches--**

jobs:
build-protocol:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
if: ${{ github.event.pull_request.draft == false }}
runs-on: [arc-runner-set]
permissions:
# Give the necessary permissions for stefanzweifel/git-auto-commit-action.
Expand Down Expand Up @@ -67,7 +69,7 @@ jobs:
pnpm test:deploy:l1
genesis-docker:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
if: ${{ github.event.pull_request.draft == false }}
runs-on: [taiko-runner]
permissions:
# Give the necessary permissions for stefanzweifel/git-auto-commit-action.
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/relayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
- "packages/relayer/**"
- "go.mod"
- "go.sum"
branches-ignore:
- release-please--branches--**

jobs:
lint-relayer:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/repo--auto-approve-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Auto Approve PR
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches-ignore:
- release-please--branches--**

jobs:
auto-approve:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/repo--release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ on:
push:
branches:
- main
tags:
- '*'
delete:
tags:
- '*'

permissions:
contents: write
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/supplementary-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "packages/supplementary-contracts/**"
branches-ignore:
- release-please--branches--**

jobs:
build-supplementary-contracts:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
if: ${{ github.event.pull_request.draft == false }}
runs-on: [arc-runner-set]
steps:
- name: Cancel previous runs
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/taiko-client--hive_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
- "packages/taiko-client/**"
- "go.mod"
- "go.sum"
branches-ignore:
- release-please--branches--**

jobs:
hive_tests:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/taiko-client--test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ on:
- "packages/taiko-client/**"
- "go.mod"
- "go.sum"
branches-ignore:
- release-please--branches--**

jobs:
lint:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
if: ${{ github.event.pull_request.draft == false }}
name: Lint
runs-on: [ubuntu-latest]
steps:
Expand All @@ -30,7 +32,7 @@ jobs:
run: golangci-lint run --path-prefix=./ --config=.golangci.yml

integration_tests:
if: contains(github.event.pull_request.labels.*.name, 'option.workflow_on') || github.event.pull_request.draft == false && github.head_ref != 'release-please-*'
if: ${{ github.event.pull_request.draft == false }}
name: Integration tests
runs-on: [ubuntu-latest]
timeout-minutes: 15
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,28 @@ description: Network reference page describing various important addresses on Ta
| ERC20Vault | `0x2259662ed5dE0E09943Abe701bc5f5a108eABBAa` |
| ERC721Vault | `0x046b82D9010b534c716742BE98ac3FEf3f2EC99f` |
| ERC1155Vault | `0x9Ae5945Ab34f6182F75E16B73e037421F341fEe3` |
| BridgedERC20 | `0xe3661857941E4A711fa6b4Fc080bC5c5948a70f1` |
| BridgedERC721 | `0xbD832CAf65c8a73609EFd62E2A4FCB1292e4c9C1` |
| BridgedERC1155 | `0x0B5B063dc89EcfCedf8aF570d82598F72a7dfF35` |

| Contract Name (Rollup-Specific) | Address |
| ------------------------------- | -------------------------------------------- |
| TaikoL1 | `0x79C9109b764609df928d16fC4a91e9081F7e87DB` |
| RollupAddressManager | `0x1F027871F286Cf4B7F898B21298E7B3e090a8403` |
| GuardianProver | `0x92F195a8702da2104aE8E3E10779176E7C35d6BC` |
| GuardianMinority | `0x31d4d27da5c299d4b6CE19c869B8891C0002795d` |
| AssignmentHook | `0x9e640a6aadf4f664CF467B795c31332f44AcBe6c` |
| TierProvider | `0x9AaBba3Ae6D4aC3F5487608Da81006454e7933d3` |
| TierRouter | `0x98d4FaD098526c4582063FA588C5e96229270366` |
| SgxVerifier | `0x532EFBf6D62720D0B2a2Bb9d11066E8588cAE6D9` |
| Groth16Verifier | `0x5fd84014c62D5ea28D4533D5B1B48Ca44e571057` |
| Risc0Verifier | `0x4fEd801C5a876D4289e869cbEfA1E1A448b10714` |
| SP1Verifier | `0xFbE49f777E0078b3Fa0bae6de4794c88d6EA6DDD` |
| PlonkVerifier | `0xa5287276f63b669E09cF6Dc6F44e941d77D7139e` |
| AutomataDcapAttestation | `0xC6cD3878Fc56F2b2BaB0769C580fc230A95e1398` |
| PemCertChainLib | `0x08d7865e7F534d743Aba5874A9AD04bcB223a92E` |
| ProverSet | `0xD3f681bD6B49887A48cC9C9953720903967E9DC0` |
| ProverSetContester | `0x335103c4fa2F55451975082136F1478eCFeB84B9` |

## Taiko L2 (Hekla) contracts

Expand Down
130 changes: 72 additions & 58 deletions packages/protocol/contracts/layer1/based/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -149,64 +149,7 @@ library LibProposing {
local.params = abi.decode(_params, (TaikoData.BlockParamsV2));
}

if (local.params.proposer == address(0)) {
local.params.proposer = msg.sender;
} else {
require(
local.params.proposer == msg.sender || local.allowCustomProposer,
L1_INVALID_CUSTOM_PROPOSER()
);
}

if (local.params.coinbase == address(0)) {
local.params.coinbase = local.params.proposer;
}

if (local.params.anchorBlockId == 0) {
unchecked {
local.params.anchorBlockId = uint64(block.number - 1);
}
}

if (local.params.timestamp == 0) {
local.params.timestamp = uint64(block.timestamp);
}

// Verify params against the parent block.
TaikoData.BlockV2 storage parentBlk;
unchecked {
parentBlk = _state.blocks[(local.b.numBlocks - 1) % _config.blockRingBufferSize];
}

// Verify the passed in L1 state block number to anchor.
require(
local.params.anchorBlockId + _config.maxAnchorHeightOffset >= block.number,
L1_INVALID_ANCHOR_BLOCK()
);
require(local.params.anchorBlockId < block.number, L1_INVALID_ANCHOR_BLOCK());

// parentBlk.proposedIn is actually parent's params.anchorBlockId
require(local.params.anchorBlockId >= parentBlk.proposedIn, L1_INVALID_ANCHOR_BLOCK());

// Verify the provided timestamp to anchor. Note that local.params.anchorBlockId and
// local.params.timestamp may not correspond to the same L1 block.
require(
local.params.timestamp + _config.maxAnchorHeightOffset * SECONDS_PER_BLOCK
>= block.timestamp,
L1_INVALID_TIMESTAMP()
);
require(local.params.timestamp <= block.timestamp, L1_INVALID_TIMESTAMP());

// parentBlk.proposedAt is actually parent's params.timestamp
require(local.params.timestamp >= parentBlk.proposedAt, L1_INVALID_TIMESTAMP());

// Check if parent block has the right meta hash. This is to allow the proposer to make sure
// the block builds on the expected latest chain state.
if (local.params.parentMetaHash == 0) {
local.params.parentMetaHash = parentBlk.metaHash;
} else {
require(local.params.parentMetaHash == parentBlk.metaHash, L1_UNEXPECTED_PARENT());
}
_validateParams(_state, _config, local);

// Initialize metadata to compute a metaHash, which forms a part of the block data to be
// stored on-chain for future integrity checks. If we choose to persist all data fields in
Expand Down Expand Up @@ -285,6 +228,77 @@ library LibProposing {
emit BlockProposedV2(meta_.id, meta_);
}

/// @dev Validates the parameters for proposing a block.
/// @param _state Pointer to the protocol's storage.
/// @param _config The configuration parameters for the Taiko protocol.
/// @param _local The local struct.
function _validateParams(
TaikoData.State storage _state,
TaikoData.Config memory _config,
Local memory _local
)
private
view
{
unchecked {
if (_local.params.proposer == address(0)) {
_local.params.proposer = msg.sender;
} else {
require(
_local.params.proposer == msg.sender || _local.allowCustomProposer,
L1_INVALID_CUSTOM_PROPOSER()
);
}

if (_local.params.coinbase == address(0)) {
_local.params.coinbase = _local.params.proposer;
}

if (_local.params.anchorBlockId == 0) {
_local.params.anchorBlockId = uint64(block.number - 1);
}

if (_local.params.timestamp == 0) {
_local.params.timestamp = uint64(block.timestamp);
}
}

// Verify params against the parent block.
TaikoData.BlockV2 storage parentBlk;
unchecked {
parentBlk = _state.blocks[(_local.b.numBlocks - 1) % _config.blockRingBufferSize];
}

// Verify the passed in L1 state block number to anchor.
require(
_local.params.anchorBlockId + _config.maxAnchorHeightOffset >= block.number,
L1_INVALID_ANCHOR_BLOCK()
);
require(_local.params.anchorBlockId < block.number, L1_INVALID_ANCHOR_BLOCK());

// parentBlk.proposedIn is actually parent's params.anchorBlockId
require(_local.params.anchorBlockId >= parentBlk.proposedIn, L1_INVALID_ANCHOR_BLOCK());

// Verify the provided timestamp to anchor. Note that local.params.anchorBlockId and
// local.params.timestamp may not correspond to the same L1 block.
require(
_local.params.timestamp + _config.maxAnchorHeightOffset * SECONDS_PER_BLOCK
>= block.timestamp,
L1_INVALID_TIMESTAMP()
);
require(_local.params.timestamp <= block.timestamp, L1_INVALID_TIMESTAMP());

// parentBlk.proposedAt is actually parent's params.timestamp
require(_local.params.timestamp >= parentBlk.proposedAt, L1_INVALID_TIMESTAMP());

// Check if parent block has the right meta hash. This is to allow the proposer to make sure
// the block builds on the expected latest chain state.
require(
_local.params.parentMetaHash == 0 || _local.params.parentMetaHash == parentBlk.metaHash,
L1_UNEXPECTED_PARENT()
);
}

/// @dev Encodes the base fee configuration into a bytes32.
/// @param _baseFeeConfig The base fee configuration.
/// @return The encoded base fee configuration.
Expand Down
2 changes: 1 addition & 1 deletion packages/taiko-client/bindings/.githead
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4adab8b735d7c4dde9a58c3692925e87a580e2d0
5b4b0cd271534aa72d865afa5fc55e0ee4b16b73
Loading

0 comments on commit ed06d66

Please sign in to comment.