Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rpc config #186

Merged
merged 3 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
description: 'Cachix Cache Authentication Token'
required: true
runs:
using: "composite"
using: 'composite'
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
Expand Down
49 changes: 32 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,29 @@ env:
INFURA_API_KEY: '${{ secrets.INFURA_API_KEY }}'
USER_PRIVATE_KEY: '${{ secrets.USER_PRIVATE_KEY }}'
ETHERSCAN_API_KEY: '${{ secrets.ETHERSCAN_API_KEY }}'
ETHEREUM_MAINNET_RPC: https://eth.llamarpc.com

jobs:
EOS_Relayer_Test:
Linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Use local my-action
uses: ./.github/actions/setup
with:
cachix_auth_token: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Run yarn format check
run: nix develop -c yarn format:check

EOS_Relayer_Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Use local my-action
uses: ./.github/actions/setup
with:
Expand Down Expand Up @@ -188,23 +202,24 @@ jobs:
if: always()

needs:
- EOS_Relayer_Test
- Solidity_Validators_Accumulator_Test
- Nim_Light_Client_Compiled_with_Emsctipten_Tests
- Nim_Light_Client_Clang_Test
- Nim_Groth16_Verifier_Tests
- Run_Light_Client_In_Cosmos_Test
- Run_Verifier_In_Cosmos_Test
- Run_Circom_Tests
- Run_Verifier_In_Cosmos_Relay_Tests
- Run_Verify_Given_Proof
- Solidity_Verifier_Tests
- OneShot_Syncing_Simulation
- Linter
- EOS_Relayer_Test
- Solidity_Validators_Accumulator_Test
- Nim_Light_Client_Compiled_with_Emsctipten_Tests
- Nim_Light_Client_Clang_Test
- Nim_Groth16_Verifier_Tests
- Run_Light_Client_In_Cosmos_Test
- Run_Verifier_In_Cosmos_Test
- Run_Circom_Tests
- Run_Verifier_In_Cosmos_Relay_Tests
- Run_Verify_Given_Proof
- Solidity_Verifier_Tests
- OneShot_Syncing_Simulation

runs-on: ubuntu-latest

steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ the full blockchain environments).
| [Malaga/Cosmos](https://block-explorer.malaga-420.cosmwasm.com/account/wasm12te4t793yq9jgqnyqauuvhza44ss43fxnsgj8lyxrqru6pc2c6ds68l4es) | [goerli](http://unstable.prater.beacon-api.nimbus.team/) | https://github.com/metacraft-labs/DendrETH/pull/94 (Capella) |
| [Jungle/EOS](https://local.bloks.io/account/dendreth2222?nodeUrl=http%3A%2F%2Fjungle4.cryptolions.io&systemDomain=eosio&hyperionUrl=https%3A%2F%2Fjungle4history.cryptolions.io) | [goerli](http://unstable.prater.beacon-api.nimbus.team/) | https://github.com/metacraft-labs/DendrETH/pull/94 (Capella) |
| [Aurora/Near](https://explorer.testnet.aurora.dev/address/0xA3418F79c98A3E496A5E97610a97f82daE364619) | [goerli](http://unstable.prater.beacon-api.nimbus.team/) | https://github.com/metacraft-labs/DendrETH/pull/94 (Capella) |
| [Gnosis/Gnosis](https://gnosisscan.io/address/0x2b2d8b2bcf1e98a46e773a0679d4ebcb8bfb6996) | [goerli](http://unstable.prater.beacon-api.nimbus.team/) | https://github.com/metacraft-labs/DendrETH/pull/94 (Capella) |
| [Gnosis/Gnosis](https://gnosisscan.io/address/0xb676a5e81168a24496ad13de79f2675c66684d23) | [goerli](http://unstable.prater.beacon-api.nimbus.team/) | https://github.com/metacraft-labs/DendrETH/pull/94 (Capella) |

## Working with the Codebase

Expand Down
49 changes: 32 additions & 17 deletions beacon-light-client/solidity/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ const conf = {
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
INFURA_API_KEY: process.env.INFURA_API_KEY,
ETHERSCAN_API_KEY: process.env.ETHERSCAN_API_KEY,
ETHEREUM_MAINNET_RPC: process.env.ETHEREUM_MAINNET_RPC || '',
ROPSTEN_RPC: process.env.ROPSTEN_RPC || '',
SEPOLIA_RPC: process.env.SEPOLIA_RPC || '',
GOERLI_RPC: process.env.GOERLI_RPC || '',
OPTIMISTIC_GOERLI_RPC: process.env.OPTIMISTIC_GOERLI_RPC || '',
BASE_GOERLI_RPC: process.env.BASE_GOERLI_RPC || '',
ARBITRUM_GOERLI_RPC: process.env.ARBITRUM_GOERLI_RPC || '',
MUMBAI_RPC: process.env.MUMBAI_RPC || '',
AVALANCHE_RPC: process.env.AVALANCHE_RPC || '',
FANTOM_RPC: process.env.FANTOM_RPC || '',
CELO_RPC: process.env.CELO_RPC || '',
BSC_RPC: process.env.BSC_RPC || '',
CHIADO_RPC: process.env.CHIADO_RPC || '',
GNOSIS_RPC: process.env.GNOSIS_RPC || '',
EVMOS_RPC: process.env.EVMOS_RPC || '',
AURORA_RPC: process.env.AURORA_RPC || '',
};

if (!/^0x[0-9a-fA-F]{64}$/.test(conf.USER_PRIVATE_KEY ?? '')) {
Expand Down Expand Up @@ -68,72 +84,71 @@ export default {
},
hardhat: {
forking: {
url: 'https://eth.llamarpc.com',
url: conf.ETHEREUM_MAINNET_RPC,
blockNumber: 17578101,
},
},
ropsten: {
url: `https://ropsten.infura.io/v3/${conf.INFURA_API_KEY}`,
url: conf.ROPSTEN_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
sepolia: {
url: `https://eth-sepolia.g.alchemy.com/v2/${conf.ALCHEMY_API_KEY}`,
url: conf.SEPOLIA_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
goerli: {
url: `https://eth-goerli.g.alchemy.com/v2/${conf.ALCHEMY_API_KEY}`,
url: conf.GOERLI_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
optimisticGoerli: {
url: `https://optimism-goerli.blockpi.network/v1/rpc/public`,
url: conf.OPTIMISTIC_GOERLI_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
baseGoerli: {
url: 'https://base-goerli.public.blastapi.io',
url: conf.BASE_GOERLI_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
arbitrumGoerli: {
url: `https://arb-goerli.g.alchemy.com/v2/${conf.ALCHEMY_API_KEY}`,
url: conf.ARBITRUM_GOERLI_RPC,
accounts: [conf.USER_PRIVATE_KEY],
contractAddress: '0xB94868ba0903883bD2dE3311Fc377f3c50D602eA',
},
mumbai: {
url: `https://endpoints.omniatech.io/v1/matic/mumbai/public`,
url: conf.MUMBAI_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
avalanche: {
url: `https://rpc.ankr.com/avalanche_fuji`,
url: conf.AVALANCHE_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
fantom: {
url: 'https://rpc.testnet.fantom.network',
url: conf.FANTOM_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
celo: {
url: 'https://alfajores-forno.celo-testnet.org',
url: conf.CELO_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
bsc: {
url: 'https://bsc-testnet.public.blastapi.io',
url: conf.BSC_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
chiado: {
url: 'https://rpc.chiado.gnosis.gateway.fm',
url: conf.CHIADO_RPC,
accounts: [conf.USER_PRIVATE_KEY],
gas: 30000000,
gasPrice: 20,
gasMultiplier: 10,
},
evmos: {
url: 'https://eth.bd.evmos.dev:8545',
url: conf.EVMOS_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
aurora: {
url: 'https://aurora-testnet.rpc.thirdweb.com',
url: conf.AURORA_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
gnosis: {
url: `https://rpc.gnosis.gateway.fm`,
url: conf.GNOSIS_RPC,
accounts: [conf.USER_PRIVATE_KEY],
},
},
Expand Down
4 changes: 1 addition & 3 deletions libs/typescript/ts-utils/ssz-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,5 @@ export async function getBlockHeaderFromUpdate(head) {
export const SLOTS_PER_PERIOD = 8192;

export function computeSyncCommitteePeriodAt(slot: number) {
return Math.floor(
slot / (SLOTS_PER_PERIOD),
);
return Math.floor(slot / SLOTS_PER_PERIOD);
}
6 changes: 2 additions & 4 deletions relay/utils/get_current_network_config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
checkConfig,
} from '../../libs/typescript/ts-utils/common-utils';
import { checkConfig } from '../../libs/typescript/ts-utils/common-utils';
import { Config } from '../constants/constants';
import * as network_config from '../constants/network_config.json';

Expand All @@ -12,7 +10,7 @@ export function getNetworkConfig(network: 'pratter' | 'mainnet'): Config {

checkConfig(config);

network_config[network]["BEACON_REST_API"] =
network_config[network]['BEACON_REST_API'] =
network === 'pratter'
? config.BEACON_REST_API_PRATTER!.split(',')
: config.BEACON_REST_API_MAINNET!.split(',');
Expand Down
13 changes: 7 additions & 6 deletions relay/utils/smart_contract_utils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { IBeaconApi } from "../abstraction/beacon-api-interface";
import { ISmartContract } from "../abstraction/smart-contract-abstraction";
import { IBeaconApi } from '../abstraction/beacon-api-interface';
import { ISmartContract } from '../abstraction/smart-contract-abstraction';

export async function getSlotOnChain(smartContract: ISmartContract, beaconApi: IBeaconApi) {
export async function getSlotOnChain(
smartContract: ISmartContract,
beaconApi: IBeaconApi,
) {
const header_root_on_chain = await smartContract.optimisticHeaderRoot();

console.log('header on chain', header_root_on_chain);

const lastSlotOnChain = await beaconApi.getBlockSlot(
header_root_on_chain
);
const lastSlotOnChain = await beaconApi.getBlockSlot(header_root_on_chain);
return lastSlotOnChain;
}