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

Draft PR to avoid branch pruning #1035

Draft
wants to merge 159 commits into
base: release/cuttlefish
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
0451b01
Add MeshApi v1.4.15 schema
lrubasze Oct 31, 2024
21db3e2
Add generated openapi server
lrubasze Oct 31, 2024
4badcac
mesh-api-server initial implementation
lrubasze Oct 31, 2024
beb0172
MeshApi support in Java part
lrubasze Oct 30, 2024
22e1e2c
Adjust errors to MeshApi requirements
lrubasze Oct 31, 2024
73086f4
Add network/status endpoint
lrubasze Oct 31, 2024
d7a19a0
Add network/list endpoint
lrubasze Nov 4, 2024
386d221
Refactor error reporting
lrubasze Nov 4, 2024
b493069
Add network/options endpoint
lrubasze Nov 4, 2024
2a5a38d
Assume block is a single transaction
lrubasze Nov 4, 2024
e583d77
Add account/balance endpoint
lrubasze Nov 5, 2024
b11d85e
Hardcode node version
lrubasze Nov 5, 2024
1aac9ea
Unsupport historical balance querying
lrubasze Nov 5, 2024
76c4451
Use index as hash in block identifier
lrubasze Nov 5, 2024
3cc82f3
Add endpoint stubs
lrubasze Nov 5, 2024
e3a4e6c
Fix formatting
lrubasze Nov 5, 2024
bdf71f0
Add mesh-api-server to Dockerfile
lrubasze Nov 5, 2024
8b8c4a1
Block identifier conversions improved
lrubasze Nov 6, 2024
f1fdeff
Cleanup
lrubasze Nov 6, 2024
ae467e3
Cleanup OpenAPI generation scripts
lrubasze Nov 6, 2024
a7e617a
Cleanup TODO notes
lrubasze Nov 6, 2024
322ee34
Tweak network status response
lrubasze Nov 6, 2024
34c4379
Add more TODOs
lrubasze Nov 6, 2024
5bb0067
Tweak network status response
lrubasze Nov 6, 2024
56b4153
Some renaming
lrubasze Nov 6, 2024
ceaeac3
Fix Currency <-> ResourceAddress conversion
lrubasze Nov 6, 2024
74af262
Add extract_account
lrubasze Nov 6, 2024
205fea7
Add support for node version fetching
lrubasze Nov 6, 2024
81bf9da
Remove FeatureNotEnabled error
lrubasze Nov 6, 2024
07045b1
Cleanup
lrubasze Nov 6, 2024
008779b
Fix formatting
lrubasze Nov 6, 2024
522e23e
Cleanup warnings
lrubasze Nov 6, 2024
c9302a6
Fix network endpoints
lrubasze Nov 6, 2024
ebe526a
Update default.config.envsubst
lrubasze Nov 7, 2024
518d94f
Conditionally start MeshAPI server
lrubasze Nov 7, 2024
ddee0b8
Rework timestamp_start_index getting
lrubasze Nov 7, 2024
272afd5
Assert subnetworks
lrubasze Nov 7, 2024
7f2b65e
Assert account in extract_account
lrubasze Nov 7, 2024
7164fe8
Add mesh-cli tests to CI
iamyulong Nov 6, 2024
b5acc27
MeshApi - Scaffolding (#1013)
lrubasze Nov 7, 2024
448f409
Feature/add mesh cli tests (#1014)
iamyulong Nov 7, 2024
ca306cd
Add construct derive
iamyulong Nov 7, 2024
782a606
Add construction preprocess & metadata
iamyulong Nov 7, 2024
a5f87c5
Implement /block endpoint
lrubasze Nov 6, 2024
b99fd78
Fix account balance
lrubasze Nov 7, 2024
9dea949
Handle invalid timestamps
lrubasze Nov 8, 2024
92d17ab
Fix failed transactions reporting
lrubasze Nov 8, 2024
4382ce6
/block/transaction endpoint
lrubasze Nov 8, 2024
ae4bf85
Configure rosetta-cli test dir and test end condition
lrubasze Nov 8, 2024
c4ba45a
Add construction payloads endpoint
iamyulong Nov 7, 2024
51a293a
Fix mesh-cli CI
lrubasze Nov 8, 2024
b18daae
Some cleanup
lrubasze Nov 8, 2024
c971a8d
Workaround empty node version
lrubasze Nov 8, 2024
febcea0
Run node in daemon mode
lrubasze Nov 8, 2024
edd5a24
Set localhost when running node in CI
lrubasze Nov 8, 2024
e95e395
Restore mesh-cli node setup
lrubasze Nov 8, 2024
4aea4d0
Add construction parse endpoint
iamyulong Nov 8, 2024
edd2295
Add construction hash endpoint
iamyulong Nov 8, 2024
3b26b9b
Add combine & submit endpoints
iamyulong Nov 8, 2024
4a07672
Revert "Workaround empty node version"
lrubasze Nov 8, 2024
ea9942a
ApplicationVersion - fallback to defaults if properties are empty str…
lrubasze Nov 8, 2024
fb9fbb9
Fix partial block conversion
lrubasze Nov 11, 2024
9ea54b7
Some cleanup
lrubasze Nov 11, 2024
e626ddb
Some comments
lrubasze Nov 11, 2024
cd602e4
TODO added
lrubasze Nov 11, 2024
7df3a9d
Bump deps for docker images
lrubasze Nov 11, 2024
6ef0ffc
TODO added
lrubasze Nov 11, 2024
7ee28b9
Stub mempool implementation
lrubasze Nov 11, 2024
d29527b
Merge remote-tracking branch 'origin/develop' into feature/mesh-api-m…
lrubasze Nov 11, 2024
547957a
Feature/mesh api block (#1018)
lrubasze Nov 11, 2024
df86f22
Merge remote-tracking branch 'origin/feature/mesh' into feature/const…
iamyulong Nov 11, 2024
4b4086c
Add MeshAPI mempool test
lrubasze Nov 11, 2024
338e6ce
Implement mempool endpoint
lrubasze Nov 11, 2024
c5d5b36
Implement mempool/transaction endpoint
lrubasze Nov 11, 2024
066d14f
Add MeshAPI mempool/transaction test
lrubasze Nov 11, 2024
56b8531
Update workflows
iamyulong Nov 11, 2024
86767bd
Tweak mempool tests
lrubasze Nov 12, 2024
2ac2616
Update workflows
iamyulong Nov 12, 2024
3b6af37
Update construction endpoints
iamyulong Nov 12, 2024
df43df4
Update workflows
iamyulong Nov 12, 2024
16028d3
Update transaction submit
iamyulong Nov 12, 2024
4e57a59
Clean up code
iamyulong Nov 12, 2024
5c6908c
Update CI
iamyulong Nov 12, 2024
9fd6ba0
Fix typo
iamyulong Nov 12, 2024
65473e8
Revert CI change
iamyulong Nov 13, 2024
add63fe
Feature/mesh api mempool (#1019)
lrubasze Nov 13, 2024
92acbbe
Tweak stale_depth and broadcast_limit
iamyulong Nov 13, 2024
c86ce2f
Remove binary
iamyulong Nov 13, 2024
4cb91a4
Merge remote-tracking branch 'origin/feature/mesh' into feature/const…
iamyulong Nov 13, 2024
f75dbf8
Add construction API endpoints (#1022)
iamyulong Nov 13, 2024
902846b
Merge remote-tracking branch 'origin/develop' into feature/mesh
iamyulong Nov 13, 2024
b3b7d27
Fix merge errors
iamyulong Nov 13, 2024
254d6d2
Move fee payment computations to node-common
lrubasze Nov 12, 2024
d5c2aaf
Add fee support to MeshAPI block endpoints
lrubasze Nov 12, 2024
69e5992
Fix MeshApiOperationTypes
lrubasze Nov 13, 2024
628edcd
Lock fee from implicit sender
iamyulong Nov 13, 2024
bc1e1e2
Use negative for withdraw amount
iamyulong Nov 13, 2024
6e4579c
Temporarily unsupport fee operations
lrubasze Nov 14, 2024
552cbad
Warnings cleanup
lrubasze Nov 14, 2024
f7866ed
Fix error message
lrubasze Nov 14, 2024
0a563c5
Fix mempool test
lrubasze Nov 14, 2024
5667cf9
MeshAPI - support non-user transactions (#1024)
lrubasze Nov 15, 2024
a6dd4e0
Update engine dependencies for upgraded wasmi
iamyulong Nov 15, 2024
4493114
Merge remote-tracking branch 'origin/develop' into feature/mesh
iamyulong Nov 15, 2024
ad4f966
Add spec tests to CI
lrubasze Nov 15, 2024
8fba923
Fetching balances improved
lrubasze Nov 15, 2024
20fc115
Update rust version
iamyulong Nov 15, 2024
c042e54
Feature/update rust (#1028)
iamyulong Nov 15, 2024
3e25205
Update rust version
iamyulong Nov 15, 2024
fda3e68
Removed TODO from balance exemptions
lrubasze Nov 15, 2024
763585b
Feature/mesh cleanups (#1027)
lrubasze Nov 15, 2024
a12ba95
Merge branch 'develop' into feature/mesh
lrubasze Nov 15, 2024
3d03cd0
Merge branch 'release/cuttlefish' into release/cuttlefish-wasmi-upgrade
iamyulong Nov 15, 2024
4f7aa04
Bump engine dependencies
iamyulong Nov 15, 2024
6cf9cb7
Merge remote-tracking branch 'origin/develop' into feature/mesh
iamyulong Nov 15, 2024
1f89f0c
Clean up error in conventions mod
iamyulong Nov 15, 2024
6e03a72
Clean up construction errors
iamyulong Nov 15, 2024
e4f2720
Setup workflow in separate scenario
lrubasze Nov 18, 2024
d87b52d
More error cleanup
lrubasze Nov 18, 2024
e0050aa
Remove not used errors
lrubasze Nov 18, 2024
93c5c76
Revert "Setup workflow in separate scenario"
lrubasze Nov 18, 2024
7003fc7
Workaround mesh-cli DSL parsing error
lrubasze Nov 19, 2024
2753ec2
Mempool tests cleanup
lrubasze Nov 20, 2024
0c4aa93
Merge remote-tracking branch 'origin/release/cuttlefish' into develop
iamyulong Nov 21, 2024
36bca03
Some cleanup
lrubasze Nov 20, 2024
46cebc9
TODOs added
lrubasze Nov 20, 2024
d37c370
More cleanup
lrubasze Nov 21, 2024
9e03a3b
Reimplement block hash
lrubasze Nov 21, 2024
44bc046
Reimplement transaction identifier for non-user transactions
lrubasze Nov 21, 2024
df784c5
Cleanup
lrubasze Nov 21, 2024
c8c5f33
Merge branch 'develop' into feature/mesh
lrubasze Nov 21, 2024
b8f3151
Feature: Mesh API Implementation (#1021)
iamyulong Nov 21, 2024
1251e85
Enable historical balances for Mesh
lrubasze Nov 19, 2024
ea3fc65
Support fee payments
lrubasze Nov 19, 2024
020d4c0
Support only FeePayment type
lrubasze Nov 20, 2024
0465299
Check if history enabled in runtime
lrubasze Nov 22, 2024
bc0abcf
Add mesh-cli configs for stokenet and mainnet
lrubasze Nov 22, 2024
694a2a4
Add Mesh API readme
lrubasze Nov 26, 2024
d62e0b7
Remove TODO from Mesh API metrics
lrubasze Nov 26, 2024
d5b2a9e
Parse operations for mempool transactions
lrubasze Nov 27, 2024
2f80d02
Update CI
lrubasze Nov 28, 2024
9684fe5
Cleanup
lrubasze Nov 28, 2024
b043d27
Update Readme
lrubasze Nov 28, 2024
0ac415f
Remove TODOs
lrubasze Nov 28, 2024
323538d
Fix MeshApiMempoolEndpointsTest
lrubasze Nov 29, 2024
8df5dd3
Add numeric conversion tests
lrubasze Nov 29, 2024
50fdd19
Update Mesh readme
lrubasze Dec 9, 2024
1950e4e
Assume successful operations only
lrubasze Dec 9, 2024
3f20511
Update some comments
lrubasze Dec 9, 2024
5b0d1bf
Rename error
lrubasze Dec 9, 2024
486f539
Tune InvalidTransaction messages
lrubasze Dec 9, 2024
0e5f5fb
Add Mesh API bind address in testnet node setup
lrubasze Dec 10, 2024
ac6660e
Add Mesh instructions for docker
lrubasze Dec 10, 2024
5fca792
Replace dyn Trait objects with impl Trait for better performance
lrubasze Dec 10, 2024
95b0ed7
Use ActualStateManagerDatabase in Mesh API
lrubasze Dec 10, 2024
26e8eb2
Revert "Use ActualStateManagerDatabase in Mesh API"
lrubasze Dec 10, 2024
0d2b11b
Enable Mesh API in testnet-node
lrubasze Dec 10, 2024
8de4789
Address some comments
lrubasze Dec 10, 2024
6cb8f0a
Mesh reconciliation tests support (#1036)
lrubasze Dec 10, 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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,41 @@ jobs:
# Might be set to warn for debugging purposes. Warning, log file will be huge.
RADIXDLT_LOG_LEVEL: error
run: ./gradlew clean runTargetedIntegrationTests --info --refresh-dependencies --parallel
mesh-api-test-suite:
name: Run Mesh API tests
runs-on: selfhosted-ubuntu-22.04-16-cores
steps:
- uses: RDXWorks-actions/checkout@main
with:
# Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0
- name: Setup environment
uses: ./.github/actions/setup-env
- name: Cache Gradle packages
uses: RDXWorks-actions/cache@main
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build Node
run: ./gradlew build
- name: Run Node in the background
env:
# This is to skip keygen step
RADIXDLT_NODE_KEY: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY=
run: |
echo "db.historical_substate_values.enable=true" >> core/default.config
./gradlew :core:run --info &
- name: Wait for 2 minutes
run: sleep 2m
- name: Install mesh-cli
run: curl -sSfL https://raw.githubusercontent.com/coinbase/mesh-cli/master/scripts/install.sh | sh -s
- name: Run Data API tests
run: ./bin/rosetta-cli --configuration-file core-rust/mesh-api-server/mesh-cli-configs/localnet.json check:data
- name: Run Construction API tests
run: ./bin/rosetta-cli --configuration-file core-rust/mesh-api-server/mesh-cli-configs/localnet.json check:construction
- name: Run Coinbase-spec tests
run: ./bin/rosetta-cli --configuration-file core-rust/mesh-api-server/mesh-cli-configs/localnet.json check:spec
cross-xwin:
name: Cross compile to Windows
runs-on: ubuntu-latest
Expand Down
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,14 @@ RUN USER=root "$HOME/.cargo/bin/cargo" init --lib --name dummy --vcs none . \
&& mkdir -p ./node-common/src \
&& mkdir -p ./state-manager/src \
&& mkdir -p ./p2p/src \
&& mkdir -p ./mesh-api-server/src \
&& touch ./core-api-server/src/lib.rs \
&& touch ./engine-state-api-server/src/lib.rs \
&& touch ./jni-export/src/lib.rs \
&& touch ./node-common/src/lib.rs \
&& touch ./state-manager/src/lib.rs \
&& touch ./p2p/src/lib.rs
&& touch ./p2p/src/lib.rs \
&& touch ./mesh-api-server/src/lib.rs
COPY core-rust/Cargo.toml ./
COPY core-rust/Cargo.lock ./
COPY core-rust/core-api-server/Cargo.toml ./core-api-server
Expand All @@ -192,6 +194,7 @@ COPY core-rust/jni-export/Cargo.toml ./jni-export
COPY core-rust/node-common/Cargo.toml ./node-common
COPY core-rust/state-manager/Cargo.toml ./state-manager
COPY core-rust/p2p/Cargo.toml ./p2p
COPY core-rust/mesh-api-server/Cargo.toml ./mesh-api-server

COPY docker/build_scripts/cargo_build_by_platform.sh /opt/radixdlt/cargo_build_by_platform.sh

Expand All @@ -210,7 +213,7 @@ RUN --mount=type=cache,id=radixdlt-babylon-node-rust-cache,target=/root/.cache/s
FROM library-build-stage-cache-packages AS library-build-stage

# Tidy up from the previous layer
RUN rm -rf core-api-server engine-state-api-server jni-export node-common state-manager
RUN rm -rf core-api-server engine-state-api-server jni-export node-common state-manager mesh-api-server

# Copy across all the code (docker ignore excepted)
COPY core-rust ./
Expand Down Expand Up @@ -309,6 +312,8 @@ ENV RADIXDLT_HOME=/home/radixdlt \
RADIXDLT_PROMETHEUS_API_BIND_ADDRESS=0.0.0.0 \
RADIXDLT_ENGINE_STATE_API_PORT=3336 \
RADIXDLT_ENGINE_STATE_API_BIND_ADDRESS=0.0.0.0 \
RADIXDLT_MESH_API_PORT=3337 \
RADIXDLT_MESH_API_BIND_ADDRESS=0.0.0.0 \
RADIXDLT_NETWORK_ID=240 \
RADIXDLT_NODE_KEY_CREATE_IF_MISSING=false

Expand Down
107 changes: 107 additions & 0 deletions core-rust-bridge/src/main/java/com/radixdlt/api/MeshApiServer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands).
*
* Licensed under the Radix License, Version 1.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
*
* radixfoundation.org/licenses/LICENSE-v1
*
* The Licensor hereby grants permission for the Canonical version of the Work to be
* published, distributed and used under or by reference to the Licensor’s trademark
* Radix ® and use of any unregistered trade names, logos or get-up.
*
* The Licensor provides the Work (and each Contributor provides its Contributions) on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
* including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
*
* Whilst the Work is capable of being deployed, used and adopted (instantiated) to create
* a distributed ledger it is your responsibility to test and validate the code, together
* with all logic and performance of that code under all foreseeable scenarios.
*
* The Licensor does not make or purport to make and hereby excludes liability for all
* and any representation, warranty or undertaking in any form whatsoever, whether express
* or implied, to any entity or person, including any representation, warranty or
* undertaking, as to the functionality security use, value or other characteristics of
* any distributed ledger nor in respect the functioning or value of any tokens which may
* be created stored or transferred using the Work. The Licensor does not warrant that the
* Work or any use of the Work complies with any law or regulation in any territory where
* it may be implemented or used or that it will be appropriate for any specific purpose.
*
* Neither the licensor nor any current or former employees, officers, directors, partners,
* trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor
* shall be liable for any direct or indirect, special, incidental, consequential or other
* losses of any kind, in tort, contract or otherwise (including but not limited to loss
* of revenue, income or profits, or loss of use or data, or loss of reputation, or loss
* of any economic or other opportunity of whatsoever nature or howsoever arising), arising
* out of or in connection with (without limitation of any use, misuse, of any ledger system
* or use made or its functionality or any performance or operation of any code or protocol
* caused by bugs or programming or logic errors or otherwise);
*
* A. any offer, purchase, holding, use, sale, exchange or transmission of any
* cryptographic keys, tokens or assets created, exchanged, stored or arising from any
* interaction with the Work;
*
* B. any failure in a transmission or loss of any token or assets keys or other digital
* artefacts due to errors in transmission;
*
* C. bugs, hacks, logic errors or faults in the Work or any communication;
*
* D. system software or apparatus including but not limited to losses caused by errors
* in holding or transmitting tokens by any third-party;
*
* E. breaches or failure of security including hacker attacks, loss or disclosure of
* password, loss of private key, unauthorised use or misuse of such passwords or keys;
*
* F. any losses including loss of anticipated savings or other benefits resulting from
* use of the Work or any changes to the Work (however implemented).
*
* You are solely responsible for; testing, validating and evaluation of all operation
* logic, functionality, security and appropriateness of using the Work for any commercial
* or non-commercial purpose and for any reproduction or redistribution by You of the
* Work. You assume all risks associated with Your use of the Work and the exercise of
* permissions under this License.
*/

package com.radixdlt.api;

import com.google.common.reflect.TypeToken;
import com.radixdlt.environment.MeshApiServerConfig;
import com.radixdlt.environment.NodeRustEnvironment;
import com.radixdlt.sbor.NodeSborCodecs;

public final class MeshApiServer {

static {
System.loadLibrary("corerust");
}

/** A pointer to the owned Rust structure. */
@SuppressWarnings("unused")
private final long rustMeshApiServerPointer = 0;

public static MeshApiServer create(
NodeRustEnvironment nodeRustEnvironment, MeshApiServerConfig config) {
return new MeshApiServer(nodeRustEnvironment, config);
}

MeshApiServer(NodeRustEnvironment nodeRustEnvironment, MeshApiServerConfig config) {
final var encodedConfig =
NodeSborCodecs.encode(config, NodeSborCodecs.resolveCodec(new TypeToken<>() {}));
init(nodeRustEnvironment, this, encodedConfig);
}

public void start() {
start(this);
}

public void stop() {
stop(this);
}

private static native void init(
NodeRustEnvironment nodeRustEnvironment, MeshApiServer meshApiServer, byte[] config);

private static native void start(MeshApiServer meshApiServer);

private static native void stop(MeshApiServer meshApiServer);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands).
*
* Licensed under the Radix License, Version 1.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
*
* radixfoundation.org/licenses/LICENSE-v1
*
* The Licensor hereby grants permission for the Canonical version of the Work to be
* published, distributed and used under or by reference to the Licensor’s trademark
* Radix ® and use of any unregistered trade names, logos or get-up.
*
* The Licensor provides the Work (and each Contributor provides its Contributions) on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
* including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
*
* Whilst the Work is capable of being deployed, used and adopted (instantiated) to create
* a distributed ledger it is your responsibility to test and validate the code, together
* with all logic and performance of that code under all foreseeable scenarios.
*
* The Licensor does not make or purport to make and hereby excludes liability for all
* and any representation, warranty or undertaking in any form whatsoever, whether express
* or implied, to any entity or person, including any representation, warranty or
* undertaking, as to the functionality security use, value or other characteristics of
* any distributed ledger nor in respect the functioning or value of any tokens which may
* be created stored or transferred using the Work. The Licensor does not warrant that the
* Work or any use of the Work complies with any law or regulation in any territory where
* it may be implemented or used or that it will be appropriate for any specific purpose.
*
* Neither the licensor nor any current or former employees, officers, directors, partners,
* trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor
* shall be liable for any direct or indirect, special, incidental, consequential or other
* losses of any kind, in tort, contract or otherwise (including but not limited to loss
* of revenue, income or profits, or loss of use or data, or loss of reputation, or loss
* of any economic or other opportunity of whatsoever nature or howsoever arising), arising
* out of or in connection with (without limitation of any use, misuse, of any ledger system
* or use made or its functionality or any performance or operation of any code or protocol
* caused by bugs or programming or logic errors or otherwise);
*
* A. any offer, purchase, holding, use, sale, exchange or transmission of any
* cryptographic keys, tokens or assets created, exchanged, stored or arising from any
* interaction with the Work;
*
* B. any failure in a transmission or loss of any token or assets keys or other digital
* artefacts due to errors in transmission;
*
* C. bugs, hacks, logic errors or faults in the Work or any communication;
*
* D. system software or apparatus including but not limited to losses caused by errors
* in holding or transmitting tokens by any third-party;
*
* E. breaches or failure of security including hacker attacks, loss or disclosure of
* password, loss of private key, unauthorised use or misuse of such passwords or keys;
*
* F. any losses including loss of anticipated savings or other benefits resulting from
* use of the Work or any changes to the Work (however implemented).
*
* You are solely responsible for; testing, validating and evaluation of all operation
* logic, functionality, security and appropriateness of using the Work for any commercial
* or non-commercial purpose and for any reproduction or redistribution by You of the
* Work. You assume all risks associated with Your use of the Work and the exercise of
* permissions under this License.
*/

package com.radixdlt.api;

import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.multibindings.ProvidesIntoSet;
import com.radixdlt.environment.MeshApiServerConfig;
import com.radixdlt.environment.NodeAutoCloseable;
import com.radixdlt.environment.NodeRustEnvironment;
import com.radixdlt.utils.UInt32;

public final class MeshApiServerModule extends AbstractModule {

private final MeshApiServerConfig config;

public MeshApiServerModule(String apiBindAddress, int apiPort, String nodeDisplayVersion) {
this.config =
new MeshApiServerConfig(
apiBindAddress, UInt32.fromNonNegativeInt(apiPort), nodeDisplayVersion);
}

@Provides
@Singleton
private MeshApiServer meshApiServer(NodeRustEnvironment nodeRustEnvironment) {
return MeshApiServer.create(nodeRustEnvironment, config);
}

@ProvidesIntoSet
NodeAutoCloseable closeable(MeshApiServer meshApiServer) {
return meshApiServer::stop;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands).
*
* Licensed under the Radix License, Version 1.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
*
* radixfoundation.org/licenses/LICENSE-v1
*
* The Licensor hereby grants permission for the Canonical version of the Work to be
* published, distributed and used under or by reference to the Licensor’s trademark
* Radix ® and use of any unregistered trade names, logos or get-up.
*
* The Licensor provides the Work (and each Contributor provides its Contributions) on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
* including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
*
* Whilst the Work is capable of being deployed, used and adopted (instantiated) to create
* a distributed ledger it is your responsibility to test and validate the code, together
* with all logic and performance of that code under all foreseeable scenarios.
*
* The Licensor does not make or purport to make and hereby excludes liability for all
* and any representation, warranty or undertaking in any form whatsoever, whether express
* or implied, to any entity or person, including any representation, warranty or
* undertaking, as to the functionality security use, value or other characteristics of
* any distributed ledger nor in respect the functioning or value of any tokens which may
* be created stored or transferred using the Work. The Licensor does not warrant that the
* Work or any use of the Work complies with any law or regulation in any territory where
* it may be implemented or used or that it will be appropriate for any specific purpose.
*
* Neither the licensor nor any current or former employees, officers, directors, partners,
* trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor
* shall be liable for any direct or indirect, special, incidental, consequential or other
* losses of any kind, in tort, contract or otherwise (including but not limited to loss
* of revenue, income or profits, or loss of use or data, or loss of reputation, or loss
* of any economic or other opportunity of whatsoever nature or howsoever arising), arising
* out of or in connection with (without limitation of any use, misuse, of any ledger system
* or use made or its functionality or any performance or operation of any code or protocol
* caused by bugs or programming or logic errors or otherwise);
*
* A. any offer, purchase, holding, use, sale, exchange or transmission of any
* cryptographic keys, tokens or assets created, exchanged, stored or arising from any
* interaction with the Work;
*
* B. any failure in a transmission or loss of any token or assets keys or other digital
* artefacts due to errors in transmission;
*
* C. bugs, hacks, logic errors or faults in the Work or any communication;
*
* D. system software or apparatus including but not limited to losses caused by errors
* in holding or transmitting tokens by any third-party;
*
* E. breaches or failure of security including hacker attacks, loss or disclosure of
* password, loss of private key, unauthorised use or misuse of such passwords or keys;
*
* F. any losses including loss of anticipated savings or other benefits resulting from
* use of the Work or any changes to the Work (however implemented).
*
* You are solely responsible for; testing, validating and evaluation of all operation
* logic, functionality, security and appropriateness of using the Work for any commercial
* or non-commercial purpose and for any reproduction or redistribution by You of the
* Work. You assume all risks associated with Your use of the Work and the exercise of
* permissions under this License.
*/

package com.radixdlt.environment;

import com.radixdlt.sbor.codec.CodecMap;
import com.radixdlt.sbor.codec.StructCodec;
import com.radixdlt.utils.UInt32;

public record MeshApiServerConfig(String bindInterface, UInt32 port, String nodeDisplayVersion) {
public static void registerCodec(CodecMap codecMap) {
codecMap.register(
MeshApiServerConfig.class,
codecs -> StructCodec.fromRecordComponents(MeshApiServerConfig.class, codecs));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ public static void registerCodecsWithCodecMap(CodecMap codecMap) {
CoreApiServerConfig.registerCodec(codecMap);
CoreApiServerFlags.registerCodec(codecMap);
EngineStateApiServerConfig.registerCodec(codecMap);
MeshApiServerConfig.registerCodec(codecMap);
ValidatorInfo.registerCodec(codecMap);
GenesisData.registerCodec(codecMap);
GenesisConsensusManagerConfig.registerCodec(codecMap);
Expand Down
Loading
Loading