* 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
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
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>
* 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>
* 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