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

Implement TLOAD and TSTORE #1233

Merged
merged 9 commits into from
Apr 26, 2024
Merged

Implement TLOAD and TSTORE #1233

merged 9 commits into from
Apr 26, 2024

Conversation

z2trillion
Copy link

Description

[PR description]

Issue Link

[link issue here]

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Contents

  • [item]

Rationale

[design decisions and extended information]

How Has This Been Tested?

[explanation]


How to fill a PR description

Please give a concise description of your PR.

The target readers could be future developers, reviewers, and auditors. By reading your description, they should easily understand the changes proposed in this pull request.

MUST: Reference the issue to resolve

Single responsability

Is RECOMMENDED to create single responsibility commits, but not mandatory.

Anyway, you MUST enumerate the changes in a unitary way, e.g.

This PR contains:
- Cleanup of xxxx, yyyy
- Changed xxxx to yyyy in order to bla bla
- Added xxxx function to ...
- Refactored ....

Design choices

RECOMMENDED to:

  • What types of design choices did you face?
  • What decisions you have made?
  • Any valuable information that could help reviewers to think critically

@z2trillion z2trillion changed the title cherry pick upstream Implement TLOAD and TSTORE Apr 25, 2024
@github-actions github-actions bot added the CI label Apr 25, 2024
@z2trillion z2trillion force-pushed the feat/tload_tstore branch 4 times, most recently from 5ee85ee to 8b95ad3 Compare April 25, 2024 15:35
@github-actions github-actions bot removed the CI label Apr 25, 2024
// removed rwc_inner_chunk here... does that matter?
self.transient_storage.push(Operation::new(rwc, rw, op));
OperationRef::from((Target::TransientStorage, self.transient_storage.len() - 1))
}
Copy link

@lispc lispc Apr 26, 2024

Choose a reason for hiding this comment

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

better to keep rwc check. (the rwc check is used for early terminate, to avoid rws cost too much memory to make l2geth down. while for tload/tstore, the 100 gas cost is non trivial, you cannot create too many tload/tstores. Anyway, keeping rwc_check makes code more consistent.)

Copy link

Choose a reason for hiding this comment

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

fixed in latest commit

@@ -581,6 +599,8 @@ impl Rw {
Self::Memory { .. } => RwTableTag::Memory,
Self::Stack { .. } => RwTableTag::Stack,
Self::AccountStorage { .. } => RwTableTag::AccountStorage,
// TODO: pick one!
Self::AccountTransientStorage { .. } => RwTableTag::TransientStorage,
Copy link

Choose a reason for hiding this comment

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

what is this todo?

// state.stack_read(&mut exec_step, value_stack_position, value)?;

let (_, value_prev) = state.sdb.get_transient_storage(&contract_addr, &key);
let value_prev = *value_prev;
Copy link

Choose a reason for hiding this comment

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

why we need value_prev? (SSTORE needs value_prev since it is related to gas cost)

Copy link

Choose a reason for hiding this comment

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

oh revert.

@lispc
Copy link

lispc commented Apr 26, 2024

i think you forget to modify get_rev_op_by_ref. Strange that the tests cannot find this.

@lispc lispc merged commit 9200c08 into develop Apr 26, 2024
15 checks passed
@lispc lispc deleted the feat/tload_tstore branch April 26, 2024 07:14
@z2trillion
Copy link
Author

I have added the changes by @lispc
fix EIP1153: is_static check and reversion to the PR upstream here: privacy-scaling-explorations#1811

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants