Skip to content

Commit

Permalink
Merge branch 'master' into fmacleal/addition_transient_storage_opcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
fmacleal committed Dec 16, 2024
2 parents 7bacf1f + 1cf9ad6 commit 2120e87
Show file tree
Hide file tree
Showing 12 changed files with 2,172 additions and 264 deletions.
2 changes: 1 addition & 1 deletion rskj-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ ext {
jaxwsRtVer : '2.3.5',
picocliVer : '4.6.3',

bitcoinjThinVer: '0.14.4-rsk-16',
bitcoinjThinVer: '0.14.4-rsk-17-SNAPSHOT',
rskjNativeVer: '1.3.0',
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

package co.rsk.peg;

import static co.rsk.bitcoinj.core.StoredBlock.deserializeCompactLegacy;
import static co.rsk.bitcoinj.core.StoredBlock.deserializeCompactV2;

import co.rsk.bitcoinj.core.BtcBlock;
import co.rsk.bitcoinj.core.NetworkParameters;
import co.rsk.bitcoinj.core.Sha256Hash;
Expand Down Expand Up @@ -307,17 +310,36 @@ public StoredBlock getStoredBlockAtMainChainDepth(int depth) throws BlockStoreEx
}

private byte[] storedBlockToByteArray(StoredBlock block) {
ByteBuffer byteBuffer = ByteBuffer.allocate(128);
block.serializeCompact(byteBuffer);
ByteBuffer byteBuffer = serializeBlock(block);
byte[] ba = new byte[byteBuffer.position()];
byteBuffer.flip();
byteBuffer.get(ba);
return ba;
}

private ByteBuffer serializeBlock(StoredBlock block) {
if (shouldUseLegacy12ByteChainworkFormat()) {
ByteBuffer byteBuffer = ByteBuffer.allocate(StoredBlock.COMPACT_SERIALIZED_SIZE_LEGACY);
block.serializeCompactLegacy(byteBuffer);
return byteBuffer;
}

ByteBuffer byteBuffer = ByteBuffer.allocate(StoredBlock.COMPACT_SERIALIZED_SIZE_V2);
block.serializeCompactV2(byteBuffer);
return byteBuffer;
}

private boolean shouldUseLegacy12ByteChainworkFormat() {
return !activations.isActive(ConsensusRule.RSKIP454);
}

private StoredBlock byteArrayToStoredBlock(byte[] ba) {
ByteBuffer byteBuffer = ByteBuffer.wrap(ba);
return StoredBlock.deserializeCompact(btcNetworkParams, byteBuffer);
if (ba.length == StoredBlock.COMPACT_SERIALIZED_SIZE_LEGACY) {
return deserializeCompactLegacy(btcNetworkParams, byteBuffer);
}

return deserializeCompactV2(btcNetworkParams, byteBuffer);
}

