Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[master] v1 metamask connect to isolated server + testnet #2820

Merged
merged 75 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
00e5606
v1 metamask connect - try testnet, too
n-hutton Jun 24, 2022
26f2440
fixup
n-hutton Jun 24, 2022
676d6a9
bump travis/jenkins
n-hutton Jun 28, 2022
ef23f54
tidying
n-hutton Jun 28, 2022
31cf230
add debug for testnet
n-hutton Jun 29, 2022
86ec18e
add killer rpc call for debug purpose
n-hutton Jun 29, 2022
cd3b4af
hacks
n-hutton Jun 29, 2022
b8639f8
Merge branch 'master' into feature/evm_rpc
n-hutton Jun 29, 2022
2d2faf0
fix unfortunate error
n-hutton Jun 29, 2022
3052f3b
WIP
n-hutton Jun 30, 2022
afa4c22
testnet
n-hutton Jul 4, 2022
878768d
fixme
n-hutton Jul 4, 2022
f6dc7d3
about to switch TX way
n-hutton Jul 5, 2022
3d23a94
fix versioning
n-hutton Jul 5, 2022
05c9349
fixes
n-hutton Jul 5, 2022
7f19390
fixes
n-hutton Jul 5, 2022
b4bc76c
bump and turn off travis
n-hutton Jul 5, 2022
56b53af
try more stuff
n-hutton Jul 5, 2022
f75267b
fix balance
n-hutton Jul 6, 2022
abbf7bd
fix balance querying
n-hutton Jul 6, 2022
e7af88a
WIP
n-hutton Jul 7, 2022
989125c
thing thing
n-hutton Jul 7, 2022
46af9a6
WORKING FIRST VERSION!
n-hutton Jul 9, 2022
7ca3ecb
seems to be working... try for another testnet deployment
n-hutton Jul 12, 2022
18ca008
another testnet deployment
n-hutton Jul 12, 2022
f78ebec
bump
n-hutton Jul 12, 2022
f09aaa8
add missing cmake file
n-hutton Jul 12, 2022
ecac377
add other file
n-hutton Jul 12, 2022
d2360c9
fix bad build
n-hutton Jul 12, 2022
cbf1da4
do not strip symbols
n-hutton Jul 13, 2022
544964b
Add debugging
n-hutton Jul 13, 2022
0f0e8f0
add more debug
n-hutton Jul 13, 2022
4a1a0d1
fixes
n-hutton Jul 13, 2022
b0b32cb
more fixes
n-hutton Jul 13, 2022
d97645c
add new eth library
n-hutton Jul 13, 2022
2e71a66
add additional debug
n-hutton Jul 13, 2022
a145230
bump it
n-hutton Jul 13, 2022
30caf65
add libEth
n-hutton Jul 13, 2022
6d3110a
ignore more files
n-hutton Jul 13, 2022
cb0ba1a
update schnorr...
n-hutton Jul 13, 2022
37ae6df
does this change the build materially?
n-hutton Jul 13, 2022
0538893
revert schnorr???
n-hutton Jul 13, 2022
c222b3c
fix hopefullyQ
n-hutton Jul 13, 2022
4607714
bump gitignore further
n-hutton Jul 13, 2022
4646afa
cleanup
n-hutton Jul 14, 2022
a89b2ae
fix build errors
n-hutton Jul 14, 2022
e90857b
tidy
n-hutton Jul 18, 2022
042ccd2
fix errors...
n-hutton Jul 18, 2022
21e3c06
attempt at recovery from corrupted git file
n-hutton Jul 18, 2022
6914897
fixes...
n-hutton Jul 18, 2022
0d9c546
transfer demo still works...
n-hutton Jul 18, 2022
780df7c
cleanup
n-hutton Jul 19, 2022
b5164a9
initial commit add python test file
Jul 19, 2022
059349b
Merge branch 'feature/evm_rpc' of github.com:Zilliqa/Zilliqa into fea…
n-hutton Jul 19, 2022
0f17863
v1 test
Jul 19, 2022
f0d9538
cleanup
n-hutton Jul 19, 2022
33ac463
Merge branch 'feature/evm_rpc' of github.com:Zilliqa/Zilliqa into fea…
n-hutton Jul 19, 2022
8b0253b
fixed balance issues
n-hutton Jul 19, 2022
35ce4fe
tests seemingly added
n-hutton Jul 19, 2022
e2d02df
fix build...
n-hutton Jul 19, 2022
6d062d7
sigh
n-hutton Jul 20, 2022
a080c5c
format fix
n-hutton Jul 20, 2022
9b25bac
include linting
n-hutton Jul 20, 2022
cb97c00
fix build error...
n-hutton Jul 20, 2022
525bddd
clang tidy fix
n-hutton Jul 20, 2022
1d9c7f2
sigh
n-hutton Jul 21, 2022
7601a21
fix test
n-hutton Jul 21, 2022
2904777
fix another test
n-hutton Jul 21, 2022
21a5a34
merge to master
n-hutton Jul 22, 2022
1139ff3
fix build
n-hutton Jul 23, 2022
b019d75
Merge branch 'master' into feature/evm_rpc
n-hutton Jul 28, 2022
152d26e
pr feedback except for unit tests
Jul 28, 2022
af1b70d
add unit tests
n-hutton Jul 28, 2022
dd8a036
style...
n-hutton Jul 28, 2022
109df60
more style
n-hutton Jul 28, 2022
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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,12 @@ compile_commands.json
.vscode
.history
cmake-build-debug

