Skip to content

Commit

Permalink
Wanchain changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrion70 committed Sep 14, 2018
1 parent 99e9f9c commit 0549375
Show file tree
Hide file tree
Showing 20 changed files with 194 additions and 101,661 deletions.
99 changes: 99 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
version: 2

workflows:
version: 2
full_test:
jobs:
- prep-deps-npm
- test-lint:
requires:
- prep-deps-npm
- test-unit:
requires:
- prep-deps-npm
- test-browser:
requires:
- prep-deps-npm
- all-tests-pass:
requires:
- test-lint
- test-unit
- test-browser
- job-publish-release:
filters:
branches:
only: master
requires:
- prep-deps-npm
- all-tests-pass
jobs:
prep-deps-npm:
docker:
- image: circleci/node:10
steps:
- checkout
- restore_cache:
keys:
- v1.0-dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Install npm 6 + deps via npm
command: |
sudo npm install -g npm@6 && npm install --no-save
- persist_to_workspace:
root: .
paths:
- node_modules
test-lint:
docker:
- image: circleci/node:10
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Test
command: npm run lint
test-browser:
docker:
- image: circleci/node:10-browsers
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Test
command: npm run test:browser
test-unit:
docker:
- image: circleci/node:10
steps:
- checkout
- attach_workspace:
at: .
- run:
name: test:coverage
command: npm run test:coverage
all-tests-pass:
docker:
- image: circleci/node:10
steps:
- run:
name: All Tests Passed
command: echo 'weew - everything passed!'
job-publish-release:
context: NPM
docker:
- image: circleci/node:10
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/.npmrc
- run:
name: "Run docs"
command: npm run build:docs
- run:
name: "Publish Release on NPM"
command: npm publish
45 changes: 23 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
# Created by https://www.gitignore.io/api/osx,node

### OSX ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### Node ###
Expand Down Expand Up @@ -76,3 +76,4 @@ package-lock.json
# Yarn Integrity file
.yarn-integrity

.idea
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
(modification: no type change headlines) and this project adheres to
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.0.2] - 2018-09-14
- Wanchain

