Skip to content

Commit

Permalink
Release/v1.5.0 (#263)
Browse files Browse the repository at this point in the history
* adding max limit to some API endpoints (#248)

* Remove unnecessary foreign keys from gift_codes table. (#249)

* Update readme installation instructions (#250)

* Enable foreign key constraints. Fix transient FK errors when deleting an account. (#251)

* Remove foreign key check before running migrations. This allows databases with existing foreign key errors to be fixed by the migrations. (#252)

* Fix a bug causing sync to create many tiny chunks. (#253)

* Remove target block arg from manually sync account fn (#255)

* Initial action to build containers for tag pushes (#256)

* Supporting FOG enabled accounts (#254)

* FOG Creds default to empty string if not provided from API (#257)

* update readme (#259)

* Api key guard (#205)

* fixing issue with ledger not syncing automatically (#261)

* sync up to the last block instead of excluding it (#262)
  • Loading branch information
briancorbin authored Mar 4, 2022
1 parent e0b1e3f commit 3c9c1b8
Show file tree
Hide file tree
Showing 37 changed files with 992 additions and 545 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Full Service CI

env:
DOCKERHUB_REPO: mobilecoin/full-service

on:
push:
tags:
- 'v*'
branches:
- 'develop'
- 'feature/**'

jobs:
# Stub out job for work Mikey is working on for stress tests
# tests:
# runs-on: ubuntu-latest
# steps:
# - name: CI Tests
# run: |
# echo "Hello World"

# Only run docker builds for tag pushes. Build testnet and mainnet images for now
docker:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
strategy:
matrix:
include:
- namespace: test
network: testnet
- namespace: prod
network: mainnet
outputs:
tags: ${{ steps.meta.outputs.tags }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Generate Docker tags
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKERHUB_REPO }}
flavor: |
latest=false
suffix=-${{ matrix.network }}
tags: |
type=semver,pattern=v{{version}},priority=20
type=sha,priority=10
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Publish to DockerHub
id: docker_publish_dockerhub
uses: docker/build-push-action@v2
with:
build-args: |
NAMESPACE=${{ matrix.namespace }}
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@ ingest-enclave.css

*.mdb

release/
release/

.env
3 changes: 2 additions & 1 deletion Cargo.lock

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

13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

A MobileCoin service for wallet implementations.

The Full-Service Node provides ledger syncing and validation, account management, and funds transfer and receiving. It uses a JSONRPC API, so you can connect to it from command line tools or build services around its functionality. It serves the use cases of single user (and is the backing to the MobileCoin Desktop Wallet), while also serving high performance, multi-account, multi-subaddress needs (such as backing merchant services platforms).

Please see the full API documentation at: [High-Performance Wallet API](https://mobilecoin.gitbook.io/full-service-api/)


* You must read and accept the [Terms of Use for MobileCoins and MobileCoin Wallets](./TERMS-OF-USE.md) to use
MobileCoin Software.

Expand Down Expand Up @@ -38,6 +43,11 @@ For database encryption features, see [DATABASE.md](DATABASE.md).

### Build and Run

Note: Full-Service and mobilecoin are not currently compatible with Xcode 13 (the Xcode that ships with OSX Monterey). Make sure you are using Xcode 12 before building and running Full-service. You can [download Xcode 12 from apple's developer downloads page](https://developer.apple.com/download/all/?q=xcode%2012). Download Xcode 12, add it to your applications folder, then set your system to use it with:
```sh
sudo xcode-select -s /Applications/<name of xcode application>.app/Contents/Developer
```

1. Install Rust from https://www.rust-lang.org/tools/install

2. Install dependencies.
Expand Down Expand Up @@ -222,6 +232,9 @@ For database encryption features, see [DATABASE.md](DATABASE.md).
| `offline` | Use Full Service in offline mode. This mode does not download new blocks or submit transactions. | |
| `fog-ingest-enclave-css` | Path to the Fog ingest enclave sigstruct CSS file. | Needed in order to enable sending transactions to fog addresses. |

## API Key

You can add an optional API key to full service by adding a `.env` file to the root of this repo. The variable you need to set is: `MC_API_KEY="<api key of your choosing>"`. If you set this env var, you must provide the `X-API-KEY` header in your requests to full-service.

## Exit Codes

Expand Down
4 changes: 4 additions & 0 deletions docs/tutorials/environment-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ Replace our default peers or tx-source-urls if you would prefer to establish you

1. Install a service, such as [Postman](https://www.postman.com/), to send HTTP requests.

## API Key

You can add an optional API key to full service by adding a `.env` file to the root of this repo. The variable you need to set is: `MC_API_KEY="<api key of your choosing>"`. If you set this env var, you must provide the `X-API-KEY` header in your requests to full-service.

3 changes: 2 additions & 1 deletion full-service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mc-full-service"
version = "1.4.0"
version = "1.5.0"
authors = ["MobileCoin"]
edition = "2018"

Expand Down Expand Up @@ -38,6 +38,7 @@ mc-util-parse = { path = "../mobilecoin/util/parse" }
mc-util-serial = { path = "../mobilecoin/util/serial", default-features = false }
mc-util-uri = { path = "../mobilecoin/util/uri" }

base64 = "0.13.0"
chrono = { version = "0.4", default-features = false, features = ["alloc"] }
crossbeam-channel = "0.5"
diesel = { version = "1.4.6", features = ["sqlcipher-bundled"] }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
DROP TABLE gift_codes;
CREATE TABLE gift_codes (
id INTEGER NOT NULL PRIMARY KEY,
gift_code_b58 VARCHAR NOT NULL,
root_entropy BLOB,
bip39_entropy BLOB,
txo_public_key BLOB NOT NULL,
value UNSIGNED BIG INT NOT NULL,
memo TEXT NOT NULL DEFAULT '',
account_id_hex VARCHAR NOT NULL DEFAULT '',
txo_id_hex VARCHAR NOT NULL,
FOREIGN KEY (account_id_hex) REFERENCES accounts(account_id_hex),
FOREIGN KEY (txo_id_hex) REFERENCES txos(txo_id_hex)
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE NEW_gift_codes (
id INTEGER NOT NULL PRIMARY KEY,
gift_code_b58 VARCHAR NOT NULL,
value UNSIGNED BIG INT NOT NULL
);
INSERT INTO NEW_gift_codes SELECT id, gift_code_b58, value FROM gift_codes;
DROP TABLE gift_codes;
ALTER TABLE NEW_gift_codes RENAME TO gift_codes;

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE accounts DROP COLUMN fog_enabled;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE accounts ADD COLUMN fog_enabled BOOLEAN NOT NULL DEFAULT FALSE;
23 changes: 10 additions & 13 deletions full-service/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ use mc_fog_report_validation::FogResolver;
use mc_full_service::{
check_host,
config::APIConfig,
wallet::{consensus_backed_rocket, validator_backed_rocket, WalletState},
wallet::{consensus_backed_rocket, validator_backed_rocket, APIKeyState, WalletState},
ValidatorLedgerSyncThread, WalletDb, WalletService,
};
use mc_ledger_sync::{LedgerSyncServiceThread, PollingNetworkState, ReqwestTransactionsFetcher};
use mc_validator_api::ValidatorUri;
use mc_validator_connection::ValidatorConnection;
use std::{
env,
process::exit,
sync::{Arc, RwLock},
};
Expand Down Expand Up @@ -83,15 +84,13 @@ fn main() {
// "This pragma is a no-op within a transaction; foreign key constraint
// enforcement may only be enabled or disabled when there is no pending
// BEGIN or SAVEPOINT."
// Check foreign key constraints after the migration. If they fail,
// we will abort until the user resolves it.
conn.batch_execute("PRAGMA foreign_keys = OFF;")
.expect("failed disabling foreign keys");
embedded_migrations::run_with_output(&conn, &mut std::io::stdout())
.expect("failed running migrations");

// Ensure the database is still in good shape. If not, we will abort until the
// user resolves it.
WalletDb::validate_foreign_keys(&conn);

conn.batch_execute("PRAGMA foreign_keys = ON;")
.expect("failed enabling foreign keys");

Expand All @@ -109,9 +108,9 @@ fn main() {

// Start WalletService based on our configuration
if let Some(validator_uri) = config.validator.as_ref() {
validator_backed_full_service(validator_uri, &config, wallet_db, rocket_config, logger);
validator_backed_full_service(validator_uri, &config, wallet_db, rocket_config, logger)
} else {
consensus_backed_full_service(&config, wallet_db, rocket_config, logger);
consensus_backed_full_service(&config, wallet_db, rocket_config, logger)
};
}

Expand Down Expand Up @@ -185,12 +184,11 @@ fn consensus_backed_full_service(
config.offline,
logger,
);

// Start HTTP API server
let state = WalletState { service };

let rocket = consensus_backed_rocket(rocket_config, state);
rocket.launch();
let api_key = env::var("MC_API_KEY").unwrap_or_default();
rocket.manage(APIKeyState(api_key)).launch();
}

fn validator_backed_full_service(
Expand Down Expand Up @@ -273,10 +271,9 @@ fn validator_backed_full_service(
false,
logger,
);

// Start HTTP API server
let state = WalletState { service };

let rocket = validator_backed_rocket(rocket_config, state);
rocket.launch();
let api_key = env::var("MC_API_KEY").unwrap_or_default();
rocket.manage(APIKeyState(api_key)).launch();
}
Loading

0 comments on commit 3c9c1b8

Please sign in to comment.