# Files from running isolated server
persistence/
scilla/
scilla_files/
evm-ds/
config.xml
isolated-server-accounts.json
isolated-server.logs
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ find_package(g3logger CONFIG REQUIRED)

include(InstallCryptoUtils)

include(ProjectSecp256k1)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3rd party library for public key recovery

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

external library from a bitcoin-core fork


include(InstallMongo)
find_package(mongocxx CONFIG REQUIRED)

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export PATH=$HOME/.local/bin:$PATH
cmake --version
rm cmake-3.19.3-Linux-x86_64.sh
```

### Additional Requirements for Contributors

If you intend to contribute to the code base, please perform these additional steps:
Expand Down Expand Up @@ -168,7 +169,7 @@ The Zilliqa client works together with Scilla for executing smart contracts. Ple
$ cd build && ./tests/Node/pre_run.sh && ./tests/Node/test_node_lookup.sh && ./tests/Node/test_node_simple.sh
```

2. Logs of each node can be found at `./local_run`.
2. Logs of each node can be found at `./local_run`

3. To terminate Zilliqa:

Expand Down
39 changes: 39 additions & 0 deletions cmake/ProjectSecp256k1.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
include(ExternalProject)

if (MSVC)
set(_only_release_configuration -DCMAKE_CONFIGURATION_TYPES=Release)
set(_overwrite_install_command INSTALL_COMMAND cmake --build <BINARY_DIR> --config Release --target install)
endif()

set(prefix "${CMAKE_BINARY_DIR}/deps")
set(SECP256K1_LIBRARY "${prefix}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}secp256k1${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(SECP256K1_INCLUDE_DIR "${prefix}/include")

ExternalProject_Add(
secp256k1
PREFIX "${prefix}"
DOWNLOAD_NAME secp256k1-ac8ccf29.tar.gz
DOWNLOAD_NO_PROGRESS 1
URL https://github.com/chfast/secp256k1/archive/ac8ccf29b8c6b2b793bc734661ce43d1f952977a.tar.gz
URL_HASH SHA256=02f8f05c9e9d2badc91be8e229a07ad5e4984c1e77193d6b00e549df129e7c3a
PATCH_COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_LIST_DIR}/secp256k1/CMakeLists.txt <SOURCE_DIR>
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_POSITION_INDEPENDENT_CODE=${BUILD_SHARED_LIBS}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
${_only_release_configuration}
LOG_CONFIGURE 1
BUILD_COMMAND ""
${_overwrite_install_command}
LOG_INSTALL 1
BUILD_BYPRODUCTS "${SECP256K1_LIBRARY}"
)

