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

Migrate to new account #762

Merged
merged 1 commit into from
Jan 20, 2025
Merged

Conversation

ryutamago
Copy link
Collaborator

@ryutamago ryutamago commented Jan 13, 2025

Context

This PR completes the migration to the new account type.
255
In the next step, NewAddress enums are replaced with SmartFunctionHash for parts that should only use sf(e.g. set_code, the self address of ledger, sf runtime api etc)

Description

Replaced the old Account with the new Account. the KT1 address is now supported.

Manually testing the PR

  • Added unit tests for smart function deployment.

  • Added unit tests for rejecting non KT1 address for adding sf alias

  • manually tested sf deployment and running.

cargo run --bin jstz -- deploy examples/counter.js --network dev
cargo run --bin jstz -- run tezos://KT1J6BkxBK96qQgJURrut4SJz65EQAA5vDhU/ --network dev --trace
  • manually tested account alias for sf
cargo run --bin jstz -- account alias counter_sf KT1J6BkxBK96qQgJURrut4SJz65EQAA5vDhU 

Added smart function: counter_sf -> KT1J6BkxBK96qQgJURrut4SJz65EQAA5vDhU
  • manually tested deposit / withdrawal to user acount
cargo run --bin jstz -- account create test

cargo run --bin jstz -- bridge deposit --from bootstrap1 --to test --amount 2 --network dev

cargo run --bin jstz -- account balance -a test --network dev

cargo run --bin jstz -- bridge withdraw --to tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx --amount 1 --network dev
  • manually tested deposit/withdraw to a KT1 address
cargo run --bin jstz -- bridge deposit --from bootstrap1 --to counter_sf --amount 2 --network dev

cargo run --bin jstz -- account balance -a counter_sf --network dev

argo run --bin jstz -- bridge withdraw --to KT1J6BkxBK96qQgJURrut4SJz65EQAA5vDhU --amount 1 --network dev
  • manually tested that adding sf alias is rejected for tz1 address
cargo run --bin jstz -- account alias sf tz1cmuyEpW2vg6JxVzzRman9bDJXsJadxD2h

error: invalid value 'tz1cmuyEpW2vg6JxVzzRman9bDJXsJadxD2h' for '<ADDRESS>': Invalid smart function address: tz1cmuyEpW2vg6JxVzzRman9bDJXsJadxD2h

  • manually tested repl
>> jstz.Account.balance("tz1cD5CuvAALcxgypqBXcBQEA8dkLJivoFjU");
0

@ryutamago ryutamago force-pushed the leounoki-jstz-255/migrate-to-new-account2 branch from ed56fa8 to bcae52d Compare January 13, 2025 13:30
Copy link

codecov bot commented Jan 13, 2025

Codecov Report

Attention: Patch coverage is 62.50000% with 33 lines in your changes missing coverage. Please review.

Project coverage is 49.33%. Comparing base (4fb8290) to head (5b69707).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/jstz_node/src/services/accounts.rs 0.00% 18 Missing ⚠️
crates/jstz_proto/src/executor/smart_function.rs 83.33% 1 Missing and 4 partials ⚠️
crates/jstz_proto/src/executor/fa_deposit.rs 78.57% 3 Missing ⚠️
crates/jstz_cli/src/account.rs 71.42% 1 Missing and 1 partial ⚠️
crates/jstz_cli/src/repl/debug_api/account.rs 0.00% 2 Missing ⚠️
crates/jstz_kernel/src/inbox.rs 66.66% 2 Missing ⚠️
crates/jstz_kernel/src/lib.rs 75.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
crates/jstz_cli/src/deploy.rs 0.00% <ø> (ø)
crates/jstz_cli/src/jstz.rs 0.00% <ø> (ø)
crates/jstz_kernel/src/parsing.rs 96.66% <ø> (ø)
crates/jstz_mock/src/host.rs 97.43% <ø> (ø)
crates/jstz_mock/src/message/fa_deposit.rs 100.00% <100.00%> (ø)
crates/jstz_proto/src/api/ledger.rs 32.67% <ø> (ø)
crates/jstz_proto/src/api/smart_function.rs 79.89% <100.00%> (+0.05%) ⬆️
crates/jstz_proto/src/context/mod.rs 32.15% <ø> (ø)
crates/jstz_proto/src/context/ticket_table.rs 94.76% <ø> (ø)
crates/jstz_proto/src/executor/deposit.rs 100.00% <ø> (ø)
... and 10 more

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4fb8290...5b69707. Read the comment docs.

