parent
9f263c46f8
commit
0e2b8ae251
|
@ -1,5 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
## UNRELEASED
|
||||
|
||||
### Fixed
|
||||
|
||||
- **aiken-lang**: Fix flat encoding and decoding of large integer values. @KtorZ
|
||||
|
||||
## v1.0.21-alpha - 2023-12-04
|
||||
|
||||
### Added
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,11 +25,11 @@ ignore = "0.4.20"
|
|||
indexmap = "1.9.2"
|
||||
itertools = "0.10.5"
|
||||
miette = { version = "5.9.0", features = ["fancy"] }
|
||||
minicbor = "0.19.1"
|
||||
notify = "6.1.1"
|
||||
owo-colors = { version = "3.5.0", features = ["supports-colors"] }
|
||||
pallas = "0.20.0"
|
||||
pallas-traverse = "0.20.0"
|
||||
pallas = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
pallas-traverse = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
pallas-codec = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
petgraph = "0.6.3"
|
||||
pulldown-cmark = { version = "0.9.2", default-features = false }
|
||||
rayon = "1.7.0"
|
||||
|
|
|
@ -4,8 +4,8 @@ use super::{
|
|||
};
|
||||
use aiken_lang::ast::Span;
|
||||
use miette::{Diagnostic, NamedSource};
|
||||
use minicbor as cbor;
|
||||
use owo_colors::{OwoColorize, Stream::Stdout};
|
||||
use pallas_codec::minicbor as cbor;
|
||||
use std::fmt::Debug;
|
||||
use uplc::ast::Constant;
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ ignore = "0.4.20"
|
|||
indoc = "2.0"
|
||||
miette = { version = "5.5.0", features = ["fancy"] }
|
||||
owo-colors = { version = "3.5.0", features = ["supports-colors"] }
|
||||
pallas-addresses = "0.20.0"
|
||||
pallas-codec = "0.20.0"
|
||||
pallas-crypto = "0.20.0"
|
||||
pallas-primitives = "0.20.0"
|
||||
pallas-traverse = "0.20.0"
|
||||
pallas-addresses = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
pallas-codec = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21", features = ["num-bigint"] } # 0.21.0 patched
|
||||
pallas-crypto = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
pallas-primitives = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
pallas-traverse = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
regex = "1.7.1"
|
||||
serde_json = "1.0.94"
|
||||
thiserror = "1.0.39"
|
||||
|
|
|
@ -20,11 +20,11 @@ miette = "5.5.0"
|
|||
num-bigint = "0.4.3"
|
||||
num-integer = "0.1.45"
|
||||
num-traits = "0.2.15"
|
||||
pallas-addresses = "0.20.0"
|
||||
pallas-codec = "0.20.0"
|
||||
pallas-crypto = "0.20.0"
|
||||
pallas-primitives = "0.20.0"
|
||||
pallas-traverse = "0.20.0"
|
||||
pallas-addresses = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
pallas-codec = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21", features = ["num-bigint"] } # 0.21.0 patched
|
||||
pallas-crypto = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
pallas-primitives = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
pallas-traverse = { git = "https://github.com/txpipe/pallas.git", rev = "7cb1ffe100befaa6236f14c14081961c44d6ad21" } # 0.21.0 patched
|
||||
peg = "0.8.1"
|
||||
pretty = "0.11.3"
|
||||
pretty_assertions = "1.3.0"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use std::{collections::VecDeque, fmt::Debug, rc::Rc};
|
||||
|
||||
use num_bigint::BigInt;
|
||||
use pallas_codec::flat::{
|
||||
de::{self, Decode, Decoder},
|
||||
en::{self, Encode, Encoder},
|
||||
Flat,
|
||||
};
|
||||
use pallas_primitives::{babbage::PlutusData, Fragment};
|
||||
use std::{collections::VecDeque, fmt::Debug, rc::Rc};
|
||||
|
||||
use crate::{
|
||||
ast::{
|
||||
|
@ -444,9 +444,6 @@ impl Encode for Constant {
|
|||
match self {
|
||||
Constant::Integer(i) => {
|
||||
encode_constant(&[0], e)?;
|
||||
|
||||
let i: i128 = i.try_into().unwrap();
|
||||
|
||||
i.encode(e)?;
|
||||
}
|
||||
|
||||
|
@ -521,11 +518,7 @@ impl Encode for Constant {
|
|||
|
||||
fn encode_constant_value(x: &Constant, e: &mut Encoder) -> Result<(), en::Error> {
|
||||
match x {
|
||||
Constant::Integer(x) => {
|
||||
let x: i128 = x.try_into().unwrap();
|
||||
|
||||
x.encode(e)
|
||||
}
|
||||
Constant::Integer(x) => x.encode(e),
|
||||
Constant::ByteString(b) => b.encode(e),
|
||||
Constant::String(s) => s.encode(e),
|
||||
Constant::Unit => Ok(()),
|
||||
|
@ -588,7 +581,7 @@ fn encode_type(typ: &Type, bytes: &mut Vec<u8>) {
|
|||
impl<'b> Decode<'b> for Constant {
|
||||
fn decode(d: &mut Decoder) -> Result<Self, de::Error> {
|
||||
match &decode_constant(d)?[..] {
|
||||
[0] => Ok(Constant::Integer(i128::decode(d)?.into())),
|
||||
[0] => Ok(Constant::Integer(BigInt::decode(d)?)),
|
||||
[1] => Ok(Constant::ByteString(Vec::<u8>::decode(d)?)),
|
||||
[2] => Ok(Constant::String(String::decode(d)?)),
|
||||
[3] => Ok(Constant::Unit),
|
||||
|
@ -653,7 +646,7 @@ impl<'b> Decode<'b> for Constant {
|
|||
|
||||
fn decode_constant_value(typ: Rc<Type>, d: &mut Decoder) -> Result<Constant, de::Error> {
|
||||
match typ.as_ref() {
|
||||
Type::Integer => Ok(Constant::Integer(i128::decode(d)?.into())),
|
||||
Type::Integer => Ok(Constant::Integer(BigInt::decode(d)?)),
|
||||
Type::ByteString => Ok(Constant::ByteString(Vec::<u8>::decode(d)?)),
|
||||
Type::String => Ok(Constant::String(String::decode(d)?)),
|
||||
Type::Unit => Ok(Constant::Unit),
|
||||
|
|
|
@ -8,7 +8,7 @@ use pallas_codec::utils::{KeyValuePairs, MaybeIndefArray};
|
|||
use pallas_crypto::hash::Hash;
|
||||
use pallas_primitives::babbage::{
|
||||
Certificate, CostMdls, DatumHash, DatumOption, ExUnits, Language, Mint, MintedTx, NativeScript,
|
||||
PlutusV1Script, PlutusV2Script, PolicyId, Redeemer, RedeemerTag, RewardAccount, Script,
|
||||
PlutusV1Script, PlutusV2Script, PolicyId, PseudoScript, Redeemer, RedeemerTag, RewardAccount,
|
||||
StakeCredential, TransactionInput, TransactionOutput, Value, Withdrawals,
|
||||
};
|
||||
use pallas_traverse::{ComputeHash, OriginalHash};
|
||||
|
@ -666,7 +666,10 @@ pub fn get_script_and_datum_lookup_table(
|
|||
}
|
||||
|
||||
for script in scripts_native_witnesses.iter() {
|
||||
scripts.insert(script.compute_hash(), ScriptVersion::Native(script.clone()));
|
||||
scripts.insert(
|
||||
script.compute_hash(),
|
||||
ScriptVersion::Native(script.clone().unwrap()),
|
||||
);
|
||||
}
|
||||
|
||||
for script in scripts_v1_witnesses.iter() {
|
||||
|
@ -685,13 +688,13 @@ pub fn get_script_and_datum_lookup_table(
|
|||
TransactionOutput::PostAlonzo(output) => {
|
||||
if let Some(script) = &output.script_ref {
|
||||
match &script.0 {
|
||||
Script::NativeScript(ns) => {
|
||||
PseudoScript::NativeScript(ns) => {
|
||||
scripts.insert(ns.compute_hash(), ScriptVersion::Native(ns.clone()));
|
||||
}
|
||||
Script::PlutusV1Script(v1) => {
|
||||
PseudoScript::PlutusV1Script(v1) => {
|
||||
scripts.insert(v1.compute_hash(), ScriptVersion::V1(v1.clone()));
|
||||
}
|
||||
Script::PlutusV2Script(v2) => {
|
||||
PseudoScript::PlutusV2Script(v2) => {
|
||||
scripts.insert(v2.compute_hash(), ScriptVersion::V2(v2.clone()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ use pallas_codec::utils::{AnyUInt, Bytes, Int, KeyValuePairs};
|
|||
use pallas_crypto::hash::Hash;
|
||||
use pallas_primitives::babbage::{AssetName, BigInt, Constr, Mint, PlutusData, ScriptRef};
|
||||
use pallas_primitives::babbage::{
|
||||
Certificate, DatumOption, Redeemer, Script, StakeCredential, TransactionInput,
|
||||
Certificate, DatumOption, PseudoScript, Redeemer, StakeCredential, TransactionInput,
|
||||
TransactionOutput, Value,
|
||||
};
|
||||
use pallas_traverse::ComputeHash;
|
||||
|
@ -276,10 +276,12 @@ impl ToPlutusData for MintValue {
|
|||
|
||||
impl ToPlutusData for ScriptRef {
|
||||
fn to_plutus_data(&self) -> PlutusData {
|
||||
match &self.0 {
|
||||
Script::NativeScript(native_script) => native_script.compute_hash().to_plutus_data(),
|
||||
Script::PlutusV1Script(plutus_v1) => plutus_v1.compute_hash().to_plutus_data(),
|
||||
Script::PlutusV2Script(plutus_v2) => plutus_v2.compute_hash().to_plutus_data(),
|
||||
match &self {
|
||||
PseudoScript::NativeScript(native_script) => {
|
||||
native_script.compute_hash().to_plutus_data()
|
||||
}
|
||||
PseudoScript::PlutusV1Script(plutus_v1) => plutus_v1.compute_hash().to_plutus_data(),
|
||||
PseudoScript::PlutusV2Script(plutus_v2) => plutus_v2.compute_hash().to_plutus_data(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +337,11 @@ impl ToPlutusData for TxOut {
|
|||
.to_plutus_data(),
|
||||
post_alonzo_output.value.to_plutus_data(),
|
||||
post_alonzo_output.datum_option.to_plutus_data(),
|
||||
post_alonzo_output.script_ref.to_plutus_data(),
|
||||
post_alonzo_output
|
||||
.script_ref
|
||||
.as_ref()
|
||||
.map(|s| s.clone().unwrap())
|
||||
.to_plutus_data(),
|
||||
],
|
||||
),
|
||||
},
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# This file was generated by Aiken
|
||||
# You typically do not need to edit this file
|
||||
|
||||
requirements = []
|
||||
packages = []
|
||||
|
||||
[etags]
|
|
@ -0,0 +1,2 @@
|
|||
name = "aiken-lang/acceptance_test_090"
|
||||
version = "0.0.0"
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"preamble": {
|
||||
"title": "aiken-lang/acceptance_test_090",
|
||||
"version": "0.0.0",
|
||||
"plutusVersion": "v2",
|
||||
"compiler": {
|
||||
"name": "Aiken",
|
||||
"version": "v1.0.21-alpha+9f263c4"
|
||||
}
|
||||
},
|
||||
"validators": [
|
||||
{
|
||||
"title": "foo.spend",
|
||||
"datum": {
|
||||
"title": "datum",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Int"
|
||||
}
|
||||
},
|
||||
"redeemer": {
|
||||
"title": "_redeemer",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Data"
|
||||
}
|
||||
},
|
||||
"compiledCode": "583f010000322223253330053370e00290487777c9cfdde5c8f27bf4c1637fc55b5eeef7d8c4d9e0d4454967ff7d6e7ee6e242eb60c6318a4c26cac6eb400d5cd1",
|
||||
"hash": "d18aa035514acb988a34d33fc246420c5b0eca4f3f947ce95e294447"
|
||||
}
|
||||
],
|
||||
"definitions": {
|
||||
"Data": {
|
||||
"title": "Data",
|
||||
"description": "Any Plutus data."
|
||||
},
|
||||
"Int": {
|
||||
"dataType": "integer"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
const foo =
|
||||
45898945895546556456546223123184821312385384845153123213185685815615232323484552
|
||||
|
||||
validator {
|
||||
fn spend(datum: Int, _redeemer: Data, _context: Data) {
|
||||
datum == foo
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue