Skip to content

Commit

Permalink
Merge branch 'main' into fix-jestdom-bridgeui
Browse files Browse the repository at this point in the history
  • Loading branch information
d1onys1us authored Jan 20, 2023
2 parents d332f1b + 3b71285 commit ea89688
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ After your pull request is merged, a bot will automatically leave a comment with

Specify the scope of your change with a [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) in the PR title (for example, `feat(scope): description of feature`). This will be squashed and merged into the `main` branch.

Because we squash all of the changes into a single commit, please try to keep the PR limited to the scope specified in the commit message. This commit message will end up in the automated changelog by checking which packages are affected by the commit. For example, `feat(scope): description of feature` should only impact the `scope` package. If your change is a global one, you can use `feat: description of feature`, for example.

### Source code comments

Follow the [NatSpec format](https://docs.soliditylang.org/en/latest/natspec-format.html) for documenting smart contract source code. Please adhere to a few additional standards:
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/contracts/L1/TkoToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ contract TkoToken is EssentialContract, ERC20Upgradeable, IMintableERC20 {
function init(address _addressManager) external initializer {
EssentialContract._init(_addressManager);
ERC20Upgradeable.__ERC20_init({
name_: "Taiko Test Token",
symbol_: "tTKO",
decimals_: 18
name_: "Taiko USD Stablecoin Token",
symbol_: "tkUSD",
decimals_: 6
});
}

Expand Down
11 changes: 11 additions & 0 deletions packages/protocol/contracts/L1/libs/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ library LibProposing {
AddressResolver resolver,
bytes[] calldata inputs
) public {
// For alpha-2 testnet, the network only allows an special address
// to propose but anyone to prove. This is the first step of testing
// the tokenomics.

// TODO(daniel): remove this special address.
address specialProposer = resolver.resolve("special_proposer", true);
require(
specialProposer == address(0) || specialProposer == msg.sender,
"L1:specialProposer"
);

assert(!LibUtils.isHalted(state));

require(inputs.length == 2, "L1:inputs:size");
Expand Down
34 changes: 22 additions & 12 deletions packages/protocol/contracts/L1/libs/LibProving.sol
Original file line number Diff line number Diff line change
Expand Up @@ -246,19 +246,29 @@ library LibProving {

bytes32 blockHash = evidence.header.hashBlockHeader();

// For alpha-2 testnet, the network allows any address to submit ZKP,
// but a special prover can skip ZKP verification if the ZKP is empty.

// TODO(daniel): remove this special address.
address specialProver = resolver.resolve("special_prover", true);

for (uint256 i = 0; i < config.zkProofsPerBlock; ++i) {
require(
proofVerifier.verifyZKP({
verificationKey: ConfigManager(
resolver.resolve("config_manager", false)
).getValue(string(abi.encodePacked("zk_vkey_", i))),
zkproof: evidence.proofs[i],
blockHash: blockHash,
prover: evidence.prover,
txListHash: evidence.meta.txListHash
}),
"L1:zkp"
);
if (msg.sender == specialProver && evidence.proofs[i].length == 0) {
// Skip ZKP verification
} else {
require(
proofVerifier.verifyZKP({
verificationKey: ConfigManager(
resolver.resolve("config_manager", false)
).getValue(string(abi.encodePacked("zk_vkey_", i))),
zkproof: evidence.proofs[i],
blockHash: blockHash,
prover: evidence.prover,
txListHash: evidence.meta.txListHash
}),
"L1:zkp"
);
}
}

_markBlockProven({
Expand Down

0 comments on commit ea89688

Please sign in to comment.