chore: add ci for amaru-uplc
Signed-off-by: Jonathan Lim <[email protected]>
Signed-off-by: Jonathan Lim <[email protected]>
Signed-off-by: KtorZ <[email protected]>
Signed-off-by: Eric Torreborre <[email protected]>
Signed-off-by: Chris Gianelloni <[email protected]>
This is more convenient and easier to document than some opaque configuration file. One can still use a config file which would export ENV vars. Signed-off-by: KtorZ <[email protected]>
It is not okay to change production behavior to accomodate tests; this is dangerous and will send even send a wrong test signal. We should test the code that ends up in production. Note that I've kept some of the ideas behind the hack to make the stake distribution resolution a bit more flexible while remaining correct. This is mostly just deferring the error to later; but no longer tries to return a placeholder stake distribution when not found. Signed-off-by: KtorZ <[email protected]>
Port of lambdasistemi 36ea009c onto upstream/main's rewritten state.rs. Generated private testnets (db-synthesizer / amaru-bootstrap) can serve block headers from the next leader schedule before the stable ledger has materialized that epoch's snapshot. Add an opt-in forecast on StakeDistributionObserver::get_pool that falls back to the latest cached distribution when the requested epoch is strictly newer; only enabled for NetworkName::Testnet(_). Public networks (mainnet/preprod/preview) keep the existing strict lookup behaviour. Signed-off-by: paolino <[email protected]>
Signed-off-by: KtorZ <[email protected]>
This matches the Haskell's behaviour; and is a lot more sound than returning 1 (which simply bypass the leader schedule stake check). Signed-off-by: KtorZ <[email protected]>
Signed-off-by: paolino <[email protected]>
The node-snapshot (tvar) import path derived the current era's epoch size from the network default (86400), ignoring custom-testnet genesis. Load the history.<slot>.<hash>.json sidecar (as the .cbor path already does via make_era_history) and use it to interpret the snapshot, but only for Testnet(_); public networks keep the snapshot-derived history unchanged. Signed-off-by: paolino <[email protected]>
Two sites in amaru-ledger/src/state.rs were doing unchecked Epoch subtraction on a u64-backed Epoch, producing u64::MAX-1 (or panicking, depending on overflow checks) when the latest snapshot or the slot-derived current epoch was below the rewards/leader-schedule horizon (epoch < 2): - StakeDistributionObserver::get_pool: `current_epoch - 2` becomes saturating_sub(2). Headers validated very early in the chain (or with a custom era history that maps slots to low epoch numbers) no longer surface a misleading "no stake distribution available for pool access 18446744073709551614" — the error now correctly says "pool access 0" and points at a real missing snapshot. - initial_stake_distributions: `latest_epoch - Epoch::from(2)` and `- Epoch::from(1)` become saturating_sub(2) / saturating_sub(1). Bundles produced by amaru-bootstrap from cold-start short-epoch testnets (e.g. lambdasistemi/amaru-bootstrap#34's antithesis reproducer) where the most_recent_snapshot is epoch 0 or 1 no longer hit a u64 underflow on Ledger::new; for_epoch(0) is exercised normally and surfaces a sensible StoreError if the snapshot is genuinely absent. This is a defensive correctness improvement only — it does not change behaviour for any chain past epoch 2. Surfaced by the new live amaru-run consumer test in lambdasistemi/amaru-bootstrap#35. Signed-off-by: Paolo Veronelli <[email protected]> Signed-off-by: paolino <[email protected]>
Signed-off-by: paolino <[email protected]>
Signed-off-by: paolino <[email protected]>
GetAccountState is a Conway-era query; add the same era guard the other Conway governance client methods (GetConstitution, GetGovState, GetDRepState) use, so calling it on a pre-Conway chain returns a clear error instead of sending an unsupported query. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Chris Guiney <[email protected]>
Signed-off-by: Chris Gianelloni <[email protected]>
by extracting the shared logic in helpers
Signed-off-by: Chris Gianelloni <[email protected]>