Skip to content

feat(codegen): refactor control stack #305

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

Merged
merged 3 commits into from
Mar 5, 2025

Conversation

g4titanx
Copy link
Member

@g4titanx g4titanx commented Mar 4, 2025

resolves #287

@g4titanx g4titanx requested a review from clearloop March 4, 2025 18:45
@clearloop
Copy link
Member

clearloop commented Mar 4, 2025

lgtm! btw could you please try to resolve the issue in the transfer method here as well:

zink/examples/erc20.rs

Lines 244 to 267 in 453604b

// 4. check transfer
{
// 4.1. verify balance of the caller
let info = evm
.calldata(&contract.encode(&[
b"balances(address)".to_vec(),
evm.caller.to_bytes32().to_vec(),
])?)
.call(address)?;
assert_eq!(info.ret, value.to_bytes32(), "{info:?}");
// TODO: see br_balance.rs (#287)
// 4.2. check transfer
/* evm = evm.commit(false);
let info = evm
.calldata(&contract.encode(&[
b"transfer(address,uint256)".to_vec(),
spender.to_bytes32().to_vec(),
half_value.to_bytes32().to_vec(),
])?)
.call(address)?;
println!("{info:?}");
assert_eq!(info.ret, true.to_bytes32(), "{info:?}"); */
}

if I'm not mistaken, it was caused by the same problem, if it is not caused by the same problem, please open a new issue to describe the unhandled problem in the erc20 example

@g4titanx
Copy link
Member Author

g4titanx commented Mar 4, 2025

if I'm not mistaken, it was caused by the same problem, if it is not caused by the same problem, please open a new issue to describe the unhandled problem in the erc20 example

they are not the same issue, i realized that after debugging this. now, the erc20 test is failing with Insufficient balance or ERC20 Insufficient allowance errors. this is a different problem related to how balances are set up and accessed in the test environment
i'd create another issue for this now, let me know what you think tho

Copy link
Member

@clearloop clearloop left a comment

Choose a reason for hiding this comment

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

great start! getting closer to the erc20 implementation!

@clearloop clearloop merged commit ffc89d2 into zink-lang:main Mar 5, 2025
4 checks passed
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.

Refactor control stack to support complex control flow
2 participants