# Create imported library
add_library(Secp256k1 STATIC IMPORTED)
file(MAKE_DIRECTORY "${SECP256K1_INCLUDE_DIR}") # Must exist.
set_property(TARGET Secp256k1 PROPERTY IMPORTED_CONFIGURATIONS Release)
set_property(TARGET Secp256k1 PROPERTY IMPORTED_LOCATION_RELEASE "${SECP256K1_LIBRARY}")
set_property(TARGET Secp256k1 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${SECP256K1_INCLUDE_DIR}")
add_dependencies(Secp256k1 secp256k1)
38 changes: 38 additions & 0 deletions cmake/secp256k1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This CMake config file for secp256k1 project from https://github.com/bitcoin-core/secp256k1
#
# The secp256k1 project has been configured following official docs with following options:
#
# ./configure --disable-shared --disable-tests --disable-coverage --disable-openssl-tests --disable-exhaustive-tests --disable-jni --with-bignum=no --with-field=64bit --with-scalar=64bit --with-asm=no
#
# Build static context:
# make src/ecmult_static_context.h
#
# Copy src/ecmult_static_context.h and src/libsecp256k1-config.h
#
# Copy CFLAGS from Makefile to COMPILE_OPTIONS.

cmake_minimum_required(VERSION 3.4)
project(secp256k1 LANGUAGES C)

set(COMMON_COMPILE_FLAGS ENABLE_MODULE_RECOVERY ENABLE_MODULE_ECDH USE_ECMULT_STATIC_PRECOMPUTATION USE_FIELD_INV_BUILTIN USE_NUM_NONE USE_SCALAR_INV_BUILTIN)
if (MSVC)
set(COMPILE_FLAGS USE_FIELD_10X26 USE_SCALAR_8X32)
set(COMPILE_OPTIONS "")
else()
set(COMPILE_FLAGS USE_FIELD_5X52 USE_SCALAR_4X64 HAVE_BUILTIN_EXPECT HAVE___INT128)
set(COMPILE_OPTIONS -O3 -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fvisibility=hidden)
endif()

add_executable(gen_context src/gen_context.c)
target_include_directories(gen_context PRIVATE ${CMAKE_SOURCE_DIR})

add_custom_target(ecmult_static_context gen_context WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

add_library(secp256k1 STATIC src/secp256k1.c)
target_compile_definitions(secp256k1 PRIVATE ${COMMON_COMPILE_FLAGS} ${COMPILE_FLAGS})
target_include_directories(secp256k1 PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src)
target_compile_options(secp256k1 PRIVATE ${COMPILE_OPTIONS})
add_dependencies(secp256k1 ecmult_static_context)

install(TARGETS secp256k1 ARCHIVE DESTINATION lib)
install(DIRECTORY include/ DESTINATION include)
68 changes: 34 additions & 34 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,39 +98,39 @@ ARG BUILD_TYPE=RelWithDebInfo
ARG EXTRA_CMAKE_ARGS=
ARG MONGO_INSTALL_DIR=${BUILD_DIR}/mongo

RUN git clone ${REPO} ${SOURCE_DIR} \
&& git -C ${SOURCE_DIR} checkout ${COMMIT_OR_TAG} \
&& cmake -H${SOURCE_DIR} -B${BUILD_DIR} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} ${EXTRA_CMAKE_ARGS} \
&& cmake --build ${BUILD_DIR} -- -j$(nproc) \
&& cmake --build ${BUILD_DIR} --target install \
&& echo "built files:" && ls -lh ${BUILD_DIR} && echo "installed libs:" && ls -lh ${INSTALL_DIR}/lib \
&& echo "mongo files:" && ls -lh ${MONGO_INSTALL_DIR}/lib \
# strip all exes
&& strip /usr/local/bin/grepperf \
/usr/local/bin/zilliqad \
/usr/local/bin/genkeypair \
/usr/local/bin/signmultisig \
/usr/local/bin/verifymultisig \
/usr/local/bin/getpub \
/usr/local/bin/getaddr \
/usr/local/bin/genaccounts \
/usr/local/bin/sendcmd \
/usr/local/bin/gentxn \
/usr/local/bin/restore \
/usr/local/bin/gensigninitialds \
/usr/local/bin/validateDB \
/usr/local/bin/genTxnBodiesFromS3 \
/usr/local/bin/getnetworkhistory \
/usr/local/bin/isolatedServer \
/usr/local/bin/getrewardhistory \
# /usr/local/bin/zilliqa \
/usr/local/bin/data_migrate \
/usr/local/lib/libSchnorr.so \
/usr/local/lib/libCryptoUtils.so \
/usr/local/lib/libNAT.so \
/usr/local/lib/libCommon.so \
/usr/local/lib/libTrie.so
RUN git clone ${REPO} ${SOURCE_DIR}
RUN git -C ${SOURCE_DIR} checkout ${COMMIT_OR_TAG}
RUN cmake -H${SOURCE_DIR} -B${BUILD_DIR} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} ${EXTRA_CMAKE_ARGS}
RUN cmake --build ${BUILD_DIR} -- -j$(nproc)
RUN cmake --build ${BUILD_DIR} --target install
RUN echo "built files:" && ls -lh ${BUILD_DIR} && echo "installed libs:" && ls -lh ${INSTALL_DIR}/lib
RUN echo "mongo files:" && ls -lh ${MONGO_INSTALL_DIR}/lib

# strip all exes
RUN strip /usr/local/bin/grepperf \
/usr/local/bin/zilliqad \
/usr/local/bin/genkeypair \
/usr/local/bin/signmultisig \
/usr/local/bin/verifymultisig \
/usr/local/bin/getpub \
/usr/local/bin/getaddr \
/usr/local/bin/genaccounts \
/usr/local/bin/sendcmd \
/usr/local/bin/gentxn \
/usr/local/bin/restore \
/usr/local/bin/gensigninitialds \
/usr/local/bin/validateDB \
/usr/local/bin/genTxnBodiesFromS3 \
/usr/local/bin/getnetworkhistory \
/usr/local/bin/isolatedServer \
/usr/local/bin/getrewardhistory \
# /usr/local/bin/zilliqa \
/usr/local/bin/data_migrate \
/usr/local/lib/libSchnorr.so \
/usr/local/lib/libCryptoUtils.so \
/usr/local/lib/libNAT.so \
/usr/local/lib/libCommon.so \
/usr/local/lib/libTrie.so

# start from a new ubuntu as the runner image
FROM ubuntu:18.04
Expand Down Expand Up @@ -182,7 +182,7 @@ RUN pip3 install wheel \
&& pip3 install --no-cache-dir -r requirements3.txt \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10 # set python3 as default instead python2

# make dirs fro scilla and zilliqa
# make dirs for scilla and zilliqa
RUN mkdir -p \
/scilla/0/bin /scilla/0/src/stdlib \
/zilliqa/scripts
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_subdirectory (libConsensus)
add_subdirectory (libCrypto)
add_subdirectory (libData)
add_subdirectory (libDirectoryService)
add_subdirectory (libEth)
add_subdirectory (libLookup)
add_subdirectory (libMediator)
add_subdirectory (libMessage)
Expand Down
18 changes: 14 additions & 4 deletions src/common/Constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ double ReadConstantDouble(const string& propertyName,
}

string ReadConstantString(const string& propertyName,
const char* path = "node.general.") {
const char* path = "node.general.",
const char* defaultVal = "defaulted") {
auto pt = PTree::GetInstance();
return pt.get<string>(path + propertyName);

try {
return pt.get<string>(path + propertyName);
} catch (exception e) {
return defaultVal;
}
}

uint64_t ReadConstantUInt64(const string& propertyName,
Expand Down Expand Up @@ -130,6 +136,8 @@ const unsigned int MSG_VERSION{
ReadConstantNumeric("MSG_VERSION", "node.version.")};
const unsigned int TRANSACTION_VERSION{
ReadConstantNumeric("TRANSACTION_VERSION", "node.version.")};
const unsigned int TRANSACTION_VERSION_ETH{
ReadConstantNumeric("TRANSACTION_VERSION", "node.version.") + 1};
const unsigned int DSBLOCK_VERSION{
ReadConstantNumeric("DSBLOCK_VERSION", "node.version.")};
const unsigned int TXBLOCK_VERSION{
Expand Down Expand Up @@ -736,7 +744,9 @@ const std::string EVM_SERVER_SOCKET_PATH{
ReadConstantString("EVM_SERVER_SOCKET_PATH", "node.jsonrpc.")};
const std::string EVM_SERVER_BINARY{
ReadConstantString("EVM_SERVER_BINARY", "node.jsonrpc.")};
const std::string EVM_LOG_CONFIG{
ReadConstantString("EVM_LOG_CONFIG", "node.jsonrpc.")};
const std::string EVM_LOG_CONFIG{ReadConstantString(
"EVM_LOG_CONFIG", "node.jsonrpc.", "/usr/local/etc/log4rs.yml")};
const std::string ETH_CHAINID{
ReadConstantString("ETH_CHAINID", "node.jsonrpc.")};
const uint64_t ETH_CHAINID_INT{DataConversion::HexStringToUint64Ret(
ReadConstantString("ETH_CHAINID", "node.jsonrpc."))};
2 changes: 2 additions & 0 deletions src/common/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ extern const uint64_t INIT_TRIE_DB_SNAPSHOT_EPOCH;
// Version constants
extern const unsigned int MSG_VERSION;
extern const unsigned int TRANSACTION_VERSION;
extern const unsigned int TRANSACTION_VERSION_ETH;
extern const unsigned int DSBLOCK_VERSION;
extern const unsigned int TXBLOCK_VERSION;
extern const unsigned int MICROBLOCK_VERSION;
Expand Down Expand Up @@ -310,6 +311,7 @@ extern const std::string EVM_SERVER_SOCKET_PATH;
extern const std::string EVM_SERVER_BINARY;
extern const std::string EVM_LOG_CONFIG;
extern const std::string ETH_CHAINID;
extern const uint64_t ETH_CHAINID_INT;

extern const std::string IP_TO_BIND; // Only for non-lookup nodes
extern const bool ENABLE_STAKING_RPC;
Expand Down
1 change: 1 addition & 0 deletions src/libCrypto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
add_library(EthCrypto EthCrypto.cpp)
target_include_directories(EthCrypto PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(EthCrypto Secp256k1)
Loading