Skip to content

Commit

Permalink
Merge pull request #212 from kroma-network/dev
Browse files Browse the repository at this point in the history
dev -> main
  • Loading branch information
kangsorang authored Oct 19, 2023
2 parents 578b976 + 332acb5 commit 37092a3
Show file tree
Hide file tree
Showing 250 changed files with 32,027 additions and 5,991 deletions.
44 changes: 38 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,48 @@
# Kroma
<div align="center">
<br />
<br />
<a href="https://kroma.network"><img alt="Kroma" src="https://github.com/kroma-network/kroma-brand-kit/raw/main/assets/images/signature/Kroma-signature.svg" width=500></a>
<br />
<h3><a href="https://kroma.network">Kroma</a> aims to be a New Universal ZK Rollup on Ethereum.</h3>
<br />
</div>

This is a client for Kroma network.
## About Kroma

## Documentation
Kroma is the first universal stage 2 Layer 2 (L2) on Ethereum. Kroma has been developed based on Optimism Bedrock
architecture, and aims to be a universal ZK rollup. Currently, Kroma operates as an Optimistic rollup with ZK fault
proofs, utilizing a zkEVM based on Scroll. The goal of Kroma is to eventually transition to a ZK rollup once the
generation of ZK proofs becomes more cost-efficient and faster.

If you want to build Kroma, check out the [Protocol Specs](./specs/).
Kroma offers lower transactions fees compared to the Ethereum mainnet, with native Ethereum security and EVM
equivalence. Our roadmap to transition from Optimistic rollup to ZK rollup sets Kroma apart from other L2 networks.
Additionally, Kroma is advancing towards decentralization. As an initial step for this, Kroma has introduced a
permissionless validator and challenge system.

For more detailed information about Kroma, check [Kroma docs](https://docs.kroma.network) (or
[spec docs](./specs)).

## Links

