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

Some fixes with how the powpeg node interacts with the SVP protocol #353

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,12 @@ public void onBestBlock(org.ethereum.core.Block block, List<TransactionReceipt>

// Sign svp spend tx waiting for signatures, if it exists,
// before attempting to sign any pegouts.
federatorSupport.getStateForProposedFederator()
.map(StateForProposedFederator::getSvpSpendTxWaitingForSignatures)
.filter(svpSpendTxWaitingForSignatures -> isSVPSpendTxReadyToSign(block.getNumber(), svpSpendTxWaitingForSignatures))
.ifPresent(svpSpendTxReadyToBeSigned -> processReleases(Set.of(svpSpendTxReadyToBeSigned)));
if (activationConfig.isActive(ConsensusRule.RSKIP419, block.getNumber())) {
federatorSupport.getStateForProposedFederator()
.map(StateForProposedFederator::getSvpSpendTxWaitingForSignatures)
.filter(svpSpendTxWaitingForSignatures -> isSVPSpendTxReadyToSign(block.getNumber(), svpSpendTxWaitingForSignatures))
.ifPresent(svpSpendTxReadyToBeSigned -> processReleases(Set.of(svpSpendTxReadyToBeSigned)));
}

// Processing transactions waiting for signatures on best block only still "works",
// since it all lies within RSK's blockchain and normal rules apply. I.e., this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void updateProposedFederation() {
boolean hasProposedFederationChanged = !currentlyProposedFederationAddress.equals(oldProposedFederationAddress);

if (hasProposedFederationChanged) {
logger.info("[updateRetiringFederation] Proposed federation changed from {} to {}",
logger.info("[updateProposedFederation] Proposed federation changed from {} to {}",
oldProposedFederationAddress.orElse(null),
currentlyProposedFederationAddress.orElse(null));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.ethereum.config.blockchain.upgrades.ConsensusRule;
import org.ethereum.config.Constants;
import org.ethereum.config.blockchain.upgrades.ActivationConfig;
import org.ethereum.core.Block;
Expand Down Expand Up @@ -740,9 +740,12 @@ void onBestBlock_whenOnlySvpSpendTxWaitingForSignaturesIsAvailable_shouldAddSign
mock(NodeBlockProcessor.class)
);

ActivationConfig activationConfig = mock(ActivationConfig.class);
when(activationConfig.isActive(ConsensusRule.RSKIP419, bestBlock.getNumber())).thenReturn(true);

btcReleaseClient.setup(
signer,
mock(ActivationConfig.class),
activationConfig,
signerMessageBuilderFactory,
releaseCreationInformationGetter,
mock(ReleaseRequirementsEnforcer.class),
Expand Down Expand Up @@ -853,9 +856,12 @@ void onBestBlock_whenBothPegoutAndSvpSpendTxWaitingForSignaturesAreAvailableAndF
mock(NodeBlockProcessor.class)
);

ActivationConfig activationConfig = mock(ActivationConfig.class);
when(activationConfig.isActive(ConsensusRule.RSKIP419, bestBlock.getNumber())).thenReturn(true);

btcReleaseClient.setup(
signer,
mock(ActivationConfig.class),
activationConfig,
signerMessageBuilderFactory,
releaseCreationInformationGetter,
mock(ReleaseRequirementsEnforcer.class),
Expand Down Expand Up @@ -971,9 +977,12 @@ void onBestBlock_whenBothPegoutAndSvpSpendTxWaitingForSignaturesIsAvailable_shou
mock(NodeBlockProcessor.class)
);

ActivationConfig activationConfig = mock(ActivationConfig.class);
when(activationConfig.isActive(ConsensusRule.RSKIP419, bestBlock.getNumber())).thenReturn(true);

btcReleaseClient.setup(
signer,
mock(ActivationConfig.class),
activationConfig,
signerMessageBuilderFactory,
releaseCreationInformationGetter,
mock(ReleaseRequirementsEnforcer.class),
Expand Down
Loading