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

Psychopunk working #20

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ebfe521
fix::> Added testify/assert || added basic tests for client
PsychoPunkSage Mar 25, 2024
e137a9c
fix:: Updated the test cases according to new changes in the fn, para…
PsychoPunkSage Mar 28, 2024
24eb700
fix::> Added support func to tests and Updated CreateNewFedimintClient()
PsychoPunkSage Mar 31, 2024
fe061ab
fix::> Added main testing function - TestFedimintGo
PsychoPunkSage Mar 31, 2024
35fb74b
fix::> justfile.local.just updated
PsychoPunkSage Mar 31, 2024
b7305ca
fix::> Added test suite for LIGHTNING METHODS updated
PsychoPunkSage Apr 1, 2024
f128a23
fix::> changed the type of field in DecodeNotesResponse struct and Mi…
PsychoPunkSage Apr 1, 2024
ca915fd
fix::> Added test suite for MINT METHODS
PsychoPunkSage Apr 1, 2024
68dc12b
fix::> Added test suite for ONCHAIN METHODS
PsychoPunkSage Apr 1, 2024
ec20a4c
minor changes in structure
PsychoPunkSage Apr 2, 2024
cb8b6f7
fix::> Transfered all TEST function to main.go and mirrored them with…
PsychoPunkSage Apr 2, 2024
e10e7be
fix::> updated some parameters
PsychoPunkSage Apr 2, 2024
f0c1eab
fix::> Made some changes in parameters of func
PsychoPunkSage Apr 2, 2024
7921744
fix::> Mirrored python tests with go tests + updated just.local files
PsychoPunkSage Apr 5, 2024
83d2127
fix::> discover_version now takes threshold as a copulsory input
PsychoPunkSage Apr 5, 2024
ec006ea
fix::> Codebase cleanup
PsychoPunkSage Apr 7, 2024
31b7267
fix::> discover_version deserialization done + signal SIGSEGV Error t…
PsychoPunkSage Apr 7, 2024
acca3e4
fix::> added deserialize functionality to all outputs
PsychoPunkSage Apr 7, 2024
1b0974c
fix::> Made gatewayId as a compulsory parameter for all Ln methods
PsychoPunkSage Apr 12, 2024
62a604b
fix::> stash added ad1de49
PsychoPunkSage Apr 12, 2024
a582f26
fix::> Updated Ln test suite to accept ActiveGatewayIds
PsychoPunkSage Apr 12, 2024
aadadd2
fix: all go working
Kodylow Apr 13, 2024
44f7cac
fix: fix
Kodylow Apr 13, 2024
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
1 change: 1 addition & 0 deletions .direnv/flake-profile
1 change: 1 addition & 0 deletions .direnv/flake-profile-1-link
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ fm_client_db
.cargo
.vscode
.DS_Store
fm_db
4 changes: 2 additions & 2 deletions fedimint-clientd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ fn fedimint_v2_rest() -> Router<AppState> {
post(fedimint::ln::list_gateways::handle_rest),
);