- Official Website: [Kroma](https://kroma.network)
- Documentation: [Kroma Docs](https://docs.kroma.network)
- Blog: [Kroma Medium](https://medium.com/@kroma-network)
- Discord: [Kroma Discord](https://discord.gg/kroma)
- X (Twitter): [Kroma X](https://twitter.com/kroma_network)

## Contributing

Read through [CONTRIBUTING.md](./CONTRIBUTING.md) for a general overview of our contribution process.
Use the [Developer Quick Start](./CONTRIBUTING.md#development-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](https://github.com/kroma-network/kroma/contribute) to find something fun
Then check out our list of [Good First Issues](https://github.com/kroma-network/kroma/contribute) to find something fun
to work on!
****

## Security Policy

Please refer to the canonical [Security Policy](https://github.com/kroma-network/.github/blob/main/SECURITY.md) document
for detailed information about how to report vulnerabilities in this codebase.

## License

All files within this repository are licensed under the [MIT License](./LICENSE) unless stated otherwise.
Binary file not shown.
6 changes: 6 additions & 0 deletions audits/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- DOCTOC SKIP -->
# Kroma Security Audits

This directory contains security audit reports of Kroma.

- [2023-09 Kroma Security Audit by ChainLight](./2023_09_Kroma_Security_Audit_ChainLight.pdf)
1,332 changes: 298 additions & 1,034 deletions bindings/bindings/securitycouncil.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bindings/bindings/securitycouncil_more.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/bindings/securitycounciltoken.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/bindings/securitycounciltoken_more.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/bindings/timelock.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/bindings/timelock_more.go

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions bindings/bindings/upgradegovernor.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/bindings/upgradegovernor_more.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/bindings/validatorpool.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/bindings/validatorpool_more.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bindings/bindings/validatorrewardvault.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components/batcher/batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"

"github.com/kroma-network/kroma/components/batcher/metrics"
"github.com/kroma-network/kroma/utils"
Expand Down
2 changes: 1 addition & 1 deletion components/batcher/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"

"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"

"github.com/kroma-network/kroma/components/batcher"
"github.com/kroma-network/kroma/components/batcher/flags"
Expand Down
22 changes: 11 additions & 11 deletions components/batcher/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"

"github.com/kroma-network/kroma/components/batcher/flags"
"github.com/kroma-network/kroma/components/batcher/metrics"
Expand Down Expand Up @@ -122,18 +122,18 @@ func (c CLIConfig) Check() error {
func NewCLIConfig(ctx *cli.Context) CLIConfig {
return CLIConfig{
// Required Flags
L1EthRpc: ctx.GlobalString(flags.L1EthRpcFlag.Name),
L2EthRpc: ctx.GlobalString(flags.L2EthRpcFlag.Name),
RollupRpc: ctx.GlobalString(flags.RollupRpcFlag.Name),
SubSafetyMargin: ctx.GlobalUint64(flags.SubSafetyMarginFlag.Name),
PollInterval: ctx.GlobalDuration(flags.PollIntervalFlag.Name),
L1EthRpc: ctx.String(flags.L1EthRpcFlag.Name),
L2EthRpc: ctx.String(flags.L2EthRpcFlag.Name),
RollupRpc: ctx.String(flags.RollupRpcFlag.Name),
SubSafetyMargin: ctx.Uint64(flags.SubSafetyMarginFlag.Name),
PollInterval: ctx.Duration(flags.PollIntervalFlag.Name),

// Optional Flags
MaxChannelDuration: ctx.GlobalUint64(flags.MaxChannelDurationFlag.Name),
MaxL1TxSize: ctx.GlobalUint64(flags.MaxL1TxSizeBytesFlag.Name),
TargetL1TxSize: ctx.GlobalUint64(flags.TargetL1TxSizeBytesFlag.Name),
TargetNumFrames: ctx.GlobalInt(flags.TargetNumFramesFlag.Name),
ApproxComprRatio: ctx.GlobalFloat64(flags.ApproxComprRatioFlag.Name),
MaxChannelDuration: ctx.Uint64(flags.MaxChannelDurationFlag.Name),
MaxL1TxSize: ctx.Uint64(flags.MaxL1TxSizeBytesFlag.Name),
TargetL1TxSize: ctx.Uint64(flags.TargetL1TxSizeBytesFlag.Name),
TargetNumFrames: ctx.Int(flags.TargetNumFramesFlag.Name),
ApproxComprRatio: ctx.Float64(flags.ApproxComprRatioFlag.Name),
TxMgrConfig: txmgr.ReadCLIConfig(ctx),
RPCConfig: rpc.ReadCLIConfig(ctx),
LogConfig: klog.ReadCLIConfig(ctx),
Expand Down
72 changes: 36 additions & 36 deletions components/batcher/flags/flags.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package flags

import (
"github.com/urfave/cli"
"github.com/urfave/cli/v2"

"github.com/kroma-network/kroma/components/batcher/rpc"
kservice "github.com/kroma-network/kroma/utils/service"
Expand All @@ -17,71 +17,71 @@ const envVarPrefix = "BATCHER"
var (
// Required flags

L1EthRpcFlag = cli.StringFlag{
L1EthRpcFlag = &cli.StringFlag{
Name: "l1-eth-rpc",
Usage: "HTTP provider URL for L1",
Required: true,
EnvVar: kservice.PrefixEnvVar(envVarPrefix, "L1_ETH_RPC"),
EnvVars: kservice.PrefixEnvVar(envVarPrefix, "L1_ETH_RPC"),
}
L2EthRpcFlag = cli.StringFlag{
L2EthRpcFlag = &cli.StringFlag{
Name: "l2-eth-rpc",
Usage: "HTTP provider URL for L2 execution engine",
Required: true,
EnvVar: kservice.PrefixEnvVar(envVarPrefix, "L2_ETH_RPC"),
EnvVars: kservice.PrefixEnvVar(envVarPrefix, "L2_ETH_RPC"),
}
RollupRpcFlag = cli.StringFlag{
RollupRpcFlag = &cli.StringFlag{
Name: "rollup-rpc",
Usage: "HTTP provider URL for Rollup node",
Required: true,
EnvVar: kservice.PrefixEnvVar(envVarPrefix, "ROLLUP_RPC"),
EnvVars: kservice.PrefixEnvVar(envVarPrefix, "ROLLUP_RPC"),
}
SubSafetyMarginFlag = cli.Uint64Flag{
SubSafetyMarginFlag = &cli.Uint64Flag{
Name: "sub-safety-margin",
Usage: "The batcher tx submission safety margin (in #L1-blocks) to subtract " +
"from a channel's timeout and proposing window, to guarantee safe inclusion " +
"of a channel on L1.",
Required: true,
EnvVar: kservice.PrefixEnvVar(envVarPrefix, "SUB_SAFETY_MARGIN"),
EnvVars: kservice.PrefixEnvVar(envVarPrefix, "SUB_SAFETY_MARGIN"),
}
PollIntervalFlag = cli.DurationFlag{
PollIntervalFlag = &cli.DurationFlag{
Name: "poll-interval",
Usage: "Delay between querying L2 for more transactions and " +
"creating a new batch",
Required: true,
EnvVar: kservice.PrefixEnvVar(envVarPrefix, "POLL_INTERVAL"),
EnvVars: kservice.PrefixEnvVar(envVarPrefix, "POLL_INTERVAL"),
}

// Optional flags

MaxChannelDurationFlag = cli.Uint64Flag{
Name: "max-channel-duration",
Usage: "The maximum duration of L1-blocks to keep a channel open. 0 to disable.",
Value: 0,
EnvVar: kservice.PrefixEnvVar(envVarPrefix, "MAX_CHANNEL_DURATION"),
MaxChannelDurationFlag = &cli.Uint64Flag{
Name: "max-channel-duration",
Usage: "The maximum duration of L1-blocks to keep a channel open. 0 to disable.",
Value: 0,
EnvVars: kservice.PrefixEnvVar(envVarPrefix, "MAX_CHANNEL_DURATION"),
}
MaxL1TxSizeBytesFlag = cli.Uint64Flag{
Name: "max-l1-tx-size-bytes",
Usage: "The maximum size of a batch tx submitted to L1.",
Value: 120_000,
EnvVar: kservice.PrefixEnvVar(envVarPrefix, "MAX_L1_TX_SIZE_BYTES"),
MaxL1TxSizeBytesFlag = &cli.Uint64Flag{
Name: "max-l1-tx-size-bytes",
Usage: "The maximum size of a batch tx submitted to L1.",
Value: 120_000,
EnvVars: kservice.PrefixEnvVar(envVarPrefix, "MAX_L1_TX_SIZE_BYTES"),
}
TargetL1TxSizeBytesFlag = cli.Uint64Flag{
Name: "target-l1-tx-size-bytes",
Usage: "The target size of a batch tx submitted to L1.",
Value: 100_000,
EnvVar: kservice.PrefixEnvVar(envVarPrefix, "TARGET_L1_TX_SIZE_BYTES"),
TargetL1TxSizeBytesFlag = &cli.Uint64Flag{
Name: "target-l1-tx-size-bytes",
Usage: "The target size of a batch tx submitted to L1.",
Value: 100_000,
EnvVars: kservice.PrefixEnvVar(envVarPrefix, "TARGET_L1_TX_SIZE_BYTES"),
}
TargetNumFramesFlag = cli.IntFlag{
Name: "target-num-frames",
Usage: "The target number of frames to create per channel",
Value: 1,
EnvVar: kservice.PrefixEnvVar(envVarPrefix, "TARGET_NUM_FRAMES"),
TargetNumFramesFlag = &cli.IntFlag{
Name: "target-num-frames",
Usage: "The target number of frames to create per channel",
Value: 1,
EnvVars: kservice.PrefixEnvVar(envVarPrefix, "TARGET_NUM_FRAMES"),
}
ApproxComprRatioFlag = cli.Float64Flag{
Name: "approx-compr-ratio",
Usage: "The approximate compression ratio (<= 1.0)",
Value: 1.0,
EnvVar: kservice.PrefixEnvVar(envVarPrefix, "APPROX_COMPR_RATIO"),
ApproxComprRatioFlag = &cli.Float64Flag{
Name: "approx-compr-ratio",
Usage: "The approximate compression ratio (<= 1.0)",
Value: 1.0,
EnvVars: kservice.PrefixEnvVar(envVarPrefix, "APPROX_COMPR_RATIO"),
}
)

Expand Down
12 changes: 6 additions & 6 deletions components/batcher/rpc/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package rpc

import (
"github.com/urfave/cli"
"github.com/urfave/cli/v2"

kservice "github.com/kroma-network/kroma/utils/service"
krpc "github.com/kroma-network/kroma/utils/service/rpc"
Expand All @@ -13,10 +13,10 @@ const (

func CLIFlags(envPrefix string) []cli.Flag {
return []cli.Flag{
cli.BoolFlag{
Name: EnableAdminFlagName,
Usage: "Enable the admin API (experimental)",
EnvVar: kservice.PrefixEnvVar(envPrefix, "RPC_ENABLE_ADMIN"),
&cli.BoolFlag{
Name: EnableAdminFlagName,
Usage: "Enable the admin API (experimental)",
EnvVars: kservice.PrefixEnvVar(envPrefix, "RPC_ENABLE_ADMIN"),
},
}
}
Expand All @@ -29,7 +29,7 @@ type CLIConfig struct {
func ReadCLIConfig(ctx *cli.Context) CLIConfig {
return CLIConfig{
CLIConfig: krpc.ReadCLIConfig(ctx),
EnableAdmin: ctx.GlobalBool(EnableAdminFlagName),
EnableAdmin: ctx.Bool(EnableAdminFlagName),
}
}

Expand Down
31 changes: 31 additions & 0 deletions components/node/chaincfg/chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,36 @@ import (
"github.com/kroma-network/kroma/components/node/rollup"
)

var Mainnet = rollup.Config{
Genesis: rollup.Genesis{
L1: eth.BlockID{
Hash: common.HexToHash("0xe459c500b760ed52a1ad799bf578b257af2c76f6ebe061a4c62627e9c605bced"),
Number: 18067255,
},
L2: eth.BlockID{
Hash: common.HexToHash("0xeab1dbcbd854942126643609f6b457e391b169c819b7e5d5042389ccf6012cbf"),
Number: 0,
},
L2Time: 1693880387,
SystemConfig: eth.SystemConfig{
BatcherAddr: common.HexToAddress("0x41b8cd6791de4d8f9e0eaf7861ac506822adce12"),
Overhead: eth.Bytes32(common.HexToHash("0x00000000000000000000000000000000000000000000000000000000000000bc")),
Scalar: eth.Bytes32(common.HexToHash("0x00000000000000000000000000000000000000000000000000000000000a6fe0")),
GasLimit: 30_000_000,
ValidatorRewardScalar: eth.Bytes32(common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000002710")),
},
},
BlockTime: 2,
MaxProposerDrift: 600,
ProposerWindowSize: 3600,
ChannelTimeout: 300,
L1ChainID: big.NewInt(1),
L2ChainID: big.NewInt(255),
BatchInboxAddress: common.HexToAddress("0xff00000000000000000000000000000000000255"),
DepositContractAddress: common.HexToAddress("0x31f648572b67e60ec6eb8e197e1848cc5f5558de"),
L1SystemConfigAddress: common.HexToAddress("0x3971eb866aa9b2b8afea8a7c816f3b7e8b195a35"),
}

var Sepolia = rollup.Config{
Genesis: rollup.Genesis{
L1: eth.BlockID{
Expand Down Expand Up @@ -41,6 +71,7 @@ var Sepolia = rollup.Config{
}

var NetworksByName = map[string]rollup.Config{
"mainnet": Mainnet,
"sepolia": Sepolia,
}

Expand Down
Loading

0 comments on commit 37092a3

Please sign in to comment.