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

feat: Ecotone hardfork support #111

Merged
merged 25 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1422e8b
feat: decode call data to ecotone info
thinkAfCod Feb 16, 2024
4daf354
feat: beacon blob fetcher
thinkAfCod Feb 17, 2024
dc2d53f
feat: activation ecotone
thinkAfCod Feb 25, 2024
2ab4b78
doc: modify comments
thinkAfCod Feb 25, 2024
8ece548
fix: upgrade tx order
thinkAfCod Feb 25, 2024
a3c28de
fix: batch sequence number
thinkAfCod Feb 28, 2024
2732f52
fix: activation of engine_forkchoice_updated_v3
thinkAfCod Mar 2, 2024
4285627
fix: activation api for ecotone
thinkAfCod Mar 2, 2024
644456a
fix: engine api and gossip
thinkAfCod Mar 4, 2024
207651a
fix: derive l1 info
thinkAfCod Mar 4, 2024
28e656f
fix: encode deposit tx in ecotone from l1 info
thinkAfCod Mar 7, 2024
71c0f79
fix: update web3j core jar
thinkAfCod Mar 7, 2024
209c680
fix: modify method name
thinkAfCod Mar 7, 2024
64977e6
chore: add http logging interceptor
thinkAfCod Mar 8, 2024
0916729
fix: blob index
thinkAfCod Mar 8, 2024
a5a4efb
fix: byte to int when blob decode
thinkAfCod Mar 8, 2024
fe66296
fix: attributes tx timestamp
thinkAfCod Mar 8, 2024
064e6d6
fix: attributes tx timestamp
thinkAfCod Mar 8, 2024
2258ce5
fix: AttributesDeposited encode for ecotone
thinkAfCod Mar 8, 2024
1389b93
fix: decode system config from ecotone tx input
thinkAfCod Mar 9, 2024
e1fb15d
style: format
thinkAfCod Mar 9, 2024
de3f629
fix: test case params
thinkAfCod Mar 9, 2024
c29962c
chore: test case
thinkAfCod Mar 9, 2024
94e0db6
chore: remove useless import
thinkAfCod Mar 10, 2024
eb012e9
fix: test case
thinkAfCod Mar 11, 2024
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
1 change: 1 addition & 0 deletions hildr-node/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ dependencies {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
exclude group: 'com.squareup.okhttp3', module: 'logging-interceptor'
}
implementation files('../libs/core-4.11.1-SNAPSHOT.jar')
implementation('net.osslabz.evm:evm-abi-decoder:0.0.6')
implementation 'com.github.gestalt-config:gestalt-core:0.20.4'
implementation 'com.github.gestalt-config:gestalt-toml:0.20.4'
Expand Down
12 changes: 10 additions & 2 deletions hildr-node/src/main/java/io/optimism/cli/Cli.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,18 @@ public class Cli implements Runnable {
description = "network type, or rollup.json file path, support: optimism-goerli, base-goerli")
String network;

@Option(names = "--l1-rpc-url", required = true, description = "The base chain RPC URL")
@Option(names = "--l1-rpc-url", required = true, description = "The l1 chain RPC URL")
String l1RpcUrl;

@Option(names = "--l1-ws-rpc-url", required = true, description = "The base chain WS RPC URL")
@Option(names = "--l1-ws-rpc-url", required = true, description = "The l1 chain WS RPC URL")
String l1WsRpcUrl;

@Option(names = "--l1-beacon-url", required = true, description = "The l1 chain beacon client RPC URL")
String l1BeaconUrl;

@Option(names = "--l1-beacon-archiver-url", required = false, description = "The l1 beacon chain archiver RPC URL")
String l1BeaconArchiverUrl;

@Option(names = "--l2-rpc-url", required = true, description = "The L2 engine RPC URL")
String l2RpcUrl;

