Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into bitvector-bitlist-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkenan committed Feb 15, 2024
2 parents 3b56b25 + 22a782e commit 30fe232
Show file tree
Hide file tree
Showing 61 changed files with 1,627 additions and 1,516 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ on:
branches: [ main ]
pull_request:
branches: [ '*' ]
# NOTE: these paths should be the same as the ones in ci_skipped.yml
paths-ignore:
- 'docs/**'
- '.all-contributorsrc'
- 'README.md'
- 'LICENSE'
- 'metrics/**'

# Cancel old runs on the same branch (except on main)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

env:
MIX_ENV: test
Expand Down Expand Up @@ -169,7 +181,7 @@ jobs:
run: mix compile --warnings-as-errors
- name: Run the node
# NOTE: this starts and then stops the application. It should catch simple runtime errors
run: mix run -- --checkpoint-sync https://sync-mainnet.beaconcha.in/
run: mix run -- --checkpoint-sync-url https://mainnet-checkpoint-sync.stakely.io/

test:
name: Test
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/ci_skipped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Workaround to skip the "required" check when jobs are skipped
name: '*CI Skipped*'

on:
pull_request:
branches: [ '*' ]
paths:
- 'docs/**'
- '.all-contributorsrc'
- 'README.md'
- 'LICENSE'
- 'metrics/**'

jobs:
compile-native:
name: Build native libraries
runs-on: ubuntu-22.04
if: false
steps: [run: true]

build:
name: Build project
runs-on: ubuntu-22.04
if: false
steps: [run: true]

smoke:
name: Start and stop the node
runs-on: ubuntu-22.04
if: false
steps: [run: true]

test:
name: Test
runs-on: ubuntu-22.04
if: false
steps: [run: true]

lint:
name: Lint
runs-on: ubuntu-22.04
if: false
steps: [run: true]

# NOTE: matrix jobs aren't expanded if skipped
spectests:
name: Run spec-tests
strategy:
matrix:
config: ["minimal", "general", "mainnet"]
runs-on: ubuntu-22.04
steps: [run: true]
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,15 @@ iex: compile-all

#▶️ checkpoint-sync: @ Run an interactive terminal using checkpoint sync.
checkpoint-sync: compile-all
iex -S mix run -- --checkpoint-sync https://sync-mainnet.beaconcha.in/
iex -S mix run -- --checkpoint-sync-url https://mainnet-checkpoint-sync.stakely.io/

#▶️ sepolia: @ Run an interactive terminal using sepolia network
sepolia: compile-all
iex -S mix run -- --checkpoint-sync https://sepolia.beaconstate.info --network sepolia
iex -S mix run -- --checkpoint-sync-url https://sepolia.beaconstate.info --network sepolia

#▶️ gnosis: @ Run an interactive terminal using gnosis network
gnosis: compile-all
iex -S mix run -- --checkpoint-sync-url https://checkpoint.gnosischain.com --network gnosis

#🔴 test: @ Run tests
test: compile-all
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ The iex terminal can be closed by pressing ctrl+c two times.
### Checkpoint Sync

You can also sync from a checkpoint given by a trusted third-party.
For that, get the URL that serves the checkpoint, and pass it to the node with the "--checkpoint-sync" flag:
You can specify a URL to fetch it from with the "--checkpoint-sync-url" flag:

```shell
iex -S mix run -- --checkpoint-sync <your_url_here>
iex -S mix run -- --checkpoint-sync-url <your_url_here>
```

Some public endpoints can be found in [eth-clients.github.io/checkpoint-sync-endpoints](https://eth-clients.github.io/checkpoint-sync-endpoints/).
Expand Down
21 changes: 21 additions & 0 deletions bench/shuffling_bench.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
alias LambdaEthereumConsensus.StateTransition.Shuffling
alias LambdaEthereumConsensus.StateTransition.Misc

index_count = 1000
seed = :crypto.strong_rand_bytes(32)
input = 0..(index_count - 1)//1

Benchee.run(
%{
"shuffle_list" => fn ->
Shuffling.shuffle_list(Aja.Vector.new(input), seed)
end,
"compute_shuffled_index" => fn ->
for index <- input do
Misc.compute_shuffled_index(index, index_count, seed)
end
end
},
warmup: 2,
time: 5
)
33 changes: 3 additions & 30 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,10 @@ import Config
# Configure logging
config :logger, level: :info, truncate: :infinity

config :logger, :default_formatter, format: {ConsoleLogger, :format}, metadata: [:slot, :root]

# # Uncomment to log to a file
# # TODO: we might want to enable this with a CLI flag
# config :logger, :default_handler,
# config: [
# file: ~c"logs/system.log",
# filesync_repeat_interval: 5000,
# file_check: 5000,
# max_no_bytes: 10_000_000,
# max_no_files: 5,
# compress_on_rotate: true
# ]

# # NOTE: We want to log UTC timestamps, for convenience
# config :logger, utc_log: true

# config :logger, :default_formatter,
# format: {LogfmtEx, :format},
# colors: [enabled: false],
# metadata: [:mfa]
config :lambda_ethereum_consensus, LambdaEthereumConsensus.Telemetry, enable: true

# config :logfmt_ex, :opts,
# message_key: "msg",
# timestamp_key: "ts",
# timestamp_format: :iso8601
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason

# Configures the phoenix endpoint
config :lambda_ethereum_consensus, BeaconApi.Endpoint,
Expand All @@ -39,8 +17,3 @@ config :lambda_ethereum_consensus, BeaconApi.Endpoint,
formats: [json: BeaconApi.ErrorJSON],
layout: false
]

