Skip to content

Conversation

@bleepbloopsify
Copy link
Contributor

@bleepbloopsify bleepbloopsify commented Nov 5, 2025

Moving from OCaml local ledger to JS local ledger

@bleepbloopsify bleepbloopsify force-pushed the leon/reimpl-local-ledger branch from 3bc3feb to 2bf4a1a Compare November 5, 2025 20:09
@bleepbloopsify bleepbloopsify force-pushed the leon/reimpl-local-ledger branch from 49d049e to cf81984 Compare November 14, 2025 18:47
await txn.sign([feePayer1.key]).send();
} catch (err: any) {
handleError(err, 'Account_delegate_precondition_unsatisfied');
handleError(err, 'delegate precondition');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this breaks when using the local ledger because our error messages are slightly different. This is probably bad :((

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this should actually be fine! Because we also want to improve the error messages and overall error handling. That being said, we should be able to make the error messages "backwards compatible" via something like this throw Error('Account_delegate_precondition_unsatisfied: ....');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only sorting imports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we actually lose some information during the

v1 -> v2 -> v1 transformation :((

the timing field has a boolean in it that isn't transferred around, and zkappversion and lastActionSlot are lost as well :(((((

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can change the logic of the transformation, should be fine since its not finished yet and under experimental anyway

@bleepbloopsify
Copy link
Contributor Author

bleepbloopsify commented Nov 14, 2025

Status quo: not yet checking account balance underflowing quite yet

our add function was all sorts of wrong

@bleepbloopsify bleepbloopsify force-pushed the leon/reimpl-local-ledger branch from cf81984 to 0a37c9c Compare November 14, 2025 22:38
@bleepbloopsify
Copy link
Contributor Author

Status quo: verification key hash does not match, nor does the isNew field of the AccountV2

removed both checks from applytransaction, everything else seems to work

checkPrecondition<PublicKey>('delegate', preconditions.account.delegate, account.delegate);
checkPrecondition<Bool>('isProven', preconditions.account.isProven, account.zkapp.isProven);
checkPrecondition<Bool>('isNew', preconditions.account.isNew, new Bool(account.isNew.get()));
// checkPrecondition<Bool>('isNew', preconditions.account.isNew, new Bool(account.isNew.get()));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logic is a little iffy here, something is a bit strange, needs to be investigated

Comment on lines +342 to +347
// if (!account.zkapp.verificationKey.hash.equals(update.verificationKeyHash).toBoolean())
// errors.push(
// new Error(
// `account verification key does not match account update's verification key (account has ${account.zkapp.verificationKey.hash}, account update referenced ${update.verificationKeyHash})`
// )
// );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the verification key hash isn't lining up either, something is weird

@bleepbloopsify
Copy link
Contributor Author

hmm, account deployment still broken

@Trivo25
Copy link
Member

Trivo25 commented Nov 17, 2025

hmm, account deployment still broken

If converting between v1 and v2 is too annoying we can just copy&paste the v2 transaction logic into v1 and make it v1 type compatible - thats fine as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants