Skip to content

Commit

Permalink
Merge branch 'main' into 2054-historical-zq1-blocks-should-have-their…
Browse files Browse the repository at this point in the history
…-state-root-hash-set-to-zero
  • Loading branch information
86667 authored Feb 6, 2025
2 parents 2105b91 + 541e58f commit 4940f54
Show file tree
Hide file tree
Showing 43 changed files with 503 additions and 368 deletions.
314 changes: 194 additions & 120 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions eth-trie.rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ readme = "README.md"
keywords = ["patricia", "mpt", "evm", "trie", "ethereum"]

[dependencies]
alloy = { version = "0.6.4", default-features = false, features = ["rlp"] }
alloy = { version = "0.11.0", default-features = false, features = ["rlp"] }
hashbrown = "0.15.2"
log = "0.4.25"
parking_lot = "0.12.3"
rlp = "0.6.1"

[dev-dependencies]
alloy = { version = "0.6.4", default-features = false, features = ["getrandom"] }
alloy = { version = "0.11.0", default-features = false, features = ["getrandom"] }
rand = "0.8.5"
hex = "0.4.3"
criterion = "0.5.1"
Expand Down
9 changes: 8 additions & 1 deletion infra/config_rpc_disabled.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
bootstrap_address = [
"12D3KooWESMZ2ttSxDwjfnNe23sHCqsJf6sNEKwgHkdgtCHDsbWU",
"/ip4/198.51.100.1/tcp/5643",
]
otlp_collector_endpoint = "http://otel-collector:4317"

[[nodes]]
Expand All @@ -21,11 +25,14 @@ consensus.genesis_accounts = [
["1958b2f7b5c476F5e8FeBdEFeba5EC39E2f20288", "5000000000000000000000"],
]

# speed up local/docker epochs
consensus.blocks_per_epoch = 36

# Reward parameters
consensus.rewards_per_hour = "51_000_000_000_000_000_000_000"
consensus.blocks_per_hour = 3600
consensus.minimum_stake = "10_000_000_000_000_000_000_000_000"
# Gas parameters
consensus.eth_block_gas_limit = 84000000
consensus.gas_price = "4_761_904_800_000"
consensus.contract_upgrade_block_heights = { deposit_v4 = 0 }
consensus.contract_upgrade_block_heights = { deposit_v4 = 0 }
3 changes: 0 additions & 3 deletions infra/tf/api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ module "apis" {
subdomain = base64encode(var.subdomain)
}

node_dns_subdomain = var.node_dns_subdomain
node_dns_zone_project_id = var.node_dns_zone_project_id

service_account_iam = local.default_service_account_iam
}

Expand Down
3 changes: 0 additions & 3 deletions infra/tf/apps.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ module "apps" {
subdomain = base64encode(var.subdomain)
}

node_dns_subdomain = var.node_dns_subdomain
node_dns_zone_project_id = var.node_dns_zone_project_id

service_account_iam = local.default_service_account_iam
}

Expand Down
44 changes: 0 additions & 44 deletions infra/tf/bootstrap.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ module "bootstraps" {
subdomain = base64encode(var.subdomain)
}

node_dns_subdomain = var.node_dns_subdomain
node_dns_zone_project_id = var.node_dns_zone_project_id

service_account_iam = local.default_service_account_iam
}

Expand All @@ -39,44 +36,3 @@ resource "google_compute_instance_group" "bootstrap" {
port = "3333"
}
}

resource "google_compute_region_health_check" "bootstrap" {
name = "${var.chain_name}-bootstrap-health"

tcp_health_check {
port_name = "peer"
port_specification = "USE_NAMED_PORT"
}
}

resource "google_compute_region_backend_service" "bootstrap" {
name = "${var.chain_name}-bootstrap-nodes"
health_checks = [google_compute_region_health_check.bootstrap.id]
port_name = "peer"
load_balancing_scheme = "EXTERNAL"
protocol = "TCP"
enable_cdn = false
session_affinity = "CLIENT_IP" # Enables sticky sessions by client IP
locality_lb_policy = "MAGLEV"

dynamic "backend" {
for_each = var.bootstrap.detach_load_balancer ? {} : google_compute_instance_group.bootstrap
content {
group = backend.value.self_link
balancing_mode = "CONNECTION"
}
}
}

data "google_compute_address" "bootstrap" {
name = "bootstrap-${replace(var.subdomain, ".", "-")}"
}

resource "google_compute_forwarding_rule" "bootstrap" {
name = "${var.chain_name}-bootstrap-nodes-forwarding-rule"
ip_protocol = "TCP"
load_balancing_scheme = "EXTERNAL"
port_range = "3333"
backend_service = google_compute_region_backend_service.bootstrap.id # Directly reference backend service
ip_address = data.google_compute_address.bootstrap.address
}
3 changes: 0 additions & 3 deletions infra/tf/checkpoints.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ module "checkpoints" {
subdomain = base64encode(var.subdomain)
}

