Kroma
This is a client for Kroma network.
Documentation
If you want to build Kroma, check out the Protocol Specs.
Contributing
Read through CONTRIBUTING.md for a general overview of our contribution process. Use the Developer Quick Start to get your development environment set up to start working on the Kroma repository. Then check out our list of good first issues to find something fun to work on!
feat(node): update validator reward ratio on L1Block contract
The name of the Fee Vault has been updated:
And, to distribute the transaction fee to the Protocol Vault and the Validator Reward Vault, the ValidatorRewardRatio value in the L1Block contract is updated.
Related: #19
chore: rename organization and project
As part of the rebranding of WEMIX Kanvas to Kroma, this commit includes changes to rename the name of the GitHub organization and the project to Kroma:
docs: rewrite description of zkevm-prover
Add more description of kroma-prover in detail.
test(e2e): mock challenger RPC in e2e actions test
This PR is based on
fix/validator-e2e
branch.As mentioned in #71, validator and challenger RPC rollup client is mocked for challenge E2E test.
In addition, there are some fixes in public input:
gasLimit
to uint64feat(contracts): reward via portal to L2 vault when the output is finalized
When output is submitted to L2OutputOracle, it calls a function in L2 ValidatorRewardVault via CrossDomainMessenger to reward the submitter. Once the output is finalized, the submitter can receive this reward.
Related #19
chore: inject git tag as a version
The Makefile is modified to set the versions of the binaries using git tag. The versions are managed using git tag and GitHub release, and the version of the binaries is set to the tag associated with the commit.
fix(contracts): fix logic after output finalized in challenger timeout
Description
Related to https://github.com/chainlight-io/2023-kroma-network-audit-issues-client/issues/9 reported by theori audit. Fixed an issue where, for a challenge to a finalized output root, the asserter could not take the bond even if the challenger went into a timeout state.
feat!(validator): rename output submitter and challenger flags
Renamed two validator flags for consistency and readability:
VALIDATOR_OUTPUT_SUBMITTER_ENABLED
andVALIDATOR_CHALLENGER_ENABLED
, both are required.At first, we named the flags with
*_DISABLED
. If no value is set, it was to turn on the output submitter and challenger by default.With this renaming, we should provide a sample
.env
file with default value oftrue
for both flags for guide of running Kroma node.feat: update integrations for securityCouncil and related testing and deployment code
Description
Update colosseum contract integration for securityCouncil and related testing and deployment code.
Related #18
feat: update public input hash computation
Since our prover code is bumped up to version based on scroll zkevm v0.3, the public input hash computation is changed as follows.
The main changes are followings:
final pair
is represented using two values instead of one because thebn256
curve cannot fully represent the result of the keccak 256 hash, which is a bytes32 value. By splitting it into two values, we can accommodate the complete representation of the hash result.to
field.coinbase
,difficulty
, andchain ID
were omitted, while the fields forblock hash
,parent hash
, andwithdrawals root
were included.feat!(challenger): change challenge handling to event-driven for multiple challenges
Description
Challenge handling is changed from polling-based to event-driven way. As multiple challenges can be created simultaneously, the validator can properly handle multiple challenges at the same time.
To handle outputs in the past and within the finalization window,
scanPrevOutputs
has also been implemented.Tx nonce collision
Validator
has two components: L2 output submitter and challenger. Since each component sends transaction with the same account, should be very careful with nonce collisions. To avoid it,Validator
would have a channel for transaction,txCandidatesChan
. The created tx candidates will be transferred totxCandidateChan
in each component, andtxmgr
will process the tx candidates sequentially.FYI,
This PR has a slightly complicated structure, using several go routines to concurrently process multiple challenges. I'd appreciate you for your detailed review.
feat(contracts): add contracts about `Multi sig based proxy upgrade`
Description
Contracts and related code have been written for the Multi sig based proxy upgrade. A contract upgrade is only possible if the vote following the proposal passes. Voting privileges are granted based on a token for this purpose, which in this case is security council members. If a proposal is voted on and passed, it will be executed after being delayed by a set timelock. The delay in upgrading by Timelock will be more than a month. (https://ethereum-magicians.org/t/proposed-milestones-for-rollups-taking-off-training-wheels/11571)
NOTE: Additional audits are underway and feedback will be adjusted.
Setup continous deployment of npm packages publishment
Issue Type
CI/CD
Kroma Version
0.2.1
Current Behaviour?
There is no continuous deployment setup to publish npm packages.
Expected Behaviour
When a new version of Kroma is released, a new version of npm packages should be released as well with the same version of Kroma
Improve validation of multiple outputs
Issue Type
Performance
Kroma Version
0.2.1
Current Behaviour?
When validating multiple outputs (when scanning previous outputs or missed output submitted event), validator fetches and validates output one by one. To improve the performance of validation, it should fetch multiple outputs at once and validate it.
Expected Behaviour
Validator can fetch multiple outputs and validate them.
Allow multiple validators to submit output
Issue Type
Feature Request
Kroma Version
0.1.0
OS Platform and Distribution
Linux Ubuntu 22.04
Go version
go1.19.3 linux/amd64
Node version
v16.14.2
Changes
Currently a single validator only submits output, which is called validation. For the next release, we want to contain permissionless validation.
TL;DR
Fee vaults
would be divided into three categories based on its purpose.Proposer Reward Vault
,Protocol Vault
andValidator Reward Vault
.Optimism distinguishes between three different types of funding sources:
ProposerFeeVault
,BaseFeeVault
, andRollupFeeVault
, based on their origin. In the upcoming release of Kroma, funds will be divided intoProposerRewardVault
,ProtocolVault
, andValidatorRewardVault
, based on their purpose. TheProposerRewardVault
will be similar to the existingRollupFeeVault
. Of the total fee (sum of base fee and priority fee), a proportion R (Validator Reward Ratio
) will go to theValidatorRewardVault
, while the remaining amount will go to theProtocolVault
. The funds in theValidatorRewardVault
will be used solely for rewarding validators, while theProtocolVault
will be used for the development of the protocol.R is designed considering the following:
To participate in the validation process, a validator must stake a certain amount of bond, but if the bonding amount is too high, the profitability will decrease, and if it is too low, it may lead to abuse. Therefore, to ensure that the staking profitability is similar to that of ETH staking, it is important to set $R_{min}$ and $R_{max}$ appropriately. If the output submitted by a validator is successfully finalized, they can claim a share of the amount present in the
ValidatorRewardVault
at that time proportional to their contribution. However, there is a submission timeout for validation, and if the output is not submitted within that timeout, the trusted validator will receive the reward.In addition, the validation bonding amount should be proportional to the
ValidatorRewardVault
and inversely proportional to the number of pending output submissions.On the other hand, the challenge bonding amount is initially similar to the validation bonding amount, but as the finalized period approaches, the required amount increases. This is to prevent attacks that try to prevent the output from being finalized by challenging it at the last minute. Currently, the finalization period of our chain is 7 days after the output submission, and there is only one challenge, so there are no immediate problems such as delay attacks, but it is still an issue that needs to be discussed. In a similar context, the challenge reward ratio also decreases as the finalization period approaches.
TODO
As a first implementation, the protocol will reward only the one who submits the output the fastest. Such a design will make only a few validators with high-spec devices participate in the network. To prevent this, we need to use VRF (verifiable random function) or Round-robin to ensure that everyone has a fair chance.
Tasks
ValidatorPool.sol
andColosseum.sol
. allow only registered validators to submit output with a bond. (https://github.com/kroma-network/kroma/pull/53)ProposerFeeVault.sol
,BaseFeeVault.sol
andRollupFeeVault.sol
. (https://github.com/kroma-network/kroma/pull/47)ProtocolVault.sol
andValidationRewardVault.sol
. (https://github.com/kroma-network/go-ethereum/pull/36)coinbase
/suggestFeeRecipient
to zero address.Support debugging by attaching go process which is run by docker compose
Issue Type
Feature Request
Kroma Version
0.1.0
OS Platform and Distribution
Linux Ubuntu 22.04
Go version
go1.19.3 linux/amd64
Node version
No response
Current Behaviour?
In
ops-devnet/docker-compose.yaml
, setpid
tohost
onkanvas-node
.And then set
ptrace_scope
to0
And then if I try to debug by attaching go process is rejected with this message.
Which feature do you want to expect?
I expect the process is launched with
uid:gid
so that we are able to debug. Currently, we should rely on the log message, which is very difficult when we consider that the logs are emitted so long.