let wallet_router = Router::new()
let onchain_router = Router::new()
.route(
"/deposit-address",
post(fedimint::onchain::deposit_address::handle_rest),
Expand Down Expand Up @@ -291,7 +291,7 @@ fn fedimint_v2_rest() -> Router<AppState> {
.nest("/admin", admin_router)
.nest("/mint", mint_router)
.nest("/ln", ln_router)
.nest("/wallet", wallet_router)
.nest("/onchain", onchain_router)
}

/// Implements Cashu V1 API Routes:
Expand Down
30 changes: 15 additions & 15 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

173 changes: 86 additions & 87 deletions misc/git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ set -e

# Revert `git stash` on exit
function revert_git_stash {
>&2 echo "Unstashing uncommitted changes..."
echo >&2 "Unstashing uncommitted changes..."
git stash pop -q
}

# Stash pending changes and revert them when script ends
if [ -z "${NO_STASH:-}" ] && [ $is_unclean -ne 0 ]; then
>&2 echo "Stashing uncommitted changes..."
echo >&2 "Stashing uncommitted changes..."
GIT_LITERAL_PATHSPECS=0 git stash -q --keep-index
trap revert_git_stash EXIT
fi
Expand All @@ -25,146 +25,145 @@ FLAKEBOX_GIT_LS="$(git ls-files)"
export FLAKEBOX_GIT_LS_TEXT
FLAKEBOX_GIT_LS_TEXT="$(echo "$FLAKEBOX_GIT_LS" | grep -v -E "\.(png|ods|jpg|jpeg|woff2|keystore|wasm|ttf|jar|ico|gif)\$")"


function check_nothing() {
true
}
export -f check_nothing

function check_cargo_fmt() {
set -euo pipefail
set -euo pipefail

flakebox-in-each-cargo-workspace cargo fmt --all --check
flakebox-in-each-cargo-workspace cargo fmt --all --check

}
export -f check_cargo_fmt

function check_cargo_lock() {
set -euo pipefail
set -euo pipefail

# https://users.rust-lang.org/t/check-if-the-cargo-lock-is-up-to-date-without-building-anything/91048/5
flakebox-in-each-cargo-workspace cargo update --workspace --locked
# https://users.rust-lang.org/t/check-if-the-cargo-lock-is-up-to-date-without-building-anything/91048/5
flakebox-in-each-cargo-workspace cargo update --workspace --locked

}
export -f check_cargo_lock

function check_leftover_dbg() {
set -euo pipefail

errors=""
for path in $(echo "$FLAKEBOX_GIT_LS_TEXT" | grep '.*\.rs'); do
if grep 'dbg!(' "$path" > /dev/null; then
>&2 echo "$path contains dbg! macro"
errors="true"
fi
done

if [ -n "$errors" ]; then
>&2 echo "Fix the problems above or use --no-verify" 1>&2
return 1
set -euo pipefail

errors=""
for path in $(echo "$FLAKEBOX_GIT_LS_TEXT" | grep '.*\.rs'); do
if grep 'dbg!(' "$path" >/dev/null; then
echo >&2 "$path contains dbg! macro"
errors="true"
fi
done

if [ -n "$errors" ]; then
echo >&2 "Fix the problems above or use --no-verify" 1>&2
return 1
fi

}
export -f check_leftover_dbg

function check_semgrep() {
set -euo pipefail
set -euo pipefail

# semgrep is not available on MacOS
if ! command -v semgrep > /dev/null ; then
>&2 echo "Skipping semgrep check: not available"
return 0
fi
# semgrep is not available on MacOS
if ! command -v semgrep >/dev/null; then
echo >&2 "Skipping semgrep check: not available"
return 0
fi

if [ ! -f .config/semgrep.yaml ] ; then
>&2 echo "Skipping semgrep check: .config/semgrep.yaml doesn't exist"
return 0
fi
if [ ! -f .config/semgrep.yaml ]; then
echo >&2 "Skipping semgrep check: .config/semgrep.yaml doesn't exist"
return 0
fi

if [ ! -s .config/semgrep.yaml ] ; then
>&2 echo "Skipping semgrep check: .config/semgrep.yaml empty"
return 0
fi
if [ ! -s .config/semgrep.yaml ]; then
echo >&2 "Skipping semgrep check: .config/semgrep.yaml empty"
return 0
fi

env SEMGREP_ENABLE_VERSION_CHECK=0 \
semgrep -q --error --no-rewrite-rule-ids --config .config/semgrep.yaml
env SEMGREP_ENABLE_VERSION_CHECK=0 \
semgrep -q --error --no-rewrite-rule-ids --config .config/semgrep.yaml

}
export -f check_semgrep

function check_shellcheck() {
set -euo pipefail
set -euo pipefail

for path in $(echo "$FLAKEBOX_GIT_LS_TEXT" | grep -E '.*\.sh$'); do
shellcheck --severity=warning "$path"
done
for path in $(echo "$FLAKEBOX_GIT_LS_TEXT" | grep -E '.*\.sh$'); do
shellcheck --severity=warning "$path"
done

}
export -f check_shellcheck

function check_trailing_newline() {
set -euo pipefail

errors=""
for path in $(echo "$FLAKEBOX_GIT_LS_TEXT"); do

# extra branches for clarity
if [ ! -s "$path" ]; then
# echo "$path is empty"
true
elif [ -z "$(tail -c 1 < "$path")" ]; then
# echo "$path ends with a newline or with a null byte"
true
else
>&2 echo "$path doesn't end with a newline" 1>&2
errors="true"
fi
done

if [ -n "$errors" ]; then
>&2 echo "Fix the problems above or use --no-verify" 1>&2
return 1
set -euo pipefail

errors=""
for path in $(echo "$FLAKEBOX_GIT_LS_TEXT"); do

# extra branches for clarity
if [ ! -s "$path" ]; then
# echo "$path is empty"
true
elif [ -z "$(tail -c 1 <"$path")" ]; then
# echo "$path ends with a newline or with a null byte"
true
else
echo >&2 "$path doesn't end with a newline" 1>&2
errors="true"
fi
done

if [ -n "$errors" ]; then
echo >&2 "Fix the problems above or use --no-verify" 1>&2
return 1
fi

}
export -f check_trailing_newline

function check_trailing_whitespace() {
set -euo pipefail

rev="HEAD"
if ! git rev-parse -q 1>/dev/null HEAD 2>/dev/null ; then
>&2 echo "Warning: no commits yet, checking against --root"
rev="--root"
fi
if ! git diff --check $rev ; then
>&2 echo "Trailing whitespace detected. Please remove them before committing."
return 1
fi
set -euo pipefail

rev="HEAD"
if ! git rev-parse -q HEAD 1>/dev/null 2>/dev/null; then
echo >&2 "Warning: no commits yet, checking against --root"
rev="--root"
fi
if ! git diff --check $rev; then
echo >&2 "Trailing whitespace detected. Please remove them before committing."
return 1
fi

}
export -f check_trailing_whitespace

function check_typos() {
set -euo pipefail
set -euo pipefail

if ! echo "$FLAKEBOX_GIT_LS_TEXT" | typos --file-list - --force-exclude ; then
>&2 echo "Typos found: Valid new words can be added to '.typos.toml'"
return 1
fi
if ! echo "$FLAKEBOX_GIT_LS_TEXT" | typos --file-list - --force-exclude; then
echo >&2 "Typos found: Valid new words can be added to '.typos.toml'"
return 1
fi

}
export -f check_typos

parallel \
--nonotice \
::: \
check_cargo_fmt \
check_cargo_lock \
check_leftover_dbg \
check_semgrep \
check_shellcheck \
check_trailing_newline \
check_trailing_whitespace \
check_typos \
::: \
check_cargo_fmt \
check_cargo_lock \
check_leftover_dbg \
check_semgrep \
check_shellcheck \
check_trailing_newline \
check_trailing_whitespace \
check_typos \
check_nothing
6 changes: 6 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# save this as shell.nix
{ pkgs ? import <nixpkgs> {}}:

pkgs.mkShell {
packages = [ pkgs.hello ];
}
Loading
Loading