## [2.0.1] - 2018-08-08
- Fixes ``BlockHeader.prototype.validate()`` bug, see PR [#49](https://github.com/ethereumjs/ethereumjs-block/pull/49)
Expand Down
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
# SYNOPSIS
[![NPM Package](https://img.shields.io/npm/v/ethereumjs-block.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-block)
[![Build Status](https://img.shields.io/travis/ethereumjs/ethereumjs-block.svg?branch=master&style=flat-square)](https://travis-ci.org/ethereumjs/ethereumjs-block)
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-block.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-block)
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)]() or #ethereumjs on freenode
[![CircleCI][circle-image]][circle-url]
[![Coverage Status][coveralls-image]][coveralls-url]
[![dependency status][dep-image]][dep-url]
[![NPM][npm-image]][npm-url]

[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
[circle-image]: https://circleci.com/gh/WanJS/wanchainjs-block.svg?style=svg
[circle-url]: https://circleci.com/gh/WanJS/wanchainjs-block
[dep-image]: https://david-dm.org/WanJS/wanchainjs-block.svg
[dep-url]: https://david-dm.org/WanJS/wanchainjs-block
[coveralls-image]: https://coveralls.io/repos/github/WanJS/wanchainjs-block/badge.svg?branch=dev
[coveralls-url]: https://coveralls.io/github/WanJS/wanchainjs-block?branch=dev
[npm-image]: http://img.shields.io/npm/v/wanchainjs-block.svg
[npm-url]: https://www.npmjs.org/package/wanchainjs-block


Implements schema and functions related to Ethereum's block.
Implements schema and functions related to Wanchain's block.

# INSTALL
`npm install ethereumjs-block`
`npm install wanchainjs-block`

# BROWSER
This module work with `browserify`.
Expand All @@ -19,7 +26,7 @@ This module work with `browserify`.
[./docs](./docs/index.md)

# TESTING
Tests in the ``tests`` directory are partly outdated and testing is primarily done by running the ``BlockchainTests`` from within the [ethereumjs-vm](https://github.com/ethereumjs/ethereumjs-vm) repository.
Tests in the ``tests`` directory are partly outdated and testing is primarily done by running the ``BlockchainTests`` from within the [wanchainjs-vm](https://github.com/WanJS/wanchain-vm) repository.

Relevant test folders:
- ``bcTotalDifficultyTest``
Expand Down
12 changes: 6 additions & 6 deletions from-rpc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict'
const Transaction = require('ethereumjs-tx')
const ethUtil = require('ethereumjs-util')
const Transaction = require('wanchainjs-tx')
const ethUtil = require('wanchainjs-util')
const Block = require('./')
const blockHeaderFromRpc = require('./header-from-rpc')

module.exports = blockFromRpc

/**
* Creates a new block object from Ethereum JSON RPC.
* @param {Object} blockParams - Ethereum JSON RPC of block (eth_getBlockByNumber)
* @param {Array.<Object>} Optional list of Ethereum JSON RPC of uncles (eth_getUncleByBlockHashAndIndex)
* Creates a new block object from Wanchain JSON RPC.
* @param {Object} blockParams - Wanchain JSON RPC of block (eth_getBlockByNumber)
* @param {Array.<Object>} Optional list of Wanchain JSON RPC of uncles (eth_getUncleByBlockHashAndIndex)
*/
function blockFromRpc (blockParams, uncles) {
uncles = uncles || []
Expand Down Expand Up @@ -41,7 +41,7 @@ function blockFromRpc (blockParams, uncles) {

function normalizeTxParams (_txParams) {
const txParams = Object.assign({}, _txParams)
// hot fix for https://github.com/ethereumjs/ethereumjs-util/issues/40
// hot fix for https://github.com/WanJS/wanchainjs-util/issues/40
txParams.gasLimit = (txParams.gasLimit === undefined) ? txParams.gas : txParams.gasLimit
txParams.data = (txParams.data === undefined) ? txParams.input : txParams.data
// strict byte length checking
Expand Down
2 changes: 1 addition & 1 deletion header-from-rpc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'
const BlockHeader = require('./header')
const ethUtil = require('ethereumjs-util')
const ethUtil = require('wanchainjs-util')

module.exports = blockHeaderFromRpc

Expand Down
4 changes: 2 additions & 2 deletions header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Common = require('ethereumjs-common')
const utils = require('ethereumjs-util')
const Common = require('wanchainjs-common')
const utils = require('wanchainjs-util')
const BN = utils.BN
/**
* An object that repersents the block header
Expand Down
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Common = require('ethereumjs-common')
const ethUtil = require('ethereumjs-util')
const Tx = require('ethereumjs-tx')
const Common = require('wanchainjs-common')
const ethUtil = require('wanchainjs-util')
const Tx = require('wanchainjs-tx')
const Trie = require('merkle-patricia-tree')
const BN = ethUtil.BN
const rlp = ethUtil.rlp
Expand All @@ -14,7 +14,7 @@ const BlockHeader = require('./header')
* @param {Array} opts Options
* @param {String|Number} opts.chain The chain for the block [default: 'mainnet']
* @param {String} opts.hardfork Hardfork for the block [default: null, block number-based behaviour]
* @param {Object} opts.common Alternatively pass a Common instance (ethereumjs-common) instead of setting chain/hardfork directly
* @param {Object} opts.common Alternatively pass a Common instance (wanchainjs-common) instead of setting chain/hardfork directly
* @prop {Header} header the block's header
* @prop {Array.<Header>} uncleList an array of uncle headers
* @prop {Array.<Buffer>} raw an array of buffers containing the raw blocks.
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = function (config) {
browserNoActivityTimeout: 60000,
frameworks: ['browserify', 'detectBrowsers', 'tap'],
files: [
'./tests/difficulty.js'
'./tests/index.js'
],
preprocessors: {
'tests/*.js': ['browserify', 'env']
Expand Down
33 changes: 16 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
{
"name": "ethereumjs-block",
"version": "2.0.1",
"name": "wanchainjs-block",
"version": "2.0.2",
"description": "Provides Block serialization and help functions",
"main": "index.js",
"scripts": {
"coverage": "istanbul cover ./tests/index.js",
"coveralls": "npm run coverage && coveralls < coverage/lcov.info",
"lint": "standard",
"test": "npm run test:node && npm run test:browser",
"test": "npm run test:unit && npm run test:browser",
"test:browser": "karma start karma.conf.js",
"test:node": "node tests/index.js",
"test:unit": "node tests/index.js",
"test:coverage": "nyc npm run test:unit && npm run test:coveralls-upload",
"test:coveralls-upload": "if [ $COVERALLS_REPO_TOKEN ]; then nyc report --reporter=text-lcov | coveralls; fi",
"build:docs": "documentation build ./index.js ./header.js --format md --shallow > ./docs/index.md && documentation build ./from-rpc.js --format md --shallow > ./docs/fromRpc.md"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ethereumjs/ethereumjs-block.git"
"url": "git+https://github.com/WanJS/wanchainjs-block.git"
},
"keywords": [
"ethereum",
"wanchain",
"block"
],
"author": "mjbecze (mb@ethdev.com)",
"author": "Tyrion70 (tyrion70@gmail.com)",
"license": "MPL-2.0",
"bugs": {
"url": "https://github.com/ethereumjs/ethereumjs-block/issues"
"url": "https://github.com/WanJS/wanchainjs-block/issues"
},
"homepage": "https://github.com/ethereumjs/ethereumjs-block#readme",
"homepage": "https://github.com/WanJS/wanchainjs-block#readme",
"dependencies": {
"async": "^2.0.1",
"ethereumjs-common": "^0.3.0",
"ethereumjs-tx": "^1.2.2",
"ethereumjs-util": "^5.0.0",
"wanchainjs-common": "^0.5.2",
"wanchainjs-tx": "^1.5.0",
"wanchainjs-util": "^5.2.1",
"merkle-patricia-tree": "^2.1.2"
},
"devDependencies": {
"babelify": "^8.0.0",
"babel-preset-env": "^1.6.1",
"babelify": "^8.0.0",
"browserify": "^15.0.0",
"coveralls": "^2.11.6",
"documentation": "4.0.0-beta16",
"ethereumjs-testing": "~1.0.0",
"istanbul": "^0.4.2",
"karma": "^2.0.0",
"karma-browserify": "^5.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-detect-browsers": "^2.2.5",
"karma-env-preprocessor": "^0.1.1",
"karma-firefox-launcher": "^1.1.0",
"karma-tap": "^4.0.0",
"nyc": "^13.0.1",
"standard": "^8.4.0",
"tape": "^4.2.0"
}
Expand Down

0 comments on commit 0549375

Please sign in to comment.