node_dns_subdomain = var.node_dns_subdomain
node_dns_zone_project_id = var.node_dns_zone_project_id

service_account_iam = local.default_service_account_iam
}

Expand Down
3 changes: 0 additions & 3 deletions infra/tf/graph.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ module "graphs" {
subdomain = base64encode(var.subdomain)
}

node_dns_subdomain = var.node_dns_subdomain
node_dns_zone_project_id = var.node_dns_zone_project_id

service_account_iam = local.default_service_account_iam
}

Expand Down
5 changes: 2 additions & 3 deletions infra/tf/modules/node/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
################################################################################

locals {
node_dns_zone_name = replace(var.node_dns_subdomain, ".", "-")
resource_name = format("%s-%s-%s", var.chain_name, local.role_short_name, random_id.name_suffix.hex)
role_short_name = var.node_role_mappings[var.role]
resource_name = format("%s-%s-%s", var.chain_name, local.role_short_name, random_id.name_suffix.hex)
role_short_name = var.node_role_mappings[var.role]

regions = flatten([
for instance in local.instances : instance.region
Expand Down
14 changes: 0 additions & 14 deletions infra/tf/modules/node/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,3 @@ resource "google_compute_instance" "this" {
]
}
}

resource "google_dns_record_set" "this" {
for_each = local.instances_map

project = var.node_dns_zone_project_id
managed_zone = local.node_dns_zone_name
name = "${google_compute_instance.this[each.value.resource_id].name}.${var.node_dns_subdomain}."
type = "A"
ttl = "60"

rrdatas = [google_compute_instance.this[each.value.resource_id].network_interface[0].access_config[0].nat_ip]

depends_on = [google_compute_instance.this]
}
5 changes: 5 additions & 0 deletions infra/tf/modules/node/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ output "network_ip" {
value = { for instance in google_compute_instance.this : instance.name => instance.network_interface[0].network_ip }
}

output "external_ip" {
description = "The provisioned instances network IPs"
value = { for instance in google_compute_instance.this : instance.name => instance.network_interface[0].access_config[0].nat_ip }
}

output "zones" {
description = "The GCP zones where the instances are deployed in"
value = distinct(flatten([
Expand Down
12 changes: 0 additions & 12 deletions infra/tf/modules/node/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,6 @@ variable "network_tags" {
nullable = false
}

variable "node_dns_subdomain" {
description = "Nodes DNS zone name (ie. zq2.dev)"
type = string
nullable = false
}

variable "node_dns_zone_project_id" {
description = "The id of the Google project that hosts the DNS zone."
type = string
nullable = false
}

variable "service_account_iam" {
description = "(Optional) Roles to associate to the instances service account"
type = list(string)
Expand Down
43 changes: 43 additions & 0 deletions infra/tf/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
################################################################################
# ZQ2 GCP Terraform outputs
################################################################################

output "api_external_ip" {
description = "The provisioned bootstrap external IPs"
value = module.apis.external_ip
}

output "bootstrap_external_ip" {
description = "The provisioned bootstrap external IPs"
value = module.bootstraps.external_ip
}

output "bootstrap_dns_names" {
description = "The provisioned bootstrap DNS names"
value = length(module.bootstraps.external_ip) > 0 ? merge(
{ "bootstrap.${var.chain_name}" = module.bootstraps.external_ip[keys(module.bootstraps.external_ip)[0]] },
{ for idx, key in keys(module.bootstraps.external_ip) : "bootstrap-${idx}.${var.chain_name}" => module.bootstraps.external_ip[key] }
) : {}
}

output "validator_external_ip" {
description = "The provisioned bootstrap external IPs"
value = module.validators.external_ip
}

output "checkpoint_external_ip" {
description = "The provisioned bootstrap external IPs"
value = module.checkpoints.external_ip
}

output "persistence_external_ip" {
description = "The provisioned bootstrap external IPs"
value = module.persistences.external_ip
}

output "query_external_ip" {
description = "The provisioned bootstrap external IPs"
value = module.queries.external_ip
}

output "graph_external_ip" {
description = "The provisioned bootstrap external IPs"
value = module.graphs.external_ip
}
3 changes: 0 additions & 3 deletions infra/tf/persistence.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ module "persistences" {
subdomain = base64encode(var.subdomain)
}

node_dns_subdomain = var.node_dns_subdomain
node_dns_zone_project_id = var.node_dns_zone_project_id

service_account_iam = local.default_service_account_iam
}

Expand Down
3 changes: 0 additions & 3 deletions infra/tf/query.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ module "queries" {
subdomain = base64encode(var.subdomain)
}

node_dns_subdomain = var.node_dns_subdomain
node_dns_zone_project_id = var.node_dns_zone_project_id

service_account_iam = local.default_service_account_iam
}

Expand Down
3 changes: 0 additions & 3 deletions infra/tf/validator.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ module "validators" {
subdomain = base64encode(var.subdomain)
}

node_dns_subdomain = var.node_dns_subdomain
node_dns_zone_project_id = var.node_dns_zone_project_id

service_account_iam = local.default_service_account_iam
}

Expand Down
13 changes: 0 additions & 13 deletions infra/tf/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ variable "bootstrap" {
instance_type = optional(string, "e2-standard-2")
provisioning_model = optional(string, "STANDARD")
generate_external_ip = optional(bool, true)
detach_load_balancer = optional(bool, false)
nodes = list(object({
count = number
region = optional(string)
Expand Down Expand Up @@ -318,18 +317,6 @@ variable "graph" {
}
}

variable "node_dns_subdomain" {
description = "Nodes DNS zone name"
type = string
nullable = false
}

variable "node_dns_zone_project_id" {
description = "The id of the Google project that hosts the DNS zone."
type = string
nullable = false
}

variable "subdomain" {
description = "The subdomain for the public endpoints"
type = string
Expand Down
8 changes: 4 additions & 4 deletions z2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
alloy = { version = "0.6.4", default-features = false, features = ["consensus", "eips", "rlp", "serde", "signer-local"] }
alloy = { version = "0.11.0", default-features = false, features = ["consensus", "eips", "rlp", "serde", "signer-local"] }
anyhow = "1.0.95"
async-trait = "0.1.86"
base64 = "0.22.0"
Expand Down Expand Up @@ -55,11 +55,11 @@ rand = "0.8.5"
rand_core = "0.6.4"
regex = "1.11.1"
reqwest = {version = "0.12.9", features = ["json", "rustls-tls", "http2", "charset"], default-features = false}
revm = {version = "18.0.0", features = ["optional_balance_check"]}
revm = {version = "19.4.0", features = ["optional_balance_check"]}
rs-leveldb = "0.1.5"
rustls = "0.23.22"
serde = {version = "1.0.217", features = ["derive"]}
serde_json = "1.0.138"
serde_json = { version = "1.0.138", features = ["preserve_order"] }
serde_yaml = "0.9.34"
sha2 = "0.10.8"
sha3 = "0.10.8"
Expand All @@ -70,7 +70,7 @@ tera = "1.19.1"
thiserror = "2.0.11"
tokio = {version = "1.43.0", features = ["macros", "rt-multi-thread", "sync", "io-std", "io-util", "process", "fs"]}
tokio-stream = "0.1.17"
toml = "0.8.19"
toml = { version = "0.8.19", features = ["preserve_order"] }
tracing = "0.1.41"
tracing-subscriber = "0.3.18"
url = "2.5.4"
Expand Down
11 changes: 6 additions & 5 deletions z2/docs/join.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ Join a ZQ2 network
Usage: z2 join [OPTIONS] --chain <CHAIN_NAME>

Options:
--chain <CHAIN_NAME> Specify the ZQ2 chain you want join [possible values: zq2-richard, zq2-uccbtest, zq2-infratest, zq2-perftest, zq2-devnet, zq2-prototestnet, zq2-protomainnet]
--image-tag <IMAGE_TAG> Specify the tag of the image to run
-v, --verbose... Increase logging verbosity
-q, --quiet... Decrease logging verbosity
-h, --help Print help
--chain <CHAIN_NAME> Specify the ZQ2 chain you want join [possible values: zq2-richard, zq2-uccbtest, zq2-infratest, zq2-perftest, zq2-devnet, zq2-prototestnet, zq2-protomainnet]
--image-tag <IMAGE_TAG> Specify the tag of the image to run
--otlp-endpoint <OTLP_ENDPOINT> Endpoint of OTLP collector
-v, --verbose... Increase logging verbosity
-q, --quiet... Decrease logging verbosity
-h, --help Print help
```

## Create a startup script and configuration file to join the prototestnet
Expand Down
4 changes: 2 additions & 2 deletions z2/resources/chain-specs/zq2-devnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ consensus.minimum_stake = "10_000_000_000_000_000_000_000_000"
consensus.eth_block_gas_limit = 84000000
consensus.gas_price = "4_761_904_800_000"
consensus.scilla_call_gas_exempt_addrs = []
consensus.contract_upgrade_block_heights = { deposit_v3 = 3600 }
consensus.contract_upgrade_block_heights = { deposit_v3 = 3600, deposit_v4 = 428400 }

api_servers = [{ port = 4201, enabled_apis = [{ apis = ["blockNumber"], namespace = "eth" }] }, { enabled_apis = ["admin", "debug", "erigon", "eth", "net", "ots", "trace", "txpool", "web3", "zilliqa"], port = 4202 }]
api_servers = [{ port = 4201, enabled_apis = [{ namespace = "eth", apis = ["blockNumber"] }] }, { port = 4202, enabled_apis = ["admin", "debug", "erigon", "eth", "net", "ots", "trace", "txpool", "web3", "zilliqa"] }]
8 changes: 4 additions & 4 deletions z2/resources/chain-specs/zq2-infratest.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
p2p_port = 3333
bootstrap_address = [ "12D3KooWSe8gG2PYGg9qemHNZDsuZcFjkvcU2Fr49bomHGZD2k8x", "/dns/bootstrap.zq2-infratest.zilstg.dev/tcp/3333" ]
bootstrap_address = [ "12D3KooWLe4CnsLgeEZnfgS44gdDKdsMEayE96qfU2csB8Lijp54", "/dns/bootstrap.zq2-infratest.zilstg.dev/tcp/3333" ]

[[nodes]]
eth_chain_id = 33103
allowed_timestamp_skew = { secs = 60, nanos = 0 }
data_dir = "/data"
consensus.genesis_accounts = [ ["0x5e1f6f14a75f12e055599a137229cfa012554695", "900_000_000_000_000_000_000_000_000" ] ]
consensus.genesis_deposits = [ ["95f1b0d4d47dfdd782e5ea823c2a175098e1a1afd9525c9f7e2f9fec6da080ab654ff27210d20d81331038bd10e0b08e", "12D3KooWSe8gG2PYGg9qemHNZDsuZcFjkvcU2Fr49bomHGZD2k8x", "20_000_000_000_000_000_000_000_000", "0x0000000000000000000000000000000000000000", "0x5e1f6f14a75f12e055599a137229cfa012554695"] ]
consensus.genesis_deposits = [ ["b462b1237800dd183432290cb6e3691ff3832886db903979f086078e5334e32ee3f8d483ee4a96dcae747fdcc5dd2ba7", "12D3KooWLe4CnsLgeEZnfgS44gdDKdsMEayE96qfU2csB8Lijp54", "20_000_000_000_000_000_000_000_000", "0x0000000000000000000000000000000000000000", "0x5e1f6f14a75f12e055599a137229cfa012554695"] ]

# Reward parameters
consensus.rewards_per_hour = "51_000_000_000_000_000_000_000"
Expand All @@ -16,6 +16,6 @@ consensus.minimum_stake = "10_000_000_000_000_000_000_000_000"
consensus.eth_block_gas_limit = 84000000
consensus.gas_price = "4_761_904_800_000"
consensus.scilla_call_gas_exempt_addrs = []
consensus.contract_upgrade_block_heights = { deposit_v3 = 0 }
consensus.contract_upgrade_block_heights = { deposit_v4 = 0 }

api_servers = [{ port = 4201, enabled_apis = [{ apis = ["blockNumber"], namespace = "eth" }] }, { enabled_apis = ["admin", "erigon", "eth", "net", "ots", "trace", "txpool", "web3", "zilliqa"], port = 4202 }]
api_servers = [{ port = 4201, enabled_apis = [{ namespace = "eth", apis = ["blockNumber"] }] }, { port = 4202, enabled_apis = ["admin", "debug", "erigon", "eth", "net", "ots", "trace", "txpool", "web3", "zilliqa"] }]
4 changes: 2 additions & 2 deletions z2/resources/chain-specs/zq2-perftest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ consensus.minimum_stake = "10_000_000_000_000_000_000_000_000"
consensus.eth_block_gas_limit = 84000000
consensus.gas_price = "4_761_904_800_000"
consensus.scilla_call_gas_exempt_addrs = []
consensus.contract_upgrade_block_heights = {}
consensus.contract_upgrade_block_heights = { deposit_v4 = 0 }

api_servers = [{ port = 4201, enabled_apis = [{ apis = ["blockNumber"], namespace = "eth" }] }, { enabled_apis = ["admin", "debug", "erigon", "eth", "net", "ots", "trace", "txpool", "web3", "zilliqa"], port = 4202 }]
api_servers = [{ port = 4201, enabled_apis = [{ namespace = "eth", apis = ["blockNumber"] }] }, { port = 4202, enabled_apis = ["admin", "debug", "erigon", "eth", "net", "ots", "trace", "txpool", "web3", "zilliqa"] }]
Loading

0 comments on commit 4940f54

Please sign in to comment.