Skip to content

Commit

Permalink
Merge branch 'master' into feature/addition-of-rit-tests-in-gha-pipel…
Browse files Browse the repository at this point in the history
…ines
  • Loading branch information
fmacleal authored Aug 26, 2024
2 parents ca77722 + 01bb758 commit 100132a
Show file tree
Hide file tree
Showing 44 changed files with 1,949 additions and 746 deletions.
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,23 @@
[![CodeQL](https://github.com/rsksmart/rskj/workflows/CodeQL/badge.svg)](https://github.com/rsksmart/rskj/actions?query=workflow%3ACodeQL)

# About
RskJ is a Java implementation of the Rootstock node. For more information about Rootstock, visit [rootstock.io/](https://rootstock.io/). The [Rootstock white paper](https://rootstock.io/rsk-white-paper-updated.pdf) provides a complete conceptual overview of the platform.

If you have questions about the code please find us on [![Gitter](https://badges.gitter.im/rsksmart/rskj.svg)](https://gitter.im/rsksmart/rskj?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

You may also want to check [our blog](https://blog.rsk.co/) for articles and updates on the project.
RskJ is a Java implementation of the Rootstock node. For more information about Rootstock, visit [rootstock.io](https://rootstock.io/). The [Rootstock white paper](https://rootstock.io/rsk-white-paper-updated.pdf) provides a complete conceptual overview of the platform.

# Getting Started
Information about compiling and running a Rootstock node can be found in the [wiki](https://github.com/rsksmart/rskj/wiki).
The stable versions are the tags published in [releases tab](https://github.com/rsksmart/rskj/releases).
Information about compiling and running a Rootstock node can be found in the [Rootstock Developers Portal](https://dev.rootstock.io/).
The stable RskJ versions are published in the [Releases section](https://github.com/rsksmart/rskj/releases).

# Report Security Vulnerabilities
We have a [vulnerability reporting guideline](https://github.com/rsksmart/rskj/blob/master/SECURITY.md) for details on how to
See the [vulnerability reporting guideline](https://github.com/rsksmart/rskj/blob/master/SECURITY.md) for details on how to
contact us to report a vulnerability.

# License
RskJ is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the COPYING.LESSER file.

# Your Pledge
RskJ has been developed with the intention to foster the progress of society. By using RskJ, you make a pledge not to use it to incur in:
- Any kind of illegal or criminal act, activity or business;
- Any kind of act, activity or business that requires any kind of governmental authorization or license to legally occur or exist, without previously obtaining such authorization or license;
- Any kind of act, activity or business that is expected to infringe upon intellectual property rights belonging to other people;
- Any kind of act, activity or business involving dangerous or controlled goods or substances, including stolen goods, firearms, radioactive materials or drugs.
Something will be considered illegal, criminal, or requiring any kind of governmental authorization or license, when either the laws or regulations of the country in which you reside, or the laws or regulations of the country from which you use RskJ, consider it illegal, criminal, or requiring any kind of governmental authorization or license.
RskJ has been developed with the intention of fostering the progress of society. By using RskJ, you make a pledge not to use it to incur in:
- Any kind of illegal or criminal act, activity, or business;
- Any kind of act, activity, or business that requires any kind of governmental authorization or license to legally occur or exist without previously obtaining such authorization or license;
- Any kind of act, activity, or business that is expected to infringe upon intellectual property rights belonging to other people;
- Any kind of act, activity, or business involving dangerous or controlled goods or substances, including stolen goods, firearms, radioactive materials, or drugs.
Something will be considered illegal, criminal, or requiring any kind of governmental authorization or license when either the laws or regulations of the country in which you reside or the laws or regulations of the country from which you use RskJ consider it illegal, criminal, or requiring any kind of governmental authorization or license.
22 changes: 11 additions & 11 deletions rskj-core/src/main/java/co/rsk/peg/Bridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import co.rsk.panic.PanicProcessor;
import co.rsk.peg.BridgeMethods.BridgeMethodExecutor;
import co.rsk.peg.feeperkb.FeePerKbResponseCode;
import co.rsk.peg.lockingcap.LockingCapIllegalArgumentException;
import co.rsk.peg.vote.ABICallSpec;
import co.rsk.peg.bitcoin.MerkleBranch;
import co.rsk.peg.federation.Federation;
Expand Down Expand Up @@ -461,7 +462,7 @@ private boolean shouldReturnNullOnVoidMethods() {
return !activations.isActive(RSKIP417);
}

private void teardown() throws IOException {
private void teardown() {
bridgeSupport.save();
}

Expand Down Expand Up @@ -902,7 +903,7 @@ public long getRetiringFederationCreationBlockNumber(Object[] args) {
return bridgeSupport.getRetiringFederationCreationBlockNumber();
}

public Integer createFederation(Object[] args) throws BridgeIllegalArgumentException {
public Integer createFederation(Object[] args) {
logger.trace("createFederation");

return bridgeSupport.voteFederationChange(
Expand All @@ -911,7 +912,7 @@ public Integer createFederation(Object[] args) throws BridgeIllegalArgumentExcep
);
}

public Integer addFederatorPublicKey(Object[] args) throws BridgeIllegalArgumentException {
public Integer addFederatorPublicKey(Object[] args) {
logger.trace("addFederatorPublicKey");

byte[] publicKeyBytes;
Expand All @@ -928,7 +929,7 @@ public Integer addFederatorPublicKey(Object[] args) throws BridgeIllegalArgument
);
}

public Integer addFederatorPublicKeyMultikey(Object[] args) throws BridgeIllegalArgumentException {
public Integer addFederatorPublicKeyMultikey(Object[] args) {
logger.trace("addFederatorPublicKeyMultikey");

byte[] btcPublicKeyBytes = (byte[]) args[0];
Expand All @@ -944,7 +945,7 @@ public Integer addFederatorPublicKeyMultikey(Object[] args) throws BridgeIllegal
);
}

public Integer commitFederation(Object[] args) throws BridgeIllegalArgumentException {
public Integer commitFederation(Object[] args) {
logger.trace("commitFederation");

byte[] hash;
Expand All @@ -961,7 +962,7 @@ public Integer commitFederation(Object[] args) throws BridgeIllegalArgumentExcep
);
}

public Integer rollbackFederation(Object[] args) throws BridgeIllegalArgumentException {
public Integer rollbackFederation(Object[] args) {
logger.trace("rollbackFederation");

return bridgeSupport.voteFederationChange(
Expand Down Expand Up @@ -1163,13 +1164,12 @@ public byte[] getActivePowpegRedeemScript(Object[] args) {

public boolean increaseLockingCap(Object[] args) throws BridgeIllegalArgumentException {
logger.trace("increaseLockingCap");

Coin newLockingCap = BridgeUtils.getCoinFromBigInteger((BigInteger) args[0]);
if (newLockingCap.getValue() <= 0) {
throw new BridgeIllegalArgumentException("Locking cap must be bigger than zero");
try {
return bridgeSupport.increaseLockingCap(rskTx, newLockingCap);
} catch (LockingCapIllegalArgumentException e) {
throw new BridgeIllegalArgumentException(e);
}

return bridgeSupport.increaseLockingCap(rskTx, newLockingCap);
}

public void registerBtcCoinbaseTransaction(Object[] args) throws VMException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ public BridgeIllegalArgumentException(String s) {
public BridgeIllegalArgumentException(String message, Throwable cause) {
super(message, cause);
}

public BridgeIllegalArgumentException(Throwable cause) {
super(cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public enum BridgeStorageIndexKey {
RELEASE_REQUEST_QUEUE("releaseRequestQueue"),
PEGOUTS_WAITING_FOR_CONFIRMATIONS("releaseTransactionSet"),
PEGOUTS_WAITING_FOR_SIGNATURES("rskTxsWaitingFS"),
LOCKING_CAP_KEY("lockingCap"),
RELEASE_REQUEST_QUEUE_WITH_TXHASH("releaseRequestQueueWithTxHash"),
PEGOUTS_WAITING_FOR_CONFIRMATIONS_WITH_TXHASH_KEY("releaseTransactionSetWithTxHash"),
RECEIVE_HEADERS_TIMESTAMP("receiveHeadersLastTimestamp"),
Expand Down
32 changes: 4 additions & 28 deletions rskj-core/src/main/java/co/rsk/peg/BridgeStorageProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ public class BridgeStorageProvider {
private PegoutsWaitingForConfirmations pegoutsWaitingForConfirmations;
private SortedMap<Keccak256, BtcTransaction> pegoutsWaitingForSignatures;

private Coin lockingCap;

private HashMap<Sha256Hash, Long> btcTxHashesToSave;

private Map<Sha256Hash, CoinbaseInformation> coinbaseInformationMap;
Expand Down Expand Up @@ -250,26 +248,6 @@ public void savePegoutsWaitingForSignatures() {
safeSaveToRepository(PEGOUTS_WAITING_FOR_SIGNATURES, pegoutsWaitingForSignatures, BridgeSerializationUtils::serializeMap);
}

public void saveLockingCap() {
if (activations.isActive(RSKIP134)) {
safeSaveToRepository(LOCKING_CAP_KEY, this.getLockingCap(), BridgeSerializationUtils::serializeCoin);
}
}

public void setLockingCap(Coin lockingCap) {
this.lockingCap = lockingCap;
}

public Coin getLockingCap() {
if (activations.isActive(RSKIP134)) {
if (this.lockingCap == null) {
this.lockingCap = safeGetFromRepository(LOCKING_CAP_KEY, BridgeSerializationUtils::deserializeCoin);
}
return this.lockingCap;
}
return null;
}

public CoinbaseInformation getCoinbaseInformation(Sha256Hash blockHash) {
if (!activations.isActive(RSKIP143)) {
return null;
Expand Down Expand Up @@ -395,15 +373,15 @@ public Optional<FlyoverFederationInformation> getFlyoverFederationInformation(by
return Optional.empty();
}

FlyoverFederationInformation flyoverFederationInformation = this.safeGetFromRepository(
FlyoverFederationInformation flyoverFederationInformationInStorage = this.safeGetFromRepository(
getStorageKeyForFlyoverFederationInformation(flyoverFederationRedeemScriptHash),
data -> BridgeSerializationUtils.deserializeFlyoverFederationInformation(data, flyoverFederationRedeemScriptHash)
);
if (flyoverFederationInformation == null) {
if (flyoverFederationInformationInStorage == null) {
return Optional.empty();
}

return Optional.of(flyoverFederationInformation);
return Optional.of(flyoverFederationInformationInStorage);
}

public void setFlyoverFederationInformation(FlyoverFederationInformation flyoverFederationInformation) {
Expand Down Expand Up @@ -542,15 +520,13 @@ protected void savePegoutTxSigHashes() {
));
}

public void save() throws IOException {
public void save() {
saveBtcTxHashesAlreadyProcessed();

saveReleaseRequestQueue();
savePegoutsWaitingForConfirmations();
savePegoutsWaitingForSignatures();

saveLockingCap();

saveHeightBtcTxHashAlreadyProcessed();

saveCoinbaseInformations();
Expand Down
Loading

0 comments on commit 100132a

Please sign in to comment.