config :lambda_ethereum_consensus, LambdaEthereumConsensus.Telemetry, enable: true

# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason
14 changes: 14 additions & 0 deletions config/networks/gnosis/bootnodes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- enr:-Ly4QMU1y81COwm1VZgxGF4_eZ21ub9-GHF6dXZ29aEJ0oZpcV2Rysw-viaEKfpcpu9ZarILJLxFZjcKOjE0Sybs3MQBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpCCS-QxAgAAZP__________gmlkgnY0gmlwhANLnx-Jc2VjcDI1NmsxoQKoaYT8I-wf2I_f_ii6EgoSSXj5T3bhiDyW-7ZLsY3T64hzeW5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EM0QnzolzZWNwMjU2azGhAhNvrRkpuK4MWTf3WqiOXSOePL8Zc-wKVpZ9FQx_BDadg3RjcIIjKIN1ZHCCIyg
131 changes: 131 additions & 0 deletions config/networks/gnosis/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
PRESET_BASE: "gnosis"

# Free-form short name of the network that this configuration applies to - known
# canonical network names include:
# * 'mainnet' - there can be only one
# * 'prater' - testnet
# Must match the regex: [a-z0-9\-]
CONFIG_NAME: "gnosis"

# Transition
# ---------------------------------------------------------------
# Estimated on Dec 5, 2022
TERMINAL_TOTAL_DIFFICULTY: 8626000000000000000000058750000000000000000000
# By default, don't use these params
TERMINAL_BLOCK_HASH: 0x0000000000000000000000000000000000000000000000000000000000000000
TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: 18446744073709551615

# Genesis
# ---------------------------------------------------------------
# `2**12` (= 4,096)
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 4096
# Dec 08, 2021, 13:00 UTC
MIN_GENESIS_TIME: 1638968400
# GBC area code
GENESIS_FORK_VERSION: 0x00000064
# Customized for GBC: ~1 hour
GENESIS_DELAY: 6000

# Forking
# ---------------------------------------------------------------
# Some forks are disabled for now:
# - These may be re-assigned to another fork-version later
# - Temporarily set to max uint64 value: 2**64 - 1

# Altair
ALTAIR_FORK_VERSION: 0x01000064
ALTAIR_FORK_EPOCH: 512
# Bellatrix
BELLATRIX_FORK_VERSION: 0x02000064
BELLATRIX_FORK_EPOCH: 385536 # 2022-11-30T19:23:40.000Z
# Capella
CAPELLA_FORK_VERSION: 0x03000064
CAPELLA_FORK_EPOCH: 648704 # 2023-08-01T11:34:20.000Z
# Deneb
DENEB_FORK_VERSION: 0x04000064
DENEB_FORK_EPOCH: 18446744073709551615

# Time parameters
# ---------------------------------------------------------------
# 5 seconds
SECONDS_PER_SLOT: 5
# 6 (estimate from xDai mainnet)
SECONDS_PER_ETH1_BLOCK: 6
# 2**8 (= 256) epochs ~5.7 hours
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256
# 2**8 (= 256) epochs ~5.7 hours
SHARD_COMMITTEE_PERIOD: 256
# 2**10 (= 1024) ~1.4 hour
ETH1_FOLLOW_DISTANCE: 1024

# Validator cycle
# ---------------------------------------------------------------
# 2**2 (= 4)
INACTIVITY_SCORE_BIAS: 4
# 2**4 (= 16)
INACTIVITY_SCORE_RECOVERY_RATE: 16
# 2**4 * 10**9 (= 16,000,000,000) Gwei
EJECTION_BALANCE: 16000000000
# 2**2 (= 4)
MIN_PER_EPOCH_CHURN_LIMIT: 4
# 2**12 (= 4096)
CHURN_LIMIT_QUOTIENT: 4096
# [New in Deneb:EIP7514] 2*
MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT: 2