Expand Down Expand Up @@ -197,6 +203,8 @@ private Config.CliConfig from(Cli cli) {
return new Config.CliConfig(
cli.l1RpcUrl,
cli.l1WsRpcUrl,
cli.l1BeaconUrl,
cli.l1BeaconArchiverUrl,
cli.l2RpcUrl,
cli.l2EngineUrl,
StringUtils.trim(Cli.this.getJwtSecret()),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
package io.optimism.common;

import io.optimism.type.L1BlockInfo;
import java.math.BigInteger;
import java.util.Objects;
import net.osslabz.evm.abi.decoder.AbiDecoder;
import net.osslabz.evm.abi.decoder.DecodedFunctionCall;
import org.apache.commons.lang3.StringUtils;
import org.web3j.utils.Numeric;

/**
* The type AttributesDepositedCall.
*
* @param number the number
* @param timestamp the timestamp
* @param baseFee the base fee
* @param hash the hash
* @param sequenceNumber the sequence number
* @param batcherHash the batcher hash
* @param feeOverhead the fee overhead
* @param feeScalar the fee scalar
* @param number the number
* @param timestamp the timestamp
* @param baseFee the base fee
* @param hash the hash
* @param sequenceNumber the sequence number
* @param batcherHash the batcher hash
* @param feeOverhead the fee overhead
* @param feeScalar the fee scalar
* @param blobBaseFeeScalar the blob base fee scalar
* @param blobBaseFee the blob base fee
* @author grapebaba
* @since 0.1.0
*/
Expand All @@ -27,38 +29,31 @@ public record AttributesDepositedCall(
BigInteger sequenceNumber,
String batcherHash,
BigInteger feeOverhead,
BigInteger feeScalar) {

private static final AbiDecoder l1BlockAbi;

static {
l1BlockAbi = new AbiDecoder(Objects.requireNonNull(Epoch.class.getResourceAsStream("/abi/L1Block.json")));
}
BigInteger feeScalar,
BigInteger blobBaseFeeScalar,
BigInteger blobBaseFee) {

/**
* From attributes deposited call.
* Create AttributesDepositedCall from attributes deposited call.
*
* @param callData the call data
* @param callData the call data from ectone transaction or bedrock transaction
* @return the attributes deposited call
*/
public static AttributesDepositedCall from(String callData) {
DecodedFunctionCall decodedFunctionCall = l1BlockAbi.decodeFunctionCall(callData);
BigInteger number = (BigInteger) decodedFunctionCall.getParam("_number").getValue();
BigInteger timestamp =
(BigInteger) decodedFunctionCall.getParam("_timestamp").getValue();
BigInteger baseFee =
(BigInteger) decodedFunctionCall.getParam("_basefee").getValue();
String hash = (String) decodedFunctionCall.getParam("_hash").getValue();
BigInteger sequenceNumber =
(BigInteger) decodedFunctionCall.getParam("_sequencenumber").getValue();
String batcherHash =
(String) decodedFunctionCall.getParam("_batcherhash").getValue();
BigInteger feeOverhead =
(BigInteger) decodedFunctionCall.getParam("_l1feeoverhead").getValue();
BigInteger feeScalar =
(BigInteger) decodedFunctionCall.getParam("_l1feescalar").getValue();

if (StringUtils.isEmpty(callData)) {
throw new RuntimeException();
}
var info = L1BlockInfo.from(Numeric.hexStringToByteArray(callData));
return new AttributesDepositedCall(
number, timestamp, baseFee, hash, sequenceNumber, batcherHash, feeOverhead, feeScalar);
info.number(),
info.time(),
info.baseFee(),
info.blockHash(),
info.sequenceNumber(),
info.batcherAddr(),
info.l1FeeOverhead(),
info.l1FeeScalar(),
info.blobBaseFeeScalar(),
info.blobBaseFee());
}
}
29 changes: 26 additions & 3 deletions hildr-node/src/main/java/io/optimism/common/Epoch.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.optimism.common;

import io.optimism.type.L1BlockInfo;
import java.math.BigInteger;

/**
Expand All @@ -8,18 +9,40 @@
* @param number L1 block number.
* @param hash L1 block hash.
* @param timestamp L1 block timestamp.
* @param sequenceNumber The sequence number of the batcher transactions.
* @author grapebaba
* @since 0.1.0
*/
public record Epoch(BigInteger number, String hash, BigInteger timestamp) {
public record Epoch(BigInteger number, String hash, BigInteger timestamp, BigInteger sequenceNumber) {

/**
* From epoch.
* Create epoch from AttributesDepositedCall.
*
* @param call the hex call data
* @return the epoch
*/
public static Epoch from(AttributesDepositedCall call) {
return new Epoch(call.number(), call.hash(), call.timestamp());
return new Epoch(call.number(), call.hash(), call.timestamp(), call.sequenceNumber());
}

/**
* Create epoch from L1BlockInfo.
*
* @param info the L1 block info
* @return the epoch
*/
public static Epoch from(L1BlockInfo info) {
return new Epoch(info.number(), info.blockHash(), info.time(), info.sequenceNumber());
}

/**
* Creates epoch from an another epoch and sets sequence number.
*
* @param epoch the epoch info
* @param sequenceNumber the sequence number
* @return a new epoch with sequence number
*/
public static Epoch from(Epoch epoch, BigInteger sequenceNumber) {
return new Epoch(epoch.number(), epoch.hash(), epoch.timestamp(), sequenceNumber);
}
}
Loading
Loading