aboutsummaryrefslogtreecommitdiffstats
path: root/packages/metacoin/package.json
diff options
context:
space:
mode:
Diffstat (limited to 'packages/metacoin/package.json')
-rw-r--r--packages/metacoin/package.json26
1 files changed, 13 insertions, 13 deletions
diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json
index c6090ba4f..04bdeba4c 100644
--- a/packages/metacoin/package.json
+++ b/packages/metacoin/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/metacoin",
- "version": "0.0.23",
+ "version": "0.0.24",
"engines": {
"node": ">=6.12"
},
@@ -29,25 +29,25 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
- "@0x/abi-gen": "^1.0.13",
- "@0x/base-contract": "^3.0.1",
- "@0x/sol-cov": "^2.1.7",
- "@0x/subproviders": "^2.0.7",
- "@0x/tslint-config": "^1.0.8",
- "@0x/types": "^1.1.4",
- "@0x/typescript-typings": "^3.0.2",
- "@0x/utils": "^2.0.2",
- "@0x/web3-wrapper": "^3.0.3",
+ "@0x/abi-gen": "^1.0.14",
+ "@0x/base-contract": "^3.0.2",
+ "@0x/sol-cov": "^2.1.8",
+ "@0x/subproviders": "^2.1.0",
+ "@0x/tslint-config": "^1.0.9",
+ "@0x/types": "^1.2.0",
+ "@0x/typescript-typings": "^3.0.3",
+ "@0x/utils": "^2.0.3",
+ "@0x/web3-wrapper": "^3.1.0",
"@types/mocha": "^5.2.2",
"copyfiles": "^2.0.0",
- "ethereum-types": "^1.1.0",
+ "ethereum-types": "^1.1.1",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"run-s": "^0.0.0"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.12",
- "@0x/sol-compiler": "^1.1.7",
+ "@0x/dev-utils": "^1.0.13",
+ "@0x/sol-compiler": "^1.1.8",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",
dity/commit/createRandomTest.cpp?id=6c0b16bc032b89520d737f313e31c03856783f9f'>6c0b16bc
5b3c47aa

5b3c47aa







60a7ff58

5b3c47aa







057553a0
5b3c47aa





057553a0
5b3c47aa





a6ba0f79
5b3c47aa

1310011f
5b3c47aa

5b3c47aa
c1ffbbe7
057553a0
d3910593
057553a0
5b3c47aa

c1ffbbe7

5b3c47aa
d3910593


057553a0
d3910593
5b3c47aa


























057553a0





9101b707
057553a0
5b3c47aa

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195























                                                                         
                 
                           






                                                    
                                   
                             









                                       
                           




                                   

                                                                                      









                                                                                             

                                           
 




































                                                                                                                   

                 







                                                                                                                                               

                                                                   







                                      
                                 





                                                
                                         





                                                     
                                     

                                                                                 
                                                  

                 
                             
                                                          
 
                         
                                                

                   

                                                                          
                 


                                                                                             
                                                  
                 


























                                                                                             





                                                                   
                                                                  
                 

         
/*
    This file is part of cpp-ethereum.

    cpp-ethereum is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    cpp-ethereum is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with cpp-ethereum.  If not, see <http://www.gnu.org/licenses/>.
*/
/** @file createRandomTest.cpp
 * @author Christoph Jentzsch <jentzsch.simulationsoftware@gmail.com>
 * @date 2014
 * Creating a random virtual machine test.
 */

#include <string>
#include <iostream>
#include <chrono>
#include <boost/random.hpp>
#include <boost/filesystem/path.hpp>
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <json_spirit/json_spirit.h>
#include <json_spirit/json_spirit_reader_template.h>
#include <json_spirit/json_spirit_writer_template.h>
#include <libdevcore/CommonIO.h>
#include <libdevcore/CommonData.h>
#include <libevmcore/Instruction.h>
#include <libevm/VMFactory.h>
#include "vm.h"

using namespace std;
using namespace json_spirit;
using namespace dev;

void doMyTests(json_spirit::mValue& v);

int main(int argc, char *argv[])
{
    g_logVerbosity = 0;

    // create random code

    boost::random::mt19937 gen;

    auto now = chrono::steady_clock::now().time_since_epoch();
    auto timeSinceEpoch = chrono::duration_cast<chrono::nanoseconds>(now).count();
    gen.seed(static_cast<unsigned int>(timeSinceEpoch));
    boost::random::uniform_int_distribution<> lengthOfCodeDist(2, 16);
    boost::random::uniform_int_distribution<> opcodeDist(0, 255);
    boost::random::variate_generator<boost::mt19937&,
            boost::random::uniform_int_distribution<> > randGen(gen, opcodeDist);

    int lengthOfCode  = lengthOfCodeDist(gen);
    string randomCode;

    for (int i = 0; i < lengthOfCode; ++i)
    {
        uint8_t opcode = randGen();

        // disregard all invalid commands, except of one (0x10)
        if (dev::eth::isValidInstruction(dev::eth::Instruction(opcode)) || opcode == 0x10)
            randomCode += toHex(toCompactBigEndian(opcode));
        else
            i--;
    }

    const string s =\
"{\n\
    \"randomVMtest\": {\n\
        \"env\" : {\n\
            \"previousHash\" : \"5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6\",\n\
            \"currentNumber\" : \"0\",\n\
            \"currentGasLimit\" : \"1000000\",\n\
            \"currentDifficulty\" : \"256\",\n\
            \"currentTimestamp\" : 1,\n\
            \"currentCoinbase\" : \"2adc25665018aa1fe0e6bc666dac8fc2697ff9ba\"\n\
        },\n\
        \"pre\" : {\n\
            \"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6\" : {\n\
                \"balance\" : \"1000000000000000000\",\n\
                \"nonce\" : 0,\n\
                \"code\" : \"random\",\n\
                \"storage\": {}\n\
            }\n\
        },\n\
        \"exec\" : {\n\
            \"address\" : \"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6\",\n\
            \"origin\" : \"cd1722f3947def4cf144679da39c4c32bdc35681\",\n\
            \"caller\" : \"cd1722f3947def4cf144679da39c4c32bdc35681\",\n\
            \"value\" : \"1000000000000000000\",\n\
            \"data\" : \"\",\n\
            \"gasPrice\" : \"100000000000000\",\n\
            \"gas\" : \"10000\"\n\
        }\n\
    }\n\
}";

    mValue v;
    read_string(s, v);

    // insert new random code
    v.get_obj().find("randomVMtest")->second.get_obj().find("pre")->second.get_obj().begin()->second.get_obj()["code"] = "0x" + randomCode;

    // execute code in vm
    doMyTests(v);

    // stream to output for further handling by the bash script
    cout << json_spirit::write_string(v, true);

    return 0;
}

void doMyTests(json_spirit::mValue& v)
{
    for (auto& i: v.get_obj())
    {
        cnote << i.first;
        mObject& o = i.second.get_obj();

        assert(o.count("env") > 0);
        assert(o.count("pre") > 0);
        assert(o.count("exec") > 0);

        dev::test::FakeExtVM fev;
        fev.importEnv(o["env"].get_obj());
        fev.importState(o["pre"].get_obj());

        o["pre"] = mValue(fev.exportState());

        fev.importExec(o["exec"].get_obj());
        if (fev.code.empty())
        {
            fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress));
            fev.code = fev.thisTxCode;
        }

        bytes output;
        auto vm = eth::VMFactory::create(fev.gas);

        u256 gas;