Skip to content

Commit

Permalink
Update for new Control Datum
Browse files Browse the repository at this point in the history
  • Loading branch information
MicroProofs committed Jan 19, 2025
1 parent 51992f2 commit ea760bd
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 103 deletions.
4 changes: 2 additions & 2 deletions aiken.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ requirements = []
source = "github"

[etags]
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1737196931, nanos_since_epoch = 830992000 }, "e594326795accb687e9bfacd6a0553eb1d611ba23d5bba31b49ec7fe29445e3c"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1737196930, nanos_since_epoch = 558531000 }, "9191378e1310dcd34d3f8a883f67fb6440c5535897e210e84ba90ec207b884fc"]
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1737279884, nanos_since_epoch = 297901000 }, "e594326795accb687e9bfacd6a0553eb1d611ba23d5bba31b49ec7fe29445e3c"]
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1737279883, nanos_since_epoch = 489311000 }, "9191378e1310dcd34d3f8a883f67fb6440c5535897e210e84ba90ec207b884fc"]
10 changes: 5 additions & 5 deletions aiken.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ one_shot_output_index = 0
namespace = "Bullet"

[config.preview.bullet_hash]
bytes = "04451f9d70975d2128329476fc63bd749a886a258b2cfd476a5b7892"
bytes = "3e8b3d0bda81efcd1ce86d17b7764e55551cec6783f90bbc31069d69"
encoding = "hex"

[config.preview.nonce_bullet_hash]
bytes = "79ab8797c0988e4ed9bcabedf640d539ca2ab21e6a8a490cbf5fcdf8"
bytes = "881020a2a9c9aa047340db4592b3062e9fe1324e8460f311f433dcb0"
encoding = "hex"

[config.preview.proxy_hash]
bytes = "a0000e3a816eb367643bab13b1116b5d6be99903394d2904a6c57974"
bytes = "b04621841bec49b38d231d3edb83d09dd385a81903927e467185f101"
encoding = "hex"

[config.preview.stake_proxy_hash]
bytes = "34d23ef5bf59a02eb666111fcd6e64b964a4d7af16f35e7c00b584ab"
bytes = "ef3324c70e3bc2112f26d379c11fd68c5b3133b1840b778e4c243b39"
encoding = "hex"

[config.preview.new_user_tx_hash]
bytes = "b56638585097321a13916b66733e7be0599e3954f95e747a601646fe30f19203"
bytes = "7cf13461c8d12b585e63be1a1719c4d60468182f3d19d30ac732c624f0fb4323"
encoding = "hex"

[config.preview.one_shot_tx_hash]
Expand Down
148 changes: 74 additions & 74 deletions plutus.json

Large diffs are not rendered by default.

43 changes: 28 additions & 15 deletions src/bulletTypes.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { Data } from "@lucid-evolution/lucid";

export const BulletRedeemerSchema = Data.Object({});

export type BulletRedeemerType = Data.Static<typeof BulletRedeemerSchema>;
export const BulletRedeemerType =
BulletRedeemerSchema as unknown as BulletRedeemerType;

export const SecpSchema = Data.Object({
Secp: Data.Tuple([Data.Bytes({ minLength: 33, maxLength: 33 })]),
});
Expand All @@ -17,12 +11,25 @@ export const SchnorrSchema = Data.Object({
export const VkSchema = Data.Enum([SecpSchema, SchnorrSchema]);

export const VerificationSchema = Data.Object({
Verification: Data.Tuple([
Data.Map(
Verification: Data.Object({
ed25519_keys: Data.Map(
Data.Bytes({ minLength: 28, maxLength: 28 }),
Data.Bytes({ minLength: 32, maxLength: 32 }),
),
]),
other_keys: Data.Array(VkSchema),
hot_quorum: Data.Integer({ minimum: 1 }),
wallet_quorum: Data.Integer({ minimum: 1 }),
}),
});

export const ColdVerificationSchema = Data.Object({
ColdVerification: Data.Object({
ed25519_keys: Data.Map(
Data.Bytes({ minLength: 28, maxLength: 28 }),
Data.Bytes({ minLength: 32, maxLength: 32 }),
),
other_keys: Data.Array(VkSchema),
}),
});

export const VerificationKeySchema = Data.Object({
Expand All @@ -42,18 +49,24 @@ export const WithdrawalSchema = Data.Object({
Withdrawal: Data.Tuple([CredentialSchema]),
});

export const BulletCredentialSchema = Data.Enum([
export const ColdWithdrawalSchema = Data.Object({
ColdWithdrawal: Data.Tuple([CredentialSchema]),
});

export const HotBulletCredentialSchema = Data.Enum([
VerificationSchema,
WithdrawalSchema,
]);

export const ColdBulletCredentialSchema = Data.Enum([
ColdVerificationSchema,
ColdWithdrawalSchema,
]);

export const ControlSchema = Data.Object({
Control: Data.Object({
quorum: Data.Integer(),
hotCred: Data.Array(VkSchema),
hotCredHash: BulletCredentialSchema,
coldCred: Data.Array(VkSchema),
coldCredHash: BulletCredentialSchema,
hotCred: HotBulletCredentialSchema,
coldCred: ColdBulletCredentialSchema,
}),
});

Expand Down
20 changes: 13 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,20 @@ async function setupBullet() {

const controlDatum: BulletDatumType = {
Control: {
quorum: 1n,
hotCred: [],
hotCredHash: {
Verification: [new Map([[userPayCred.hash, userPublicKey]])],
hotCred: {
Verification: {
ed25519_keys: new Map([[userPayCred.hash, userPublicKey]]),
other_keys: [],
hot_quorum: 1n,
wallet_quorum: 1n,
},
},
coldCred: [],
coldCredHash: {
Verification: [new Map([[userPayCred.hash, userPublicKey]])],

coldCred: {
ColdVerification: {
ed25519_keys: new Map([[userPayCred.hash, userPublicKey]]),
other_keys: [],
},
},
},
};
Expand Down

0 comments on commit ea760bd

Please sign in to comment.