Skip to content

Commit

Permalink
fix isGenesisInfos
Browse files Browse the repository at this point in the history
  • Loading branch information
michele-nuzzi committed Jun 18, 2024
1 parent 76bd02d commit 5d4cc6c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
5 changes: 3 additions & 2 deletions packages/offchain/src/TxBuilder/GenesisInfos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export function isGenesisInfos( stuff: any ): stuff is GenesisInfos
hasOwn( stuff, "slotLengthMs" ) &&
canBeUInteger( stuff.slotLengthMs )
)) && (
hasOwn( stuff, "startSlotNo" ) &&
canBeUInteger( stuff.startSlotNo )
hasOwn( stuff, "startSlotNo" ) ?
canBeUInteger( stuff.startSlotNo ) :
true
)

);
Expand Down
14 changes: 14 additions & 0 deletions packages/offchain/src/TxBuilder/__tests__/isGenesisInfos.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { isGenesisInfos, normalizedGenesisInfos } from "../GenesisInfos";

describe("isGenesisInfos", () => {

test("deprecated gInfos", () => {
const gInfos = {
systemStartPOSIX: 1666656000_000,
slotLengthInMilliseconds: 1000
};

expect( isGenesisInfos( gInfos ) ).toBe( true );

})
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fromAscii, fromHex } from "@harmoniclabs/uint8array-utils";
import { Address, Hash28, Script, TxOut, TxOutRef, UTxO, Value, defaultProtocolParameters } from "@harmoniclabs/cardano-ledger-ts";
import { DataConstr, DataI, dataFromCbor } from "@harmoniclabs/plutus-data";
import { PTokenName, PAssetsEntry, PCredential, PCurrencySymbol, PData, PExtended, PInt, PScriptContext, PScriptPurpose, PTxInfo, PTxOut, PTxOutRef, PType, PUnit, PValue, PValueEntry, Term, TermFn, TermList, bool, bs, data, delayed, fn, int, lam, list, pBSToData, pBool, pData, pDataI, pInt, pIntToData, pList, pListToData, pchooseList, pdelay, peqData, perror, pfn, pforce, phoist, pif, pindexBs, pisEmpty, plam, plet, pmakeUnit, pmatch, pmatchList, pnilData, precursive, pserialiseData, psha2_256, pstrictIf, pstruct, psub, ptrace, ptraceError, ptraceVal, punBData, punIData, punsafeConvertType, str, termTypeToString, unit } from "../../../onchain/src/pluts";
import { TxBuilder } from "..";
import { TxBuilder, defaultMainnetGenesisInfos } from "..";

const master_tn = PTokenName.from( fromAscii("itamae") );

Expand Down
1 change: 0 additions & 1 deletion packages/onchain/src/IR/IRNodes/IRLetted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ export class IRLetted
Object.defineProperty(
this, "hash", {
get: () => {
++n_hash_access > 6300 && console.log("n_hash_access", n_hash_access);
if(!( hash instanceof Uint8Array ))
{
const normalized = getNormalizedLettedArgs( this.dbn, _value );
Expand Down
4 changes: 0 additions & 4 deletions packages/onchain/src/IR/toUPLC/compileIRToUPLC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ export function compileIRToUPLC( term: IRTerm ): UPLCTerm
// ------------------------------------------------------------------------- //
///////////////////////////////////////////////////////////////////////////////

console.log(
prettyIR( term )
);

term = replaceNativesAndReturnRoot( term );

replaceClosedLettedWithHoisted( term );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ describe("builtin bench", () => {

const machine = new Machine( defaultV3Costs );

console.log( defaultV3Costs );

const _ifTerm = (
pif( int ).$( pBool( true ) )
.$( 1 )
Expand Down

0 comments on commit 5d4cc6c

Please sign in to comment.