-
Notifications
You must be signed in to change notification settings - Fork 63
Conversation
👍 |
Can you also add the return types to the functions? |
(corrected the comment above, please read on GitHub directly) |
Ok, that's REALLY a lot of any 😄, is it not possible to be more precise in many cases? |
(but if you think that's too much work load on this iteration - so be it - then we do it next round separately) |
I am looking at being more specific with the types as I can, but there I think I might have to do a separate PR. |
7d54aea
to
ee24224
Compare
The main sticking point is that there are a good few functions in the index file that manipulate the arguments/overload the functions and to express that properly I would need to rewrite the functions themselves and I don't want them to get lost in the diff noise. |
Ah ok, no, them leave as-is, we can also add the return types later. |
.editorconfig
Outdated
insert_final_newline = true | ||
|
||
[*.md] | ||
indent_size = 4 |
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.
What kind of editor configuration is this here? Even if this might be useful I would prefer not to side introduce here and eventually discuss along a separate PR, can you please remove?
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.
Yup, I'll add this in a separate PR
Generally: just realizing the scope of this work by scrolling completely through for the first time, really great! 😀 👍 |
Can you do one integration test on this and open a PR on the VM pointing the blockchain dependency towards this branch so that we can see if CI runs through? This will largely help build up confidence that this has no side effects (especially after the experiences with the other TS transitions 😆). |
For sure, I'll add that |
Using this branch is a bit tricky with the new build process. The published versions will have compiled TS code where the branch doesn't. I could add a temporary step to ethereumjs/ethereumjs-monorepo#469 that compiles the source, how does that sound? |
@whymarrh Whatever is easier for you, you can also do a local test run and post the results here. |
This lacks a |
Also .prettierignore. |
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.
Not completely through yet, some things to clarify or update, can already be addressed.
const level = require("level-mem"); | ||
const semaphore = require("semaphore"); | ||
|
||
export default class Blockchain { |
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.
Just for notation: this will be the same kind of API breaking module loading as along the other TS transitions.
c3fb550
to
4373b4b
Compare
I've got ethereumjs/ethereumjs-monorepo#469 to build successfully based on (a form of) these changes |
This has now linting errors since |
src/index.ts
Outdated
_initLock: any; | ||
_putSemaphore: any; | ||
_staleHeadBlock: any; | ||
_staleHeads: any; |
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.
Nice resorting and - generally - property collection, finally gives some overview what's inside. 😄 👍
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.
To be continued... 😄
} | ||
this._initLock.go(); | ||
}); | ||
} |
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.
constructor()
: Ok.
src/index.ts
Outdated
} | ||
cb(); | ||
} | ||
); |
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.
get meta()
, _init()
: Ok.
self._headBlock = genesisHash; | ||
} | ||
} | ||
} |
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.
getHeads()
: Ok.
}, | ||
cb | ||
); | ||
} |
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.
Ok till here.
this._putBlockOrHeader(block, done, isGenesis); | ||
}, cb); | ||
}); | ||
} |
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.
lockUnlock
extracted, good.
next(); | ||
} | ||
} | ||
} |
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.
_putBlockOrHeader()
: Ok.
} | ||
|
||
nextBlock(blockId); | ||
} |
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.
Ok until here.
* Gets block details by its hash | ||
* @deprecated | ||
*/ | ||
getDetails(_: string, cb: any) { |
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.
Is this hash
-> _
replacement some convention to mark things as deprecated? Other reason?
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.
The hash
argument isn't used so it's a convention to note that it's not used
|
||
_saveHeads(cb: any) { | ||
this._batchDbOps(this._saveHeadOps(), cb); | ||
} |
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.
Ok till here.
cb(); | ||
} | ||
}); | ||
} |
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.
Ok till here.
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.
Ok, I'm through finally 😄. Apart from another prettier fix run and a handful minor comments to be addressed I think this should actually be ready to merge since tests are also passing on the VM. Really great job! 👍
src/index.ts
Outdated
}); | ||
} | ||
|
||
_delBlock(blockHash: any, cb: any) { |
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 be safe to use Buffer
here as a type too as in delBlock()
.
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.
I'll update this to use Buffer
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.
Good catch
417159c
to
bad4381
Compare
@holgerd77 updated again, let me know how it looks now |
Hi @whymarrh, thanks for the updates, can you please have a final look at the CI run some time after you push and check that this is ok? Otherwise this is always blocking. Linting is still failing, probably |
@whymarrh Can you do this final |
Updated. We'll also want to drop 83fb9c0 from this PR or before we publish. |
@whymarrh Not completely getting it. Why did you introduce this in the first place and why didn't you remove now along this update? Is this something which needs further work? |
@holgerd77 updated and removed 83fb9c0. Apologies for the confusion, what wasn't clear? To be able to use this package via Git in ethereumjs/ethereumjs-monorepo#469 the From that PR's description:
|
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.
Ah sorry, wasn't aware of this connection.
Looks good now, will merge! 😀🎷🎺🥁
This PR migrates the codebase to use TypeScript. This PR also replaces the Babel tooling with tooling from ethereumjs-config, resulting a project structure similar to the account, rlp, etc. libraries. I've made heavy use of
any
as a starting point for future restricting of the types (which will likely have to be accompanied by further refactoring). I've also droppedsafe-buffer
(as outlined in the organizations technical documentation).