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

feat: implement light client verification methods #1116

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a537493
feat: implement light client verification methods
austinabell Apr 24, 2023
39b4575
chore: docs
austinabell Apr 25, 2023
879a7ab
refactor: move light-client APIs to own crate, migrate sha impl
austinabell Apr 26, 2023
17f0cf3
chore: changeset
austinabell Apr 26, 2023
f47b4fa
chore: add docs to validation steps
austinabell Apr 26, 2023
f8612ff
refactor: switch function params to be an object rather than positional
austinabell Apr 26, 2023
b280d8e
chore: revert naj test changes
austinabell Apr 26, 2023
4e81fae
test: adds back light client block verification test
austinabell Apr 26, 2023
09f957f
chore: lint
austinabell Apr 26, 2023
8ad77ae
test: add back execution proof verification in NAJ test
austinabell Apr 26, 2023
153dfa7
test: add execution proof test vectors
austinabell Apr 26, 2023
59b4f14
chore: address comments before refactoring
austinabell Apr 27, 2023
68601e5
refactor: move Enum class to types
austinabell Apr 27, 2023
73644e2
refactor: move light client logic into separate files
austinabell Apr 27, 2023
ab94d18
refactor: move borsh utils to own file
austinabell Apr 27, 2023
e15fad7
Merge branch 'master' into light_client
austinabell Apr 27, 2023
206df23
chore: remove todo from updated types
austinabell Apr 27, 2023
de393fb
chore: update changeset
austinabell Apr 27, 2023
daca5d2
test: move execution verification providers check into accounts
austinabell Apr 27, 2023
f509b3f
Merge branch 'master' into light_client
austinabell Apr 29, 2023
0dde04f
Merge branch 'master' into light_client
austinabell May 4, 2023
29c9ea6
fix: bug with bp signature validation
austinabell May 5, 2023
fe45242
refactor: move block hash generation to after trivial validation
austinabell May 5, 2023
20bff2e
chore: lint fix
austinabell May 5, 2023
0559e23
fix: bn comparison bug
austinabell May 23, 2023
d867179
fix: execution test parameter format from changes
austinabell May 24, 2023
8731572
Merge branch 'master' into light_client
austinabell May 24, 2023
f766671
fix: changes based on review comments
austinabell Jun 2, 2023
c5d1378
Merge branch 'master' into light_client
austinabell Jun 2, 2023
a8e19d8
chore: empty commit to re-trigger flaky CI
austinabell Jun 2, 2023
e7c26ce
Merge branch 'master' into light_client
vikinatora Feb 26, 2024
d97a801
fix: pnpm-lock.yaml
vikinatora Feb 26, 2024
35c12da
chore: lock package version
vikinatora Feb 26, 2024
6aed942
Merge remote-tracking branch 'upstream/master' into light_client
vikinatora Mar 12, 2024
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
5 changes: 5 additions & 0 deletions .changeset/four-toys-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@near-js/light-client": patch
---

Implement light client block and proof verification
17 changes: 17 additions & 0 deletions packages/light-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# @near-js/types
austinabell marked this conversation as resolved.
Show resolved Hide resolved

## 0.0.3

### Patch Changes

- [#1103](https://github.com/near/near-api-js/pull/1103) [`b713ae78`](https://github.com/near/near-api-js/commit/b713ae78969d530e7e69e21e315e3d3fdb5e68e9) Thanks [@austinabell](https://github.com/austinabell)! - Implement light client block retrieval and relevant types

- [#1106](https://github.com/near/near-api-js/pull/1106) [`bc53c32c`](https://github.com/near/near-api-js/commit/bc53c32c80694e6f22d9be97db44603591f0026b) Thanks [@austinabell](https://github.com/austinabell)! - Adds missing timestamp_nanosec field to light client proof header

- [#1105](https://github.com/near/near-api-js/pull/1105) [`8c6bf391`](https://github.com/near/near-api-js/commit/8c6bf391a01af9adb81cb8731c45bdb17f5291c0) Thanks [@austinabell](https://github.com/austinabell)! - Adds missing version field in ValidatorStakeView

## 0.0.2

### Patch Changes

- [#1091](https://github.com/near/near-api-js/pull/1091) [`ca458cac`](https://github.com/near/near-api-js/commit/ca458cac683fab614b77eb5daa160e03b0640350) Thanks [@andy-haynes](https://github.com/andy-haynes)! - Only include contents of lib/ in NPM packages
8 changes: 8 additions & 0 deletions packages/light-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# @near-js/light-client

NEAR light client verification utilities. Based on the [Light Client spec](https://github.com/near/NEPs/blob/master/specs/ChainSpec/LightClient.md)

# License

This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See [LICENSE](https://github.com/near/near-api-js/blob/master/LICENSE) and [LICENSE-APACHE](https://github.com/near/near-api-js/blob/master/LICENSE-APACHE) for details.
5 changes: 5 additions & 0 deletions packages/light-client/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
collectCoverage: true
};
37 changes: 37 additions & 0 deletions packages/light-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@near-js/light-client",
"version": "0.0.1",
"description": "TypeScript API for NEAR light client verification",
"main": "lib/index.js",
"scripts": {
"build": "pnpm compile",
"compile": "tsc -p tsconfig.json",
"lint:js": "eslint -c ../../.eslintrc.js.yml test/**/*.js --no-eslintrc",
"lint:js:fix": "eslint -c ../../.eslintrc.js.yml test/**/*.js --no-eslintrc --fix",
"lint:ts": "eslint -c ../../.eslintrc.ts.yml src/**/*.ts --no-eslintrc",
"lint:ts:fix": "eslint -c ../../.eslintrc.ts.yml src/**/*.ts --no-eslintrc --fix",
"test": "jest test"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"bn.js": "5.2.1",
"@near-js/crypto": "workspace:*",
"@near-js/types": "workspace:*",
"@near-js/providers": "workspace:*",
austinabell marked this conversation as resolved.
Show resolved Hide resolved
"@near-js/utils": "workspace:*",
austinabell marked this conversation as resolved.
Show resolved Hide resolved
"bs58": "^4.0.0",
"borsh": "^0.7.0",
"js-sha256": "^0.9.0"
},
"devDependencies": {
"@types/node": "^18.11.18",
"jest": "^26.0.1",
"ts-jest": "^26.5.6",
"typescript": "^4.9.4"
},
"files": [
"lib"
]
}
Loading