Skip to content

Commit

Permalink
feat: make ledger wasm compatible
Browse files Browse the repository at this point in the history
Signed-off-by: jeluard <jeluard@users.noreply.github.com>
  • Loading branch information
jeluard committed Feb 9, 2025
1 parent 28a41bf commit 3c0860c
Show file tree
Hide file tree
Showing 41 changed files with 552 additions and 370 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ jobs:
- runner: ubuntu-latest
target: wasm32-unknown-unknown
packages: -p amaru-ledger
optional: true
command: build
- runner: ubuntu-latest
target: riscv32im-risc0-zkvm-elf
packages: -p amaru-ledger
extra-args: +nightly -Zbuild-std=std,panic_abort
command: build
# Disabled for now
#- runner: ubuntu-latest
# target: aarch64-unknown-linux-musl
Expand All @@ -60,13 +65,15 @@ jobs:
- name: Run tests
run: |
set +e
EXTRA_ARGS="${{ matrix.environments.extra-args || '' }}"
SCOPE="${{ matrix.environments.packages || '--workspace' }}"
COMMAND="${{ matrix.environments.command || 'test' }}"
if [[ "${{ matrix.environments.cross-compile }}" == "true" ]] ; then
cargo install cross --git https://github.com/cross-rs/cross
# cross doesn't load .cargo/config.toml, see https://github.com/cross-rs/cross/issues/562
$HOME/.cargo/bin/cross test --locked --all-features $SCOPE --target ${{ matrix.environments.target }}
$HOME/.cargo/bin/cross $COMMAND --locked --all-features $SCOPE --target ${{ matrix.environments.target }}
else
cargo test $SCOPE --locked --target ${{ matrix.environments.target }}
cargo $EXTRA_ARGS $COMMAND $SCOPE --locked --target ${{ matrix.environments.target }}
fi
exitcode="$?"
if [[ "${{ matrix.environments.optional }}" == "true" && "$exitcode" != "0" ]] ; then
Expand Down
157 changes: 33 additions & 124 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ indoc = "2.0"
miette = "7.2.0"
minicbor = "0.25.1"
mockall = "0.13"
num = "0.4.3"
num = { version = "0.4.3", default-features = false, features = ["alloc"] }
opentelemetry = "0.27.1"
opentelemetry-otlp = "0.27.0"
opentelemetry_sdk = "0.27.1"
Expand Down Expand Up @@ -55,7 +55,7 @@ vrf_dalek = { git = "https://github.com/txpipe/vrf", rev = "044b45a1a919ba9d9c24
kes-summed-ed25519 = { git = "https://github.com/txpipe/kes", rev = "f69fb357d46f6a18925543d785850059569d7e78" }

# dev-dependencies
proptest = "1.5.0"
proptest = { version = "1.5.0", default-features = false, features = ["alloc"] }
insta = "1.41.1"
envpath = "0.0.1-beta.3"
criterion = "0.5.1"
Expand Down
1 change: 1 addition & 0 deletions crates/amaru/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tracing-subscriber = { workspace = true, features = ["env-filter", "std", "json"
tracing.workspace = true

amaru-consensus = { path = "../consensus" }
amaru-kernel = { path = "../kernel" }
amaru-ledger = { path = "../ledger" }
amaru-ouroboros = { path = "../ouroboros" }
amaru-stores = { path = "../stores" }
Expand Down
8 changes: 4 additions & 4 deletions crates/amaru/src/bin/amaru/cmd/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use amaru_kernel::{
epoch_from_slot, DRep, Epoch, Lovelace, Point, PoolId, PoolParams, Set, StakeCredential,
TransactionInput, TransactionOutput, STAKE_CREDENTIAL_DEPOSIT,
};
use amaru_ledger::{
self,
kernel::{
epoch_from_slot, DRep, Epoch, Lovelace, Point, PoolId, PoolParams, Set, StakeCredential,
TransactionInput, TransactionOutput, STAKE_CREDENTIAL_DEPOSIT,
},
store::{
Store, {self},
},
Expand Down
2 changes: 1 addition & 1 deletion crates/amaru/src/bin/amaru/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use amaru_ouroboros::protocol::Point;
use amaru_kernel::Point;

pub(crate) mod daemon;
pub(crate) mod import;
Expand Down
2 changes: 2 additions & 0 deletions crates/amaru/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

mod pipeline;

/// Sync pipeline
///
/// The sync pipeline is responsible for fetching blocks from the upstream node and
Expand Down
Loading

0 comments on commit 3c0860c

Please sign in to comment.