-
Notifications
You must be signed in to change notification settings - Fork 0
feat: verify_l1_address #13
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
base: main
Are you sure you want to change the base?
Conversation
c78b215 to
e079c82
Compare
f1fca5e to
0d058d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@remollemo reviewed all commit messages.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @noa-starkware)
packages/usdc_migration/src/usdc_migration.cairo line 92 at r1 (raw file):
assert!(from_address == self.l1_recipient.read().into(), "{}", Error::VERIFY_L1_FAILED); // TODO: Emit event? }
this would be unhelpful.
definitely without an event/
unlike the problem with l2 owner address where we want to be sure the owner is valid before we get money etc,
here it's easier, as we are not forced into a state.
so - we can simply condition the operation - migration, send to l1 whatever, with the l1 address been validated.
dont revert.
when the address is correct - simply flag it as so.
and condition the actions on this flag.
Code quote:
/// Verify the L1 recipient address is a reachable address.
#[l1_handler]
fn verify_l1_recipient(self: @ContractState, from_address: felt252) {
assert!(from_address == self.l1_recipient.read().into(), "{}", Error::VERIFY_L1_FAILED);
// TODO: Emit event?
}e079c82 to
153101e
Compare
0d058d8 to
2e8b54c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @noa-starkware and @remollemo)
packages/usdc_migration/src/usdc_migration.cairo line 92 at r1 (raw file):
Previously, remollemo wrote…
this would be unhelpful.
definitely without an event/unlike the problem with l2 owner address where we want to be sure the owner is valid before we get money etc,
here it's easier, as we are not forced into a state.so - we can simply condition the operation - migration, send to l1 whatever, with the l1 address been validated.
dont revert.
when the address is correct - simply flag it as so.
and condition the actions on this flag.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@remollemo reviewed 3 of 3 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @noa-starkware)
153101e to
7d78c2b
Compare
2e8b54c to
494a7e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @noa-starkware)
packages/usdc_migration/src/usdc_migration.cairo line 34 at r3 (raw file):
/// The threshold amount of legacy token balance, that triggers sending to L1. legacy_threshold: u256, /// Whether the L1 recipient address is verified.
Suggestion:
/// Indicates if L1 recipient address was verified.0ee48ca to
107d8b5
Compare
494a7e1 to
402d4fa
Compare
402d4fa to
9fe30c2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@remollemo reviewed all commit messages.
Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @noa-starkware)
packages/usdc_migration/src/usdc_migration.cairo line 156 at r4 (raw file):
self.l1_recipient_verified.write(true); // TODO: Emit event? }
- i don't think there is a reason to revert
- once we've successfully validated the l1 recipient reverting with failed to verify l1 recipient is really confusing.
- yeah, i'd event this.
- maybe smt like this:
Suggestion:
fn verify_l1_recipient(ref self: ContractState, from_address: felt252) {
if (! self.l1_recipient_verified.read() {
l1_recipient: EthAddresss = self.l1_recipient.read();
if (from_address == l1_recipient.into()) {
self.l1_recipient_verified.write(true);
self.emit(L1RecipientValidated { :l1_recipient });
}
}
}
This change is