Commit graph

45 commits

Author SHA1 Message Date
Santiago Carmuega
b483b3a17a chore: apply new lint warnings from latest clippy (#561) 2024-12-14 17:37:33 -03:00
Santiago Carmuega
a29a6cf50f feat(txbuilder): compute ScriptDataHash including edge cases (#525)
Co-authored-by: kalomaaan <kalomaaan@gmail.com>
2024-10-22 22:20:58 -03:00
Matthias Benkort
6b667c78a3 refactor: Re-organize and clean-up pallas-primitives (#523)
* Re-organize and clean-up pallas-primitives

  Namely:

  - Move _common_ (i.e. era-independent) types and structures up to the
    `lib` module; to be shared across all eras. If any of those deviate
    in a subsequent era, it is easy to bring them down and define new
    types from the point of divergence onward. This simplifies the scope
    of each era-specific module and make them slightly easier to
    navigate.

    Note that, each era module still re-export all of the common types
    that's relevant to that particular era. So technically, this
    reorganization doesn't really change anything for callers/users of
    the library.

  - Rename `Scripthash` to `ScriptHash`. Before this commit, both
    actually existed as `ScriptHash` was introduced with the Conway era.
    Yet, they refer to the same thing, so the duplication is simply
    confusing.

  - Rename `One` / `Two` constructors for `NetworkId` to `Testnet` and
    `Mainnet` respectively. Also defined idiomatic `From` & `TryFrom`
    implementation for conversion to and from `u8`. This is a lot let
    confusing!

  - Generalize `PlutusScript` with a constant generic, to avoid
    repetition for each plutus script generated for specific version.
    Note that a distinction is still _necessary_ if we want to provie
    out-of-the-box serialisers for Plutus scripts, which are serialised
    with a tag prefix depending on the language. All else apart, they
    are strictly similar types.

  - Rename `CostMdls` to `CostModels`. Because, common.

  - Rename `plutus_script` to `plutus_v1_script` in the Alonzo's witness
    set, for consistency with other eras.

* Fix ordering of ScriptHash variants.

  This is an odd one. See the note.

* Bump minicbor to v0.25.1

* Add aliases with deprecation warnings to various fields and types.

* revert renaming plutus_script to plutus_v1_script in Alonzo witness

  See https://github.com/txpipe/pallas/pull/523#discussion_r1807329742
2024-10-22 08:57:21 -03:00
Andrew Westberg
de923dc004 feat(crypto): add extra types and conversions (#517) 2024-10-04 08:37:36 -03:00
Santiago Carmuega
cd2fd2b639 feat(codec): improve KeyValuePairs ergonomics (#515) 2024-10-01 09:00:23 -03:00
Harper
67f8b4bc9a fix(primitives): skip nonempty invariant check (#506) 2024-08-25 11:44:35 -03:00
Matthias Benkort
afc93b2c3c fix(traverse): use Conway types in places they are meant to (#499) 2024-08-08 08:33:10 -03:00
Alexsander Falcucci
9e7cafbcac feat(network): implement GetChainBlockNo local state query (#441) 2024-04-16 09:27:23 -03:00
Harper
0c84dc4983 feat: add Conway 2024-03 CDDL conformity (#424) 2024-04-01 14:02:52 -03:00
Santiago Carmuega
ce8eac735b fix(primitives): contemplate Conway's CBOR set tag (#421)
Co-authored-by: jmhrpr <25673452+jmhrpr@users.noreply.github.com>
2024-03-08 19:32:03 -03:00
Santiago Carmuega
90432bf556 chore: fix new lint warnings (#400) 2024-02-11 17:56:22 -03:00
Matthias Benkort
0b1e5f0231 fix(codec): Fix flat encoding and decoding of arbitrarily size integers (#378)
This commits fixes the flat encoding and decoding (and consequently,
  the zigzag) for large integers in the following ways:

  - It removes support for encoding and decoding i128 values.

  - It optionally (feature = "num-bigint") introduces encoding and
    decoding of large sized integers through the num-bigint::BigInt
    type.

  Without the feature enabled, it is still possible to encode and decode
  isize values; but the use of i128 is now prohibited (as it would
  overflow on boundaries) in favor of arbitrarily sized integers.

  The commit also introduces a missing property roundtrip for encoding
  and decoding large integers, which was missing and thus, failed to
  identify the overflow problem.

  See related issue: https://github.com/aiken-lang/aiken/issues/796
2024-01-13 10:09:16 -03:00
Alexsander Falcucci
27f1b3af24 feat(network): implement GetUTxOByAddress local state query (#341) 2023-12-12 09:31:46 -03:00
Alexsander Falcucci
b1ac003716 feat(network): implement stake distribution local state query (#340) 2023-11-24 06:43:25 -03:00
Santiago Carmuega
fdbdcc3a4f chore: fix lint warnings (#330) 2023-11-13 17:00:00 -03:00
Santiago Carmuega
1dc4d7e19d feat(codec): add utility for untyped CBOR fragments (#327) 2023-11-09 18:22:42 -03:00
Maico Leberle
5391a037d6 feat: scaffold Byron phase-1 validations (#300)
Co-authored-by: Santiago Carmuega <santiago@carmuega.me>
2023-10-10 17:16:26 -03:00
Lucas
11687d7f85 feat: Move flat en/de from aiken to pallas (#303)
Nothing new is going on within the code itself.
I simply popped the crate into pallas_codec
as a submodule `pallas_codec::flat`. I also moved
over the tests that we had in the crate. In general
this is in solid shape and hasn't had any changes for
months. That said there could be some things that require love
like dealing with BigInt.

Co-authored-by: Kasey White <kwhitemsg@gmail.com>
2023-10-04 19:08:52 -04:00
Santiago Carmuega
5a3246eb3c feat: add helper to create bootstrap addresses (#269) 2023-07-29 18:15:00 -03:00
Mitchell Turner
6ac63a04e2 feat(addresses): Derive Hash on Address (#235)
authored-by: Turner <mitch@tpfs.io>
2023-03-14 18:10:55 -03:00
Santiago Carmuega
6a3679dcda feat(miniprotocols): Implement tx submission client (#220)
* feat(miniprotocols): Implement tx submission client

* Match CDDL specs

* Fix build errors

* Add server implementation for txsubmission

Also includes some documentation for how to use both the client and the server

* cargo fmt

* clippy suggestions

clippy pls

* Fail explicitly on missing n2c unix socket

---------

Co-authored-by: Pi Lanningham <pi@sundaeswap.finance>
2023-02-03 20:38:12 -05:00
Santiago Carmuega
cd0212e5dc fix: Provide original hash for inline datum (#221) 2023-02-03 14:58:39 -03:00
Harper
8480c4502f fix: use PlutusBytes to encode BigUInt/BigNInt (#216) 2023-01-25 21:15:55 -03:00
Santiago Carmuega
8cfc6129b2 feat(miniprotocols): Introduce tracing (#214) 2022-12-20 14:31:43 -03:00
Karol Ochman-Milarski
dadb39de43 fix: Match CBOR encoding of plutus data with the haskell implementation. (#212)
* Add failing cbor rountrip test
* Encode lists like haskell does
* Encode plutus data bytestrings as haskell does

That is:
 - as bytestring for up to 64 bytes length
 - as an indefinite bytestring made of 64 byte chunks, last one can be shorter
2022-12-14 21:20:11 -03:00
Lucas
32c05c6ff7 feat: Provide access to all assets at a tx out (#180) 2022-09-16 17:53:45 -03:00
Santiago Carmuega
4dc373335f feat(primitives): Preserve order of map structures (#192) 2022-09-14 15:00:53 -03:00
Santiago Carmuega
f75d9aff9f fix(codec): Make Int struct copy (#170) 2022-08-13 10:51:03 -03:00
Santiago Carmuega
9845fc4040 feat(primitives): Enable serde of ledger structs (#169) 2022-08-12 19:43:56 -03:00
Santiago Carmuega
8f38834a1d fix(primitives): Force CBOR null primitive for missing aux data (#159) 2022-08-05 07:26:06 -03:00
Santiago Carmuega
e42341c653 fix(addresses): Fix Byron cbor structure (#155)
* Use correct CBOR struct for Byron addresses
* Implement universal to / from string that works across all eras
2022-07-23 08:18:53 -03:00
Santiago Carmuega
33c6152f19 feat(traverse): Introduce new accessor methods (#152) 2022-07-16 19:31:27 -03:00
Santiago Carmuega
9e22c842cd feat(traverse): Integrate address library (#149) 2022-07-04 18:06:14 -03:00
Santiago Carmuega
4e08620bc4 feat: Add Vasil / Babbage compatibility (#126)
* feat: Bump n2n protocol versions for Babbage (#125)
* feat: Allow a specified timeout on tcp connection (#127)
* feat: Add Babbage primitives (#128)
* fix: Inaccurate header-body CDDL (#129)
* fix: Babbage CBOR codec issues (#130)
* feat: Include Babbage in traverse lib
* Parse Babbage headers (#131)
* Add Babbage nonce/leader vrf extension (#132)

Co-authored-by: Andrew Westberg <andrewwestberg@gmail.com>
2022-06-20 22:09:42 -03:00
Santiago Carmuega
e67da5e7ef feat: Implement common traverse iterators (#119) 2022-06-14 13:47:11 -03:00
Santiago Carmuega
6913efef78 feat: Introduce 'traverse' library (#117) 2022-06-12 19:09:33 -03:00
Santiago Carmuega
4ea3e134c0 feat: Add mechanism to retain original CBOR (#110) 2022-06-03 21:43:18 -03:00
Santiago Carmuega
3260abcb98 chore(deps): Upgrade to minicbor 0.17 (breaking changes) (#109) 2022-06-02 09:49:55 -03:00
Santiago Carmuega
1c214ac72f feat: Implement Plutus Data hashing / JSON (#100) 2022-04-29 10:36:02 -03:00
Santiago Carmuega
5c6979d3e5 fix: Use correct struct for metadatum labels (#96) 2022-04-27 20:19:56 -03:00
Santiago Carmuega
7fb7860602 feat(primitives): Implement length-preserving uints (#92) 2022-04-25 23:04:07 -03:00
Santiago Carmuega
3234523c83 fix(miniprotocols): Handle regression related to multi-msg payloads (#76) 2022-03-16 18:17:10 -03:00
Santiago Carmuega
f543e9828c fix(primitives): Handle very BigInt in plutus data (#75) 2022-03-16 09:20:22 -03:00
Santiago Carmuega
3eb064502c feat: Use DecodeOwned for improved ergonomic (#74) 2022-03-14 18:27:00 -03:00
Santiago Carmuega
43c3cbd457 feat: Introduce shared codec lib (#71)
closes #65
2022-03-13 09:37:08 -03:00