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

Moving window normalized fee #929

Merged
merged 12 commits into from
Nov 25, 2020
Merged

Conversation

isaacJChen
Copy link
Contributor

  • Calculate normalized fee
  • Version protocol parameters

Copy link
Collaborator

@thehenrytsai thehenrytsai left a comment

Choose a reason for hiding this comment

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

Some comments.

lib/bitcoin/BitcoinProcessor.ts Show resolved Hide resolved
lib/bitcoin/BitcoinProcessor.ts Outdated Show resolved Hide resolved
lib/bitcoin/BitcoinProcessor.ts Outdated Show resolved Hide resolved
lib/bitcoin/VersionManager.ts Outdated Show resolved Hide resolved
lib/bitcoin/lock/LockMonitor.ts Outdated Show resolved Hide resolved
lib/bitcoin/models/ProtocolParameters.ts Outdated Show resolved Hide resolved
lib/common/models/TransactionModel.ts Outdated Show resolved Hide resolved
lib/bitcoin/versions/latest/NormalizedFeeCalculator.ts Outdated Show resolved Hide resolved
lib/bitcoin/versions/latest/NormalizedFeeCalculator.ts Outdated Show resolved Hide resolved
@@ -21,17 +22,26 @@ export default class NormalizedFeeCalculator implements IFeeCalculator {
}

public async getNormalizedFee (block: number): Promise<number> {
// DB call optimization
// https://github.com/decentralized-identity/sidetree/issues/936
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: standard patterns is to append TODO to enable searching and automated tooling (such as extension in VSC).

Suggested change
// https://github.com/decentralized-identity/sidetree/issues/936
// TODO: https://github.com/decentralized-identity/sidetree/issues/936

* Normalized fee sohuld always be populated in core layer when core makes call to transactions endpoint.
* It may not be populated in blockchain service. This allows flexibility for the value to be computed on the spot or stored.
* To remove potentially dangerous behavior. Make a seperate model
* https://github.com/decentralized-identity/sidetree/issues/937
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: add TODO for tooling/searching.

Suggested change
* https://github.com/decentralized-identity/sidetree/issues/937
* TODO: https://github.com/decentralized-identity/sidetree/issues/937

@@ -149,8 +149,8 @@ export default class BitcoinProcessor {
/**
* Initializes the Bitcoin processor
*/
public async initialize () {
await this.versionManager.initialize(this.blockMetadataStore);
public async initialize (versionModels: BitcoinVersionModel[]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess BitcoinProcessor was the example I was looking for for dependency injection, so I still want to make sure we have an agreed upon pattern. Let's discuss but won't block the PR on this.

@@ -63,7 +65,7 @@ export default class JasmineSidetreeErrorValidator {
}

if (!validated) {
fail(`Expected error '${expectedErrorCode}' did not occur.`);
fail(`Expected error '${expectedErrorCode}' did not occur. Instead got '${actualError.code}'`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

LOL!

@thehenrytsai thehenrytsai merged commit a84366a into master Nov 25, 2020
@thehenrytsai thehenrytsai deleted the ische/movingWindowNormalizedFee branch November 25, 2020 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants