Skip to content

Commit

Permalink
Merge branch 'monero-project:master' into dropdown-menu-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
devhyper authored Dec 26, 2022
2 parents d9af1d9 + 48393db commit 4975fbe
Show file tree
Hide file tree
Showing 21 changed files with 235 additions and 72 deletions.
103 changes: 103 additions & 0 deletions .github/verify_p2pool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import requests
import subprocess
from urllib.request import urlretrieve
import difflib

sech_key = "https://p2pool.io/SChernykh.asc"
sech_key_backup = "https://raw.githubusercontent.com/monero-project/gitian.sigs/master/gitian-pubkeys/SChernykh.asc"
sech_key_fp = "1FCA AB4D 3DC3 310D 16CB D508 C47F 82B5 4DA8 7ADF"

p2pool_files = [{
"os": "WIN",
"filename": "windows-x64.zip",
},
{
"os": "LINUX",
"filename": "linux-x64.tar.gz"
},
{
"os": "MACOS",
"filename": "macos-x64.tar.gz",
}]

def get_hash(fname):
fhash = subprocess.check_output(["sha256sum", fname]).decode("utf-8")
print(fhash.strip())
return fhash.split()[0]

def main():
global p2pool_files, sech_key, sech_key_backup, sech_key_fp
p2pool_tag_api = "https://api.github.com/repos/SChernykh/p2pool/releases/latest"
data = requests.get(p2pool_tag_api).json()
tag = data["tag_name"]
head = f"p2pool-{tag}-"
url = f"https://github.com/SChernykh/p2pool/releases/download/{tag}/"

try:
urlretrieve(sech_key,"SChernykh.asc")
except:
urlretrieve(sech_key_backup,"SChernykh.asc")

urlretrieve(f"{url}sha256sums.txt.asc","sha256sums.txt.asc")

subprocess.check_call(["gpg", "--import", "SChernykh.asc"])
subprocess.check_call(["gpg", "--verify", "sha256sums.txt.asc"])
fingerprint = subprocess.check_output(["gpg","--fingerprint", "SChernykh"]).decode("utf-8").splitlines()[1].strip()

assert fingerprint == sech_key_fp

with open("sha256sums.txt.asc","r") as f:
lines = f.readlines()

signed_hashes = {}
for line in lines:
if "Name:" in line:
signed_fname = line.split()[1]
if "SHA256:" in line:
signed_hashes[signed_fname] = line.split()[1].lower()

expected = ""
for i in range(len(p2pool_files)):
fname = p2pool_files[i]["filename"]
str_os =p2pool_files[i]["os"]
dl = f"{url}{head}{fname}"
urlretrieve(dl,f"{head}{fname}")
fhash = get_hash(f"{head}{fname}")
assert signed_hashes[f"{head}{fname}"] == fhash
if i == 0:
expected += f" #ifdef Q_OS_{str_os}\n"
else:
expected += f" #elif defined(Q_OS_{str_os})\n"
expected += f" url = \"https://github.com/SChernykh/p2pool/releases/download/{tag}/{head}{fname}\";\n"
expected += f" fileName = m_p2poolPath + \"/{head}{fname}\";\n"
expected += f" validHash = \"{fhash}\";\n"
expected += " #endif\n"

print(f"Expected:\n{expected}")

with open("src/p2pool/P2PoolManager.cpp","r") as f:
p2pool_lines = f.readlines()

unexpected = ""
ignore = 1
for line in p2pool_lines:
if ignore == 0:
unexpected += line
if "QString validHash;" in line:
ignore = 0
if "#endif" in line and ignore == 0:
break

d = difflib.Differ()
diff = d.compare(str(unexpected).splitlines(True),str(expected).splitlines(True))

print("Unexpected:")
for i in diff:
if i.startswith("?"):
continue
print(i.replace("\n",""))

assert unexpected == expected

if __name__ == "__main__":
main()
16 changes: 16 additions & 0 deletions .github/workflows/verify_p2pool.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: ci/gh-actions/verify
on:
push:
paths:
- 'src/p2pool/P2PoolManager.cpp'
pull_request:
paths:
- 'src/p2pool/P2PoolManager.cpp'
jobs:
p2pool-hashes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Verify Hashes
run: |
python3 .github/verify_p2pool.py
18 changes: 14 additions & 4 deletions Dockerfile.android
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ ARG ANDROID_NDK_REVISION=21e
ARG ANDROID_NDK_HASH=c3ebc83c96a4d7f539bd72c241b2be9dcd29bda9
ARG ANDROID_SDK_REVISION=7302050_latest
ARG ANDROID_SDK_HASH=7a00faadc0864f78edd8f4908a629a46d622375cbe2e5814e82934aebecdb622
ARG QT_VERSION=v5.15.6-lts-lgpl
ARG QT_VERSION=v5.15.7-lts-lgpl

WORKDIR /opt/android
ENV WORKDIR=/opt/android

ENV ANDROID_NATIVE_API_LEVEL=29
ENV ANDROID_NATIVE_API_LEVEL=30
ENV ANDROID_API=android-${ANDROID_NATIVE_API_LEVEL}
ENV ANDROID_CLANG=aarch64-linux-android${ANDROID_NATIVE_API_LEVEL}-clang
ENV ANDROID_CLANGPP=aarch64-linux-android${ANDROID_NATIVE_API_LEVEL}-clang++
Expand Down Expand Up @@ -43,8 +43,8 @@ RUN echo y | ${ANDROID_SDK_ROOT}/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} "
ENV HOST_PATH=${PATH}
ENV PATH=${TOOLCHAIN_DIR}/aarch64-linux-android/bin:${TOOLCHAIN_DIR}/bin:${PATH}

ARG ZLIB_VERSION=1.2.12
ARG ZLIB_HASH=91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9
ARG ZLIB_VERSION=1.2.13
ARG ZLIB_HASH=b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30
RUN wget -q https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf zlib-${ZLIB_VERSION}.tar.gz \
Expand Down Expand Up @@ -206,6 +206,16 @@ RUN git clone -b v3.24.2 --depth 1 https://github.com/Kitware/CMake \
&& PATH=${HOST_PATH} make -j${THREADS} install \
&& rm -rf $(pwd)

RUN GRADLE_VERSION=5.6.4 \
&& GRADLE_HASH=1f3067073041bc44554d0efe5d402a33bc3d3c93cc39ab684f308586d732a80d \
&& wget -q https\://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip \
&& echo "${GRADLE_HASH} gradle-${GRADLE_VERSION}-bin.zip" | sha256sum -c \
&& GRADLE_LOCAL_PATH=gradle/wrapper/dists/gradle-${GRADLE_VERSION}-bin/bxirm19lnfz6nurbatndyydux \
&& mkdir -p ${GRADLE_LOCAL_PATH} \
&& mv gradle-${GRADLE_VERSION}-bin.zip ${GRADLE_LOCAL_PATH}

ENV GRADLE_USER_HOME=${WORKDIR}/gradle

CMD set -ex \
&& cd /monero-gui \
&& mkdir -p build/Android/release \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.linux
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:16.04

ARG THREADS=1
ARG QT_VERSION=v5.15.6-lts-lgpl
ARG QT_VERSION=v5.15.7-lts-lgpl

ENV CFLAGS="-fPIC"
ENV CPPFLAGS="-fPIC"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:20.04

ARG THREADS=1
ARG QT_VERSION=v5.15.6-lts-lgpl
ARG QT_VERSION=v5.15.7-lts-lgpl
ENV SOURCE_DATE_EPOCH=1397818193

