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

Set Tycho hardfork date on bsc mainnet #42

Merged
merged 1 commit into from
Jun 18, 2024
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 bmv/bsc2/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = '0.6.0'
version = '0.6.1'

dependencies {
compileOnly("foundation.icon:javaee-api:$javaeeVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ private void verify(ChainConfig config, Header head) {
Context.require(head.getGasUsed().compareTo(head.getGasLimit()) < 0, "Invalid gas used");
Context.require(head.getSigner(BigInteger.valueOf(config.ChainID)).equals(head.getCoinbase()), "Coinbase mismatch");

if (config.isTycho(head.getNumber())) {
if (config.isTycho(head.getTime())) {
Context.require(head.getWithdrawalsHash().equals(EMPTY_WITHDRAWALS_HASH), "Invalid withdrawals hash");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ public static ChainConfig getInstance() {
public static ChainConfig fromChainID(BigInteger cid) {
if (cid.longValue() == 56L) {
// BSC Mainnet
return new ChainConfig(56L, 200L, 3L, BigInteger.valueOf(31302048L), null);
return new ChainConfig(56L, 200L, 3L, BigInteger.valueOf(31302048L),
BigInteger.valueOf(1718863500L));
} else if (cid.longValue() == 97L) {
// BSC Testnet
return new ChainConfig(97L, 200L, 3L, BigInteger.valueOf(31103030L),
BigInteger.valueOf(39539137L));
BigInteger.valueOf(1713330442L));
} else if (cid.longValue() == 99L) {
// Private BSC Testnet
return new ChainConfig(99L, 200L, 3L, BigInteger.valueOf(8), null);
Expand All @@ -72,8 +73,8 @@ public boolean isHertz(BigInteger number) {
return Hertz != null && Hertz.compareTo(number) <= 0;
}

public boolean isTycho(BigInteger number) {
return Tycho != null && Tycho.compareTo(number) <= 0;
public boolean isTycho(long time) {
return Tycho != null && Tycho.longValue() <= time;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static Header readObject(ObjectReader r) {
Hash withdrawalsHash = Hash.EMPTY;
BigInteger blobGasUsed = null;
BigInteger excessBlobGas = null;
if (ChainConfig.getInstance().isTycho(number)) {
if (ChainConfig.getInstance().isTycho(time)) {
withdrawalsHash = r.read(Hash.class);
blobGasUsed = r.readBigInteger();
excessBlobGas = r.readBigInteger();
Expand All @@ -135,7 +135,7 @@ public static Header readObject(ObjectReader r) {
}

public static void writeObject(ObjectWriter w, Header o) {
if (ChainConfig.getInstance().isTycho(o.number)) {
if (ChainConfig.getInstance().isTycho(o.time)) {
w.beginList(19);
} else if (ChainConfig.getInstance().isHertz(o.number)) {
w.beginList(16);
Expand All @@ -161,7 +161,7 @@ public static void writeObject(ObjectWriter w, Header o) {
Context.require(o.baseFee != null, "no fields for hertz");
w.write(o.baseFee);
}
if (ChainConfig.getInstance().isTycho(o.number)) {
if (ChainConfig.getInstance().isTycho(o.time)) {
Context.require(o.withdrawalsHash != Hash.EMPTY && o.blobGasUsed != null
&& o.excessBlobGas != null, "no fields for tycho");
w.write(o.withdrawalsHash);
Expand Down
Loading