Skip to content

Commit

Permalink
style: resolve style guide violations
Browse files Browse the repository at this point in the history
  • Loading branch information
oXtxNt9U authored and github-actions[bot] committed Oct 24, 2024
1 parent 079489a commit 8498ee7
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions packages/api-sync/source/restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,24 @@ export class Restore {

await this.dataSource.transaction("REPEATABLE READ", async (entityManager) => {
const context: RestoreContext = {
entityManager,
blockRepository: this.blockRepositoryFactory(entityManager),
configurationRepository: this.configurationRepositoryFactory(entityManager),
entityManager,
addressToPublicKey: {},
lastHeight: 0,
mostRecentCommit,
publicKeyToAddress: {},
receiptRepository: this.receiptRepositoryFactory(entityManager),
stateRepository: this.stateRepositoryFactory(entityManager),

totalSupply: Utils.BigNumber.ZERO,

transactionRepository: this.transactionRepositoryFactory(entityManager),
transactionTypeRepository: this.transactionTypeRepositoryFactory(entityManager),
receiptRepository: this.receiptRepositoryFactory(entityManager),
userAttributes: {},
validatorAttributes: {},
validatorRoundRepository: this.validatorRoundRepositoryFactory(entityManager),
walletRepository: this.walletRepositoryFactory(entityManager),

mostRecentCommit,

lastHeight: 0,
totalSupply: Utils.BigNumber.ZERO,
addressToPublicKey: {},
publicKeyToAddress: {},
validatorAttributes: {},
userAttributes: {},
};

// The restore keeps a long-lived postgres transaction while it ingests all data.
Expand Down Expand Up @@ -299,12 +299,12 @@ export class Restore {
for (const validator of validators) {
context.validatorAttributes[validator.address] = {
blsPublicKey: validator.blsPublicKey,
voteBalance: validator.voteBalance,
votersCount: validator.votersCount,
isResigned: validator.isResigned,
producedBlocks: 0,
totalForgedFees: Utils.BigNumber.ZERO,
totalForgedRewards: Utils.BigNumber.ZERO,
voteBalance: validator.voteBalance,
votersCount: validator.votersCount,
};
}

Expand All @@ -331,16 +331,9 @@ export class Restore {

accounts.push({
address: account.address,
publicKey: context.addressToPublicKey[account.address] ?? "",
balance: Utils.BigNumber.make(account.balance).toFixed(),
nonce: Utils.BigNumber.make(account.nonce).toFixed(),
attributes: {
...(validatorAttributes
? {
validatorPublicKey: validatorAttributes.blsPublicKey,
validatorResigned: validatorAttributes.isResigned,
validatorVoteBalance: validatorAttributes.voteBalance,
validatorVotersCount: validatorAttributes.votersCount,
validatorForgedFees: validatorAttributes.totalForgedFees.toFixed(),
validatorForgedRewards: validatorAttributes.totalForgedRewards.toFixed(),
validatorForgedTotal: validatorAttributes.totalForgedFees
Expand All @@ -353,7 +346,11 @@ export class Restore {
timestamp: validatorAttributes.lastBlock.timestamp,
}
: {},
validatorPublicKey: validatorAttributes.blsPublicKey,
validatorProducedBlocks: validatorAttributes.producedBlocks,
validatorResigned: validatorAttributes.isResigned,
validatorVoteBalance: validatorAttributes.voteBalance,
validatorVotersCount: validatorAttributes.votersCount,

// updated at end of db transaction
// - validatorRank
Expand All @@ -367,6 +364,9 @@ export class Restore {
}
: {}),
},
balance: Utils.BigNumber.make(account.balance).toFixed(),
nonce: Utils.BigNumber.make(account.nonce).toFixed(),
publicKey: context.addressToPublicKey[account.address] ?? "",
updated_at: "0",
});
}
Expand Down Expand Up @@ -397,11 +397,11 @@ export class Restore {
Utils.assert.defined(receipt.blockHeight);

receipts.push({
id: receipt.txHash,
blockHeight: Utils.BigNumber.make(receipt.blockHeight).toFixed(),
deployedContractAddress: receipt.deployedContractAddress,
gasRefunded: Number(receipt.gasRefunded),
gasUsed: Number(receipt.gasUsed),
id: receipt.txHash,
logs: receipt.logs,
output: receipt.output,
success: receipt.success,
Expand Down Expand Up @@ -483,8 +483,8 @@ export class Restore {
.insert()
.orIgnore()
.values({
id: 1,
height: context.lastHeight.toFixed(),
id: 1,
supply: context.totalSupply.toFixed(),
})
.execute();
Expand Down

0 comments on commit 8498ee7

Please sign in to comment.