Commit graph

44 commits

Author SHA1 Message Date
Santiago Carmuega
698d7a4933
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
969d5612b7
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
0ca7c34776
feat(crypto): add extra types and conversions (#517) 2024-10-04 08:37:36 -03:00
Santiago Carmuega
80d121d13a
feat(codec): improve KeyValuePairs ergonomics (#515) 2024-10-01 09:00:23 -03:00
Harper
7aa510389b
fix(primitives): skip nonempty invariant check (#506) 2024-08-25 11:44:35 -03:00
Matthias Benkort
5c18f06fa2
fix(traverse): use Conway types in places they are meant to (#499) 2024-08-08 08:33:10 -03:00
Alexsander Falcucci
97a32c9af5
feat(network): implement GetChainBlockNo local state query (#441) 2024-04-16 09:27:23 -03:00
Harper
c31e773ce2
feat: add Conway 2024-03 CDDL conformity (#424) 2024-04-01 14:02:52 -03:00
Santiago Carmuega
54997daf66
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
3dd00ad3cd
chore: fix new lint warnings (#400) 2024-02-11 17:56:22 -03:00
Matthias Benkort
7cb1ffe100
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
6f1b15269c
feat(network): implement GetUTxOByAddress local state query (#341) 2023-12-12 09:31:46 -03:00
Alexsander Falcucci
645989465d
feat(network): implement stake distribution local state query (#340) 2023-11-24 06:43:25 -03:00
Santiago Carmuega
f26b9bd591
chore: fix lint warnings (#330) 2023-11-13 17:00:00 -03:00
Santiago Carmuega
aae7d92b44
feat(codec): add utility for untyped CBOR fragments (#327) 2023-11-09 18:22:42 -03:00
Maico Leberle
986ee75761
feat: scaffold Byron phase-1 validations (#300)
Co-authored-by: Santiago Carmuega <santiago@carmuega.me>
2023-10-10 17:16:26 -03:00
Lucas
7fada705a0
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
e117a2723a
feat: add helper to create bootstrap addresses (#269) 2023-07-29 18:15:00 -03:00
Mitchell Turner
61f50b2cca
feat(addresses): Derive Hash on Address (#235)
authored-by: Turner <mitch@tpfs.io>
2023-03-14 18:10:55 -03:00
Santiago Carmuega
16d0211c5b
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
e600190107
fix: Provide original hash for inline datum (#221) 2023-02-03 14:58:39 -03:00
Harper
c6730340d0
fix: use PlutusBytes to encode BigUInt/BigNInt (#216) 2023-01-25 21:15:55 -03:00
Santiago Carmuega
c51580d042
feat(miniprotocols): Introduce tracing (#214) 2022-12-20 14:31:43 -03:00
Karol Ochman-Milarski
6fa936a998
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
bfc5a0a312
feat: Provide access to all assets at a tx out (#180) 2022-09-16 17:53:45 -03:00
Santiago Carmuega
2f7d108b53
feat(primitives): Preserve order of map structures (#192) 2022-09-14 15:00:53 -03:00
Santiago Carmuega
bfc46a7ccb
fix(codec): Make Int struct copy (#170) 2022-08-13 10:51:03 -03:00
Santiago Carmuega
2e95b7b33a
feat(primitives): Enable serde of ledger structs (#169) 2022-08-12 19:43:56 -03:00
Santiago Carmuega
60a6e99189
fix(primitives): Force CBOR null primitive for missing aux data (#159) 2022-08-05 07:26:06 -03:00
Santiago Carmuega
e7b76889bd
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
3ac707e486
feat(traverse): Introduce new accessor methods (#152) 2022-07-16 19:31:27 -03:00
Santiago Carmuega
758d6e2119
feat(traverse): Integrate address library (#149) 2022-07-04 18:06:14 -03:00
Santiago Carmuega
f67d36e7fa
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
00c9e1835e
feat: Implement common traverse iterators (#119) 2022-06-14 13:47:11 -03:00
Santiago Carmuega
26da913ad9
feat: Introduce 'traverse' library (#117) 2022-06-12 19:09:33 -03:00
Santiago Carmuega
59a3ac3b49
feat: Add mechanism to retain original CBOR (#110) 2022-06-03 21:43:18 -03:00
Santiago Carmuega
65a4468f46
chore(deps): Upgrade to minicbor 0.17 (breaking changes) (#109) 2022-06-02 09:49:55 -03:00
Santiago Carmuega
2c41c1756c
feat: Implement Plutus Data hashing / JSON (#100) 2022-04-29 10:36:02 -03:00
Santiago Carmuega
2d81664500
fix: Use correct struct for metadatum labels (#96) 2022-04-27 20:19:56 -03:00
Santiago Carmuega
016b76d747
feat(primitives): Implement length-preserving uints (#92) 2022-04-25 23:04:07 -03:00
Santiago Carmuega
1fbb4efeef
fix(miniprotocols): Handle regression related to multi-msg payloads (#76) 2022-03-16 18:17:10 -03:00
Santiago Carmuega
f9514a88e0
fix(primitives): Handle very BigInt in plutus data (#75) 2022-03-16 09:20:22 -03:00
Santiago Carmuega
3336d4d446
feat: Use DecodeOwned for improved ergonomic (#74) 2022-03-14 18:27:00 -03:00
Santiago Carmuega
187245a62f
feat: Introduce shared codec lib (#71)
closes #65
2022-03-13 09:37:08 -03:00