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 RSKIP460 true as default for mock activations #384

Merged
merged 1 commit into from
Jan 24, 2025
Merged
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
12 changes: 10 additions & 2 deletions src/test/java/co/rsk/federate/BtcToRskClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.bitcoinj.script.Script;
import org.bitcoinj.store.BlockStoreException;
import org.ethereum.config.blockchain.upgrades.ActivationConfig;
import org.ethereum.config.blockchain.upgrades.ActivationConfig.ForBlock;
import org.ethereum.config.blockchain.upgrades.ConsensusRule;
import org.ethereum.crypto.HashUtil;
import org.ethereum.util.ByteUtil;
Expand All @@ -60,12 +61,18 @@ class BtcToRskClientTest {
private BtcToRskClientBuilder btcToRskClientBuilder;
private List<BtcECKey> federationPrivateKeys;
private NetworkParameters networkParameters;
private ForBlock activationsForBlock;

@BeforeEach
void setup() throws PeginInstructionsException, IOException {
activationConfig = mock(ActivationConfig.class);
when(activationConfig.forBlock(anyLong())).thenReturn(mock(ActivationConfig.ForBlock.class));
when(activationConfig.isActive(eq(ConsensusRule.RSKIP89), anyLong())).thenReturn(true);
when(activationConfig.isActive(eq(ConsensusRule.RSKIP460), anyLong())).thenReturn(true);

activationsForBlock = mock(ForBlock.class);
when(activationConfig.forBlock(anyLong())).thenReturn(activationsForBlock);
when(activationsForBlock.isActive(eq(ConsensusRule.RSKIP89))).thenReturn(true);
when(activationsForBlock.isActive(eq(ConsensusRule.RSKIP460))).thenReturn(true);

bridgeRegTestConstants = new BridgeRegTestConstants();
networkParameters = ThinConverter.toOriginalInstance(bridgeRegTestConstants.getBtcParamsString());
Expand Down Expand Up @@ -475,10 +482,11 @@ void onBlock_including_segwit_tx_registers_coinbase() throws Exception {

ActivationConfig mockedActivationConfig = mock(ActivationConfig.class);
when(mockedActivationConfig.isActive(eq(ConsensusRule.RSKIP143), anyLong())).thenReturn(true);
when(mockedActivationConfig.isActive(eq(ConsensusRule.RSKIP460), anyLong())).thenReturn(true);

FederatorSupport federatorSupport = mock(FederatorSupport.class);
when(federatorSupport.getFederationMember()).thenReturn(activeFederationMember);
when(federatorSupport.getConfigForBestBlock()).thenReturn(mock(ActivationConfig.ForBlock.class));
when(federatorSupport.getConfigForBestBlock()).thenReturn(activationsForBlock);

BtcToRskClient client = spy(buildWithFactoryAndSetup(
federatorSupport,
Expand Down
Loading