# Fork choice
# ---------------------------------------------------------------
# 40%
PROPOSER_SCORE_BOOST: 40
# 20%
REORG_HEAD_WEIGHT_THRESHOLD: 20
# 160%
REORG_PARENT_WEIGHT_THRESHOLD: 160
# `2` epochs
REORG_MAX_EPOCHS_SINCE_FINALIZATION: 2

# Deposit contract
# ---------------------------------------------------------------
# xDai Mainnet
DEPOSIT_CHAIN_ID: 100
DEPOSIT_NETWORK_ID: 100
DEPOSIT_CONTRACT_ADDRESS: 0x0B98057eA310F4d31F2a452B414647007d1645d9

# Networking
# ---------------------------------------------------------------
# `10 * 2**20` (= 10485760, 10 MiB)
GOSSIP_MAX_SIZE: 10485760
# `2**10` (= 1024)
MAX_REQUEST_BLOCKS: 1024
# `2**8` (= 256)
EPOCHS_PER_SUBNET_SUBSCRIPTION: 256
# 33024, ~31 days
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024
# `10 * 2**20` (=10485760, 10 MiB)
MAX_CHUNK_SIZE: 10485760
# 5s
TTFB_TIMEOUT: 5
# 10s
RESP_TIMEOUT: 10
ATTESTATION_PROPAGATION_SLOT_RANGE: 32
# 500ms
MAXIMUM_GOSSIP_CLOCK_DISPARITY: 500
MESSAGE_DOMAIN_INVALID_SNAPPY: 0x00000000
MESSAGE_DOMAIN_VALID_SNAPPY: 0x01000000
# 2 subnets per node
SUBNETS_PER_NODE: 2
# 2**8 (= 64)
ATTESTATION_SUBNET_COUNT: 64
ATTESTATION_SUBNET_EXTRA_BITS: 0
# ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS
ATTESTATION_SUBNET_PREFIX_BITS: 6

# Deneb
# `2**7` (=128)
MAX_REQUEST_BLOCKS_DENEB: 128
# MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK
MAX_REQUEST_BLOB_SIDECARS: 768
# `2**14` (= 16384 epochs, ~15 days)
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 16384
# `6`
BLOB_SIDECAR_SUBNET_COUNT: 6
22 changes: 22 additions & 0 deletions config/presets/gnosis/altair.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Gnosis Beacon Chain preset - Altair

# Updated penalty values
# ---------------------------------------------------------------
# 3 * 2**24 (= 50,331,648)
INACTIVITY_PENALTY_QUOTIENT_ALTAIR: 50331648
# 2**6 (= 64)
MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR: 64
# 2
PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR: 2

# Sync committee
# ---------------------------------------------------------------
# 2**9 (= 512)
SYNC_COMMITTEE_SIZE: 512
# 2**8 (= 256)
EPOCHS_PER_SYNC_COMMITTEE_PERIOD: 512

# Sync protocol
# ---------------------------------------------------------------
# 1
MIN_SYNC_COMMITTEE_PARTICIPANTS: 1
21 changes: 21 additions & 0 deletions config/presets/gnosis/bellatrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Gnosis Beacon Chain preset - Bellatrix

# Updated penalty values
# ---------------------------------------------------------------
# 2**24 (= 16,777,216)
INACTIVITY_PENALTY_QUOTIENT_BELLATRIX: 16777216
# 2**5 (= 32)
MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX: 32
# 3
PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX: 3

# Execution
# ---------------------------------------------------------------
# 2**30 (= 1,073,741,824)
MAX_BYTES_PER_TRANSACTION: 1073741824
# 2**20 (= 1,048,576)
MAX_TRANSACTIONS_PER_PAYLOAD: 1048576
# 2**8 (= 256)
BYTES_PER_LOGS_BLOOM: 256
# 2**5 (= 32)
MAX_EXTRA_DATA_BYTES: 32
17 changes: 17 additions & 0 deletions config/presets/gnosis/capella.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Mainnet preset - Capella

# Misc
# Max operations per block
# ---------------------------------------------------------------
# 2**4 (= 16)
MAX_BLS_TO_EXECUTION_CHANGES: 16

# Execution
# ---------------------------------------------------------------
# 2**4 (= 16) withdrawals
MAX_WITHDRAWALS_PER_PAYLOAD: 8

# Withdrawals processing
# ---------------------------------------------------------------
# 2**14 (= 16384) validators
MAX_VALIDATORS_PER_WITHDRAWALS_SWEEP: 8192
Loading

0 comments on commit 30fe232

Please sign in to comment.