Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(crypto-transaction): use RLP for serialization #800

Draft
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

sebastijankuzner
Copy link
Contributor

@sebastijankuzner sebastijankuzner commented Dec 12, 2024

Summary

Make transactions EVM compatible.

Checklist

  • Tests (if necessary)
  • Ready to be merged

@sebastijankuzner sebastijankuzner marked this pull request as ready for review December 13, 2024 12:10
@sebastijankuzner sebastijankuzner changed the title RLP WIP refactor(crypto-transaction): use RLP for serialization Dec 13, 2024
@@ -31,12 +31,12 @@ export const transactionBaseSchema: SchemaObject = {
network: { $ref: "networkByte" },

nonce: { bignumber: { minimum: 0 } },

r: { type: "string" }, // TODO: prefixed hex
Copy link
Contributor

Choose a reason for hiding this comment

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

limit length (64 or 65 with prefix)


if (!signature || !senderPublicKey) {
if (!v || !r || !s || !senderPublicKey) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If v can be 0 then this also evaluates to false. Double check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am using 27 & 28 values. 27 => false, 28 => true.

@@ -66,4 +67,75 @@ export const prepareSandbox = async (context) => {
context.sandbox.app.bind(Identifiers.Cryptography.Block.Deserializer).to(Deserializer);
context.sandbox.app.bind(Identifiers.Cryptography.Block.IDFactory).to(IDFactory);
context.sandbox.app.bind(Identifiers.Cryptography.Block.Factory).to(BlockFactory);

const builder = context.sandbox.app.resolve(EvmCallBuilder);
Copy link
Contributor

Choose a reason for hiding this comment

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

Code below just for debugging? (if so, can be removed)

@@ -120,18 +120,18 @@ describe<{
assert.string(block.serialized);
});

it("#fromData - should create a block with transactions instance from an object", async (context) => {
const block = await context.factory.fromData(blockDataWithTransactions);
it.skip("#fromData - should create a block with transactions instance from an object", async (context) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

All tests should be fixed instead of skipped (also remove .only)

@@ -270,7 +270,8 @@ export class Sync implements Contracts.ApiSync.Service {
senderAddress: data.senderAddress,
senderPublicKey: data.senderPublicKey,
sequence: data.sequence as unknown as number,
signature: data.signature,
// signature: data.signature,
Copy link
Contributor

Choose a reason for hiding this comment

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

We can concatenate the r,s,v components

@@ -273,7 +273,8 @@ export class Restore {
senderAddress: data.senderAddress,
senderPublicKey: data.senderPublicKey,
sequence: data.sequence as unknown as number,
signature: data.signature,
// signature: data.signature,
Copy link
Contributor

Choose a reason for hiding this comment

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

We can concatenate the r,s,v components

@oXtxNt9U
Copy link
Contributor

changing to draft to prevent accidental merge

@oXtxNt9U oXtxNt9U marked this pull request as draft December 18, 2024 05:07
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.

2 participants