Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
implicit code_hash issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
miha-stopar committed Jan 19, 2024
1 parent 03e0a9f commit ee5f8ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 0 additions & 3 deletions light-client-poc/src/circuits/initial_state/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,6 @@ impl<F: Field> Circuit<F> for InitialStateCircuit<F> {
vec![q_enable * xnif(is_last_or_padding.expr(), new_root_propagation.expr())]
});

/*
Note: when there is a non-existing-proof, the state doesn't change
meta.create_gate(
"if not last or padding, if state changed in cur row, next row must change state also",
|meta| {
Expand All @@ -380,7 +378,6 @@ impl<F: Field> Circuit<F> for InitialStateCircuit<F> {
]
},
);
*/

meta.create_gate(
"if not padding and not last row, roots should be chained",
Expand Down
7 changes: 6 additions & 1 deletion light-client-poc/src/witness/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,12 @@ impl<F: Field> Witness<F> {
if old.balance != new.balance {
changed_values.push(TrieModification::balance(address, new.balance));
}
if old.code_hash != new.code_hash {
// If the account has been implicitly created before this code_hash modification
// and if this code_hash modification sets it to the default value (which have been
// already set implicitly), omit it.
let default_code_hash = "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470";
let is_default = new.code_hash == H256::from_str(default_code_hash).unwrap();

Check failure on line 253 in light-client-poc/src/witness/mod.rs

View workflow job for this annotation

GitHub Actions / Linux Build

no function or associated item named `from_str` found for struct `H256` in the current scope

Check failure on line 253 in light-client-poc/src/witness/mod.rs

View workflow job for this annotation

GitHub Actions / Various lints

no function or associated item named `from_str` found for struct `H256` in the current scope

Check failure on line 253 in light-client-poc/src/witness/mod.rs

View workflow job for this annotation

GitHub Actions / Heavy unit tests

no function or associated item named `from_str` found for struct `H256` in the current scope

Check failure on line 253 in light-client-poc/src/witness/mod.rs

View workflow job for this annotation

GitHub Actions / Light unit tests

no function or associated item named `from_str` found for struct `H256` in the current scope
if old.code_hash != new.code_hash && !is_default {
changed_values.push(TrieModification::codehash(address, new.code_hash));
}

Expand Down

0 comments on commit ee5f8ac

Please sign in to comment.