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

Fix spelling of isDeauthorizationReqestActive #658

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ cypress/plugins
# Yarn
node_modules/
yarn-error.log

.cosine/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this directory? 🤔

2 changes: 1 addition & 1 deletion src/store/staking-applications/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
_appData.pendingAuthorizationDecrease.toString(),
remainingAuthorizationDecreaseDelay:
_appData.remainingAuthorizationDecreaseDelay.toString(),
isDeauthorizationReqestActive: _appData.isDeauthorizationReqestActive,
isDeauthorizationRequestActive: _appData.isDeauthorizationRequestActive,

Check failure on line 151 in src/store/staking-applications/effects.ts

View workflow job for this annotation

GitHub Actions / Check code format

Insert `⏎···········`
Copy link
Contributor

@michalsmiarowski michalsmiarowski Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The builds are failing because code is not formatted. Please run yarn format:fix to fix that.

If you do that (and just that) in a separate commit, then additionaly add that commit hash to .git-blame-ignore-revs file.

deauthorizationCreatedAt:
_appData.deauthorizationCreatedAt?.toString(),
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/staking-applications/selectors.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Unrelated to the file]

Let's also change this typo in those two places:

and

Without those changes the error appears here:

tbtc: {
...tbtcApp,
stakingAppId: "tbtc",
address: tbtcAppAddress,
label: "tBTC",
},
randomBeacon: {
...randomBeaconApp,
stakingAppId: "randomBeacon",
address: randomBeaconAddress,
label: "Random Beacon",
},

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const selectStakingAppByStakingProvider = createSelector(
status = "authorized"
} else if (
hasPendingDeauthorization &&
!authData?.isDeauthorizationReqestActive &&
!authData?.isDeauthorizationRequestActive &&
authData.isOperatorInPool !== undefined &&
!authData.isOperatorInPool
) {
Expand Down
12 changes: 6 additions & 6 deletions src/store/staking-applications/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,14 @@ export const stakingApplicationsSlice = createSlice({
// was in the sortition pool. Before authorization decrease delay
// starts, the operator needs to update the state of the sortition pool
// with a call to `joinSortitionPool` or `updateOperatorStatus`.
const isDeauthorizationReqestActive =
const isDeauthorizationRequestActive =
!BigNumber.from(decreasingAt).eq(MAX_UINT64)

state[appName].stakingProviders.data[stakingProvider] = {
...stakingProviderData,
isDeauthorizationReqestActive,
isDeauthorizationRequestActive,
pendingAuthorizationDecrease: decreaseAmount,
remainingAuthorizationDecreaseDelay: isDeauthorizationReqestActive
remainingAuthorizationDecreaseDelay: isDeauthorizationRequestActive
? "0"
: MAX_UINT64.toString(),
deauthorizationCreatedAt: undefined,
Expand All @@ -243,15 +243,15 @@ export const stakingApplicationsSlice = createSlice({
if (!stakingProviderData) return

const deauthorizationCreatedAt =
!stakingProviderData.isDeauthorizationReqestActive
!stakingProviderData.isDeauthorizationRequestActive
? dateToUnixTimestamp().toString()
: stakingProviderData.deauthorizationCreatedAt

state[appName].stakingProviders.data[stakingProvider] = {
...stakingProviderData,
remainingAuthorizationDecreaseDelay:
state[appName].parameters.data.authorizationDecreaseDelay,
isDeauthorizationReqestActive: true,
isDeauthorizationRequestActive: true,
deauthorizationCreatedAt,
}
},
Expand All @@ -266,7 +266,7 @@ export const stakingApplicationsSlice = createSlice({
authorizedStake: "0",
pendingAuthorizationDecrease: "0",
remainingAuthorizationDecreaseDelay: "0",
isDeauthorizationReqestActive: false,
isDeauthorizationRequestActive: false,
deauthorizationCreatedAt: undefined,
isOperatorInPool: undefined,
operator: AddressZero,
Expand Down
6 changes: 3 additions & 3 deletions src/threshold-ts/applications/__tests__/application.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ describe("Application test", () => {
{
remainingAuthorizationDecreaseDelay: MAX_UINT64,
expectedValue: {
isDeauthorizationReqestActive: false,
isDeauthorizationRequestActive: false,
deauthorizationCreatedAt: undefined,
},
testMessage:
Expand All @@ -215,7 +215,7 @@ describe("Application test", () => {
{
remainingAuthorizationDecreaseDelay: 0,
expectedValue: {
isDeauthorizationReqestActive: true,
isDeauthorizationRequestActive: true,
deauthorizationCreatedAt: undefined,
},
testMessage:
Expand All @@ -224,7 +224,7 @@ describe("Application test", () => {
{
remainingAuthorizationDecreaseDelay,
expectedValue: {
isDeauthorizationReqestActive: true,
isDeauthorizationRequestActive: true,
deauthorizationCreatedAt: BigNumber.from(createdAt),
},
testMessage:
Expand Down
10 changes: 5 additions & 5 deletions src/threshold-ts/applications/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export interface StakingProviderAppInfo<
* call `joinSortitionPool` or `updateOperatorStatus` to activate the request.
* In that case we can't estimate when the deauthorization request started.
*/
isDeauthorizationReqestActive: boolean
isDeauthorizationRequestActive: boolean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are at it, let's also fix the similar typo in the comment above:

* `MAX_UINT64` the deauthorization reqest is pending and an operator have to

/**
* Timestamp when the deauthorization request was created.Takes an undefined
* value if it cannot be estimated
Expand Down Expand Up @@ -321,21 +321,21 @@ export class Application implements IApplication {
remainingAuthorizationDecreaseDelay.toString()
)

let isDeauthorizationReqestActive = true
let isDeauthorizationRequestActive = true
if (_remainingAuthorizationDecreaseDelay.eq(MAX_UINT64)) {
// If a `remainingAuthorizationDecreaseDelay` is equal `MAX_UINT64` the
// deauthorization reqest is pending and an operator have to call
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also fix a similar typo in this comment

Suggested change
// deauthorization reqest is pending and an operator have to call
// deauthorization request is pending and an operator have to call

// `joinSortitionPool` or `updateOperatorStatus` to activate the request.
// In that case we can't estimate when the deauthorization request
// started.
isDeauthorizationReqestActive = false
isDeauthorizationRequestActive = false
}

// If the deauthorization request is not active or the
// `_remainingAuthorizationDecreaseDelay` is equal `0` we can't estimate
// when the deauthorization was requested.
const deauthorizationCreatedAt =
!isDeauthorizationReqestActive ||
!isDeauthorizationRequestActive ||
_remainingAuthorizationDecreaseDelay.eq(ZERO)
? undefined
: BigNumber.from(requestTimestamp.toString())
Expand All @@ -346,7 +346,7 @@ export class Application implements IApplication {
authorizedStake,
pendingAuthorizationDecrease,
remainingAuthorizationDecreaseDelay,
isDeauthorizationReqestActive,
isDeauthorizationRequestActive,
deauthorizationCreatedAt,
isOperatorInPool,
operator,
Expand Down
Loading