Skip to content

Commit

Permalink
fix: add new ens url
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkAfCod committed Mar 13, 2024
1 parent 27d2a69 commit 9d11f56
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @since 0.2.7
*/
public class BeaconBlobFetcher {
// https://beacon-nd-182-746-446.p2pify.com/ae65ad4cb1ef42d6a520ac0516776939

private static final Logger LOGGER = LoggerFactory.getLogger(BeaconBlobFetcher.class);

private static final String GENESIS_METHOD_FORMAT = "%s/eth/v1/beacon/genesis";
Expand Down Expand Up @@ -127,7 +127,7 @@ public List<BlobSidecar> getBlobSidecards(String blockId, final List<BigInteger>
: Map.of("indices", indices.stream().map(BigInteger::toString).collect(Collectors.joining(",")));
var postfix = "%s%s".formatted(blockId, prepareQueryParams(params));
var res = getBlobSidecars("%s/%s".formatted(this.sidecarsMethod, postfix));
if (res.getData() != null && res.getData().isEmpty()) {
if (res.getData() != null && !res.getData().isEmpty()) {
return res.getData();
}
if (this.archiverSidecarsMethod != null) {
Expand Down
39 changes: 23 additions & 16 deletions hildr-node/src/main/java/io/optimism/network/OpStackNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,29 @@ public class OpStackNetwork {

private static final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(OpStackNetwork.class);
private static final List<String> BOOTNODES = List.of(
"enr:-J64QBbwPjPLZ6IOOToOLsSjtFUjjzN66qmBZdUexpO32Klrc"
+ "458Q24kbty2PdRaLacHM5z-cZQr8mjeQu3pik6jPS"
+ "OGAYYFIqBfgmlkgnY0gmlwhDaRWFWHb3BzdGFja4SzlAUAi"
+ "XNlY3AyNTZrMaECmeSnJh7zjKrDSPoNMGXoopeDF4"
+ "hhpj5I0OsQUUt4u8uDdGNwgiQGg3VkcIIkBg",
"enr:-J64QAlTCDa188Hl1OGv5_2Kj2nWCsvxMVc_rEnLtw7RPFbOf"
+ "qUOV6kh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VMvLTe948MyYN0Y3CCI4yDdWRwgiOM",
"enr:-LK4QKWrXTpV9T78hNG6s8AM6IO4XH9kFT91uZtFg1GcsJ6dKovDOr1jtAAFPnS2lvNltkOGA9k29BUN7lFh_sjuc9QBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhANAdd-Jc2VjcDI1NmsxoQLQa6ai7y9PMN5hpLe5HmiJSlYzMuzP7ZhwRiwHvqNXdoN0Y3CCI4yDdWRwgiOM");
private final P2PNetwork<?> p2pNetwork;

private final List<TopicHandler> topicHandlers;
Expand Down
15 changes: 13 additions & 2 deletions hildr-node/src/test/java/io/optimism/TestConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ private TestConstants() {}

private static final String ETH_API_ENV = "ETH_API_KEY";
private static final String OPT_API_ENV = "OPT_API_KEY";
private static final String BEACON_ARCHIVER_ENV = "BEACON_ARCHIVE_API_URL";

/** The L 1 rpc url format. */
static String l1RpcUrlFormat = "https://eth-sepolia.g.alchemy.com/v2/%s";
Expand All @@ -42,10 +43,20 @@ public static Config createConfig() {
}
var l1RpcUrl = l1RpcUrlFormat.formatted(envs.get(ETH_API_ENV));
var l1WsRpcUrl = l1RpcWsUrlFormat.formatted(envs.get(ETH_API_ENV));
var l1BeaconRpcUrl = l1RpcBeaconUrlFormat.formatted(envs.get(ETH_API_ENV));
var l1BeaconRpcUrl = "https://ethereum-sepolia-beacon-api.publicnode.com";
var l1BeaconArchiverRpcUrl = envs.get(BEACON_ARCHIVER_ENV);
var l2RpcUrl = l2RpcUrlFormat.formatted(envs.get(OPT_API_ENV));
Config.CliConfig cliConfig = new Config.CliConfig(
l1RpcUrl, l1WsRpcUrl, l1BeaconRpcUrl, l1BeaconRpcUrl, l2RpcUrl, null, "testjwt", null, null, false);
l1RpcUrl,
l1WsRpcUrl,
l1BeaconRpcUrl,
l1BeaconArchiverRpcUrl,
l2RpcUrl,
null,
"testjwt",
null,
null,
false);
return Config.create(null, cliConfig, Config.ChainConfig.optimismGoerli());
}
}
34 changes: 25 additions & 9 deletions hildr-node/src/test/java/io/optimism/l1/BeaconBlobFetcherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static org.junit.jupiter.api.Assertions.*;

import io.optimism.TestConstants;
import io.optimism.config.Config;
import io.optimism.type.BlobSidecar;
import io.optimism.type.SpecConfig;
import java.math.BigInteger;
Expand All @@ -15,31 +17,45 @@
*/
class BeaconBlobFetcherTest {

private static String beaconUrl =
"https://few-sleek-sound.ethereum-sepolia.quiknode.pro/8e8c3ae8c9ddf50628ad22d3d8cdaf36230d52e1";
private static BeaconBlobFetcher fetcher;

private static Config config;

@BeforeAll
static void setUp() {
fetcher = new BeaconBlobFetcher(beaconUrl);
if (!TestConstants.isConfiguredApiKeyEnv) {
return;
}
config = TestConstants.createConfig();
fetcher = new BeaconBlobFetcher(config.l1BeaconUrl());
}

@Test
void getSpecConfig() {
if (!TestConstants.isConfiguredApiKeyEnv) {
return;
}
SpecConfig specConfig = fetcher.getSpecConfig();
System.out.println(specConfig);
assertEquals(BigInteger.valueOf(12L), specConfig.getSecondsPerSlot());
}

@Test
void getSlotFromTime() {
if (!TestConstants.isConfiguredApiKeyEnv) {
return;
}
BigInteger slotFromTime = fetcher.getSlotFromTime(BigInteger.valueOf(1708659300L));
System.out.println(slotFromTime);
assertEquals(BigInteger.valueOf(4410475), slotFromTime);
}

@Test
void getBlobSidecards() {
BigInteger slotFromTime = fetcher.getSlotFromTime(BigInteger.valueOf(1708659300L));
List<BlobSidecar> blobSidecards = fetcher.getBlobSidecards(slotFromTime.toString(), null);
System.out.println(blobSidecards);
void getBlobSidecardsAlreadyPrune() {
if (!TestConstants.isConfiguredApiKeyEnv) {
return;
}
var blobFetcher = new BeaconBlobFetcher(config.l1BeaconUrl(), config.l1BeaconArchiverUrl());
BigInteger slotFromTime = blobFetcher.getSlotFromTime(BigInteger.valueOf(1708659300L));
List<BlobSidecar> blobSidecards = blobFetcher.getBlobSidecards(slotFromTime.toString(), null);
assertTrue(blobSidecards != null && blobSidecards.size() > 0);
}
}

0 comments on commit 9d11f56

Please sign in to comment.