Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
aa29e45
Update README.md
dskvr May 22, 2018
63688d9
Remove notice
dskvr May 22, 2018
389819b
Update README.md
dskvr May 22, 2018
6d104ef
Update README.md
dskvr May 22, 2018
52b210d
Update README.md
dskvr May 22, 2018
9470afa
critical patch
dskvr May 22, 2018
fb8f417
remove include b1
dskvr May 22, 2018
7d3d325
bump version
dskvr May 22, 2018
5cd9db8
Update README.md
dskvr May 22, 2018
eb55167
Update README.md
dskvr May 22, 2018
4364b5f
Update README.md
dskvr May 22, 2018
c275545
Update README.md
dskvr May 22, 2018
3cd7acb
Update README.md
dskvr May 22, 2018
f9c87f1
Update README.md
dskvr May 22, 2018
4980bba
Update README.md
dskvr May 22, 2018
68e939b
Update README.md
dskvr May 22, 2018
8d98a9f
Update README.md
dskvr May 22, 2018
d4d732b
Update README.md
dskvr May 22, 2018
ecac048
Update README.md
dskvr May 22, 2018
892934c
Update README.md
dskvr May 22, 2018
c1137d7
Update README.md
dskvr May 24, 2018
275b370
Use key() pub const from contract in FINAL snapshot
dskvr May 29, 2018
dd1909e
Fix export reference
dskvr May 29, 2018
5c61a79
don't poll again after snapshot completes final snapshot
dskvr May 29, 2018
77e4220
Don't poll again
dskvr May 29, 2018
5f02343
explicitly order by det_ind asc
dskvr May 29, 2018
3a1c009
fix wallet jsdocs
dskvr May 29, 2018
67856f8
remove bad docs
dskvr May 29, 2018
6458b57
don't use db for final snapshot, use blockchain state.
dskvr May 29, 2018
57e8803
remove bad docs
dskvr May 29, 2018
354cbfe
add a comment.
dskvr May 29, 2018
52c5768
fixes inability for script to detect final period
dskvr May 29, 2018
06393a9
Update docs
dskvr May 29, 2018
06d39ca
heavier sanitization
dskvr May 29, 2018
8655a90
changed method name
dskvr May 29, 2018
3041c2a
Merge pull request #48 from EOSIO/final-snapshot-bugfixes
dskvr May 29, 2018
8c66382
bump version
dskvr May 29, 2018
586c6a2
change status messages
dskvr May 30, 2018
96bc045
change status message
dskvr May 30, 2018
3118a26
bump version
dskvr May 30, 2018
a2943c2
order distribution by deterministic index
dskvr May 30, 2018
42a3411
deterministic index asc not desc
dskvr May 30, 2018
16cf22d
explicit determinsitic index asc
dskvr May 30, 2018
058c615
fixed catch
dskvr May 30, 2018
76ddc0d
don't fallback register contracts
dskvr May 30, 2018
8a9efeb
remove deprecated file
dskvr May 30, 2018
3c893d1
alter message
dskvr May 30, 2018
28a07b3
increase performance of multi-threaded child.
dskvr May 30, 2018
2aefb0a
the rohan fix
dskvr May 30, 2018
ae5d0e1
Merge pull request #51 from EOSIO/contract-detection
dskvr May 30, 2018
495b676
syntax
dskvr May 30, 2018
dc29103
Merge branch 'master' of github.com:EOSIO/genesis
dskvr May 30, 2018
f67ea6f
delete snapshot
dskvr May 30, 2018
477c5d4
delete snapshot.json
dskvr May 30, 2018
c6caac6
Update README.md
dskvr May 31, 2018
119527d
include registration table fix
dskvr May 31, 2018
2bcebba
better formatting
dskvr May 31, 2018
22b4c6f
simplify sanitization
dskvr May 31, 2018
7a22ca1
add liquid supply test
dskvr May 31, 2018
9d29af6
Merge branch 'master' of https://github.com/EOS-distribution-collecti…
dskvr May 31, 2018
f6ef609
undo debug changes
dskvr May 31, 2018
0e84492
docker
May 21, 2018
f7dc2ac
better docker file
May 31, 2018
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ node_modules/
data/
data/*
package-lock.json

!docker/config.js
201 changes: 123 additions & 78 deletions README.md

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ module.exports = {
//The Author
author: "Anonymous",

//Include block.one distribution in snapshot
include_b1: true,

//Minimum balance required for snapshot inclusion.
//Note: 1 EOS is recommended, as there will be a minimum balance required to have the bandwidth required for a functional account. Additionally, this prevents dust from appearing as an initial accounts, and cleans up the chain.
snapshot_minimum_balance: 1,
Expand Down
52 changes: 52 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM node:8

WORKDIR /build

# install tools and dependencies
RUN apt-get update && \
apt-get install -y \
g++ \
build-essential \
curl \
git \
file \
binutils \
libssl-dev \
pkg-config \
libudev-dev \
mysql-client

# install rustup
#RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

# rustup directory
#ENV PATH /root/.cargo/bin:$PATH

# show backtraces
#ENV RUST_BACKTRACE 1

# show tools
#RUN rustc -vV && \
#cargo -V && \
#gcc -v &&\
#g++ -v

# build parity
#RUN git clone https://github.com/paritytech/parity.git
#RUN cd parity && \
# cargo build --release --verbose && \
# ls /build/parity/target/release/parity && \
# strip /build/parity/target/release/parity

#ENV PATH /build/parity/target/release:$PATH

# build genesis
RUN mkdir genesis
WORKDIR /build/genesis
ADD . /build/genesis
RUN npm install -g lerna
RUN npm install
RUN cp docker/config.js .

EXPOSE 8080 8545 8180
#ENTRYPOINT ["node snapshot.js --load_config"]
49 changes: 49 additions & 0 deletions docker/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
module.exports = {
//Take snapshot up to which period? If left undefined, it will default to the last closed period.
period: 0,

//The Author
author: "Anonymous",

//Include block.one distribution in snapshot
include_b1: true,

//Minimum balance required for snapshot inclusion.
//Note: 1 EOS is recommended, as there will be a minimum balance required to have the bandwidth required for a functional account. Additionally, this prevents dust from appearing as an initial accounts, and cleans up the chain.
snapshot_minimum_balance: 1,

//Overwrite the snapshot.json in root directory.
overwrite_snapshot: true,

//ETH node Connection Details
eth_node_type: 'ipc',
eth_node_path: '/root/ipc/jsonrpc.ipc',

//Redis Connection Details
redis_host: null,
redis_port: null,

//Mysql Connection Details
mysql_db: "eos_snapshot_refactor",
mysql_user: "root",
mysql_pass: null,
mysql_host: "db",
mysql_port: 3306,

//
// Advanced/Developer settings
// Probably do not need to change this.
//

//Recalculate wallets table based on already synced
recalculate_wallets: false,

//For if parity is syncing but you're testing for a period that you know is already synced.
skip_web3_sync: false

//Enable fallback 1.0? (deprecated)
//registration_fallback: false,

//Cache Signatures from/for fallback (deprecated)
//cache_signatures: true,
}
3 changes: 3 additions & 0 deletions docker/createdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
echo "create database eos_snapshot_refactor;" | mysql -h db
mysql -h db eos_snapshot_refactor < bin/schema.sql
31 changes: 31 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3.1'

services:
db:
image: mariadb:5
restart: always
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=1
volumes:
- ./data:/var/lib/mysql
parity:
image: parity/parity:v1.11.3
command: --mode active --min-peers 150 --tracing off --pruning fast --db-compaction ssd --jsonrpc-apis all --chain mainnet --no-warp --cache-size 16384 --ipc-path /root/ipc/jsonrpc.ipc
volumes:
- ./io.parity.ethereum:/root/.local/share/io.parity.ethereum
- ipc:/root/ipc
genesis:
build:
context: ..
dockerfile: docker/Dockerfile
command: node snapshot.js --load_config --poll --resume --period=350 --verbose_mt --recalculate_wallets --auto-update=none
volumes:
- ipc:/root/ipc
depends_on:
- db
- parity

volumes:
ipc:
external: true

3 changes: 3 additions & 0 deletions docker/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
parity --mode active --tracing off --pruning fast --db-compaction hdd --jsonrpc-apis all --chain mainnet --no-warp --cache-size 2048 &
node snapshot.js --load_config
184,869 changes: 0 additions & 184,869 deletions snapshot.csv

This file was deleted.

76 changes: 0 additions & 76 deletions snapshot.json

This file was deleted.

17 changes: 13 additions & 4 deletions tools/snapshot/classes/Wallet.Final.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
const async = require('async'),
bn = require('bignumber.js'),
Wallet = require('./Wallet'),
util = require('../utilities')
util = require('../utilities'),
address_key = require('../helpers/web3-address').key

class WalletFinal extends Wallet {

process_key( complete ){
this.maybe_fix_key()
complete()
address_key( this.address )
.then( key => {
//encode because some of register function exploits ... fixes a different problem from the web3 fork problem
this.eos_key = util.misc.sanitize_user_input(key)
this.maybe_fix_key()
complete()
})
.catch( e => {
throw new Error(e)
})
}

process_balance_wallet( complete ){
Expand Down Expand Up @@ -53,7 +62,7 @@ class WalletFinal extends Wallet {

process_exclude(complete){
const exclude = [CS_ADDRESS_CROWDSALE, CS_ADDRESS_TOKEN]
if(!this.config.include_b1) exclude.push(CS_ADDRESS_B1)
// if(!this.config.include_b1) exclude.push(CS_ADDRESS_B1)
if(exclude.indexOf(this.address) > -1)
this.accepted = false,
this.register_error = 'exclude'
Expand Down
2 changes: 1 addition & 1 deletion tools/snapshot/classes/Wallet.Ongoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class WalletOngoing extends Wallet {

process_exclude(complete){
const exclude = [CS_ADDRESS_CROWDSALE, CS_ADDRESS_TOKEN]
if(!this.config.include_b1) exclude.push(CS_ADDRESS_B1)
// if(!this.config.include_b1) exclude.push(CS_ADDRESS_B1)
if(exclude.indexOf(this.address) > -1)
this.accepted = false,
this.register_error = 'exclude'
Expand Down
5 changes: 5 additions & 0 deletions tools/snapshot/classes/Wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ class Wallet {
error = 'not_registered'
}

//credit: rohan/roshan from eosauthority.com
else if(BURNED_EOS_KEYS.indexOf(this.eos_key) > -1) {
error = 'key_is_burned'
}

else {
error = this.validate_key()
}
Expand Down
2 changes: 1 addition & 1 deletion tools/snapshot/helpers/web3-address.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ address.key = address => {
.keys( address ).call()
}

module.exports = user
module.exports = address
31 changes: 19 additions & 12 deletions tools/snapshot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ module.exports = (COMPLETE) => {
require('./tasks/sync/public_keys'),
//Sync: events from the crowdsale contract
require('./tasks/sync/contract'),

//Misc: Sanitize Registrations
require('./tasks/misc/sanitize-registrations'),
(state, next) => {
if(config.only_produce_final_snapshot && !state.frozen) {
console.log("only_produce_final_snapshot is set to true, skipping wallet calculations and snapshot export.")
Expand Down Expand Up @@ -80,8 +81,15 @@ module.exports = (COMPLETE) => {
throw new Error(error)
}
else {
console.log(art("complete","2"))
console.log(`Snapshot for Period #${config.period} Completed.`)
if(state.mode == "final") {
console.log(art("final snapshot complete","2"))
process.exit()
return
}
else {
console.log(art("complete","2"))
console.log(`Snapshot for Period #${config.period} Completed.`)
}
}

// const sync_progress_destroy = require('./queries').sync_progress_destroy
Expand Down Expand Up @@ -109,8 +117,8 @@ module.exports = (COMPLETE) => {
//In polling, the config.period is autoincremented before check_for_poll() is called,
//so if it's greater than the highest period index (350) and the last closed period eq highest period index
//Check if the token is frozen before attempting to generate final snapshot (tasks/block_range.js will force run the final snapshot.)
else if(period.last_closed == CS_MAX_PERIOD_INDEX && config.period > CS_MAX_PERIOD_INDEX) {
contract = require('../../helpers/web3-contract.js')
else if(period.last_closed() == CS_MAX_PERIOD_INDEX) {
contract = require('./helpers/web3-contract.js')
contract.$token.methods.stopped().call()
.then( stopped => {
if(stopped) {
Expand All @@ -130,7 +138,7 @@ module.exports = (COMPLETE) => {

const configure = (callback) => {

console.log(art("level 1","2"))
console.log(art("configuration","2"))

//Show prompt?
const show_prompt = next => {
Expand Down Expand Up @@ -178,12 +186,11 @@ module.exports = (COMPLETE) => {
else if(config.period > period.last_closed()) {
let cache_period = config.period
config.period = period.last_closed()
console.log(colors.italic.red(`It appears you've set your period to ${cache_period}, has not completed yet. Period has been reset to ${config.period}`))
}
else if(config.period > CS_MAX_PERIOD_INDEX) {
let cache_period = config.period
config.period = CS_MAX_PERIOD_INDEX
console.log(colors.italic.red(`It appears you've set your period to ${cache_period}, which doesn't exist. Period has been reset to ${config.period}`))
if(config.period < 0)
console.log(colors.bold.red(`Period 0 hasn't even finished yet, exiting. try again later`)),
process.exit()
else
console.log(colors.italic.red(`It appears you've set your period to ${cache_period}, has not completed yet. Period has been reset to ${config.period}`))
}

next(null, config)
Expand Down
8 changes: 7 additions & 1 deletion tools/snapshot/lib/globals.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const bn = require('bignumber.js')

global.VERSION = "0.4.0-beta.10"
global.VERSION = "0.4.2-stable"

//Crowdsale Globals
global.CS_ADDRESS_CROWDSALE = "0xd0a6e6c54dbc68db5db3a091b171a77407ff7ccf"
Expand Down Expand Up @@ -32,9 +32,15 @@ global.SS_ACCEPTABLE_SUPPLY_DEVIATION = 5 //total number of EOS deviation al
global.CS_END_TIME = CS_START_TIME + ((CS_MAX_PERIOD_INDEX) * CS_PERIOD_LENGTH_SECONDS)
// global.CS_END_TIME = 1527893999

//EOS Keys to disallow from inclusion in snapshot becuase their private key is publicly available.
global.BURNED_EOS_KEYS = ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"]


//For screen output
global.art = require('ascii-text-generator')



//Services are global to help avoid extraneous connection bottlenecks.
global.web3
global.mysql
Expand Down
Loading