private void checkIfInitialized() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public enum ConsensusRule {
RSKIP428("rskip428"),
RSKIP434("rskip434"),
RSKIP438("rskip438"),
RSKIP446("rskip446") // Transient storage opcodes addition implementing EIP-1153
RSKIP446("rskip446") ,// Transient storage opcodes addition implementing EIP-1153
RSKIP454("rskip454")
;

private final String configKey;
Expand Down
163 changes: 82 additions & 81 deletions rskj-core/src/main/resources/expected.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,87 +20,88 @@ blockchain = {
lovell700 = <height>
}
consensusRules = {
areBridgeTxsPaid = <hardforkName>
rskip85 = <hardforkName>
rskip87 = <hardforkName>
rskip88 = <hardforkName>
rskip89 = <hardforkName>
rskip90 = <hardforkName>
rskip91 = <hardforkName>
rskip92 = <hardforkName>
rskip97 = <hardforkName>
rskip98 = <hardforkName>
rskip103 = <hardforkName>
rskip106 = <hardforkName>
rskip110 = <hardforkName>
rskip119 = <hardforkName>
rskip120 = <hardforkName>
rskip122 = <hardforkName>
rskip123 = <hardforkName>
rskip124 = <hardforkName>
rskip125 = <hardforkName>
rskip126 = <hardforkName>
rskip132 = <hardforkName>
rskip134 = <hardforkName>
rskip136 = <hardforkName>
rskip137 = <hardforkName>
rskip140 = <hardforkName>
rskip143 = <hardforkName>
rskip146 = <hardforkName>
rskip150 = <hardforkName>
rskip151 = <hardforkName>
rskip152 = <hardforkName>
rskip156 = <hardforkName>
rskipUMM = <hardforkName>
rskip153 = <hardforkName>
rskip169 = <hardforkName>
rskip170 = <hardforkName>
rskip171 = <hardforkName>
rskip174 = <hardforkName>
rskip176 = <hardforkName>
rskip179 = <hardforkName>
rskip180 = <hardforkName>
rskip181 = <hardforkName>
rskip185 = <hardforkName>
rskip186 = <hardforkName>
rskip191 = <hardforkName>
rskip197 = <hardforkName>
rskip199 = <hardforkName>
rskip200 = <hardforkName>
rskip201 = <hardforkName>
rskip203 = <hardforkName>
rskip218 = <hardforkName>
rskip219 = <hardforkName>
rskip220 = <hardforkName>
rskip252 = <hardforkName>
rskip271 = <hardforkName>
rskip284 = <hardforkName>
rskip290 = <hardforkName>
rskip293 = <hardforkName>
rskip294 = <hardforkName>
rskip297 = <hardforkName>
rskip351 = <hardforkName>
rskip144 = <hardforkName>
rskip326 = <hardforkName>
rskip353 = <hardforkName>
rskip357 = <hardforkName>
rskip374 = <hardforkName>
rskip375 = <hardforkName>
rskip376 = <hardforkName>
rskip377 = <hardforkName>
rskip379 = <hardforkName>
rskip383 = <hardforkName>
rskip385 = <hardforkName>
rskip398 = <hardforkName>
rskip400 = <hardforkName>
rskip412 = <hardforkName>
rskip415 = <hardforkName>
rskip417 = <hardforkName>
rskip427 = <hardforkName>
rskip428 = <hardforkName>
rskip434 = <hardforkName>
rskip438 = <hardforkName>
rskip446 = <hardforkName>
areBridgeTxsPaid = <hardforkName>
rskip85 = <hardforkName>
rskip87 = <hardforkName>
rskip88 = <hardforkName>
rskip89 = <hardforkName>
rskip90 = <hardforkName>
rskip91 = <hardforkName>
rskip92 = <hardforkName>
rskip97 = <hardforkName>
rskip98 = <hardforkName>
rskip103 = <hardforkName>
rskip106 = <hardforkName>
rskip110 = <hardforkName>
rskip119 = <hardforkName>
rskip120 = <hardforkName>
rskip122 = <hardforkName>
rskip123 = <hardforkName>
rskip124 = <hardforkName>
rskip125 = <hardforkName>
rskip126 = <hardforkName>
rskip132 = <hardforkName>
rskip134 = <hardforkName>
rskip136 = <hardforkName>
rskip137 = <hardforkName>
rskip140 = <hardforkName>
rskip143 = <hardforkName>
rskip146 = <hardforkName>
rskip150 = <hardforkName>
rskip151 = <hardforkName>
rskip152 = <hardforkName>
rskip156 = <hardforkName>
rskipUMM = <hardforkName>
rskip153 = <hardforkName>
rskip169 = <hardforkName>
rskip170 = <hardforkName>
rskip171 = <hardforkName>
rskip174 = <hardforkName>
rskip176 = <hardforkName>
rskip179 = <hardforkName>
rskip180 = <hardforkName>
rskip181 = <hardforkName>
rskip185 = <hardforkName>
rskip186 = <hardforkName>
rskip191 = <hardforkName>
rskip197 = <hardforkName>
rskip199 = <hardforkName>
rskip200 = <hardforkName>
rskip201 = <hardforkName>
rskip203 = <hardforkName>
rskip218 = <hardforkName>
rskip219 = <hardforkName>
rskip220 = <hardforkName>
rskip252 = <hardforkName>
rskip271 = <hardforkName>
rskip284 = <hardforkName>
rskip290 = <hardforkName>
rskip293 = <hardforkName>
rskip294 = <hardforkName>
rskip297 = <hardforkName>
rskip351 = <hardforkName>
rskip144 = <hardforkName>
rskip326 = <hardforkName>
rskip353 = <hardforkName>
rskip357 = <hardforkName>
rskip374 = <hardforkName>
rskip375 = <hardforkName>
rskip376 = <hardforkName>
rskip377 = <hardforkName>
rskip379 = <hardforkName>
rskip383 = <hardforkName>
rskip385 = <hardforkName>
rskip398 = <hardforkName>
rskip400 = <hardforkName>
rskip412 = <hardforkName>
rskip415 = <hardforkName>
rskip417 = <hardforkName>
rskip427 = <hardforkName>
rskip428 = <hardforkName>
rskip434 = <hardforkName>
rskip438 = <hardforkName>
rskip446 = <hardforkName>
rskip454 = <hardforkName>
}
}
gc = {
Expand Down
1 change: 1 addition & 0 deletions rskj-core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ blockchain = {
rskip434 = arrowhead631
rskip438 = lovell700
rskip446 = lovell700
rskip454 = lovell700
}
}
gc = {
Expand Down
Loading

0 comments on commit 2120e87

Please sign in to comment.