Skip to content

Commit

Permalink
feat(generate): native restaking genesis (ExocoreNetwork#123)
Browse files Browse the repository at this point in the history
* refactor: use correct constants

A lot of the parameters such as the beacon genesis time, the deneb time
and the deposit address are dependent on the network chosen for
deployment. This change allows a library to provide these constants,
based on the `block.chainid`.

Additionally, it creates the possibility of using a separately deployed
contract for integration networks (refer to the next commit), for which,
the parameters can be dynamically provided via `INetworkConfig`.

As a side effect, the default chain_id used in tests has been changed to
let `NetworkConstants` library provide these constants during tests.

* feat: introduce dynamic `NetworkConfig`

* attempt to add deposit and prove scripts

* fix: update proof generation script + generate.js

* change workflow cause

* Revert "change workflow cause"

This reverts commit 183dfab.

* fix: respond to AI comments

* fix: respond to more AI comments

* fix(integration): remove container.json check

* fix(env): clarify port usage

* fix(generate): respond to review comments

* fix(generate): update x/oracle data

- The `nstETH` token needs to be added both as a token and as a feeder
- The `nstETH` token's `asset_id` needs to map back to the native
  (non-staked) token's `asset_id`

* fix(generate): support whitelist `nstETH` + !`ETH`

In the event that the Bootstrap contract has whitelisted `nstETH` but
not `ETH`, the `nstETH` entry will only fetch the effective balance and
the token price from the `ETH` entry will be missing. This commit fixes
that by manually adding an `ETH` entry to the oracle state in such an
event.

* update for effective balance

* respond to AI comments

* update for 31 ETH test

* fix storage layout

* fix(integration): add client chain gateway

* fix(integration): make Bootstrap address constant

* fix(generate): truncate the values

* fix: make bootstrapper

* fix: add validation for deposit address (ai)
  • Loading branch information
MaxMustermann2 authored Dec 3, 2024
1 parent e01d9e0 commit 5eea872
Show file tree
Hide file tree
Showing 35 changed files with 2,498 additions and 963 deletions.
39 changes: 28 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# anvil --port 8646 or via docker compose up in eth-pos-devnet
CLIENT_CHAIN_RPC=http://localhost:8646
EXOCORE_TESETNET_RPC=http://localhost:8545
EXOCORE_LOCAL_RPC=http://localhost:8545
Expand All @@ -12,15 +13,31 @@ EXOCORE_GENESIS_PRIVATE_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3f
USE_ENDPOINT_MOCK=true
USE_EXOCORE_PRECOMPILE_MOCK=true

VALIDATOR_KEYS=
EXO_ADDRESSES=
NAMES=
CONS_KEYS=
# For contract verification
ETHERSCAN_API_KEY=

# The following are used by generate.js, in addition to CLIENT_CHAIN_RPC above.
BOOTSTRAP_ADDRESS=
EXCHANGE_RATES=
BASE_GENESIS_FILE_PATH=
RESULT_GENESIS_FILE_PATH=

ETHERSCAN_API_KEY=
# These are used for integration testing the Bootstrap contract, in addition to
# CLIENT_CHAIN_RPC and BEACON_CHAIN_ENDPOINT above.
INTEGRATION_VALIDATOR_KEYS=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80,0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d,0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
INTEGRATION_STAKERS=0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6,0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a,0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba,0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e,0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356,0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97,0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6
INTEGRATION_TOKEN_DEPLOYERS=0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82,0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1
INTEGRATION_CONTRACT_DEPLOYER=0xf214f2b2cd398c806f84e317254e0f0b801d0643303237d97a22a48e01628897
# Specially ETH PoS related parameters.
INTEGRATION_DEPOSIT_ADDRESS=0x6969696969696969696969696969696969696969
INTEGRATION_SECONDS_PER_SLOT=4
INTEGRATION_SLOTS_PER_EPOCH=3
INTEGRATION_BEACON_GENESIS_TIMESTAMP=
INTEGRATION_DENEB_TIMESTAMP=
INTEGRATION_NST_DEPOSITOR=0x47c99abed3324a2707c28affff1267e45918ec8c3f20b8aa892e8b065d2942dd
# margin tank lunch prison top episode peanut approve dish seat nominee illness
INTEGRATION_PUBKEY=0x98db81971df910a5d46314d21320f897060d76fdf137d22f0eb91a8693a4767d2a22730a3aaa955f07d13ad604f968e9
INTEGRATION_SIGNATURE=0x922a316bdc3516bfa66e88259d5e93e339ef81bc85b70e6c715542222025a28fa1e3644c853beb8c3ba76a2c5c03b726081bf605bde3a16e1f33f902cc1b6c01093c19609de87da9383fa4b1f347bd2d4222e1ae5428727a7896c8e553cc8071
# derived from pubkey + network params == chain id + genesis {fork version + validators root}
INTEGRATION_DEPOSIT_DATA_ROOT=0x456934ced8f08ff106857418a6d885ba69d31e1b7fab9a931be06da25490cd1d
INTEGRATION_BEACON_CHAIN_ENDPOINT=http://localhost:3500
INTEGRATION_PROVE_ENDPOINT=http://localhost:8989
# for generate.mjs
INTEGRATION_BOOTSTRAP_ADDRESS=0xF801fc13AA08876F343fEBf50dFfA52A78180811
INTEGRATION_EXCHANGE_RATES=1000.123,2000.123,1799.345345
INTEGRATION_BASE_GENESIS_FILE_PATH=
INTEGRATION_RESULT_GENESIS_FILE_PATH=
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ node_modules

## secret
.secrets

script/integration/*.json
2 changes: 2 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ignored_warnings_from = ["script", "test"]
# fail compilation if the warnings are not fixed.
# this is super useful for the code size warning.
deny_warnings = true
# for tests, use the mainnet chain_id for NetworkConstants to work.
chain_id = 1

[rpc_endpoints]
ethereum_local_rpc = "${ETHEREUM_LOCAL_RPC}"
Expand Down
Loading

0 comments on commit 5eea872

Please sign in to comment.