Skip to content

Commit cd73d0e

Browse files
authored
Merge pull request #350 from eosnetworkfoundation/kayan_1.0_to_main_brownie
[1.0 ->main] Forward 1.0.5 to main
2 parents 629e115 + 6d1ed87 commit cd73d0e

File tree

6 files changed

+709
-2
lines changed

6 files changed

+709
-2
lines changed

.github/workflows/node.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,20 @@ jobs:
321321
cd test_run_root
322322
${{ steps.evm-node-build.outputs.EVM_NODE_BUILD }}/tests/nodeos_eos_evm_test.py -v --eos-evm-contract-root ${{ steps.evm-contract.outputs.EVM_CONTRACT }} --eos-evm-build-root ${{ steps.evm-node-build.outputs.EVM_NODE_BUILD }} --use-miner ${{ steps.eos-evm-miner-build.outputs.EVM_MINER_ROOT }}
323323
324+
- name: Test Leap Integration - with Brownie Framework
325+
run: |
326+
mkdir -p test_run_root
327+
cd test_run_root
328+
pip install --upgrade web3
329+
pip install otree
330+
pip install websocket-client
331+
pip install eth-brownie
332+
npm install -g ganache
333+
pip install flask
334+
pip install flask-cors --upgrade
335+
brownie networks add Ethereum localhost5000 host=http://127.0.0.1:5000 chainid=15555
336+
${{ steps.evm-node-build.outputs.EVM_NODE_BUILD }}/tests/nodeos_eos_evm_brownietest.py -v --eos-evm-contract-root ${{ steps.evm-contract.outputs.EVM_CONTRACT }} --eos-evm-build-root ${{ steps.evm-node-build.outputs.EVM_NODE_BUILD }} --use-miner ${{ steps.eos-evm-miner-build.outputs.EVM_MINER_ROOT }} --flask-proxy-root ${{ steps.evm-node-build.outputs.EVM_NODE_BUILD }}/tests/
337+
324338
- name: Test Leap Integration - different gas token
325339
run: |
326340
mkdir -p test_run_root

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ include(cmake/conan.cmake)
2020

2121
set(VERSION_MAJOR 1)
2222
set(VERSION_MINOR 0)
23-
set(VERSION_PATCH 4)
23+
set(VERSION_PATCH 5)
2424
#set(VERSION_SUFFIX rc4)
2525

2626
if(VERSION_SUFFIX)

external/silkworm

tests/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ configure_file(nodeos_eos_evm_server.py . COPYONLY)
77
configure_file(nodeos_eos_evm_test.py . COPYONLY)
88
configure_file(nodeos_eos_evm_different_token_test.py . COPYONLY)
99
configure_file(nodeos_eos_evm_gasparam_fork_test.py . COPYONLY)
10+
configure_file(nodeos_eos_evm_brownietest.py . COPYONLY)
11+
configure_file(flask_proxy.py . COPYONLY)
1012
configure_file(defertest.wasm . COPYONLY)
1113
configure_file(defertest.abi . COPYONLY)
1214
configure_file(defertest2.wasm . COPYONLY)

tests/flask_proxy.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python3
2+
import os
3+
from flask import Flask, request, jsonify
4+
from flask_cors import CORS
5+
import requests
6+
import json
7+
8+
app = Flask(__name__)
9+
CORS(app)
10+
writemethods = {"eth_sendRawTransaction","eth_gasPrice"}
11+
readEndpoint = "http://127.0.0.1:8881"
12+
writeEndpoint = os.getenv("WRITE_RPC_ENDPOINT", "http://127.0.0.1:18888")
13+
flaskListenPort = os.getenv("FLASK_SERVER_PORT", 5000)
14+
15+
import logging
16+
log = logging.getLogger('werkzeug')
17+
log.setLevel(logging.ERROR)
18+
19+
@app.route("/", methods=["POST"])
20+
def default():
21+
def forward_request(req):
22+
if type(req) == dict and ("method" in req) and (req["method"] in writemethods):
23+
#print("send req to miner:" + str(req))
24+
resp = requests.post(writeEndpoint, json.dumps(req), headers={"Accept":"application/json","Content-Type":"application/json"}).json()
25+
#print("got resp from miner:" + str(resp))
26+
return resp
27+
else:
28+
#print("send req to eos-evm-rpc:" + str(req))
29+
resp = requests.post(readEndpoint, json.dumps(req), headers={"Accept":"application/json","Content-Type":"application/json"}).json()
30+
#print("got from eos-evm-rpc:" + str(resp))
31+
return resp
32+
33+
request_data = request.get_json()
34+
if type(request_data) == dict:
35+
return jsonify(forward_request(request_data))
36+
37+
res = []
38+
for r in request_data:
39+
res.append(forward_request(r))
40+
41+
return jsonify(res)
42+
43+
app.run(host='0.0.0.0', port=flaskListenPort)

0 commit comments

Comments
 (0)