-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adds 'should do a basic legacy pegin with the value above minimum' test #92
Adds 'should do a basic legacy pegin with the value above minimum' test #92
Conversation
be67f49
to
a67efec
Compare
lib/tests/2wp.js
Outdated
const initialBridgeBalance = Number(await rskTxHelper.getBalance(BRIDGE_ADDRESS)); | ||
const initialBridgeUtxosBalance = await getBridgeUtxosBalance(rskTxHelper); | ||
const initialFederationAddressBalanceInSatoshis = await getBtcAddressBalanceInSatoshis(btcTxHelper, federationAddress); | ||
const senderRecipientInfo = await createSenderRecipientInfo(rskTxHelper, btcTxHelper); | ||
const initialSenderAddressBalanceInSatoshis = await getBtcAddressBalanceInSatoshis(btcTxHelper, senderRecipientInfo.btcSenderAddressInfo.address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is gonna get repeated quite a lot, pre and post peg-in/peg-out. What do you think of extracting it to a method? The method could return an object with the different balances
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
lib/tests/2wp.js
Outdated
const isBtcTxHashAlreadyProcessed = await bridge.methods.isBtcTxHashAlreadyProcessed(btcPeginTxHash).call(); | ||
expect(isBtcTxHashAlreadyProcessed).to.be.true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this maybe be part of ensurePeginIsRegistered
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends. Somethings we want to assert that this is false. Inside ensurePeginIsRegistered
it should always be true. But we can put it inside the ensurePeginIsRegistered
and when needed, assert from the test that it is false.
lib/tests/2wp.js
Outdated
const recipient1RskAddressChecksumed = rskTxHelper.getClient().utils.toChecksumAddress(ensure0x(senderRecipientInfo.rskRecipientRskAddressInfo.address)); | ||
const expectedEvent = createExpectedPeginBtcEvent(PEGIN_EVENTS.PEGIN_BTC, recipient1RskAddressChecksumed, btcPeginTxHash, peginValueInSatoshis); | ||
const btcTxHashProcessedHeight = Number(await bridge.methods.getBtcTxHashProcessedHeight(btcPeginTxHash).call()); | ||
const peginBtcEvent = await findEventInBlock(rskTxHelper, expectedEvent.name, btcTxHashProcessedHeight); | ||
expect(peginBtcEvent).to.be.deep.equal(expectedEvent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also go into it's own method, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
dff4eb6
to
697367e
Compare
lib/tests/2wp.js
Outdated
const senderRecipientInfo = await createSenderRecipientInfo(rskTxHelper, btcTxHelper); | ||
const initialSenderAddressBalanceInSatoshis = await getBtcAddressBalanceInSatoshis(btcTxHelper, senderRecipientInfo.btcSenderAddressInfo.address); | ||
// Value above minimum | ||
const peginValueInSatoshis = minimumPeginValueInSatoshis + Number(btcToSatoshis(0.1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const peginValueInSatoshis = minimumPeginValueInSatoshis + Number(btcToSatoshis(0.1)); | |
const peginValueInSatoshis = minimumPeginValueInSatoshis + 1; |
Maybe make just above the minimum? To be sure
…nctions below tests.
697367e
to
f700fbe
Compare
Quality Gate passedIssues Measures |
24ffe3e
into
rits-refactors-9-2024-integration
Adds a basic legacy pegin test with a value above minimum.
Besides the value above minimum, this pegin does the same checks as this test in this pr: #87