Compare commits

...

3 Commits

Author SHA1 Message Date
semantic-release-bot 89749d9a8f chore(release): 0.1.0-develop.62 [skip ci]
# [0.1.0-develop.62](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.61...v0.1.0-develop.62) (2023-10-24)

### Features

* add basic non-verifying eth_getLogs support ([b405ee2](b405ee2581))
2023-10-24 00:24:21 +00:00
Derrick Hammer 833a007a1f
Merge remote-tracking branch 'origin/develop' into develop 2023-10-23 20:23:28 -04:00
Derrick Hammer b405ee2581
feat: add basic non-verifying eth_getLogs support 2023-10-23 20:23:23 -04:00
4 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,10 @@
# [0.1.0-develop.62](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.61...v0.1.0-develop.62) (2023-10-24)
### Features
* add basic non-verifying eth_getLogs support ([b405ee2](https://git.lumeweb.com/LumeWeb/libethsync/commit/b405ee2581953acc6e8a66dece1a8d1789d5428d))
# [0.1.0-develop.61](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.60...v0.1.0-develop.61) (2023-09-16)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/libethsync",
"version": "0.1.0-develop.61",
"version": "0.1.0-develop.62",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/libethsync",
"version": "0.1.0-develop.61",
"version": "0.1.0-develop.62",
"dependencies": {
"@chainsafe/as-sha256": "^0.3.1",
"@chainsafe/bls": "7.1.1",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/libethsync",
"version": "0.1.0-develop.61",
"version": "0.1.0-develop.62",
"type": "module",
"repository": {
"type": "git",

View File

@ -72,6 +72,7 @@ export default class VerifyingProvider implements IClientVerifyingProvider {
eth_estimateGas: this.estimateGas,
eth_sendRawTransaction: this.sendRawTransaction,
eth_getTransactionReceipt: this.getTransactionReceipt,
eth_getLogs: this.getLogs,
}),
);
private rpc: RPC;
@ -396,6 +397,19 @@ export default class VerifyingProvider implements IClientVerifyingProvider {
};
}
private async getLogs(...args: any) {
const { result: logs, success } = await this.rpc.request({
method: "eth_getLogs",
params: [args],
});
if (!(success && logs)) {
return null;
}
return logs;
}
private async getVMCopy(): Promise<VM> {
if (this.vm === null) {
const blockchain = await Blockchain.create({ common: this.common });
@ -519,6 +533,7 @@ export default class VerifyingProvider implements IClientVerifyingProvider {
await vm.stateManager.commit();
return vm;
}
private async getBlockHeader(
blockOpt: BlockNumberOrTag,
): Promise<BlockHeader> {
@ -527,6 +542,7 @@ export default class VerifyingProvider implements IClientVerifyingProvider {
const blockHash = await this.getBlockHash(blockNumber);
return this.getBlockHeaderByHash(blockHash);
}
private getBlockNumberByBlockNumberOrTag(blockOpt: BlockNumberOrTag): bigint {
// TODO: add support for blockOpts below
if (
@ -548,6 +564,7 @@ export default class VerifyingProvider implements IClientVerifyingProvider {
return blockNumber;
}
}
private async waitForBlockNumber(blockNumber: bigint) {
if (blockNumber <= this.latestBlockNumber) return;
console.log(`waiting for blockNumber ${blockNumber}`);
@ -638,6 +655,7 @@ export default class VerifyingProvider implements IClientVerifyingProvider {
return true;
}
private verifyCodeHash(code: Bytes, codeHash: Bytes32): boolean {
return (
(code === "0x" && codeHash === "0x" + KECCAK256_NULL_S) ||
@ -664,6 +682,7 @@ export default class VerifyingProvider implements IClientVerifyingProvider {
);
}
}
private async getBlock(header: BlockHeader) {
const { result: blockInfo, success } = await this.rpc.request({
method: "eth_getBlockByNumber",