diff --git a/.gitleaks.toml b/.gitleaks.toml deleted file mode 100644 index adb0e5a..0000000 --- a/.gitleaks.toml +++ /dev/null @@ -1,14 +0,0 @@ -# Sulkta gitleaks allowlist for this repo (a fork of txpipe/pallas). -# These paths hold UPSTREAM Cardano public test fixtures — the mainnet Byron -# genesis, CBOR/native-script test vectors — whose high-entropy hex strings -# false-positive as "generic-api-key". They are public on-chain / test data -# present in every pallas clone. NOT secrets. -[extend] -useDefault = true - -[allowlist] -description = "Upstream Cardano public test fixtures (not secrets)" -paths = [ - '''test_data/''', - '''.*\.native$''', -] diff --git a/CHANGELOG.md b/CHANGELOG.md index 204d460..5bd1f75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,311 +1,6 @@ ## [Unreleased] - - -## [v0.32.0] - 2024-12-29 -### Chore -- apply new lint warnings from latest clippy ([#561](https://github.com/txpipe/pallas/issues/561)) -- fix examples after latest refactors ([#560](https://github.com/txpipe/pallas/issues/560)) -- **deps:** update utxorpc-spec to v0.15 ([#568](https://github.com/txpipe/pallas/issues/568)) -- **math:** replace malachite lib with dashu ([#542](https://github.com/txpipe/pallas/issues/542)) -- **utxorpc:** update spec to v0.14 and update redeemer mapper ([#559](https://github.com/txpipe/pallas/issues/559)) - -### Feat -- **applying:** include main constants in pparams ([#565](https://github.com/txpipe/pallas/issues/565)) -- **configs:** allow clone for genesis file structs ([#528](https://github.com/txpipe/pallas/issues/528)) -- **network:** implement `GetFilteredDelegationsAndRewardAccounts` query ([#552](https://github.com/txpipe/pallas/issues/552)) -- **network:** implement get_utxo_whole query ([#564](https://github.com/txpipe/pallas/issues/564)) -- **network:** implement get stake pool parameters query ([#554](https://github.com/txpipe/pallas/issues/554)) -- **network:** implement GetUTxOByTxIn state query ([#550](https://github.com/txpipe/pallas/issues/550)) -- **traverse:** introduce small QoL improvements ([#567](https://github.com/txpipe/pallas/issues/567)) -- **traverse:** implement MultiEraValue.into_conway ([#545](https://github.com/txpipe/pallas/issues/545)) -- **txbuilder:** allow cloning of relevant structs ([#558](https://github.com/txpipe/pallas/issues/558)) -- **utxorpc:** add execution cost prices to parameter mapper ([#555](https://github.com/txpipe/pallas/issues/555)) - -### Fix -- **network:** adjust PoolDistr & ProtocolParam structs used for state queries ([#551](https://github.com/txpipe/pallas/issues/551)) -- **traverse:** don't mess with Byron update epoch ([#566](https://github.com/txpipe/pallas/issues/566)) -- **txbuilder:** support adding signatures to Conway transactions ([#553](https://github.com/txpipe/pallas/issues/553)) - - - -## [v0.31.0] - 2024-11-04 -### Build -- **deps:** update itertools requirement from 0.12.1 to 0.13.0 ([#459](https://github.com/txpipe/pallas/issues/459)) -- **deps:** update utxorpc-spec requirement from 0.3.0 to 0.4.4 ([#425](https://github.com/txpipe/pallas/issues/425)) -- **deps:** update base64 requirement from 0.21.2 to 0.22.0 ([#417](https://github.com/txpipe/pallas/issues/417)) -- **deps:** update rocksdb requirement from 0.21.0 to 0.22.0 ([#403](https://github.com/txpipe/pallas/issues/403)) -- **deps:** update itertools requirement from 0.10.5 to 0.12.1 ([#390](https://github.com/txpipe/pallas/issues/390)) -- **deps:** update minicbor requirement from 0.19 to 0.20 ([#337](https://github.com/txpipe/pallas/issues/337)) - -### Chore -- fix lint warnings ([#339](https://github.com/txpipe/pallas/issues/339)) -- remove rolldb from repo ([#537](https://github.com/txpipe/pallas/issues/537)) -- update root crate re-exports ([#536](https://github.com/txpipe/pallas/issues/536)) -- Improve network tracing messages ([#237](https://github.com/txpipe/pallas/issues/237)) -- Fix lint warnings for all targets ([#240](https://github.com/txpipe/pallas/issues/240)) -- Use gasket dep from crates.io ([#249](https://github.com/txpipe/pallas/issues/249)) -- upgrade gasket to v0.3.0 ([#255](https://github.com/txpipe/pallas/issues/255)) -- upgrade to gasket v0.4 ([#256](https://github.com/txpipe/pallas/issues/256)) -- undo upstream crate experiment ([#258](https://github.com/txpipe/pallas/issues/258)) -- fix lint warnings and outdated tests ([#475](https://github.com/txpipe/pallas/issues/475)) -- fix clippy warnings ([#262](https://github.com/txpipe/pallas/issues/262)) -- improve ImmutableDB error handling ([#426](https://github.com/txpipe/pallas/issues/426)) -- fix lint warnings ([#470](https://github.com/txpipe/pallas/issues/470)) -- split unstable features into independent flags ([#469](https://github.com/txpipe/pallas/issues/469)) -- fix pending code formatting ([#270](https://github.com/txpipe/pallas/issues/270)) -- apply lint recommendations ([#458](https://github.com/txpipe/pallas/issues/458)) -- fix lint warning ([#283](https://github.com/txpipe/pallas/issues/283)) -- move txbuilder to stable feature ([#451](https://github.com/txpipe/pallas/issues/451)) -- include configs in main crate ([#299](https://github.com/txpipe/pallas/issues/299)) -- fix new lint warnings ([#400](https://github.com/txpipe/pallas/issues/400)) -- update utxorpc-spec to 0.3.0 ([#399](https://github.com/txpipe/pallas/issues/399)) -- fix lint warnings across the board ([#374](https://github.com/txpipe/pallas/issues/374)) -- fix code formatting ([#363](https://github.com/txpipe/pallas/issues/363)) -- update mini-protocol pdf README link ([#301](https://github.com/txpipe/pallas/issues/301)) -- fix lint warnings ([#330](https://github.com/txpipe/pallas/issues/330)) -- use new method for github dark mode images ([#538](https://github.com/txpipe/pallas/issues/538)) -- **applying:** prepare pparams for folding logic ([#438](https://github.com/txpipe/pallas/issues/438)) -- **deps:** update NamedPipes related deps ([#336](https://github.com/txpipe/pallas/issues/336)) -- **deps:** use cryptoxide sha3 instead of depending on sha3 crate ([#452](https://github.com/txpipe/pallas/issues/452)) -- **interop:** bump u5c to v0.11.0 ([#519](https://github.com/txpipe/pallas/issues/519)) -- **interop:** bump u5c spec to v0.9 ([#503](https://github.com/txpipe/pallas/issues/503)) -- **interop:** update u5c spec to v0.8.0 ([#493](https://github.com/txpipe/pallas/issues/493)) -- **interop:** update u5c spec to v0.7.0 ([#489](https://github.com/txpipe/pallas/issues/489)) -- **interop:** update u5c specs to v0.6 ([#485](https://github.com/txpipe/pallas/issues/485)) -- **math:** initialize pallas-math crate ([#474](https://github.com/txpipe/pallas/issues/474)) -- **traverse:** make era enum serializable ([#467](https://github.com/txpipe/pallas/issues/467)) -- **traverse:** Improve API ergonomics ([#233](https://github.com/txpipe/pallas/issues/233)) -- **txbuilder:** export ExUnits to make them accessible from outside ([#497](https://github.com/txpipe/pallas/issues/497)) -- **txbuilder:** fix lint warnings ([#343](https://github.com/txpipe/pallas/issues/343)) -- **wallet:** fix lint warnings ([#344](https://github.com/txpipe/pallas/issues/344)) - -### Ci -- skip gmp dep until we can build on windows ([#476](https://github.com/txpipe/pallas/issues/476)) -- run Rust check on multiple OS ([#286](https://github.com/txpipe/pallas/issues/286)) - -### Doc -- **applying:** add ShelleyMA tests description ([#356](https://github.com/txpipe/pallas/issues/356)) - -### Docs -- update readme with latest crate structure ([#539](https://github.com/txpipe/pallas/issues/539)) -- define security policy ([#464](https://github.com/txpipe/pallas/issues/464)) -- Small crate readme tweaks -- **applying:** document Byron tx validations ([#311](https://github.com/txpipe/pallas/issues/311)) -- **network:** Add chain-sync client docs ([#252](https://github.com/txpipe/pallas/issues/252)) -- **network:** Document BlockFetch client ([#251](https://github.com/txpipe/pallas/issues/251)) - -### Feat -- generate genesis utxos from genesis file ([#59](https://github.com/txpipe/pallas/issues/59)) -- Add client/server use_channel variants ([#228](https://github.com/txpipe/pallas/issues/228)) -- improve access to genesis utxos ([#302](https://github.com/txpipe/pallas/issues/302)) -- Allow creation of secret key from bytes ([#224](https://github.com/txpipe/pallas/issues/224)) -- add support for Conway config and params traverse ([#521](https://github.com/txpipe/pallas/issues/521)) -- Move flat en/de from aiken to pallas ([#303](https://github.com/txpipe/pallas/issues/303)) -- Make the underlying TxBody type generic -- introduce UTxO RPC interop ([#260](https://github.com/txpipe/pallas/issues/260)) -- add handshake with query for n2c ([#266](https://github.com/txpipe/pallas/issues/266)) -- scaffold Byron phase-1 validations ([#300](https://github.com/txpipe/pallas/issues/300)) -- introduce RollDB ([#307](https://github.com/txpipe/pallas/issues/307)) -- introduce conway primitives ([#290](https://github.com/txpipe/pallas/issues/290)) -- introduce wallet crate for ed25519-bip32 key management ([#342](https://github.com/txpipe/pallas/issues/342)) -- implement GetCBOR local state query ([#413](https://github.com/txpipe/pallas/issues/413)) -- Add constants for known miniprotocols -- Introduce Upstream crate ([#230](https://github.com/txpipe/pallas/issues/230)) -- add Babbage phase-1 validations ([#405](https://github.com/txpipe/pallas/issues/405)) -- add a simple Crawler example ([#453](https://github.com/txpipe/pallas/issues/453)) -- introduce transaction builder crate ([#338](https://github.com/txpipe/pallas/issues/338)) -- add Conway 2024-03 CDDL conformity ([#424](https://github.com/txpipe/pallas/issues/424)) -- Migrate to asynchronous I/O ([#241](https://github.com/txpipe/pallas/issues/241)) -- add helper to create bootstrap addresses ([#269](https://github.com/txpipe/pallas/issues/269)) -- implement `GetCurrentPParams` local state query ([#322](https://github.com/txpipe/pallas/issues/322)) -- **addresses:** Derive Hash on Address ([#235](https://github.com/txpipe/pallas/issues/235)) -- **applying:** implement Alonzo phase-1 validations ([#380](https://github.com/txpipe/pallas/issues/380)) -- **applying:** implement ShelleyMA phase-1 validations ([#354](https://github.com/txpipe/pallas/issues/354)) -- **applying:** add support for preview / preprod networks ([#422](https://github.com/txpipe/pallas/issues/422)) -- **applying:** add remaining validations for Byron era ([#325](https://github.com/txpipe/pallas/issues/325)) -- **applying:** validate all inputs in UTxO set ([#324](https://github.com/txpipe/pallas/issues/324)) -- **applying:** add cert and native script validation for ShelleyMA ([#510](https://github.com/txpipe/pallas/issues/510)) -- **applying:** check non-empty set of inputs and outputs ([#312](https://github.com/txpipe/pallas/issues/312)) -- **codec:** add utility for untyped CBOR fragments ([#327](https://github.com/txpipe/pallas/issues/327)) -- **codec:** improve KeyValuePairs ergonomics ([#515](https://github.com/txpipe/pallas/issues/515)) -- **configs:** add serde for Alonzo genesis file ([#436](https://github.com/txpipe/pallas/issues/436)) -- **configs:** add Shelley config structs ([#359](https://github.com/txpipe/pallas/issues/359)) -- **crypto:** Add Key Evolving Signatures (KES) -- **crypto:** add extra types and conversions ([#517](https://github.com/txpipe/pallas/issues/517)) -- **crypto:** add Blake2b hasher for 20-bytes digests ([#416](https://github.com/txpipe/pallas/issues/416)) -- **hardano:** implement immutable db chunk parsing ([#328](https://github.com/txpipe/pallas/issues/328)) -- **hardano:** implement search for the immutabledb reader ([#372](https://github.com/txpipe/pallas/issues/372)) -- **hardano:** enable async for read_blocks_from_point iterator ([#379](https://github.com/txpipe/pallas/issues/379)) -- **hardano:** add fuzzy block search by slot in Immutable db ([#484](https://github.com/txpipe/pallas/issues/484)) -- **interop:** add block mapping to u5c ([#261](https://github.com/txpipe/pallas/issues/261)) -- **interop:** implement u5c pparams mapping ([#504](https://github.com/txpipe/pallas/issues/504)) -- **interop:** introduce field-mask context for u5c ([#502](https://github.com/txpipe/pallas/issues/502)) -- **interop:** map u5c Conway structs ([#511](https://github.com/txpipe/pallas/issues/511)) -- **interop:** re-export utxorpc spec to unify downstream versions ([#448](https://github.com/txpipe/pallas/issues/448)) -- **interop:** add ledger context for utxorpc mapping logic ([#450](https://github.com/txpipe/pallas/issues/450)) -- **math:** add support for some math functions ([#483](https://github.com/txpipe/pallas/issues/483)) -- **network:** add sanchonet compatibility ([#355](https://github.com/txpipe/pallas/issues/355)) -- **network:** implement GetUTxOByAddress local state query ([#341](https://github.com/txpipe/pallas/issues/341)) -- **network:** implement stake distribution local state query ([#340](https://github.com/txpipe/pallas/issues/340)) -- **network:** add cbor decoder for HardForkQuery ([#335](https://github.com/txpipe/pallas/issues/335)) -- **network:** implement windows named pipes connections ([#279](https://github.com/txpipe/pallas/issues/279)) -- **network:** implement LocalTxSubmission client ([#289](https://github.com/txpipe/pallas/issues/289)) -- **network:** add tx submission and tx monitor clients to network facades ([#442](https://github.com/txpipe/pallas/issues/442)) -- **network:** implement chain sync server side ([#277](https://github.com/txpipe/pallas/issues/277)) -- **network:** implement `GetChainBlockNo` local state query ([#441](https://github.com/txpipe/pallas/issues/441)) -- **network:** implement background keep-alive loop ([#427](https://github.com/txpipe/pallas/issues/427)) -- **network:** scaffold local state query server ([#280](https://github.com/txpipe/pallas/issues/280)) -- **network:** add server side of blockfetch miniprotocol ([#275](https://github.com/txpipe/pallas/issues/275)) -- **network:** update n2n handshake versions & add keepalive miniprotocol ([#362](https://github.com/txpipe/pallas/issues/362)) -- **network:** implement split read / write for NamedPipe bearer ([#371](https://github.com/txpipe/pallas/issues/371)) -- **network:** implement server side KeepAlive ([#376](https://github.com/txpipe/pallas/issues/376)) -- **network:** implement `GetGenesisConfig` local state query ([#407](https://github.com/txpipe/pallas/issues/407)) -- **network:** add an extra ergonomic method for n2c chainsync ([#439](https://github.com/txpipe/pallas/issues/439)) -- **network:** implement stake snapshot local state query ([#394](https://github.com/txpipe/pallas/issues/394)) -- **network:** add server-side facades ([#282](https://github.com/txpipe/pallas/issues/282)) -- **primitives:** derive Eq on relevant structs ([#446](https://github.com/txpipe/pallas/issues/446)) -- **rolldb:** allow crawl from intersect options ([#404](https://github.com/txpipe/pallas/issues/404)) -- **rolldb:** allow optionally overlap of WAL over immutable chain ([#419](https://github.com/txpipe/pallas/issues/419)) -- **rolldb:** add method to check if db is empty ([#352](https://github.com/txpipe/pallas/issues/352)) -- **traverse:** add network id to genesis values ([#272](https://github.com/txpipe/pallas/issues/272)) -- **traverse:** prioritize Conway for tx decoding heuristics ([#527](https://github.com/txpipe/pallas/issues/527)) -- **traverse:** improve protocol update access ([#360](https://github.com/txpipe/pallas/issues/360)) -- **traverse:** expose tx update field ([#313](https://github.com/txpipe/pallas/issues/313)) -- **traverse:** introduce MultiEraValue ([#516](https://github.com/txpipe/pallas/issues/516)) -- **traverse:** improve native asset access ([#259](https://github.com/txpipe/pallas/issues/259)) -- **traverse:** track original era for tx outputs ([#447](https://github.com/txpipe/pallas/issues/447)) -- **traverse:** Introduce time helpers ([#234](https://github.com/txpipe/pallas/issues/234)) -- **traverse:** Expose aux data scripts ([#232](https://github.com/txpipe/pallas/issues/232)) -- **traverse:** Decode Conway block headers properly ([#466](https://github.com/txpipe/pallas/issues/466)) -- **txbuilder:** compute ScriptDataHash including edge cases ([#525](https://github.com/txpipe/pallas/issues/525)) -- **txbuilder:** expose independent output builder ([#522](https://github.com/txpipe/pallas/issues/522)) -- **upstream:** Make output generic by adapter ([#236](https://github.com/txpipe/pallas/issues/236)) -- **wallet:** implement HD private keys & encrypted wrapper ([#358](https://github.com/txpipe/pallas/issues/358)) - -### Fix -- support multiple pools in stake snapshot query ([#396](https://github.com/txpipe/pallas/issues/396)) -- Make upstream worker easy to connect ([#246](https://github.com/txpipe/pallas/issues/246)) -- Handle bearer I/O errors ([#247](https://github.com/txpipe/pallas/issues/247)) -- back-merge v0.18.1 hotfix ([#254](https://github.com/txpipe/pallas/issues/254)) -- ignore duplicate consumed inputs ([#257](https://github.com/txpipe/pallas/issues/257)) -- fix builds on windows platform ([#263](https://github.com/txpipe/pallas/issues/263)) -- use u64 instead of i64 for unit interval and rational numerator ([#268](https://github.com/txpipe/pallas/issues/268)) -- allow extra bytes when decoding base address ([#420](https://github.com/txpipe/pallas/issues/420)) -- remove math from root crate ([#541](https://github.com/txpipe/pallas/issues/541)) -- contemplate legacy tx outputs in utxo by address query ([#386](https://github.com/txpipe/pallas/issues/386)) -- make rolldb an optional dependency ([#329](https://github.com/txpipe/pallas/issues/329)) -- exclude large data files blocking crate publish -- favor Babbage over Conway for tx decoding ([#389](https://github.com/txpipe/pallas/issues/389)) -- fix conditional code for windows builds ([#334](https://github.com/txpipe/pallas/issues/334)) -- relax CBOR decoding of Conway protocol params update ([#473](https://github.com/txpipe/pallas/issues/473)) -- return witness objects for conway era multieratx ([#346](https://github.com/txpipe/pallas/issues/346)) -- add txbuilder to unstable feature gate ([#349](https://github.com/txpipe/pallas/issues/349)) -- correct datum kind for set_datum_hash ([#350](https://github.com/txpipe/pallas/issues/350)) -- update pallas-applying to work with keepraw native scripts ([#370](https://github.com/txpipe/pallas/issues/370)) -- add missing READMEs for crate publish -- fix unable to build and sign txs ([#345](https://github.com/txpipe/pallas/issues/345)) -- add missing Cargo metadata required for publish -- **addresses:** relax length check during parsing ([#491](https://github.com/txpipe/pallas/issues/491)) -- **addresses:** check length before decoding ([#377](https://github.com/txpipe/pallas/issues/377)) -- **applying:** fix tx size calculation ([#443](https://github.com/txpipe/pallas/issues/443)) -- **applying:** contemplate fee rules for genesis UTxOs ([#332](https://github.com/txpipe/pallas/issues/332)) -- **applying:** define specific dependency versions -- **applying:** use correct cost model for Conway ([#508](https://github.com/txpipe/pallas/issues/508)) -- **applying:** add missing Conway pparams variant ([#507](https://github.com/txpipe/pallas/issues/507)) -- **codec:** Fix flat encoding and decoding of arbitrarily size integers ([#378](https://github.com/txpipe/pallas/issues/378)) -- **configs:** parse directly into rational numbers ([#437](https://github.com/txpipe/pallas/issues/437)) -- **crypto:** remove modules with non-published deps ([#540](https://github.com/txpipe/pallas/issues/540)) -- **hardano:** exclude last chunk file during immutable db read ([#454](https://github.com/txpipe/pallas/issues/454)) -- **hardano:** remove panics from immutable db parsing ([#351](https://github.com/txpipe/pallas/issues/351)) -- **interop:** use correct input order to match redeemers ([#487](https://github.com/txpipe/pallas/issues/487)) -- **interop:** map missing u5c redeemers ([#490](https://github.com/txpipe/pallas/issues/490)) -- **interop:** support Conway pparams mapping to u5c ([#509](https://github.com/txpipe/pallas/issues/509)) -- **interop:** skip conway certs in u5c ([#498](https://github.com/txpipe/pallas/issues/498)) -- **interop:** check for spend purpose when matching redeemers ([#486](https://github.com/txpipe/pallas/issues/486)) -- **math:** update once_cell::Lazy -> std::sync::LazyLock -- **math:** fix edge cases of ln and pow -- **network:** add missing feature gate flag to tokio dependency ([#333](https://github.com/txpipe/pallas/issues/333)) -- **network:** set so_linger socket option to match cardano-node ([#369](https://github.com/txpipe/pallas/issues/369)) -- **network:** relax connect args lifetime ([#367](https://github.com/txpipe/pallas/issues/367)) -- **network:** demux using one mpsc channel per miniprotocol ([#366](https://github.com/txpipe/pallas/issues/366)) -- **network:** add tcp_nodelay to bearer ([#365](https://github.com/txpipe/pallas/issues/365)) -- **network:** use correct client state transition for n2n txsub ([#348](https://github.com/txpipe/pallas/issues/348)) -- **network:** handle end of list in tx monitor response ([#305](https://github.com/txpipe/pallas/issues/305)) -- **network:** expose missing members in facades ([#468](https://github.com/txpipe/pallas/issues/468)) -- **network:** use initiatorOnlyDiffusionMode correctly after spec fix ([#384](https://github.com/txpipe/pallas/issues/384)) -- **network:** add missing rt feature for tokio -- **network:** skip unix listener on windows ([#287](https://github.com/txpipe/pallas/issues/287)) -- **network:** fix bad codec for tx monitoring messages ([#298](https://github.com/txpipe/pallas/issues/298)) -- **network:** make facade members public ([#285](https://github.com/txpipe/pallas/issues/285)) -- **primitives:** expose hidden struct fields in Conway ([#501](https://github.com/txpipe/pallas/issues/501)) -- **primitives:** skip nonempty invariant check ([#506](https://github.com/txpipe/pallas/issues/506)) -- **primitives:** handle conway extreme param updates ([#462](https://github.com/txpipe/pallas/issues/462)) -- **primitives:** contemplate Conway's CBOR `set` tag ([#421](https://github.com/txpipe/pallas/issues/421)) -- **primitives:** patch remaining Conway issues ([#505](https://github.com/txpipe/pallas/issues/505)) -- **rolldb:** fix find wal sequence semantics ([#310](https://github.com/txpipe/pallas/issues/310)) -- **traverse:** fix conway txs not returning reference inputs ([#388](https://github.com/txpipe/pallas/issues/388)) -- **traverse:** fix well-known genesis values for preprod / preview ([#284](https://github.com/txpipe/pallas/issues/284)) -- **traverse:** add missing tx field getters for Conway ([#392](https://github.com/txpipe/pallas/issues/392)) -- **traverse:** use Conway types in places they are meant to ([#499](https://github.com/txpipe/pallas/issues/499)) -- **txbuilder:** don't include empty redeemers in Conway txs ([#532](https://github.com/txpipe/pallas/issues/532)) -- **txbuilder:** sign transactions using Conway era ([#531](https://github.com/txpipe/pallas/issues/531)) -- **upstream:** Use sync read for chunk dequeue ([#239](https://github.com/txpipe/pallas/issues/239)) -- **utxorpc:** map missing struct values ([#387](https://github.com/txpipe/pallas/issues/387)) - -### Refactor -- support roundtrip encoding for script data hash components ([#526](https://github.com/txpipe/pallas/issues/526)) -- Re-organize and clean-up pallas-primitives ([#523](https://github.com/txpipe/pallas/issues/523)) -- Improve network module naming ([#245](https://github.com/txpipe/pallas/issues/245)) -- Merge multiplexer & miniprotocols into single crate ([#244](https://github.com/txpipe/pallas/issues/244)) -- **applying:** unify approach for protocol params access ([#432](https://github.com/txpipe/pallas/issues/432)) -- **interop:** use stateful mapper for u5 ([#460](https://github.com/txpipe/pallas/issues/460)) -- **interop:** use batching for utxorpc ledger interface ([#472](https://github.com/txpipe/pallas/issues/472)) -- **network:** split bearer into read/write ([#364](https://github.com/txpipe/pallas/issues/364)) -- **network:** simplify local state mini-protocol implementation ([#326](https://github.com/txpipe/pallas/issues/326)) -- **network:** don't treat rejected txs as submit protocol errors ([#306](https://github.com/txpipe/pallas/issues/306)) -- **traverse:** Unify mint and output asset artifacts ([#231](https://github.com/txpipe/pallas/issues/231)) - -### Release -- v0.21.0 ([#375](https://github.com/txpipe/pallas/issues/375)) - -### Test -- **hardano:** contemplate skip of last chunk in immutable read ([#457](https://github.com/txpipe/pallas/issues/457)) -- **hardano:** fix failing tests on CI context ([#429](https://github.com/txpipe/pallas/issues/429)) -- **hardano:** discover snapshots by inspecting test_data dir ([#428](https://github.com/txpipe/pallas/issues/428)) - -### BREAKING CHANGE - -the `validate` fn signature has changed to support these changes - ---------- - -The signature for Bearer.accept_tcp now returns the bearer, and the address that connected. - -This can, for example, be used to implement allow and deny lists for accepting or rejecting incoming connections. - -* Return the remote address from accept_unix - -* cargo fmt - -* Fix comment formatting - - - -## [v0.18.3] - 2024-10-23 -### Fix -- update n2n version table ([#530](https://github.com/txpipe/pallas/issues/530)) -- use u64 instead of i64 for unit interval and rational numerator ([#268](https://github.com/txpipe/pallas/issues/268)) -- **primitives:** Handle U8 and U16 in value serialization - - - -## [v0.30.2] - 2024-09-08 -### Feat -- **interop:** map u5c Conway structs ([#511](https://github.com/txpipe/pallas/issues/511)) - - ## [v0.30.1] - 2024-08-25 ### Fix @@ -1267,11 +962,11 @@ handshake, chainsync, localstate and blockfetch mini-protocols changed the API s - **miniprotocols:** Use pure functions for state machines ([#84](https://github.com/txpipe/pallas/issues/84)) - -## [pallas-codec@0.7.1] - 2022-03-16 - ## [pallas-miniprotocols@0.7.1] - 2022-03-16 + + +## [pallas-codec@0.7.1] - 2022-03-16 ### Fix - **miniprotocols:** Handle regression related to multi-msg payloads ([#76](https://github.com/txpipe/pallas/issues/76)) @@ -1556,11 +1251,7 @@ handshake, chainsync, localstate and blockfetch mini-protocols changed the API s - apply fmt to entire workspace -[Unreleased]: https://github.com/txpipe/pallas/compare/v0.32.0...HEAD -[v0.32.0]: https://github.com/txpipe/pallas/compare/v0.31.0...v0.32.0 -[v0.31.0]: https://github.com/txpipe/pallas/compare/v0.18.3...v0.31.0 -[v0.18.3]: https://github.com/txpipe/pallas/compare/v0.30.2...v0.18.3 -[v0.30.2]: https://github.com/txpipe/pallas/compare/v0.30.1...v0.30.2 +[Unreleased]: https://github.com/txpipe/pallas/compare/v0.30.1...HEAD [v0.30.1]: https://github.com/txpipe/pallas/compare/v0.30.0...v0.30.1 [v0.30.0]: https://github.com/txpipe/pallas/compare/v0.29.0...v0.30.0 [v0.29.0]: https://github.com/txpipe/pallas/compare/v0.28.0...v0.29.0 @@ -1615,9 +1306,9 @@ handshake, chainsync, localstate and blockfetch mini-protocols changed the API s [v0.9.0-alpha.0]: https://github.com/txpipe/pallas/compare/v0.8.0...v0.9.0-alpha.0 [v0.8.0]: https://github.com/txpipe/pallas/compare/v0.8.0-alpha.1...v0.8.0 [v0.8.0-alpha.1]: https://github.com/txpipe/pallas/compare/v0.8.0-alpha.0...v0.8.0-alpha.1 -[v0.8.0-alpha.0]: https://github.com/txpipe/pallas/compare/pallas-codec@0.7.1...v0.8.0-alpha.0 -[pallas-codec@0.7.1]: https://github.com/txpipe/pallas/compare/pallas-miniprotocols@0.7.1...pallas-codec@0.7.1 -[pallas-miniprotocols@0.7.1]: https://github.com/txpipe/pallas/compare/v0.7.0...pallas-miniprotocols@0.7.1 +[v0.8.0-alpha.0]: https://github.com/txpipe/pallas/compare/pallas-miniprotocols@0.7.1...v0.8.0-alpha.0 +[pallas-miniprotocols@0.7.1]: https://github.com/txpipe/pallas/compare/pallas-codec@0.7.1...pallas-miniprotocols@0.7.1 +[pallas-codec@0.7.1]: https://github.com/txpipe/pallas/compare/v0.7.0...pallas-codec@0.7.1 [v0.7.0]: https://github.com/txpipe/pallas/compare/v0.7.0-alpha.1...v0.7.0 [v0.7.0-alpha.1]: https://github.com/txpipe/pallas/compare/v0.7.0-alpha.0...v0.7.0-alpha.1 [v0.7.0-alpha.0]: https://github.com/txpipe/pallas/compare/pallas-primitives@0.6.4...v0.7.0-alpha.0 diff --git a/examples/n2c-miniprotocols/src/main.rs b/examples/n2c-miniprotocols/src/main.rs index 2cc0647..26dca49 100644 --- a/examples/n2c-miniprotocols/src/main.rs +++ b/examples/n2c-miniprotocols/src/main.rs @@ -8,7 +8,7 @@ use pallas::{ facades::NodeClient, miniprotocols::{ chainsync, - localstate::queries_v16::{self, Addr, Addrs, Pools, StakeAddr, TransactionInput}, + localstate::queries_v16::{self, Addr, Addrs, StakeAddr, TransactionInput}, Point, PRE_PRODUCTION_MAGIC, }, }, @@ -66,19 +66,6 @@ async fn do_localstate_query(client: &mut NodeClient) { .unwrap(); info!("result: {:?}", result); - let pool_id1 = "fdb5834ba06eb4baafd50550d2dc9b3742d2c52cc5ee65bf8673823b"; - let pool_id1 = Bytes::from_str(pool_id1).unwrap(); - let pool_id2 = "1e3105f23f2ac91b3fb4c35fa4fe301421028e356e114944e902005b"; - let pool_id2 = Bytes::from_str(pool_id2).unwrap(); - let mut pools: Pools = BTreeSet::new(); - pools.insert(pool_id1); - pools.insert(pool_id2); - - let result = queries_v16::get_stake_pool_params(client, era, pools.into()) - .await - .unwrap(); - info!("result: {:?}", result); - let result = queries_v16::get_block_epoch_number(client, era) .await .unwrap(); diff --git a/pallas-addresses/Cargo.toml b/pallas-addresses/Cargo.toml index dcfdf88..e5b9b7d 100644 --- a/pallas-addresses/Cargo.toml +++ b/pallas-addresses/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-addresses" description = "Ergonomic library to work with different Cardano addresses" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" @@ -12,8 +12,8 @@ authors = ["Santiago Carmuega "] [dependencies] hex = "0.4.3" -pallas-crypto = { version = "=0.32.1", path = "../pallas-crypto" } -pallas-codec = { version = "=0.32.1", path = "../pallas-codec" } +pallas-crypto = { version = "=0.31.0", path = "../pallas-crypto" } +pallas-codec = { version = "=0.31.0", path = "../pallas-codec" } base58 = "0.2.0" bech32 = "0.9.1" thiserror = "1.0" diff --git a/pallas-applying/Cargo.toml b/pallas-applying/Cargo.toml index 0ac0fe4..2a6f90a 100644 --- a/pallas-applying/Cargo.toml +++ b/pallas-applying/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-applying" description = "Logic for validating and applying new blocks and txs to the chain state" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/MaicoLeberle/pallas" homepage = "https://github.com/MaicoLeberle/pallas" @@ -13,14 +13,13 @@ authors = ["Maico Leberle "] doctest = false [dependencies] -pallas-addresses = { version = "=0.32.1", path = "../pallas-addresses" } -pallas-codec = { version = "=0.32.1", path = "../pallas-codec" } -pallas-crypto = { version = "=0.32.1", path = "../pallas-crypto" } -pallas-primitives = { version = "=0.32.1", path = "../pallas-primitives" } -pallas-traverse = { version = "=0.32.1", path = "../pallas-traverse" } +pallas-addresses = { version = "=0.31.0", path = "../pallas-addresses" } +pallas-codec = { version = "=0.31.0", path = "../pallas-codec" } +pallas-crypto = { version = "=0.31.0", path = "../pallas-crypto" } +pallas-primitives = { version = "=0.31.0", path = "../pallas-primitives" } +pallas-traverse = { version = "=0.31.0", path = "../pallas-traverse" } rand = "0.8" hex = "0.4" -chrono = "0.4.39" [dev-dependencies] hex = "0.4" diff --git a/pallas-applying/src/utils/environment.rs b/pallas-applying/src/utils/environment.rs index 498339b..369a24f 100644 --- a/pallas-applying/src/utils/environment.rs +++ b/pallas-applying/src/utils/environment.rs @@ -21,28 +21,6 @@ pub enum MultiEraProtocolParameters { } impl MultiEraProtocolParameters { - pub fn system_start(&self) -> chrono::DateTime { - match self { - MultiEraProtocolParameters::Byron(ByronProtParams { start_time, .. }) => { - chrono::DateTime::from_timestamp(*start_time as i64, 0) - .expect("valid timestamp") - .fixed_offset() - } - MultiEraProtocolParameters::Shelley(ShelleyProtParams { system_start, .. }) => { - *system_start - } - MultiEraProtocolParameters::Alonzo(AlonzoProtParams { system_start, .. }) => { - *system_start - } - MultiEraProtocolParameters::Babbage(BabbageProtParams { system_start, .. }) => { - *system_start - } - MultiEraProtocolParameters::Conway(ConwayProtParams { system_start, .. }) => { - *system_start - } - } - } - pub fn protocol_version(&self) -> usize { match self { MultiEraProtocolParameters::Byron(ByronProtParams { @@ -67,56 +45,11 @@ impl MultiEraProtocolParameters { }) => *x as usize, } } - - const FIVE_DAYS_IN_SECONDS: u64 = 5 * 24 * 60 * 60; - - pub fn epoch_length(&self) -> u64 { - match self { - MultiEraProtocolParameters::Byron(ByronProtParams { slot_duration, .. }) => { - // TODO: research if Byron epoch length is actually hardcoded or if you can get - // it from genesis files somehow - Self::FIVE_DAYS_IN_SECONDS / (*slot_duration / 1000) - } - MultiEraProtocolParameters::Shelley(ShelleyProtParams { epoch_length, .. }) => { - *epoch_length - } - MultiEraProtocolParameters::Alonzo(AlonzoProtParams { epoch_length, .. }) => { - *epoch_length - } - MultiEraProtocolParameters::Babbage(BabbageProtParams { epoch_length, .. }) => { - *epoch_length - } - MultiEraProtocolParameters::Conway(ConwayProtParams { epoch_length, .. }) => { - *epoch_length - } - } - } - - pub fn slot_length(&self) -> u64 { - match self { - MultiEraProtocolParameters::Byron(ByronProtParams { slot_duration, .. }) => { - *slot_duration / 1000 - } - MultiEraProtocolParameters::Shelley(ShelleyProtParams { slot_length, .. }) => { - *slot_length - } - MultiEraProtocolParameters::Alonzo(AlonzoProtParams { slot_length, .. }) => { - *slot_length - } - MultiEraProtocolParameters::Babbage(BabbageProtParams { slot_length, .. }) => { - *slot_length - } - MultiEraProtocolParameters::Conway(ConwayProtParams { slot_length, .. }) => { - *slot_length - } - } - } } #[derive(Debug, Clone)] pub struct ByronProtParams { pub block_version: (u16, u16, u8), - pub start_time: u64, pub script_version: u16, pub slot_duration: u64, pub max_block_size: u64, @@ -136,9 +69,6 @@ pub struct ByronProtParams { #[derive(Debug, Clone)] pub struct ShelleyProtParams { - pub system_start: chrono::DateTime, - pub epoch_length: u64, - pub slot_length: u64, pub minfee_a: u32, pub minfee_b: u32, pub max_block_body_size: u32, @@ -160,9 +90,6 @@ pub struct ShelleyProtParams { #[derive(Debug, Clone)] pub struct AlonzoProtParams { - pub system_start: chrono::DateTime, - pub epoch_length: u64, - pub slot_length: u64, pub minfee_a: u32, pub minfee_b: u32, pub max_block_body_size: u32, @@ -191,9 +118,6 @@ pub struct AlonzoProtParams { #[derive(Debug, Clone)] pub struct BabbageProtParams { - pub system_start: chrono::DateTime, - pub epoch_length: u64, - pub slot_length: u64, pub minfee_a: u32, pub minfee_b: u32, pub max_block_body_size: u32, @@ -222,9 +146,6 @@ pub struct BabbageProtParams { #[derive(Debug, Clone)] pub struct ConwayProtParams { - pub system_start: chrono::DateTime, - pub epoch_length: u64, - pub slot_length: u64, pub minfee_a: u32, pub minfee_b: u32, pub max_block_body_size: u32, diff --git a/pallas-applying/tests/alonzo.rs b/pallas-applying/tests/alonzo.rs index f6bbf45..59ad109 100644 --- a/pallas-applying/tests/alonzo.rs +++ b/pallas-applying/tests/alonzo.rs @@ -2558,9 +2558,6 @@ mod alonzo_tests { fn mk_params_epoch_334() -> AlonzoProtParams { AlonzoProtParams { - system_start: chrono::DateTime::parse_from_rfc3339("2017-09-23T21:44:51Z").unwrap(), - epoch_length: 432000, - slot_length: 1, minfee_a: 44, minfee_b: 155381, max_block_body_size: 65536, @@ -2636,9 +2633,6 @@ mod alonzo_tests { fn mk_params_epoch_300() -> AlonzoProtParams { AlonzoProtParams { - system_start: chrono::DateTime::parse_from_rfc3339("2017-09-23T21:44:51Z").unwrap(), - epoch_length: 432000, - slot_length: 1, minfee_a: 44, minfee_b: 155381, max_block_body_size: 81920, diff --git a/pallas-applying/tests/babbage.rs b/pallas-applying/tests/babbage.rs index 11ae64c..763642f 100644 --- a/pallas-applying/tests/babbage.rs +++ b/pallas-applying/tests/babbage.rs @@ -2369,9 +2369,6 @@ mod babbage_tests { fn mk_mainnet_params_epoch_365() -> BabbageProtParams { BabbageProtParams { - system_start: chrono::DateTime::parse_from_rfc3339("2017-09-23T21:44:51Z").unwrap(), - epoch_length: 432000, - slot_length: 1, minfee_a: 44, minfee_b: 155381, max_block_body_size: 90112, @@ -2448,9 +2445,6 @@ mod babbage_tests { fn mk_mainnet_params_epoch_380() -> BabbageProtParams { BabbageProtParams { - system_start: chrono::DateTime::parse_from_rfc3339("2022-10-25T00:00:00Z").unwrap(), - epoch_length: 432000, - slot_length: 1, minfee_a: 44, minfee_b: 155381, max_block_body_size: 90112, @@ -2703,9 +2697,6 @@ mod babbage_tests { fn mk_preview_params_epoch_30() -> BabbageProtParams { BabbageProtParams { - system_start: chrono::DateTime::parse_from_rfc3339("2022-10-25T00:00:00Z").unwrap(), - epoch_length: 432000, - slot_length: 1, minfee_a: 44, minfee_b: 155381, max_block_body_size: 90112, @@ -2796,9 +2787,6 @@ mod babbage_tests { fn mk_preprod_params_epoch_100() -> BabbageProtParams { BabbageProtParams { - system_start: chrono::DateTime::parse_from_rfc3339("2017-09-23T21:44:51Z").unwrap(), - epoch_length: 432000, - slot_length: 1, minfee_a: 44, minfee_b: 155381, max_block_body_size: 90112, diff --git a/pallas-applying/tests/byron.rs b/pallas-applying/tests/byron.rs index 2e6b81b..63813b3 100644 --- a/pallas-applying/tests/byron.rs +++ b/pallas-applying/tests/byron.rs @@ -24,45 +24,6 @@ use std::vec::Vec; mod byron_tests { use super::*; - macro_rules! hardcoded_environment_values { - ($($key:ident = $value:expr),*) => { - { - #[allow(unused_mut)] - let mut pparams = ByronProtParams { - block_version: (1, 0, 0), - start_time: 1506203091, - script_version: 0, - slot_duration: 20000, - max_block_size: 2000000, - max_header_size: 2000000, - max_tx_size: 4096, - max_proposal_size: 700, - mpc_thd: 20000000000000, - heavy_del_thd: 300000000000, - update_vote_thd: 1000000000000, - update_proposal_thd: 100000000000000, - update_implicit: 10000, - soft_fork_rule: (900000000000000, 600000000000000, 50000000000000), - summand: 155381, - multiplier: 44, - unlock_stake_epoch: 18446744073709551615, - }; - - $( - pparams.$key = $value; - )* - - Environment { - prot_params: MultiEraProtocolParameters::Byron(pparams), - prot_magic: 764824073, - block_slot: 6341, - network_id: 1, - acnt: None, - } - } - } - } - #[test] // Transaction hash: // a9e4413a5fb61a7a43c7df006ffcaaf3f2ffc9541f54757023968c5a8f8294fd @@ -77,7 +38,30 @@ mod byron_tests { 19999000000, )], ); - let env: Environment = hardcoded_environment_values!(); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Byron(ByronProtParams { + block_version: (1, 0, 0), + script_version: 0, + slot_duration: 20000, + max_block_size: 2000000, + max_header_size: 2000000, + max_tx_size: 4096, + max_proposal_size: 700, + mpc_thd: 20000000000000, + heavy_del_thd: 300000000000, + update_vote_thd: 1000000000000, + update_proposal_thd: 100000000000000, + update_implicit: 10000, + soft_fork_rule: (900000000000000, 600000000000000, 50000000000000), + summand: 155381, + multiplier: 44, + unlock_stake_epoch: 18446744073709551615, + }), + prot_magic: 764824073, + block_slot: 6341, + network_id: 1, + acnt: None, + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => (), @@ -99,7 +83,30 @@ mod byron_tests { 19999000000, )], ); - let env: Environment = hardcoded_environment_values!(); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Byron(ByronProtParams { + block_version: (1, 0, 0), + script_version: 0, + slot_duration: 20000, + max_block_size: 2000000, + max_header_size: 2000000, + max_tx_size: 4096, + max_proposal_size: 700, + mpc_thd: 20000000000000, + heavy_del_thd: 300000000000, + update_vote_thd: 1000000000000, + update_proposal_thd: 100000000000000, + update_implicit: 10000, + soft_fork_rule: (900000000000000, 600000000000000, 50000000000000), + summand: 155381, + multiplier: 44, + unlock_stake_epoch: 18446744073709551615, + }), + prot_magic: 764824073, + block_slot: 3241381, + network_id: 1, + acnt: None, + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => (), @@ -129,7 +136,30 @@ mod byron_tests { }; mtxp.transaction = Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap(); let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp); - let env: Environment = hardcoded_environment_values!(); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Byron(ByronProtParams { + block_version: (1, 0, 0), + script_version: 0, + slot_duration: 20000, + max_block_size: 2000000, + max_header_size: 2000000, + max_tx_size: 4096, + max_proposal_size: 700, + mpc_thd: 20000000000000, + heavy_del_thd: 300000000000, + update_vote_thd: 1000000000000, + update_proposal_thd: 100000000000000, + update_implicit: 10000, + soft_fork_rule: (900000000000000, 600000000000000, 50000000000000), + summand: 155381, + multiplier: 44, + unlock_stake_epoch: 18446744073709551615, + }), + prot_magic: 764824073, + block_slot: 3241381, + network_id: 1, + acnt: None, + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("Inputs set should not be empty"), @@ -162,7 +192,30 @@ mod byron_tests { 19999000000, )], ); - let env: Environment = hardcoded_environment_values!(); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Byron(ByronProtParams { + block_version: (1, 0, 0), + script_version: 0, + slot_duration: 20000, + max_block_size: 2000000, + max_header_size: 2000000, + max_tx_size: 4096, + max_proposal_size: 700, + mpc_thd: 20000000000000, + heavy_del_thd: 300000000000, + update_vote_thd: 1000000000000, + update_proposal_thd: 100000000000000, + update_implicit: 10000, + soft_fork_rule: (900000000000000, 600000000000000, 50000000000000), + summand: 155381, + multiplier: 44, + unlock_stake_epoch: 18446744073709551615, + }), + prot_magic: 764824073, + block_slot: 3241381, + network_id: 1, + acnt: None, + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("Outputs set should not be empty"), @@ -180,7 +233,30 @@ mod byron_tests { let mtxp: MintedTxPayload = minted_tx_payload_from_cbor(&cbor_bytes); let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp); let utxos: UTxOs = UTxOs::new(); - let env: Environment = hardcoded_environment_values!(); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Byron(ByronProtParams { + block_version: (1, 0, 0), + script_version: 0, + slot_duration: 20000, + max_block_size: 2000000, + max_header_size: 2000000, + max_tx_size: 4096, + max_proposal_size: 700, + mpc_thd: 20000000000000, + heavy_del_thd: 300000000000, + update_vote_thd: 1000000000000, + update_proposal_thd: 100000000000000, + update_implicit: 10000, + soft_fork_rule: (900000000000000, 600000000000000, 50000000000000), + summand: 155381, + multiplier: 44, + unlock_stake_epoch: 18446744073709551615, + }), + prot_magic: 764824073, + block_slot: 3241381, + network_id: 1, + acnt: None, + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("All inputs must be within the UTxO set"), @@ -219,7 +295,30 @@ mod byron_tests { 19999000000, )], ); - let env: Environment = hardcoded_environment_values!(); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Byron(ByronProtParams { + block_version: (1, 0, 0), + script_version: 0, + slot_duration: 20000, + max_block_size: 2000000, + max_header_size: 2000000, + max_tx_size: 4096, + max_proposal_size: 700, + mpc_thd: 20000000000000, + heavy_del_thd: 300000000000, + update_vote_thd: 1000000000000, + update_proposal_thd: 100000000000000, + update_implicit: 10000, + soft_fork_rule: (900000000000000, 600000000000000, 50000000000000), + summand: 155381, + multiplier: 44, + unlock_stake_epoch: 18446744073709551615, + }), + prot_magic: 764824073, + block_slot: 3241381, + network_id: 1, + acnt: None, + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("All outputs must contain lovelace"), @@ -243,8 +342,30 @@ mod byron_tests { 19999000000, )], ); - - let env: Environment = hardcoded_environment_values!(summand = 1000, multiplier = 1000); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Byron(ByronProtParams { + block_version: (1, 0, 0), + script_version: 0, + slot_duration: 20000, + max_block_size: 2000000, + max_header_size: 2000000, + max_tx_size: 4096, + max_proposal_size: 700, + mpc_thd: 20000000000000, + heavy_del_thd: 300000000000, + update_vote_thd: 1000000000000, + update_proposal_thd: 100000000000000, + update_implicit: 10000, + soft_fork_rule: (900000000000000, 600000000000000, 50000000000000), + summand: 1000, + multiplier: 1000, + unlock_stake_epoch: 18446744073709551615, + }), + prot_magic: 764824073, + block_slot: 3241381, + network_id: 1, + acnt: None, + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("Fees should not be below minimum"), @@ -268,7 +389,30 @@ mod byron_tests { 19999000000, )], ); - let env: Environment = hardcoded_environment_values!(max_tx_size = 0); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Byron(ByronProtParams { + block_version: (1, 0, 0), + script_version: 0, + slot_duration: 20000, + max_block_size: 2000000, + max_header_size: 2000000, + max_tx_size: 0, + max_proposal_size: 700, + mpc_thd: 20000000000000, + heavy_del_thd: 300000000000, + update_vote_thd: 1000000000000, + update_proposal_thd: 100000000000000, + update_implicit: 10000, + soft_fork_rule: (900000000000000, 600000000000000, 50000000000000), + summand: 155381, + multiplier: 44, + unlock_stake_epoch: 18446744073709551615, + }), + prot_magic: 764824073, + block_slot: 3241381, + network_id: 1, + acnt: None, + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("Transaction size cannot exceed protocol limit"), @@ -300,7 +444,30 @@ mod byron_tests { 19999000000, )], ); - let env: Environment = hardcoded_environment_values!(); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Byron(ByronProtParams { + block_version: (1, 0, 0), + script_version: 0, + slot_duration: 20000, + max_block_size: 2000000, + max_header_size: 2000000, + max_tx_size: 4096, + max_proposal_size: 700, + mpc_thd: 20000000000000, + heavy_del_thd: 300000000000, + update_vote_thd: 1000000000000, + update_proposal_thd: 100000000000000, + update_implicit: 10000, + soft_fork_rule: (900000000000000, 600000000000000, 50000000000000), + summand: 155381, + multiplier: 44, + unlock_stake_epoch: 18446744073709551615, + }), + prot_magic: 764824073, + block_slot: 3241381, + network_id: 1, + acnt: None, + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("All inputs must have a witness signature"), @@ -341,7 +508,30 @@ mod byron_tests { 19999000000, )], ); - let env: Environment = hardcoded_environment_values!(); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Byron(ByronProtParams { + block_version: (1, 0, 0), + script_version: 0, + slot_duration: 20000, + max_block_size: 2000000, + max_header_size: 2000000, + max_tx_size: 4096, + max_proposal_size: 700, + mpc_thd: 20000000000000, + heavy_del_thd: 300000000000, + update_vote_thd: 1000000000000, + update_proposal_thd: 100000000000000, + update_implicit: 10000, + soft_fork_rule: (900000000000000, 600000000000000, 50000000000000), + summand: 155381, + multiplier: 44, + unlock_stake_epoch: 18446744073709551615, + }), + prot_magic: 764824073, + block_slot: 3241381, + network_id: 1, + acnt: None, + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("Witness signature should verify the transaction"), diff --git a/pallas-applying/tests/shelley_ma.rs b/pallas-applying/tests/shelley_ma.rs index 123ccfc..7f43017 100644 --- a/pallas-applying/tests/shelley_ma.rs +++ b/pallas-applying/tests/shelley_ma.rs @@ -29,69 +29,6 @@ use std::str::FromStr; mod shelley_ma_tests { use super::*; - macro_rules! hardcoded_environment_values { - ($($key:ident = $value:expr),*) => { - { - #[allow(unused_mut)] - let mut pparams = ShelleyProtParams { - system_start: chrono::DateTime::parse_from_rfc3339("2017-09-23T21:44:51Z").unwrap(), - epoch_length: 432000, - slot_length: 1, - minfee_b: 155381, - minfee_a: 44, - max_block_body_size: 65536, - max_transaction_size: 4096, - max_block_header_size: 1100, - key_deposit: 2000000, - pool_deposit: 500000000, - maximum_epoch: 18, - desired_number_of_stake_pools: 150, - pool_pledge_influence: RationalNumber { - // FIX: this is a made-up value. - numerator: 1, - denominator: 1, - }, - expansion_rate: RationalNumber { - // FIX: this is a made-up value. - numerator: 1, - denominator: 1, - }, - treasury_growth_rate: RationalNumber { - // FIX: this is a made-up value. - numerator: 1, - denominator: 1, - }, - decentralization_constant: RationalNumber { - numerator: 1, - denominator: 1, - }, - extra_entropy: Nonce { - variant: NonceVariant::NeutralNonce, - hash: None, - }, - protocol_version: (0, 2), - min_utxo_value: 1000000, - min_pool_cost: 340000000, - }; - - $( - pparams.$key = $value; - )* - - Environment { - prot_params: MultiEraProtocolParameters::Shelley(pparams), - prot_magic: 764824073, - block_slot: 5281340, - network_id: 1, - acnt: Some(AccountState { - treasury: 261_254_564_000_000, - reserves: 0, - }), - } - } - } - } - #[test] // Transaction hash: // 50eba65e73c8c5f7b09f4ea28cf15dce169f3d1c322ca3deff03725f51518bb2 @@ -107,8 +44,54 @@ mod shelley_ma_tests { None, )], ); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; - let env: Environment = hardcoded_environment_values!(); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => (), @@ -132,7 +115,54 @@ mod shelley_ma_tests { )], ); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 17584925, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => (), @@ -141,8 +171,8 @@ mod shelley_ma_tests { } #[test] - // Same as successful_mainnet_shelley_tx_with_script, but changing "All" to - // "any" and deleting one key-witness pair + // Same as successful_mainnet_shelley_tx_with_script, but changing "All" to "any" and + // deleting one key-witness pair fn successful_mainnet_shelley_tx_with_changed_script() { let cbor_bytes: Vec = cbor_to_bytes(include_str!("../../test_data/shelley4.tx")); let mut mtx: MintedTx = minted_tx_from_cbor(&cbor_bytes); @@ -166,8 +196,54 @@ mod shelley_ma_tests { None, )], ); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; - let env: Environment = hardcoded_environment_values!(); + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 17584925, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => (), @@ -191,7 +267,54 @@ mod shelley_ma_tests { )], ); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5860488, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => (), @@ -215,7 +338,54 @@ mod shelley_ma_tests { )], ); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 24381863, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => (), @@ -239,7 +409,51 @@ mod shelley_ma_tests { )], ); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 16384, + max_block_header_size: 1100, + key_deposit: 2_000_000, + pool_deposit: 500_000_000, + maximum_epoch: 18, + desired_number_of_stake_pools: 500, + pool_pledge_influence: RationalNumber { + numerator: 3, + denominator: 10, + }, + expansion_rate: RationalNumber { + numerator: 3, + denominator: 1000, + }, + treasury_growth_rate: RationalNumber { + numerator: 2, + denominator: 10, + }, + decentralization_constant: RationalNumber { + numerator: 0, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (4, 0), + min_utxo_value: 1_000_000, + min_pool_cost: 340_000_000, + }), + prot_magic: 764824073, + block_slot: 26342415, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); let hash = Hash::from_str("FB2B631DB76384F64DD94B47F97FC8C2A206764C17A1DE7DA2F70E83").unwrap(); @@ -337,9 +551,6 @@ mod shelley_ma_tests { Environment { prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { - system_start: chrono::DateTime::parse_from_rfc3339("2017-09-23T21:44:51Z").unwrap(), - epoch_length: 432000, - slot_length: 1, minfee_b: 155381, minfee_a: 44, max_block_body_size: 65536, @@ -397,9 +608,51 @@ mod shelley_ma_tests { )], ); - let mut env: Environment = hardcoded_environment_values!(max_transaction_size = 16384); - env.block_slot = 19282133; + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 16384, + max_block_header_size: 1100, + key_deposit: 2_000_000, + pool_deposit: 500_000_000, + maximum_epoch: 18, + desired_number_of_stake_pools: 500, + pool_pledge_influence: RationalNumber { + numerator: 3, + denominator: 10, + }, + expansion_rate: RationalNumber { + numerator: 3, + denominator: 1000, + }, + treasury_growth_rate: RationalNumber { + numerator: 2, + denominator: 10, + }, + decentralization_constant: RationalNumber { + numerator: 3, + denominator: 10, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (3, 0), + min_utxo_value: 1_000_000, + min_pool_cost: 340_000_000, + }), + prot_magic: 764824073, + block_slot: 19282133, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => (), @@ -432,7 +685,54 @@ mod shelley_ma_tests { Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap(); let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley); - let env = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("Inputs set should not be empty"), @@ -451,7 +751,54 @@ mod shelley_ma_tests { let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley); let utxos: UTxOs = UTxOs::new(); - let env = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("All inputs must be within the UTxO set"), @@ -486,7 +833,54 @@ mod shelley_ma_tests { Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap(); let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("TTL must always be present in Shelley transactions"), @@ -512,9 +906,54 @@ mod shelley_ma_tests { )], ); - let mut env: Environment = hardcoded_environment_values!(); - env.block_slot = 9999999; + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 9999999, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("TTL cannot be exceeded"), @@ -540,8 +979,54 @@ mod shelley_ma_tests { )], ); - let env: Environment = hardcoded_environment_values!(max_transaction_size = 0); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 0, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("Tx size exceeds max limit"), @@ -568,7 +1053,54 @@ mod shelley_ma_tests { )], ); - let env = hardcoded_environment_values!(min_utxo_value = 10000000000000); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 10000000000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("Output amount must be above min lovelace value"), @@ -604,7 +1136,54 @@ mod shelley_ma_tests { )], ); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("Preservation of value property doesn't hold"), @@ -630,7 +1209,54 @@ mod shelley_ma_tests { )], ); - let env: Environment = hardcoded_environment_values!(minfee_b = 155381, minfee_a = 70); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 70, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("Fee should not be below minimum"), @@ -679,7 +1305,54 @@ mod shelley_ma_tests { Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap(); let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx( &mtx.transaction_body, &[( @@ -716,7 +1389,54 @@ mod shelley_ma_tests { )], ); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5860488, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("Output with wrong network ID should be rejected"), @@ -746,7 +1466,54 @@ mod shelley_ma_tests { Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap(); let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx( &mtx.transaction_body, &[( @@ -789,7 +1556,54 @@ mod shelley_ma_tests { Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap(); let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx( &mtx.transaction_body, &[( @@ -827,7 +1641,54 @@ mod shelley_ma_tests { Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap(); let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx( &mtx.transaction_body, &[( @@ -867,7 +1728,54 @@ mod shelley_ma_tests { Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap(); let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley); - let env: Environment = hardcoded_environment_values!(); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 4096, + max_block_header_size: 1100, + key_deposit: 2000000, + pool_deposit: 500000000, + maximum_epoch: 18, + desired_number_of_stake_pools: 150, + pool_pledge_influence: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + expansion_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + treasury_growth_rate: RationalNumber { + // FIX: this is a made-up value. + numerator: 1, + denominator: 1, + }, + decentralization_constant: RationalNumber { + numerator: 1, + denominator: 1, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (0, 2), + min_utxo_value: 1000000, + min_pool_cost: 340000000, + }), + prot_magic: 764824073, + block_slot: 5281340, + network_id: 1, + acnt: Some(acnt), + }; let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx( &mtx.transaction_body, &[( @@ -966,7 +1874,51 @@ mod shelley_ma_tests { )], ); - let env: Environment = hardcoded_environment_values!(max_transaction_size = 16384); + let acnt = AccountState { + treasury: 261_254_564_000_000, + reserves: 0, + }; + + let env: Environment = Environment { + prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams { + minfee_b: 155381, + minfee_a: 44, + max_block_body_size: 65536, + max_transaction_size: 16384, + max_block_header_size: 1100, + key_deposit: 2_000_000, + pool_deposit: 500_000_000, + maximum_epoch: 18, + desired_number_of_stake_pools: 500, + pool_pledge_influence: RationalNumber { + numerator: 3, + denominator: 10, + }, + expansion_rate: RationalNumber { + numerator: 3, + denominator: 1000, + }, + treasury_growth_rate: RationalNumber { + numerator: 2, + denominator: 10, + }, + decentralization_constant: RationalNumber { + numerator: 3, + denominator: 10, + }, + extra_entropy: Nonce { + variant: NonceVariant::NeutralNonce, + hash: None, + }, + protocol_version: (3, 0), + min_utxo_value: 1_000_000, + min_pool_cost: 340_000_000, + }), + prot_magic: 764824073, + block_slot: 19483200, + network_id: 1, + acnt: Some(acnt), + }; let mut cert_state: CertState = CertState::default(); match validate_txs(&[metx], &env, &utxos, &mut cert_state) { Ok(()) => panic!("MIR after the stability window"), diff --git a/pallas-codec/Cargo.toml b/pallas-codec/Cargo.toml index 48d3fa6..25fed7e 100644 --- a/pallas-codec/Cargo.toml +++ b/pallas-codec/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-codec" description = "Pallas common CBOR encoding interface and utilities" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" diff --git a/pallas-configs/Cargo.toml b/pallas-configs/Cargo.toml index 271a5a1..544809a 100644 --- a/pallas-configs/Cargo.toml +++ b/pallas-configs/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-configs" description = "Config structs and utilities matching the Haskell implementation" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" @@ -12,10 +12,10 @@ authors = ["Santiago Carmuega "] [dependencies] hex = "0.4.3" -pallas-addresses = { version = "=0.32.1", path = "../pallas-addresses" } -pallas-crypto = { version = "=0.32.1", path = "../pallas-crypto" } -pallas-codec = { version = "=0.32.1", path = "../pallas-codec" } -pallas-primitives = { version = "=0.32.1", path = "../pallas-primitives" } +pallas-addresses = { version = "=0.31.0", path = "../pallas-addresses" } +pallas-crypto = { version = "=0.31.0", path = "../pallas-crypto" } +pallas-codec = { version = "=0.31.0", path = "../pallas-codec" } +pallas-primitives = { version = "=0.31.0", path = "../pallas-primitives" } serde = { version = "1.0.136", optional = true, features = ["derive"] } serde_json = { version = "1.0.79", optional = true } base64 = "0.22.0" diff --git a/pallas-crypto/Cargo.toml b/pallas-crypto/Cargo.toml index dea7ee1..f13735c 100644 --- a/pallas-crypto/Cargo.toml +++ b/pallas-crypto/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-crypto" description = "Cryptographic primitives for Cardano" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" @@ -15,7 +15,7 @@ hex = "0.4" cryptoxide = { version = "0.4.4" } thiserror = "1.0" rand_core = "0.6" -pallas-codec = { version = "=0.32.1", path = "../pallas-codec" } +pallas-codec = { version = "=0.31.0", path = "../pallas-codec" } serde = "1.0.143" zeroize = "1.8.1" diff --git a/pallas-hardano/Cargo.toml b/pallas-hardano/Cargo.toml index 066f26c..53839be 100644 --- a/pallas-hardano/Cargo.toml +++ b/pallas-hardano/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-hardano" description = "Pallas interoperability with the Haskel Cardano node implementation" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" @@ -15,8 +15,8 @@ thiserror = "1.0.49" binary-layout = "3.2.0" tap = "1.0.1" tracing = "0.1.40" -pallas-traverse = { version = "=0.32.1", path = "../pallas-traverse" } -pallas-network = { version = "=0.32.1", path = "../pallas-network" } +pallas-traverse = { version = "=0.31.0", path = "../pallas-traverse" } +pallas-network = { version = "=0.31.0", path = "../pallas-network" } [dev-dependencies] tracing-subscriber = "0.3.17" diff --git a/pallas-math/Cargo.toml b/pallas-math/Cargo.toml index dc6ab37..cb47611 100644 --- a/pallas-math/Cargo.toml +++ b/pallas-math/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-math" description = "Mathematics functions for Cardano" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" diff --git a/pallas-network/Cargo.toml b/pallas-network/Cargo.toml index 9921075..3656c05 100644 --- a/pallas-network/Cargo.toml +++ b/pallas-network/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-network" description = "Ouroboros networking stack using async IO" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" @@ -14,8 +14,8 @@ authors = ["Santiago Carmuega ", "Pi Lanningham >(); @@ -145,15 +135,6 @@ impl VersionTable { Some(false), ), ), - ( - PROTOCOL_V14, - VersionData::new( - network_magic, - true, - Some(PEER_SHARING_DISABLED), - Some(false), - ), - ), ] .into_iter() .collect::>(); diff --git a/pallas-network/src/miniprotocols/localstate/queries_v16/codec.rs b/pallas-network/src/miniprotocols/localstate/queries_v16/codec.rs index 0350faa..2cf30a9 100644 --- a/pallas-network/src/miniprotocols/localstate/queries_v16/codec.rs +++ b/pallas-network/src/miniprotocols/localstate/queries_v16/codec.rs @@ -136,7 +136,7 @@ impl<'b> Decode<'b, ()> for BlockQuery { 4 => Ok(Self::GetProposedPParamsUpdates), 5 => Ok(Self::GetStakeDistribution), 6 => Ok(Self::GetUTxOByAddress(d.decode()?)), - 7 => Ok(Self::GetUTxOWhole), + // 7 => Ok(Self::GetUTxOWhole), // 8 => Ok(Self::DebugEpochState), 9 => Ok(Self::GetCBOR(d.decode()?)), 10 => Ok(Self::GetFilteredDelegationsAndRewardAccounts(d.decode()?)), @@ -339,29 +339,6 @@ impl minicbor::encode::Encode for RationalNumber { } } -impl<'b, C> minicbor::decode::Decode<'b, C> for PoolIds { - fn decode(d: &mut minicbor::Decoder<'b>, ctx: &mut C) -> Result { - d.tag()?; - - Ok(PoolIds { - hashes: d.decode_with(ctx)?, - }) - } -} - -impl minicbor::encode::Encode for PoolIds { - fn encode( - &self, - e: &mut minicbor::Encoder, - ctx: &mut C, - ) -> Result<(), minicbor::encode::Error> { - e.tag(Tag::new(258))?; - e.encode_with(self.hashes.clone(), ctx)?; - - Ok(()) - } -} - impl<'b, C> minicbor::decode::Decode<'b, C> for TransactionOutput { fn decode(d: &mut minicbor::Decoder<'b>, ctx: &mut C) -> Result { match d.datatype()? { diff --git a/pallas-network/src/miniprotocols/localstate/queries_v16/mod.rs b/pallas-network/src/miniprotocols/localstate/queries_v16/mod.rs index cce8af8..72097ae 100644 --- a/pallas-network/src/miniprotocols/localstate/queries_v16/mod.rs +++ b/pallas-network/src/miniprotocols/localstate/queries_v16/mod.rs @@ -1,21 +1,17 @@ // TODO: this should move to pallas::ledger crate at some point use pallas_crypto::hash::Hash; -use std::collections::{BTreeMap, BTreeSet}; +use std::collections::BTreeSet; use std::hash::Hash as StdHash; // required for derive attrs to work use pallas_codec::minicbor::{self}; -use pallas_codec::utils::{AnyUInt, Bytes, KeyValuePairs, Nullable, TagWrap}; +use pallas_codec::utils::{AnyUInt, Bytes, KeyValuePairs, TagWrap}; use pallas_codec::{ minicbor::{Decode, Encode}, utils::AnyCbor, }; -pub mod primitives; - -pub use primitives::{PoolMetadata, Relay}; - use crate::miniprotocols::Point; use super::{Client, ClientError}; @@ -43,7 +39,7 @@ pub enum BlockQuery { GetRewardProvenance, GetUTxOByTxIn(TxIns), GetStakePools, - GetStakePoolParams(PoolIds), + GetStakePoolParams(AnyCbor), GetRewardInfoPools, GetPoolState(AnyCbor), GetStakeSnapshots(Pools), @@ -201,19 +197,6 @@ pub struct StakeDistribution { pub pools: KeyValuePairs, } -/// The use of `BTreeMap`s as per [Pools] definition ensures that the hashes are -/// in order (otherwise, the node will reject some queries). -#[derive(Debug, PartialEq, Clone)] -pub struct PoolIds { - pub hashes: Pools, -} - -impl From for PoolIds { - fn from(hashes: Pools) -> Self { - Self { hashes } - } -} - #[derive(Debug, Encode, Decode, PartialEq, Clone)] pub struct Pool { #[n(0)] @@ -223,39 +206,6 @@ pub struct Pool { pub hashes: Bytes, } -// Essentially the `PoolRegistration` component of `Certificate` at -// `pallas-primitives/src/alonzo/model.rs`, with types modified for the present -// context -#[derive(Debug, Encode, Decode, PartialEq, Clone)] -pub struct PoolParams { - #[n(0)] - pub operator: Bytes, - - #[n(1)] - pub vrf_keyhash: Bytes, - - #[n(2)] - pub pledge: Coin, - - #[n(3)] - pub cost: Coin, - - #[n(4)] - pub margin: UnitInterval, - - #[n(5)] - pub reward_account: Addr, - - #[n(6)] - pub pool_owners: PoolIds, - - #[n(7)] - pub relays: Vec, - - #[n(8)] - pub pool_metadata: Nullable, -} - /// Type used at [GenesisConfig], which is a fraction that is CBOR-encoded /// as an untagged array. #[derive(Debug, Encode, Decode, PartialEq, Clone)] @@ -313,8 +263,6 @@ pub struct UTxOByAddress { pub type UTxOByTxin = UTxOByAddress; -pub type UTxOWhole = UTxOByAddress; - // Bytes CDDL -> #6.121([ * #6.121([ *datum ]) ]) pub type Datum = (Era, TagWrap); @@ -556,20 +504,6 @@ pub async fn get_cbor( Ok(result) } -/// Get parameters for the given pools. -pub async fn get_stake_pool_params( - client: &mut Client, - era: u16, - pool_ids: PoolIds, -) -> Result, ClientError> { - let query = BlockQuery::GetStakePoolParams(pool_ids); - let query = LedgerQuery::BlockQuery(era, query); - let query = Request::LedgerQuery(query); - let result: (_,) = client.query(query).await?; - - Ok(result.0) -} - /// Get the genesis configuration for the given era. pub async fn get_genesis_config( client: &mut Client, @@ -610,13 +544,3 @@ pub async fn get_utxo_by_txin( Ok(result) } - -/// Get the /entire/ UTxO. -pub async fn get_utxo_whole(client: &mut Client, era: u16) -> Result { - let query = BlockQuery::GetUTxOWhole; - let query = LedgerQuery::BlockQuery(era, query); - let query = Request::LedgerQuery(query); - let result = client.query(query).await?; - - Ok(result) -} diff --git a/pallas-network/src/miniprotocols/localstate/queries_v16/primitives.rs b/pallas-network/src/miniprotocols/localstate/queries_v16/primitives.rs deleted file mode 100644 index ea87768..0000000 --- a/pallas-network/src/miniprotocols/localstate/queries_v16/primitives.rs +++ /dev/null @@ -1,91 +0,0 @@ -// Material brought from `pallas-primitives` -// TODO: Refactor in order to avoid repetition. -pub use pallas_codec::utils::{Bytes, Nullable}; -pub use pallas_crypto::hash::Hash; - -use pallas_codec::minicbor::{self, Decode, Encode}; - -#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)] -pub struct PoolMetadata { - #[n(0)] - pub url: String, - - #[n(1)] - pub hash: PoolMetadataHash, -} - -pub type PoolMetadataHash = Hash<32>; - -pub type Port = u32; - -pub type IPv4 = Bytes; - -pub type IPv6 = Bytes; - -pub type DnsName = String; - -#[derive(Debug, PartialEq, Eq, Clone)] -pub enum Relay { - SingleHostAddr(Nullable, Nullable, Nullable), - SingleHostName(Nullable, DnsName), - MultiHostName(DnsName), -} - -// Move to `codec.rs`? -impl<'b, C> minicbor::decode::Decode<'b, C> for Relay { - fn decode(d: &mut minicbor::Decoder<'b>, ctx: &mut C) -> Result { - d.array()?; - let variant = d.u16()?; - - match variant { - 0 => Ok(Relay::SingleHostAddr( - d.decode_with(ctx)?, - d.decode_with(ctx)?, - d.decode_with(ctx)?, - )), - 1 => Ok(Relay::SingleHostName( - d.decode_with(ctx)?, - d.decode_with(ctx)?, - )), - 2 => Ok(Relay::MultiHostName(d.decode_with(ctx)?)), - _ => Err(minicbor::decode::Error::message( - "invalid variant id for Relay", - )), - } - } -} - -impl minicbor::encode::Encode for Relay { - fn encode( - &self, - e: &mut minicbor::Encoder, - ctx: &mut C, - ) -> Result<(), minicbor::encode::Error> { - match self { - Relay::SingleHostAddr(a, b, c) => { - e.array(4)?; - e.encode_with(0, ctx)?; - e.encode_with(a, ctx)?; - e.encode_with(b, ctx)?; - e.encode_with(c, ctx)?; - - Ok(()) - } - Relay::SingleHostName(a, b) => { - e.array(3)?; - e.encode_with(1, ctx)?; - e.encode_with(a, ctx)?; - e.encode_with(b, ctx)?; - - Ok(()) - } - Relay::MultiHostName(a) => { - e.array(2)?; - e.encode_with(2, ctx)?; - e.encode_with(a, ctx)?; - - Ok(()) - } - } - } -} diff --git a/pallas-network/tests/protocols.rs b/pallas-network/tests/protocols.rs index a7064c4..9d35359 100644 --- a/pallas-network/tests/protocols.rs +++ b/pallas-network/tests/protocols.rs @@ -1,9 +1,9 @@ use hex::FromHex; -use pallas_codec::utils::{AnyCbor, AnyUInt, Bytes, KeyValuePairs, Nullable, TagWrap}; +use pallas_codec::utils::{AnyCbor, AnyUInt, Bytes, KeyValuePairs, TagWrap}; use pallas_crypto::hash::Hash; use pallas_network::miniprotocols::localstate::queries_v16::{ - self, Addr, Addrs, ChainBlockNumber, Fraction, GenesisConfig, PoolMetadata, PoolParams, - RationalNumber, Relay, Snapshots, StakeAddr, Stakes, SystemStart, UnitInterval, Value, + self, Addr, Addrs, ChainBlockNumber, Fraction, GenesisConfig, RationalNumber, Snapshots, + StakeAddr, Stakes, SystemStart, UnitInterval, Value, }; use pallas_network::{ facades::{NodeClient, PeerClient, PeerServer}, @@ -23,11 +23,10 @@ use pallas_network::{ multiplexer::{Bearer, Plexer}, }; use std::{ - collections::{BTreeMap, BTreeSet}, + collections::BTreeSet, fs, net::{Ipv4Addr, SocketAddrV4}, path::Path, - str::FromStr, time::Duration, }; @@ -645,79 +644,6 @@ pub async fn local_state_query_server_and_client_happy_path() { // server receives query from client - let query: Vec = match server.statequery().recv_while_acquired().await.unwrap() { - ClientQueryRequest::Query(q) => q.unwrap(), - x => panic!( - "(While expecting `GetUTxOWhole`) \ - Unexpected message from client: {x:?}" - ), - }; - - // CBOR got from preprod node. Mind the stripped `8203`. - let cbor_query = Vec::::from_hex("8200820082068107").unwrap(); - - assert_eq!(query, cbor_query); - assert_eq!(*server.statequery().state(), localstate::State::Querying); - - let tx_hex = "1610F289E36C9D83C464F85A0AADD59101DDDB0E89592A92809D95D68D79EED9"; - let txbytes: [u8; 32] = hex::decode(tx_hex).unwrap().try_into().unwrap(); - let transaction_id_1 = Hash::from(txbytes); - let index_1 = AnyUInt::MajorByte(2); - let lovelace = AnyUInt::U32(12_419_537); - let values_1 = localstate::queries_v16::TransactionOutput::Legacy( - localstate::queries_v16::LegacyTransactionOutput { - address: Bytes::from( - hex::decode("60C0359EBB7D0688D79064BD118C99C8B87B5853E3AF59245BB97E84D2") - .unwrap(), - ), - amount: Value::Coin(lovelace), - datum_hash: None, - }, - ); - - let tx_hex = "A7BED2F5FCD72BA4CEFDA7C2CC94D119279A17D71BFFC4D90DD4272B93E8A88F"; - let txbytes: [u8; 32] = hex::decode(tx_hex).unwrap().try_into().unwrap(); - let transaction_id_2 = Hash::from(txbytes); - let index_2 = AnyUInt::MajorByte(0); - let lovelace = AnyUInt::U32(1_792_960); - let hex_datum = "D8799FD8799F1AE06755BBFF1B00000193B36BC9F0FF"; - let datum = hex::decode(hex_datum).unwrap().into(); - let tag = TagWrap::<_, 24>::new(datum); - let inline_datum = Some((1_u16, tag)); - let values_2 = localstate::queries_v16::TransactionOutput::Current( - localstate::queries_v16::PostAlonsoTransactionOutput { - address: Bytes::from( - hex::decode("603F2728EC78EF8B0F356E91A5662FF3124ADD324A7B7F5AEED69362F4") - .unwrap(), - ), - amount: Value::Coin(lovelace), - inline_datum, - script_ref: None, - }, - ); - - let utxos = KeyValuePairs::from(vec![ - ( - localstate::queries_v16::UTxO { - transaction_id: transaction_id_1, - index: index_1, - }, - values_1, - ), - ( - localstate::queries_v16::UTxO { - transaction_id: transaction_id_2, - index: index_2, - }, - values_2, - ), - ]); - - let result = AnyCbor::from_encode(localstate::queries_v16::UTxOWhole { utxo: utxos }); - server.statequery().send_result(result).await.unwrap(); - - // server receives query from client - let query: queries_v16::Request = match server.statequery().recv_while_acquired().await.unwrap() { ClientQueryRequest::Query(q) => q.into_decode().unwrap(), @@ -1074,33 +1000,6 @@ pub async fn local_state_query_server_and_client_happy_path() { assert_eq!(result, queries_v16::UTxOByAddress { utxo }); - let request = AnyCbor::from_encode(localstate::queries_v16::Request::LedgerQuery( - localstate::queries_v16::LedgerQuery::BlockQuery( - 6, - localstate::queries_v16::BlockQuery::GetUTxOWhole, - ), - )); - client.statequery().send_query(request).await.unwrap(); - - let result: Vec = client - .statequery() - .recv_while_querying() - .await - .unwrap() - .unwrap(); - - let utxo = Vec::::from_hex( - "81A28258201610F289E36C9D83C464F85A0AADD59101DDDB0E89592A92809D95D6\ - 8D79EED90282581D60C0359EBB7D0688D79064BD118C99C8B87B5853E3AF59245B\ - B97E84D21A00BD81D1825820A7BED2F5FCD72BA4CEFDA7C2CC94D119279A17D71B\ - FFC4D90DD4272B93E8A88F00A300581D603F2728EC78EF8B0F356E91A5662FF312\ - 4ADD324A7B7F5AEED69362F4011A001B5BC0028201D81856D8799FD8799F1AE067\ - 55BBFF1B00000193B36BC9F0FF", - ) - .unwrap(); - - assert_eq!(result, utxo); - let request = AnyCbor::from_encode(queries_v16::Request::LedgerQuery( queries_v16::LedgerQuery::BlockQuery(5, queries_v16::BlockQuery::GetCurrentPParams), )); @@ -1276,181 +1175,6 @@ pub async fn local_state_query_server_and_client_happy_path() { tokio::try_join!(client, server).unwrap(); } -#[cfg(unix)] -#[tokio::test] -pub async fn local_state_query_server_and_client_happy_path2() { - let server = tokio::spawn({ - async move { - // server setup - let socket_path = Path::new("node2.socket"); - - if socket_path.exists() { - fs::remove_file(socket_path).unwrap(); - } - - let listener = UnixListener::bind(socket_path).unwrap(); - - let mut server = pallas_network::facades::NodeServer::accept(&listener, 0) - .await - .unwrap(); - - // wait for acquire request from client - - let maybe_acquire = server.statequery().recv_while_idle().await.unwrap(); - - assert!(maybe_acquire.is_some()); - assert_eq!(*server.statequery().state(), localstate::State::Acquiring); - - server.statequery().send_acquired().await.unwrap(); - - assert_eq!(*server.statequery().state(), localstate::State::Acquired); - - // server receives query from client - - let query: Vec = match server.statequery().recv_while_acquired().await.unwrap() { - ClientQueryRequest::Query(q) => q.unwrap(), - x => panic!( - "While expecting `GetStakePoolParams`) \ - Unexpected message from client: {x:?}" - ), - }; - - // CBOR got from preprod node. Mind the stripped `82038200`. - let cbor_query = Vec::::from_hex( - "820082068211d9010281581cfdb5834ba06eb4baafd50550d2dc9b3742d2c52cc5ee65bf8673823b", - ) - .unwrap(); - - assert_eq!(query, cbor_query); - - assert_eq!(*server.statequery().state(), localstate::State::Querying); - - let pool_id: Bytes = - Vec::::from_hex("fdb5834ba06eb4baafd50550d2dc9b3742d2c52cc5ee65bf8673823b") - .unwrap() - .into(); - let operator = pool_id.clone(); - let vrf_keyhash = Vec::::from_hex( - "2A6A3D82278A554E9C1777C427BF0397FAF5CD7734900752D698E57679CC523F", - ) - .unwrap() - .into(); - let reward_account = - Vec::::from_hex("E01AEF81CBAB75DB2DE0FE3885332EBE67C34EB1ADBF43BB2408BA3981") - .unwrap() - .into(); - let pool_metadata: Nullable = Some(PoolMetadata { - url: "https://csouza.me/jp-pp.json".to_string(), - hash: Hash::<32>::from_str( - "C9623111188D0BF90E8305E40AA91A040D8036C7813A4ECA44E06FA0A1A893A6", - ) - .unwrap(), - }) - .into(); - let pool_params = PoolParams { - operator, - vrf_keyhash, - pledge: AnyUInt::U64(5_000_000_000), - cost: AnyUInt::U32(340_000_000), - margin: localstate::queries_v16::RationalNumber { - numerator: 3, - denominator: 40, - }, - reward_account, - pool_owners: BTreeSet::from([Bytes::from( - Vec::::from_hex("1AEF81CBAB75DB2DE0FE3885332EBE67C34EB1ADBF43BB2408BA3981") - .unwrap(), - )]) - .into(), - relays: vec![Relay::SingleHostName( - Some(3001).into(), - "preprod.junglestakepool.com".to_string(), - )], - pool_metadata, - }; - // The map is inside a (singleton) array - let result = AnyCbor::from_encode([BTreeMap::from([(pool_id, pool_params)])]); - - server.statequery().send_result(result).await.unwrap(); - - assert_eq!(*server.statequery().state(), localstate::State::Acquired); - - match server.statequery().recv_while_acquired().await.unwrap() { - ClientQueryRequest::Release => (), - x => panic!("unexpected message from client: {x:?}"), - }; - - let next_request = server.statequery().recv_while_idle().await.unwrap(); - - assert!(next_request.is_none()); - assert_eq!(*server.statequery().state(), localstate::State::Done); - } - }); - - let client = tokio::spawn(async move { - tokio::time::sleep(Duration::from_secs(1)).await; - - // client setup - let socket_path = "node2.socket"; - - let mut client = NodeClient::connect(socket_path, 0).await.unwrap(); - - // client sends acquire - - client - .statequery() - .send_acquire(Some(Point::Origin)) - .await - .unwrap(); - - client.statequery().recv_while_acquiring().await.unwrap(); - - assert_eq!(*client.statequery().state(), localstate::State::Acquired); - - // client sends a BlockQuery - - let pool_id1 = "fdb5834ba06eb4baafd50550d2dc9b3742d2c52cc5ee65bf8673823b"; - let pool_id1: Bytes = Vec::::from_hex(pool_id1).unwrap().into(); - let mut pools = BTreeSet::::new(); - pools.insert(pool_id1); - - let request = AnyCbor::from_encode(localstate::queries_v16::LedgerQuery::BlockQuery( - 6, - localstate::queries_v16::BlockQuery::GetStakePoolParams(pools.into()), - )); - - client.statequery().send_query(request).await.unwrap(); - - let result: Vec = client - .statequery() - .recv_while_querying() - .await - .unwrap() - .unwrap(); - // CBOR got from preprod node. - let pool_params_cbor = Vec::::from_hex( - "81a1581cfdb5834ba06eb4baafd50550d2dc9b3742d2c52cc5ee65bf8673823b8958\ - 1cfdb5834ba06eb4baafd50550d2dc9b3742d2c52cc5ee65bf8673823b58202a6a3d\ - 82278a554e9c1777c427bf0397faf5cd7734900752d698e57679cc523f1b00000001\ - 2a05f2001a1443fd00d81e82031828581de01aef81cbab75db2de0fe3885332ebe67\ - c34eb1adbf43bb2408ba3981d9010281581c1aef81cbab75db2de0fe3885332ebe67\ - c34eb1adbf43bb2408ba3981818301190bb9781b70726570726f642e6a756e676c65\ - 7374616b65706f6f6c2e636f6d82781c68747470733a2f2f63736f757a612e6d652f\ - 6a702d70702e6a736f6e5820c9623111188d0bf90e8305e40aa91a040d8036c7813a\ - 4eca44e06fa0a1a893a6", - ) - .unwrap(); - - assert_eq!(result, pool_params_cbor); - - client.statequery().send_release().await.unwrap(); - - client.statequery().send_done().await.unwrap(); - }); - - tokio::try_join!(client, server).unwrap(); -} - #[tokio::test] #[ignore] pub async fn txsubmission_server_and_client_happy_path_n2n() { diff --git a/pallas-primitives/Cargo.toml b/pallas-primitives/Cargo.toml index 56cb969..30dc0d3 100644 --- a/pallas-primitives/Cargo.toml +++ b/pallas-primitives/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-primitives" description = "Ledger primitives and cbor codec for the different Cardano eras" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" @@ -16,8 +16,8 @@ authors = [ [dependencies] hex = "0.4.3" log = "0.4.14" -pallas-crypto = { version = "=0.32.1", path = "../pallas-crypto" } -pallas-codec = { version = "=0.32.1", path = "../pallas-codec" } +pallas-crypto = { version = "=0.31.0", path = "../pallas-crypto" } +pallas-codec = { version = "=0.31.0", path = "../pallas-codec" } base58 = "0.2.0" bech32 = "0.9.0" serde = { version = "1.0.136", optional = true, features = ["derive"] } diff --git a/pallas-traverse/Cargo.toml b/pallas-traverse/Cargo.toml index f0d440e..6a1fc0b 100644 --- a/pallas-traverse/Cargo.toml +++ b/pallas-traverse/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-traverse" description = "Utilities to traverse over multi-era block data" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" @@ -11,10 +11,10 @@ readme = "README.md" authors = ["Santiago Carmuega "] [dependencies] -pallas-primitives = { version = "=0.32.1", path = "../pallas-primitives" } -pallas-addresses = { version = "=0.32.1", path = "../pallas-addresses" } -pallas-crypto = { version = "=0.32.1", path = "../pallas-crypto" } -pallas-codec = { version = "=0.32.1", path = "../pallas-codec" } +pallas-primitives = { version = "=0.31.0", path = "../pallas-primitives" } +pallas-addresses = { version = "=0.31.0", path = "../pallas-addresses" } +pallas-crypto = { version = "=0.31.0", path = "../pallas-crypto" } +pallas-codec = { version = "=0.31.0", path = "../pallas-codec" } hex = "0.4.3" thiserror = "1.0.31" paste = "1.0.14" diff --git a/pallas-traverse/src/block.rs b/pallas-traverse/src/block.rs index c03ad14..5c0ff71 100644 --- a/pallas-traverse/src/block.rs +++ b/pallas-traverse/src/block.rs @@ -183,7 +183,9 @@ impl<'b> MultiEraBlock<'b> { match self { MultiEraBlock::Byron(x) => { if let Some(up) = x.body.upd_payload.proposal.deref() { - let epoch = x.header.consensus_data.0.epoch; + // TODO: this might be horribly wrong, I'm assuming that the activation epoch + // for a Byron upgrade proposal is always current epoch + 1. + let epoch = x.header.consensus_data.0.epoch + 1; Some(MultiEraUpdate::Byron( epoch, Box::new(Cow::Owned(up.clone())), diff --git a/pallas-traverse/src/redeemers.rs b/pallas-traverse/src/redeemers.rs index 0c56576..5601e77 100644 --- a/pallas-traverse/src/redeemers.rs +++ b/pallas-traverse/src/redeemers.rs @@ -53,18 +53,6 @@ impl<'b> MultiEraRedeemer<'b> { } } - pub fn into_conway_deprecated(&self) -> Option { - match self { - Self::AlonzoCompatible(_) => None, - Self::Conway(x, y) => Some(conway::Redeemer { - tag: x.tag, - index: x.index, - data: y.data.clone(), - ex_units: y.ex_units, - }), - } - } - pub fn from_alonzo_compatible(redeemer: &'b alonzo::Redeemer) -> Self { Self::AlonzoCompatible(Box::new(Cow::Borrowed(redeemer))) } diff --git a/pallas-traverse/src/tx.rs b/pallas-traverse/src/tx.rs index e0a3440..21b1db4 100644 --- a/pallas-traverse/src/tx.rs +++ b/pallas-traverse/src/tx.rs @@ -199,9 +199,9 @@ impl<'b> MultiEraTx<'b> { /// Return inputs as expected for processing /// - /// To process inputs we need a set (no duplicates) and lexicographical - /// order (hash#idx). This function will take the raw inputs and apply a - /// sort following these requirements. + /// To process inputs we need a set (no duplicated) and lexicographical + /// order (hash#idx). This function will take the raw inputs and apply the + /// aforementioned cleanup changes. pub fn inputs_sorted_set(&self) -> Vec { let mut raw = self.inputs(); raw.sort_by_key(|x| x.lexicographical_key()); diff --git a/pallas-traverse/src/update.rs b/pallas-traverse/src/update.rs index e9d72f1..0604d2a 100644 --- a/pallas-traverse/src/update.rs +++ b/pallas-traverse/src/update.rs @@ -57,7 +57,7 @@ pub type DRepVotingThresholds = conway::DRepVotingThresholds; use crate::{Era, MultiEraUpdate}; impl<'b> MultiEraUpdate<'b> { - pub fn decode_for_era(era: Era, cbor: &[u8]) -> Result { + pub fn decode_for_era(era: Era, cbor: &'b [u8]) -> Result { match era { Era::Byron => { let (epoch, up) = minicbor::decode(cbor)?; diff --git a/pallas-txbuilder/Cargo.toml b/pallas-txbuilder/Cargo.toml index 2d32543..3f7dfe6 100644 --- a/pallas-txbuilder/Cargo.toml +++ b/pallas-txbuilder/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-txbuilder" description = "An ergonomic Cardano transaction builder" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" @@ -11,12 +11,12 @@ readme = "README.md" authors = ["Santiago Carmuega ", "Cainã Costa "] [dependencies] -pallas-codec = { path = "../pallas-codec", version = "=0.32.1" } -pallas-crypto = { path = "../pallas-crypto", version = "=0.32.1" } -pallas-primitives = { path = "../pallas-primitives", version = "=0.32.1" } -pallas-traverse = { path = "../pallas-traverse", version = "=0.32.1" } -pallas-addresses = { path = "../pallas-addresses", version = "=0.32.1" } -pallas-wallet = { path = "../pallas-wallet", version = "=0.32.1" } +pallas-codec = { path = "../pallas-codec", version = "=0.31.0" } +pallas-crypto = { path = "../pallas-crypto", version = "=0.31.0" } +pallas-primitives = { path = "../pallas-primitives", version = "=0.31.0" } +pallas-traverse = { path = "../pallas-traverse", version = "=0.31.0" } +pallas-addresses = { path = "../pallas-addresses", version = "=0.31.0" } +pallas-wallet = { path = "../pallas-wallet", version = "=0.31.0" } serde = { version = "1.0.188", features = ["derive"] } serde_json = "1.0.107" thiserror = "1.0.44" diff --git a/pallas-utxorpc/Cargo.toml b/pallas-utxorpc/Cargo.toml index ff0f5e1..0b87199 100644 --- a/pallas-utxorpc/Cargo.toml +++ b/pallas-utxorpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-utxorpc" description = "Pallas interoperability with the UTxORPC spec" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" @@ -12,16 +12,16 @@ authors = ["Santiago Carmuega "] [dependencies] # utxorpc-spec = { path = "../../../utxorpc/spec/gen/rust" } -utxorpc-spec = { version = "0.15.0" } +utxorpc-spec = { version = "0.14.0" } -pallas-traverse = { version = "=0.32.1", path = "../pallas-traverse" } -pallas-primitives = { version = "=0.32.1", path = "../pallas-primitives" } -pallas-codec = { version = "=0.32.1", path = "../pallas-codec" } -pallas-crypto = { version = "=0.32.1", path = "../pallas-crypto" } +pallas-traverse = { version = "=0.31.0", path = "../pallas-traverse" } +pallas-primitives = { version = "=0.31.0", path = "../pallas-primitives" } +pallas-codec = { version = "=0.31.0", path = "../pallas-codec" } +pallas-crypto = { version = "=0.31.0", path = "../pallas-crypto" } prost-types = "0.13.1" # TODO: remove this dep once we have multiera params in traverse -pallas-applying = { version = "=0.32.1", path = "../pallas-applying" } +pallas-applying = { version = "=0.31.0", path = "../pallas-applying" } [dev-dependencies] hex = "0.4.3" diff --git a/pallas-wallet/Cargo.toml b/pallas-wallet/Cargo.toml index 28e0376..442c01c 100644 --- a/pallas-wallet/Cargo.toml +++ b/pallas-wallet/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas-wallet" description = "Cardano wallet utilities such as key generation" -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" @@ -12,7 +12,7 @@ authors = ["Santiago Carmuega "] [dependencies] thiserror = "1.0.49" -pallas-crypto = { version = "=0.32.1", path = "../pallas-crypto" } +pallas-crypto = { version = "=0.31.0", path = "../pallas-crypto" } ed25519-bip32 = "0.4.1" bip39 = { version = "2.0.0", features = ["rand_core"] } cryptoxide = "0.4.4" diff --git a/pallas/Cargo.toml b/pallas/Cargo.toml index 5b8c92d..9256369 100644 --- a/pallas/Cargo.toml +++ b/pallas/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "pallas" description = "Rust-native building blocks for the Cardano blockchain ecosystem." -version = "0.32.1" +version = "0.31.0" edition = "2021" repository = "https://github.com/txpipe/pallas" homepage = "https://github.com/txpipe/pallas" @@ -11,18 +11,18 @@ readme = "../README.md" authors = ["Santiago Carmuega "] [dependencies] -pallas-network = { version = "=0.32.1", path = "../pallas-network/" } -pallas-primitives = { version = "=0.32.1", path = "../pallas-primitives/" } -pallas-traverse = { version = "=0.32.1", path = "../pallas-traverse/" } -pallas-addresses = { version = "=0.32.1", path = "../pallas-addresses/" } -pallas-crypto = { version = "=0.32.1", path = "../pallas-crypto/" } -pallas-codec = { version = "=0.32.1", path = "../pallas-codec/" } -pallas-utxorpc = { version = "=0.32.1", path = "../pallas-utxorpc/" } -pallas-configs = { version = "=0.32.1", path = "../pallas-configs/" } -pallas-txbuilder = { version = "=0.32.1", path = "../pallas-txbuilder/" } -pallas-applying = { version = "=0.32.1", path = "../pallas-applying/", optional = true } -pallas-wallet = { version = "=0.32.1", path = "../pallas-wallet/", optional = true } -pallas-hardano = { version = "=0.32.1", path = "../pallas-hardano/", optional = true } +pallas-network = { version = "=0.31.0", path = "../pallas-network/" } +pallas-primitives = { version = "=0.31.0", path = "../pallas-primitives/" } +pallas-traverse = { version = "=0.31.0", path = "../pallas-traverse/" } +pallas-addresses = { version = "=0.31.0", path = "../pallas-addresses/" } +pallas-crypto = { version = "=0.31.0", path = "../pallas-crypto/" } +pallas-codec = { version = "=0.31.0", path = "../pallas-codec/" } +pallas-utxorpc = { version = "=0.31.0", path = "../pallas-utxorpc/" } +pallas-configs = { version = "=0.31.0", path = "../pallas-configs/" } +pallas-txbuilder = { version = "=0.31.0", path = "../pallas-txbuilder/" } +pallas-applying = { version = "=0.31.0", path = "../pallas-applying/", optional = true } +pallas-wallet = { version = "=0.31.0", path = "../pallas-wallet/", optional = true } +pallas-hardano = { version = "=0.31.0", path = "../pallas-hardano/", optional = true } [features] hardano = ["pallas-hardano"]