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

draft: txe native world state #10478

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sklppy88
Copy link
Contributor

@sklppy88 sklppy88 commented Dec 7, 2024

Pinging @Thunkar, the TXE (and generally)πŸ‘¨β€πŸ”¬.

The biggest difference between old world state and new world state is that during the synching of blocks, the changes made to the trees MUST match the block itself. This gave me a bit of pain because it now has to more accurately model the side effect emission / collection of what happens in a tx.

Particular things to pay attention to:

  1. New world state assumes block numbers start at 1, hence we no longer start at 0. This means that we were off by 1 in a few places.
  2. Is the current behavior of the replacement of "getLatest" okay ? Previously we were using a different model, but now we need to make a distinction between what is happening in "this" block for public state, and what will be collected to be applied for the next block, for private state (outside of the execution note cache).
  3. Emitting arbitrary note hashes / nullifiers (not through notifying note) is a tricky flow. I'm not sure if my approach is robust enough here, we don't use the note cache because we don't have access to the full note.

Copy link
Contributor Author

sklppy88 commented Dec 7, 2024

@sklppy88 sklppy88 changed the title init draft: txe native world state Dec 7, 2024
@sklppy88 sklppy88 force-pushed the ek/feat/txe-native-world-state-2 branch from f6c3c47 to c4c75ad Compare December 8, 2024 16:47
@sklppy88 sklppy88 force-pushed the ek/feat/txe-oracle-correct-log-emission-and-storage branch from b97b0e3 to 440e035 Compare December 8, 2024 20:49
@sklppy88 sklppy88 force-pushed the ek/feat/txe-native-world-state-2 branch from c4c75ad to 1ac86e6 Compare December 8, 2024 20:49
@sklppy88 sklppy88 force-pushed the ek/feat/txe-oracle-correct-log-emission-and-storage branch from 440e035 to d9c7276 Compare December 8, 2024 22:44
@sklppy88 sklppy88 force-pushed the ek/feat/txe-native-world-state-2 branch 3 times, most recently from e16a87f to 88087d0 Compare December 8, 2024 22:59
@sklppy88 sklppy88 force-pushed the ek/feat/txe-oracle-correct-log-emission-and-storage branch from d9c7276 to 18a4dd2 Compare December 8, 2024 23:10
@sklppy88 sklppy88 force-pushed the ek/feat/txe-native-world-state-2 branch from 88087d0 to 9bd4ea0 Compare December 8, 2024 23:10
@sklppy88 sklppy88 requested a review from Thunkar December 9, 2024 06:14
@@ -17,7 +17,7 @@ where
C: CallInterface<M>,
{
let target = call_interface.get_contract_address();
let inputs = cheatcodes::get_private_context_inputs(get_block_number());
let inputs = cheatcodes::get_private_context_inputs(get_block_number() - 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Careful!

We used to do this because this.blockNumber in TXE means "the block I'm currently building" and we set the private context to "-1" so that we could do historical proofs.

Will this change break that flow?

Copy link
Contributor

@Thunkar Thunkar left a comment

Choose a reason for hiding this comment

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

Nice job! However I think this shows we really need a refactor and have some sort of TXE state machine that keeps track of the (now a lot more realistic) execution model.

@sklppy88 sklppy88 force-pushed the ek/feat/txe-oracle-correct-log-emission-and-storage branch from 18a4dd2 to c3063fe Compare December 12, 2024 04:03
@sklppy88 sklppy88 force-pushed the ek/feat/txe-native-world-state-2 branch from 9bd4ea0 to 1edc61a Compare December 12, 2024 04:04
@sklppy88 sklppy88 force-pushed the ek/feat/txe-oracle-correct-log-emission-and-storage branch from c3063fe to 9b416fa Compare December 12, 2024 04:23
@sklppy88 sklppy88 force-pushed the ek/feat/txe-native-world-state-2 branch from 1edc61a to e1e9691 Compare December 12, 2024 04:23
@sklppy88 sklppy88 force-pushed the ek/feat/txe-oracle-correct-log-emission-and-storage branch from 9b416fa to 5f7d7a0 Compare December 12, 2024 04:37
@sklppy88 sklppy88 force-pushed the ek/feat/txe-native-world-state-2 branch from e1e9691 to b5ca51b Compare December 12, 2024 04:37
@sklppy88 sklppy88 force-pushed the ek/feat/txe-oracle-correct-log-emission-and-storage branch from 5f7d7a0 to f68a7fc Compare December 12, 2024 07:25
@sklppy88 sklppy88 force-pushed the ek/feat/txe-native-world-state-2 branch from b5ca51b to e77b0f1 Compare December 12, 2024 07:25
Base automatically changed from ek/feat/txe-oracle-correct-log-emission-and-storage to master December 12, 2024 08:25
@sklppy88 sklppy88 force-pushed the ek/feat/txe-native-world-state-2 branch from e77b0f1 to a1cf14c Compare December 12, 2024 08:52
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