RUN apt update && \
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ Packaging for your favorite distribution would be a welcome contribution!
2. Install Qt:
*Note*: The Qt 5.9.7 or newer requirement makes **some** distributions (mostly based on debian, like Ubuntu 16.x or Linux Mint 18.x) obsolete due to their repositories containing an older Qt version.
*Note*: The Qt 5.9.7 or newer requirement makes **some** distributions (mostly based on Debian, like Ubuntu 16.x or Linux Mint 18.x) obsolete due to their repositories containing an older Qt version.
The recommended way is to install 5.9.7 from the [official Qt installer](https://www.qt.io/download-qt-installer) or [compiling it yourself](https://wiki.qt.io/Install_Qt_5_on_Ubuntu). This ensures you have the correct version. Higher versions *can* work but as it differs from our production build target, slight differences may occur.
The following instructions will fetch Qt from your distribution's repositories instead. Take note of what version it installs. Your mileage may vary.
- For Ubuntu 17.10+
- For Debian distributions (Debian, Ubuntu, Mint, Tails...)
`sudo apt install qtbase5-dev qt5-default qtdeclarative5-dev qml-module-qtqml-models2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qt-labs-settings qml-module-qt-labs-platform qml-module-qt-labs-folderlistmodel qttools5-dev-tools qml-module-qtquick-templates2 libqt5svg5-dev`
`sudo apt install qtbase5-dev qtdeclarative5-dev qml-module-qtqml-models2 qml-module-qtquick-controls qml-module-qtquick-controls2 qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qt-labs-settings qml-module-qt-labs-platform qml-module-qt-labs-folderlistmodel qttools5-dev-tools qml-module-qtquick-templates2 libqt5svg5-dev`
- For Gentoo
Expand All @@ -240,7 +240,7 @@ The following instructions will fetch Qt from your distribution's repositories i
- Optional : To build the flag `WITH_SCANNER`
- For Ubuntu
- For Debian distributions (Debian, Ubuntu, Mint, Tails...)
`sudo apt install qtmultimedia5-dev qml-module-qtmultimedia`
Expand Down
20 changes: 10 additions & 10 deletions cmake/Deploy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,19 @@ if(APPLE OR (WIN32 AND NOT STATIC))
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND WIN_DEPLOY_DLLS
libicudtd71.dll
libicuind71.dll
libicuiod71.dll
libicutud71.dll
libicuucd71.dll
libicudtd72.dll
libicuind72.dll
libicuiod72.dll
libicutud72.dll
libicuucd72.dll
)
else() # assume release
list(APPEND WIN_DEPLOY_DLLS
libicudt71.dll
libicuin71.dll
libicuio71.dll
libicutu71.dll
libicuuc71.dll
libicudt72.dll
libicuin72.dll
libicuio72.dll
libicutu72.dll
libicuuc72.dll
)
endif()
list(TRANSFORM WIN_DEPLOY_DLLS PREPEND "$ENV{MSYSTEM_PREFIX}/bin/")
Expand Down
1 change: 1 addition & 0 deletions components/NetworkStatusItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ Rectangle {
daemonManager.sendCommandAsync(
["set_bootstrap_daemon", "auto"],
appWindow.currentWallet.nettype,
persistentSettings.blockchainDataDir,
callback);

refreshMouseArea.visible = false;
Expand Down
14 changes: 8 additions & 6 deletions main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ ApplicationWindow {
readonly property string localDaemonAddress : "localhost:" + getDefaultDaemonRpcPort(persistentSettings.nettype)
property string currentDaemonAddress;
property int disconnectedEpoch: 0
property int estimatedBlockchainSize: persistentSettings.pruneBlockchain ? 40 : 105 // GB
property int estimatedBlockchainSize: persistentSettings.pruneBlockchain ? 55 : 150 // GB
property alias viewState: rootItem.state
property string prevSplashText;
property bool splashDisplayedBeforeButtonRequest;
Expand Down Expand Up @@ -469,7 +469,7 @@ ApplicationWindow {

// If wallet isnt connected, advanced wallet mode and no daemon is running - Ask
if (appWindow.walletMode >= 2 && !persistentSettings.useRemoteNode && !walletInitialized && disconnected) {
daemonManager.runningAsync(persistentSettings.nettype, function(running) {
daemonManager.runningAsync(persistentSettings.nettype, persistentSettings.blockchainDataDir, function(running) {
if (!running) {
daemonManagerDialog.open();
}
Expand Down Expand Up @@ -694,7 +694,8 @@ ApplicationWindow {
// Daemon connected
leftPanel.networkStatus.connected = currentWallet ? currentWallet.connected() : Wallet.ConnectionStatus_Disconnected

currentWallet.refreshHeightAsync();
if (currentWallet)
currentWallet.refreshHeightAsync();
}

function startDaemon(flags){
Expand All @@ -714,7 +715,7 @@ ApplicationWindow {
appWindow.showProcessingSplash(qsTr("Waiting for daemon to stop..."));
}
p2poolManager.exit()
daemonManager.stopAsync(persistentSettings.nettype, function(result) {
daemonManager.stopAsync(persistentSettings.nettype, persistentSettings.blockchainDataDir, function(result) {
daemonStartStopInProgress = 0;
if (splash) {
hideProcessingSplash();
Expand Down Expand Up @@ -1118,6 +1119,7 @@ ApplicationWindow {
middlePanel.transferView.clearFields();
middlePanel.receiveView.clearFields();
middlePanel.historyView.clearFields();
middlePanel.advancedView.clearFields();
// disable timers
userInActivityTimer.running = false;
});
Expand Down Expand Up @@ -1395,7 +1397,7 @@ ApplicationWindow {
property bool historyShowAdvanced: false
property bool historyHumanDates: true
property string blockchainDataDir: ""
property bool useRemoteNode: false
property bool useRemoteNode: isAndroid
property string remoteNodeAddress: "" // TODO: drop after v0.17.2.0 release
property string remoteNodesSerialized: JSON.stringify({
selected: 0,
Expand Down Expand Up @@ -2141,7 +2143,7 @@ ApplicationWindow {
if (currentWallet) {
handler(!currentWallet.disconnected);
} else {
daemonManager.runningAsync(persistentSettings.nettype, handler);
daemonManager.runningAsync(persistentSettings.nettype, persistentSettings.blockchainDataDir, handler);
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions pages/Advanced.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ColumnLayout {
spacing: 0
property int panelHeight: 900
property alias miningView: stateView.miningView
property alias signView: stateView.signView
property alias state: stateView.state

MoneroComponents.Navbar {
Expand All @@ -52,6 +53,7 @@ ColumnLayout {
active: state == "Mining"
text: qsTr("Mining") + translationManager.emptyString
onSelected: state = "Mining"
visible: !isAndroid
}
MoneroComponents.NavbarItem {
active: state == "Prove"
Expand Down Expand Up @@ -81,7 +83,7 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: panelHeight
color: "transparent"
state: "Mining"
state: isAndroid ? "Prove" : "Mining"

onCurrentViewChanged: {
if (previousView) {
Expand Down Expand Up @@ -120,7 +122,7 @@ ColumnLayout {

StackView {
id: stackView
initialItem: stateView.miningView
initialItem: isAndroid ? stateView.prooveView : stateView.miningView
anchors.fill: parent
clip: false // otherwise animation will affect left panel

Expand All @@ -146,4 +148,9 @@ ColumnLayout {
}
}
}

function clearFields() {
signView.clearFields();
}

}
17 changes: 12 additions & 5 deletions pages/History.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1765,18 +1765,25 @@ Rectangle {
var written = currentWallet.history.writeCSV(currentWallet.currentSubaddressAccount, dataDir);

if(written !== ""){
informationPopup.title = qsTr("Success") + translationManager.emptyString;
confirmationDialog.title = qsTr("Success") + translationManager.emptyString;
var text = qsTr("CSV file written to: %1").arg(written) + "\n\n"
text += qsTr("Tip: Use your favorite spreadsheet software to sort on blockheight.") + "\n\n" + translationManager.emptyString;
informationPopup.text = text;
informationPopup.icon = StandardIcon.Information;
confirmationDialog.text = text;
confirmationDialog.icon = StandardIcon.Information;
confirmationDialog.cancelText = qsTr("Open folder") + translationManager.emptyString;
confirmationDialog.onAcceptedCallback = null;
confirmationDialog.onRejectedCallback = function() {
oshelper.openContainingFolder(written);
}
confirmationDialog.open();
} else {
informationPopup.title = qsTr("Error") + translationManager.emptyString;
informationPopup.text = qsTr("Error exporting transaction data.") + "\n\n" + translationManager.emptyString;
informationPopup.icon = StandardIcon.Critical;
informationPopup.onCloseCallback = null;
informationPopup.open();

}
informationPopup.onCloseCallback = null;
informationPopup.open();
}
Component.onCompleted: {
var _folder = 'file://' + appWindow.accountsDir;
Expand Down
2 changes: 1 addition & 1 deletion pages/Mining.qml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ Rectangle {
startP2Pool()
}
else {
daemonManager.stopAsync(persistentSettings.nettype, startP2PoolLocal)
daemonManager.stopAsync(persistentSettings.nettype, persistentSettings.blockchainDataDir, startP2PoolLocal)
}
}
else {
Expand Down
Loading

0 comments on commit 4975fbe

Please sign in to comment.