@ryutamago ryutamago force-pushed the leounoki-jstz-257/introduce-new-account-type branch from ab024ef to 5aef9b2 Compare January 13, 2025 21:34
@ryutamago ryutamago force-pushed the leounoki-jstz-255/migrate-to-new-account2 branch from bcae52d to 3f1ed55 Compare January 13, 2025 21:35
@ryutamago ryutamago force-pushed the leounoki-jstz-257/introduce-new-account-type branch 2 times, most recently from 0a2db5c to e8957be Compare January 13, 2025 22:19
@ryutamago ryutamago force-pushed the leounoki-jstz-255/migrate-to-new-account2 branch 2 times, most recently from d6372e8 to 89b0512 Compare January 13, 2025 22:26
@ryutamago ryutamago changed the title Leounoki jstz 255/migrate to new account2 Migrate to new account Jan 14, 2025
@ryutamago ryutamago force-pushed the leounoki-jstz-255/migrate-to-new-account2 branch from 89b0512 to 5ec3046 Compare January 14, 2025 12:29
@ryutamago ryutamago marked this pull request as ready for review January 14, 2025 15:02
@ryutamago ryutamago force-pushed the leounoki-jstz-257/introduce-new-account-type branch from e8957be to f1945d2 Compare January 14, 2025 16:36
@ryutamago ryutamago force-pushed the leounoki-jstz-257/introduce-new-account-type branch 2 times, most recently from 40e4cf7 to a1ac76e Compare January 15, 2025 14:47
@ryutamago ryutamago force-pushed the leounoki-jstz-255/migrate-to-new-account2 branch 3 times, most recently from 66b9b90 to 4d86cd0 Compare January 15, 2025 15:22
@ryutamago ryutamago force-pushed the leounoki-jstz-257/introduce-new-account-type branch from a1ac76e to 64d7802 Compare January 16, 2025 16:16
@ryutamago ryutamago force-pushed the leounoki-jstz-255/migrate-to-new-account2 branch from 4d86cd0 to 62809b4 Compare January 16, 2025 16:17
@ryutamago ryutamago force-pushed the leounoki-jstz-257/introduce-new-account-type branch from 64d7802 to 513e63a Compare January 17, 2025 11:08
Base automatically changed from leounoki-jstz-257/introduce-new-account-type to main January 17, 2025 11:41
@ryutamago ryutamago force-pushed the leounoki-jstz-255/migrate-to-new-account2 branch from 62809b4 to 2d00f24 Compare January 17, 2025 15:32
@ryutamago ryutamago changed the base branch from main to leounoki-jstz-285/fix-kv-value January 17, 2025 15:32
Base automatically changed from leounoki-jstz-285/fix-kv-value to main January 17, 2025 16:45
@ryutamago ryutamago force-pushed the leounoki-jstz-255/migrate-to-new-account2 branch 2 times, most recently from c272d1a to 3196d27 Compare January 18, 2025 21:06
@huancheng-trili
Copy link
Collaborator

Thanks for the manual tests btw. They are great as a starting point for integration tests.

@ryutamago ryutamago force-pushed the leounoki-jstz-255/migrate-to-new-account2 branch from 3196d27 to 5b69707 Compare January 20, 2025 10:24
@ryutamago ryutamago enabled auto-merge (rebase) January 20, 2025 10:24
@ryutamago ryutamago merged commit 3f36e33 into main Jan 20, 2025
3 checks passed
@ryutamago ryutamago deleted the leounoki-jstz-255/migrate-to-new-account2 branch January 20, 2025 10:44
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