Skip to content

Commit

Permalink
set block number in genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
cdetrio committed Aug 25, 2017
1 parent 40fcd2b commit 13f00b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions evmlab/genesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def __init__(self):
self.gasLimit = "0x3D0900"
self.difficulty = "0x1"
self.metropolisBlock = 2000
self.blockNumber = 0

def geth(self):

Expand All @@ -18,6 +19,7 @@ def geth(self):
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": self.coinbase,
"timestamp": self.timestamp,
"number": self.blockNumber,
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": self.gasLimit,
Expand Down Expand Up @@ -104,6 +106,9 @@ def setTimestamp(self, timestamp):
def setDifficulty(self, difficulty):
self.difficulty = difficulty

def setBlockNumber(self, blockNumber):
self.blockNumber = blockNumber

def setMetropolisActivation(self, activationBlock):
self.metropolisBlock = activationBlock

Expand Down
6 changes: 5 additions & 1 deletion trace_statetests.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ def doGeth(test_case, test_tx):
genesis.setTimestamp(test_case['env']['currentTimestamp'])
genesis.setGasLimit(test_case['env']['currentGasLimit'])
genesis.setDifficulty(test_case['env']['currentDifficulty'])
genesis.setBlockNumber(test_case['env']['currentNumber'])
if FORK_CONFIG == 'Metropolis' or FORK_CONFIG == 'Byzantium':
genesis.setMetropolisActivation(0)

Expand Down Expand Up @@ -374,7 +375,10 @@ def doGeth(test_case, test_tx):

vm = gethvm.VM(executable = GETH_DOCKER_NAME, docker = True)
logger.info("executing geth vm.")
geth_cmd = vm.execute(genesis = g_path, gas = gas_limit, price = gas_price, json = True, sender = sender, receiver = tx_to, input = input_data, value = tx_value, dontExecuteButReturnCommand = True)
logger.info(geth_cmd)
g_output = vm.execute(genesis = g_path, gas = gas_limit, price = gas_price, json = True, sender = sender, receiver = tx_to, input = input_data, value = tx_value)
#logger.info(vm.lastCommand)
logger.info("geth vm executed. printing output:")
for g_step in g_output:
logger.info(g_step)
Expand Down Expand Up @@ -682,7 +686,7 @@ def main():
logger.info("equivalent.")
LoggingFileHandler.close()
trace_file = os.path.abspath(log_filename)
passfail_log_filename = LOGS_PATH + '/' + test_subfolder + '-' + test_name + '-' + str(tx_i) + '-' + passfail + '.log'
passfail_log_filename = LOGS_PATH + '/' + str(test_i).zfill(4) + '-' + passfail + '-' + test_subfolder + '-' + test_name + '-' + str(tx_i) + '.log.txt'
renamed_trace = os.path.abspath(passfail_log_filename)
os.rename(trace_file, renamed_trace)
print("f/p/t:", fail_count, pass_count, (fail_count + pass_count))
Expand Down

0 comments on commit 13f00b6

Please sign in to comment.